OpenWalnut
1.2.5
|
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. | |
WModuleProjectFileCombiner () | |
Creates an empty combiner. | |
virtual | ~WModuleProjectFileCombiner () |
Destructor. | |
virtual void | apply () |
Apply the internal module structure to the target container. | |
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. | |
virtual void | done () |
Called whenever the end of the project file has been reached. | |
virtual void | save (std::ostream &output) |
Saves the state to the specified stream. | |
Protected Types | |
typedef std::pair< unsigned int, boost::shared_ptr < WModule > > | ModuleID |
The module ID type. | |
typedef std::pair< unsigned int, std::string > | Connector |
A connector is described by ID and name. | |
typedef std::pair< Connector, Connector > | Connection |
A connection is a pair of connectors. | |
typedef std::pair< unsigned int, std::string > | Property |
A property is a pair of ID and name. | |
typedef std::pair< Property, std::string > | PropertyValue |
A property value is a property and the new value as string. | |
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. | |
Protected Attributes | |
std::map< unsigned int, boost::shared_ptr< WModule > > | m_modules |
All Modules. | |
std::list< Connection > | m_connections |
All connections. | |
std::list< PropertyValue > | m_properties |
All properties. |
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.
typedef std::pair< Connector, Connector > WModuleProjectFileCombiner::Connection [protected] |
A connection is a pair of connectors.
Definition at line 122 of file WModuleProjectFileCombiner.h.
typedef std::pair< unsigned int, std::string > WModuleProjectFileCombiner::Connector [protected] |
A connector is described by ID and name.
Definition at line 117 of file WModuleProjectFileCombiner.h.
typedef std::pair< unsigned int, boost::shared_ptr< WModule > > WModuleProjectFileCombiner::ModuleID [protected] |
The module ID type.
A pair of ID and pointer to module.
Definition at line 107 of file WModuleProjectFileCombiner.h.
typedef std::pair< unsigned int, std::string > WModuleProjectFileCombiner::Property [protected] |
A property is a pair of ID and name.
Definition at line 132 of file WModuleProjectFileCombiner.h.
typedef std::pair< Property, std::string > WModuleProjectFileCombiner::PropertyValue [protected] |
A property value is a property and the new value as string.
Definition at line 137 of file WModuleProjectFileCombiner.h.
WModuleProjectFileCombiner::WModuleProjectFileCombiner | ( | boost::shared_ptr< WModuleContainer > | target | ) | [explicit] |
Creates an empty combiner.
target | the target container where to add the modules to. |
Definition at line 55 of file WModuleProjectFileCombiner.cpp.
Creates an empty combiner.
This constructor automatically uses the kernel's root container as target container.
Definition at line 61 of file WModuleProjectFileCombiner.cpp.
WModuleProjectFileCombiner::~WModuleProjectFileCombiner | ( | ) | [virtual] |
Destructor.
Definition at line 67 of file WModuleProjectFileCombiner.cpp.
void WModuleProjectFileCombiner::apply | ( | ) | [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 170 of file WModuleProjectFileCombiner.cpp.
References wlog::error(), m_connections, WModuleCombiner::m_container, m_modules, m_properties, and wlog::warn().
Referenced by done().
void WModuleProjectFileCombiner::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 307 of file WModuleProjectFileCombiner.cpp.
References apply().
bool WModuleProjectFileCombiner::parse | ( | std::string | line, |
unsigned int | lineNumber | ||
) | [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 wlog::debug(), wlog::error(), WModuleFactory::getModuleFactory(), m_connections, m_modules, and m_properties.
void WModuleProjectFileCombiner::printProperties | ( | std::ostream & | output, |
boost::shared_ptr< WProperties > | props, | ||
std::string | indent, | ||
std::string | prefix, | ||
unsigned int | module | ||
) | [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 312 of file WModuleProjectFileCombiner.cpp.
Referenced by save().
void WModuleProjectFileCombiner::save | ( | std::ostream & | output | ) | [virtual] |
Saves the state to the specified stream.
output | the stream to print the state to. |
Implements WProjectFileIO.
Definition at line 350 of file WModuleProjectFileCombiner.cpp.
References WPrototyped::getName(), WKernel::getRootContainer(), WKernel::getRunningKernel(), and printProperties().
std::list< Connection > WModuleProjectFileCombiner::m_connections [protected] |
All connections.
Definition at line 127 of file WModuleProjectFileCombiner.h.
std::map< unsigned int, boost::shared_ptr< WModule > > WModuleProjectFileCombiner::m_modules [protected] |
All Modules.
Definition at line 112 of file WModuleProjectFileCombiner.h.
std::list< PropertyValue > WModuleProjectFileCombiner::m_properties [protected] |
All properties.
Definition at line 142 of file WModuleProjectFileCombiner.h.