OpenWalnut  1.2.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
WModuleCombiner Class Reference

This is a base class for all module combination classes. More...

#include <WModuleCombiner.h>

+ Inheritance diagram for WModuleCombiner:

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().
- Public Member Functions inherited from WThreadedRunner
 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.
- Protected Member Functions inherited from WThreadedRunner
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.
- Protected Attributes inherited from WThreadedRunner
boost::thread m_thread
 Thread instance.
WBoolFlag m_shutdownFlag
 Condition getting fired whenever the thread should quit.

Additional Inherited Members

- Public Types inherited from WThreadedRunner
typedef boost::function< void(void) > THREADFUNCTION
 Type used for simple thread functions.

Detailed Description

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.

Constructor & Destructor Documentation

WModuleCombiner::WModuleCombiner ( boost::shared_ptr< WModuleContainer target)
explicit

Creates an empty combiner.

Parameters
targetthe 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.

WModuleCombiner::~WModuleCombiner ( )
virtual

Destructor.

Definition at line 45 of file WModuleCombiner.cpp.

Member Function Documentation

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.

Notes:
: to have asynchronous loading, use run().

Implemented in WDisconnectCombiner, WApplyCombiner, 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 ( )
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.

Member Data Documentation

boost::shared_ptr< WModuleContainer > WModuleCombiner::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().


The documentation for this class was generated from the following files: