OpenWalnut
1.5.0dev
|
This is a base class for all module combination classes. More...
#include <WModuleCombiner.h>
Public Member Functions | |
WModuleCombiner (std::shared_ptr< WModuleContainer > target) | |
Creates an empty combiner. More... | |
WModuleCombiner () | |
Creates an empty combiner. More... | |
virtual | ~WModuleCombiner () |
Destructor. More... | |
virtual void | apply ()=0 |
Apply the internal module structure to the target container. More... | |
virtual void | run () |
Run thread and call apply(). More... | |
Public Member Functions inherited from WThreadedRunner | |
WThreadedRunner () | |
Default constructor. More... | |
virtual | ~WThreadedRunner () |
Destructor. More... | |
void | run (THREADFUNCTION f) |
Run thread. More... | |
void | wait (bool requestFinish=false) |
Wait for the thread to be finished. More... | |
virtual void | requestStop () |
This method's purpose is to request a stop without waiting for it. More... | |
virtual boost::signals2::connection | subscribeSignal (THREAD_SIGNAL signal, t_ThreadErrorSignalHandlerType notifier) |
Connects a specified notify function with a signal this thread instance is offering. More... | |
const WBoolFlag & | isCrashed () const |
Checks whether this thread has been crashed. More... | |
const std::string & | getCrashMessage () const |
Get the message of the exception finally causing the crash. More... | |
void | setThreadName (std::string name) |
Set the name of the thread. More... | |
std::string | getThreadName () const |
Returns the current thread name. More... | |
Protected Member Functions | |
virtual void | threadMain () |
Function that has to be overwritten for execution. More... | |
Protected Member Functions inherited from WThreadedRunner | |
virtual void | notifyStop () |
Gets called when the thread should be stopped. More... | |
void | yield () const |
Give remaining execution timeslice to another thread. More... | |
void | sleep (const int32_t t) const |
Sets thread asleep. More... | |
void | msleep (const int32_t t) const |
Sets thread asleep. More... | |
void | waitForStop () |
Let the thread sleep until a stop request was given. More... | |
virtual void | onThreadException (const WException &e) |
This method is called if an exception was caught, which came from the custom thread code. More... | |
void | handleDeadlyException (const WException &e, std::string sender="WThreadedRunner") |
Handle the specified exception which was not caught in the thread, which basically means the thread has crashed. More... | |
Protected Attributes | |
std::shared_ptr< WModuleContainer > | m_container |
The module container to use for the modules. More... | |
Protected Attributes inherited from WThreadedRunner | |
boost::thread | m_thread |
Thread instance. More... | |
WBoolFlag | m_shutdownFlag |
Condition getting fired whenever the thread should quit. More... | |
WBoolFlag | m_isCrashed |
True whenever an exception is thrown during threadMain. More... | |
std::string | m_crashMessage |
The crash message. More... | |
Additional Inherited Members | |
Public Types inherited from WThreadedRunner | |
typedef std::shared_ptr< WThreadedRunner > | SPtr |
Abbreviation to a shared_ptr to this type. More... | |
typedef std::shared_ptr< const WThreadedRunner > | ConstSPtr |
Abbreviation to a const shared_ptr to this type. More... | |
typedef boost::function< void(void) > | THREADFUNCTION |
Type used for simple thread functions. More... | |
Static Public Member Functions inherited from WThreadedRunner | |
static void | setThisThreadName (std::string name) |
Static function to set the name of the calling thread. More... | |
This is a base class for all module combination classes.
The basic idea is to hide the actual combination work from others. These classes may be useful in the GUI. The GUI can create a module combiner instance in a special way, with an interface the GUI wants to have. Then, the kernel can construct the actual module graph out of it. Another purpose is some kind of project file loading. One can write a combiner which loads projects files and creates a module graph out of it. The only think which all the combiners need to know: the target container. Derive all specific combiner classes from this one.
Definition at line 41 of file WModuleCombiner.h.
|
explicit |
Creates an empty combiner.
target | the target container where to add the modules to. |
Definition at line 32 of file WModuleCombiner.cpp.
WModuleCombiner::WModuleCombiner | ( | ) |
Creates an empty combiner.
This constructor automatically uses the kernel's root container as target container.
Definition at line 39 of file WModuleCombiner.cpp.
|
virtual |
Destructor.
Definition at line 45 of file WModuleCombiner.cpp.
|
pure virtual |
Apply the internal module structure to the target container.
Be aware, that this operation might take some time, as modules can be connected only if they are "ready", which, at least with WDataModule modules, might take some time.
Implemented in WModuleOneToOneCombiner, WModuleProjectFileCombiner, WDisconnectCombiner, and WApplyCombiner.
Referenced by threadMain().
|
virtual |
Run thread and call apply().
This is useful to apply a combiner asynchronously.
Reimplemented from WThreadedRunner.
Definition at line 50 of file WModuleCombiner.cpp.
References m_container, and WThreadedRunner::run().
|
protectedvirtual |
Function that has to be overwritten for execution.
It gets executed in a separate thread after run() has been called. It actually calls apply() in another thread.
Reimplemented from WThreadedRunner.
Definition at line 59 of file WModuleCombiner.cpp.
References apply(), wlog::error(), and m_container.
|
protected |
The module container to use for the modules.
Definition at line 85 of file WModuleCombiner.h.
Referenced by WApplyCombiner::apply(), WModuleProjectFileCombiner::apply(), run(), and threadMain().