OpenWalnut
1.3.1
|
This class is able to parse project files and create the appropriate module graph inside a specified container. More...
#include <WModuleProjectFileCombiner.h>
Public Member Functions | |
WModuleProjectFileCombiner (boost::shared_ptr< WModuleContainer > target) | |
Creates an empty combiner. More... | |
WModuleProjectFileCombiner () | |
Creates an empty combiner. More... | |
virtual | ~WModuleProjectFileCombiner () |
Destructor. More... | |
virtual void | apply () |
Apply the internal module structure to the target container. More... | |
virtual bool | parse (std::string line, unsigned int lineNumber) |
This method parses the specified line and interprets it to fill the internal module graph structure. More... | |
virtual void | done () |
Called whenever the end of the project file has been reached. More... | |
virtual void | save (std::ostream &output) |
Saves the state to the specified stream. More... | |
![]() | |
WModuleCombiner (boost::shared_ptr< WModuleContainer > target) | |
Creates an empty combiner. More... | |
WModuleCombiner () | |
Creates an empty combiner. More... | |
virtual | ~WModuleCombiner () |
Destructor. More... | |
virtual void | run () |
Run thread and call apply(). More... | |
![]() | |
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... | |
![]() | |
WProjectFileIO () | |
Default constructor. More... | |
virtual | ~WProjectFileIO () |
Destructor. More... | |
bool | hadErrors () const |
Checks whether there where errors during load or save. More... | |
const std::vector< std::string > & | getErrors () const |
Get error list. More... | |
Protected Types | |
typedef std::pair< unsigned int, boost::shared_ptr < WModule > > | ModuleID |
The module ID type. More... | |
typedef std::pair< unsigned int, std::string > | Connector |
A connector is described by ID and name. More... | |
typedef std::pair< Connector, Connector > | Connection |
A connection is a pair of connectors. More... | |
typedef std::pair< unsigned int, std::string > | Property |
A property is a pair of ID and name. More... | |
typedef std::pair< Property, std::string > | PropertyValue |
A property value is a property and the new value as string. More... | |
Protected Member Functions | |
void | printProperties (std::ostream &output, boost::shared_ptr< WProperties > props, std::string indent, std::string prefix, unsigned int module) |
Recursively prints the properties and nested properties. More... | |
![]() | |
virtual void | threadMain () |
Function that has to be overwritten for execution. More... | |
![]() | |
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... | |
![]() | |
void | addError (std::string description) |
Add an error. More... | |
Protected Attributes | |
std::map< unsigned int, boost::shared_ptr< WModule > > | m_modules |
All Modules. More... | |
std::list< Connection > | m_connections |
All connections. More... | |
std::list< PropertyValue > | m_properties |
All properties. More... | |
![]() | |
boost::shared_ptr < WModuleContainer > | m_container |
The module container to use for the modules. More... | |
![]() | |
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 | |
![]() | |
typedef boost::function< void(void) > | THREADFUNCTION |
Type used for simple thread functions. More... | |
![]() | |
static void | setThisThreadName (std::string name) |
Static function to set the name of the calling thread. More... | |
This class is able to parse project files and create the appropriate module graph inside a specified container.
It is also derived from WProjectFileIO to allow WProjectFile to fill this combiner.
Definition at line 46 of file WModuleProjectFileCombiner.h.
|
protected |
A connection is a pair of connectors.
Definition at line 120 of file WModuleProjectFileCombiner.h.
|
protected |
A connector is described by ID and name.
Definition at line 115 of file WModuleProjectFileCombiner.h.
|
protected |
The module ID type.
A pair of ID and pointer to module.
Definition at line 105 of file WModuleProjectFileCombiner.h.
|
protected |
A property is a pair of ID and name.
Definition at line 130 of file WModuleProjectFileCombiner.h.
|
protected |
A property value is a property and the new value as string.
Definition at line 135 of file WModuleProjectFileCombiner.h.
|
explicit |
Creates an empty combiner.
target | the target container where to add the modules to. |
Definition at line 55 of file WModuleProjectFileCombiner.cpp.
WModuleProjectFileCombiner::WModuleProjectFileCombiner | ( | ) |
Creates an empty combiner.
This constructor automatically uses the kernel's root container as target container.
Definition at line 61 of file WModuleProjectFileCombiner.cpp.
|
virtual |
Destructor.
Definition at line 67 of file WModuleProjectFileCombiner.cpp.
|
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. It applies the loaded project file.
WFileNotFound | whenever the project file could not be opened. |
Implements WModuleCombiner.
Definition at line 168 of file WModuleProjectFileCombiner.cpp.
References WProjectFileIO::addError(), m_connections, WModuleCombiner::m_container, m_modules, m_properties, and string_utils::toString().
Referenced by done().
|
virtual |
Called whenever the end of the project file has been reached.
This is useful if your specific parser class wants to do some post processing after parsing line by line.
Reimplemented from WProjectFileIO.
Definition at line 304 of file WModuleProjectFileCombiner.cpp.
References apply().
|
virtual |
This method parses the specified line and interprets it to fill the internal module graph structure.
line | the current line as string |
lineNumber | the current line number. Useful for error/warning/debugging output. |
Implements WProjectFileIO.
Definition at line 72 of file WModuleProjectFileCombiner.cpp.
References WProjectFileIO::addError(), wlog::debug(), WModuleFactory::getModuleFactory(), m_connections, m_modules, and m_properties.
|
protected |
Recursively prints the properties and nested properties.
output | the output stream to print to |
props | the properties to recursively print |
indent | the indentation level |
prefix | the prefix (name prefix of property) |
module | the module ID to use |
Definition at line 309 of file WModuleProjectFileCombiner.cpp.
Referenced by save().
|
virtual |
Saves the state to the specified stream.
output | the stream to print the state to. |
Implements WProjectFileIO.
Definition at line 347 of file WModuleProjectFileCombiner.cpp.
References WPrototyped::getName(), WKernel::getRootContainer(), WKernel::getRunningKernel(), and printProperties().
|
protected |
All connections.
Definition at line 125 of file WModuleProjectFileCombiner.h.
|
protected |
All Modules.
Definition at line 110 of file WModuleProjectFileCombiner.h.
|
protected |
All properties.
Definition at line 140 of file WModuleProjectFileCombiner.h.