OpenWalnut
1.2.5
|
This is a base class for all module combination classes. More...
#include <WModuleCombiner.h>
Public Member Functions | |
WModuleCombiner (boost::shared_ptr< WModuleContainer > target) | |
Creates an empty combiner. | |
WModuleCombiner () | |
Creates an empty combiner. | |
virtual | ~WModuleCombiner () |
Destructor. | |
virtual void | apply ()=0 |
Apply the internal module structure to the target container. | |
virtual void | run () |
Run thread and call apply(). | |
![]() | |
WThreadedRunner () | |
Default constructor. | |
virtual | ~WThreadedRunner () |
Destructor. | |
void | run (THREADFUNCTION f) |
Run thread. | |
void | wait (bool requestFinish=false) |
Wait for the thread to be finished. | |
virtual void | requestStop () |
This method's purpose is to request a stop without waiting for it. |
Protected Member Functions | |
virtual void | threadMain () |
Function that has to be overwritten for execution. | |
![]() | |
virtual void | notifyStop () |
Gets called when the thread should be stopped. | |
void | yield () const |
Give remaining execution timeslice to another thread. | |
void | sleep (const int32_t t) const |
Sets thread asleep. | |
void | msleep (const int32_t t) const |
Sets thread asleep. | |
void | waitForStop () |
Let the thread sleep until a stop request was given. |
Protected Attributes | |
boost::shared_ptr < WModuleContainer > | m_container |
The module container to use for the modules. | |
![]() | |
boost::thread | m_thread |
Thread instance. | |
WBoolFlag | m_shutdownFlag |
Condition getting fired whenever the thread should quit. |
Additional Inherited Members | |
![]() | |
typedef boost::function< void(void) > | THREADFUNCTION |
Type used for simple thread functions. |
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 42 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 WMData modules, might take some time.
Implemented in WDisconnectCombiner, WApplyCombiner, WModuleOneToOneCombiner, and WModuleProjectFileCombiner.
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.
|
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 88 of file WModuleCombiner.h.
Referenced by WModuleProjectFileCombiner::apply(), WApplyCombiner::apply(), run(), and threadMain().