OpenWalnut
1.4.0
|
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(). | |
Protected Member Functions | |
virtual void | threadMain () |
Function that has to be overwritten for execution. | |
Protected Attributes | |
boost::shared_ptr < WModuleContainer > | m_container |
The module container to use for the modules. |
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.
WModuleCombiner::WModuleCombiner | ( | boost::shared_ptr< WModuleContainer > | target | ) | [explicit] |
Creates an empty combiner.
target | the target container where to add the modules to. |
Definition at line 32 of file WModuleCombiner.cpp.
Creates an empty combiner.
This constructor automatically uses the kernel's root container as target container.
Definition at line 39 of file WModuleCombiner.cpp.
WModuleCombiner::~WModuleCombiner | ( | ) | [virtual] |
Destructor.
Definition at line 45 of file WModuleCombiner.cpp.
virtual void WModuleCombiner::apply | ( | ) | [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 WApplyCombiner, WDisconnectCombiner, WModuleOneToOneCombiner, and WModuleProjectFileCombiner.
Referenced by threadMain().
void WModuleCombiner::run | ( | ) | [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.
void WModuleCombiner::threadMain | ( | ) | [protected, virtual] |
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.
boost::shared_ptr< WModuleContainer > WModuleCombiner::m_container [protected] |
The module container to use for the modules.
Definition at line 86 of file WModuleCombiner.h.
Referenced by WModuleProjectFileCombiner::apply(), WApplyCombiner::apply(), run(), and threadMain().