OpenWalnut
1.4.0
|
Class representing a single module of OpenWalnut. More...
#include <WModule.h>
Public Types | |
typedef std::vector < boost::shared_ptr < WModuleInputConnector > > | InputConnectorList |
The type for the list of input connectors. | |
typedef std::vector < boost::shared_ptr < WModuleOutputConnector > > | OutputConnectorList |
The type for the list of output connectors. | |
typedef boost::shared_ptr < WModule > | SPtr |
Shared pointer to a WModule. | |
typedef boost::shared_ptr < const WModule > | ConstSPtr |
Shared pointer to a const WModule. | |
Public Member Functions | |
WModule () | |
Constructs a new WModule instance. | |
virtual | ~WModule () |
Destructor. | |
const InputConnectorList & | getInputConnectors () const |
Gives back input connectors. | |
boost::shared_ptr < WModuleInputConnector > | getInputConnector (std::string name) |
Finds the named connector for the module. | |
boost::shared_ptr < WModuleInputConnector > | findInputConnector (std::string name) |
Finds the named connector for the module. | |
const OutputConnectorList & | getOutputConnectors () const |
Gives back output connectors. | |
boost::shared_ptr < WModuleOutputConnector > | getOutputConnector (std::string name) |
Finds the named connector for the module. | |
boost::shared_ptr < WModuleOutputConnector > | findOutputConnector (std::string name) |
Finds the named connector for the module. | |
boost::shared_ptr < WModuleConnector > | getConnector (std::string name) |
Finds the named connector for the module. | |
boost::shared_ptr < WModuleConnector > | findConnector (std::string name) |
Finds the named connector for the module. | |
boost::shared_ptr< WProperties > | getProperties () const |
Return a pointer to the properties object of the module. | |
boost::shared_ptr< WProperties > | getInformationProperties () const |
Return a pointer to the information properties object of the module. | |
const WBoolFlag & | isInitialized () const |
Determines whether the module instance is properly initialized. | |
const WBoolFlag & | isUseable () const |
Checks whether the module instance is ready to be used. | |
const WBoolFlag & | isAssociated () const |
Checks whether this module is associated with an container. | |
const WBoolFlag & | isReady () const |
Checks whether this module is ready. | |
const WBoolFlag & | isReadyOrCrashed () const |
This is the logical or of isReady and isCrashed. | |
const WBoolFlag & | isRunning () const |
Returns a flag denoting whether the thread currently is running or nor. | |
void | waitRestored () |
This method waits for the module to be restored completely. | |
bool | isRestoreNeeded () const |
Check whether this module is in restore mode. | |
void | setRestoreNeeded (bool restore=true) |
Change the restore mode. | |
void | reportRestoreComplete () |
Called by loaders to tell the module that loading has been completed. | |
boost::shared_ptr < WModuleContainer > | getAssociatedContainer () const |
The container this module is associated with. | |
virtual boost::shared_ptr < WModule > | factory () const =0 |
Due to the prototype design pattern used to build modules, this method returns a new instance of this module. | |
virtual boost::signals2::connection | subscribeSignal (MODULE_SIGNAL signal, t_ModuleGenericSignalHandlerType notifier) |
Connects a specified notify function with a signal this module instance is offering. | |
virtual boost::signals2::connection | subscribeSignal (MODULE_SIGNAL signal, t_ModuleErrorSignalHandlerType notifier) |
Connects a specified notify function with a signal this module instance is offering. | |
virtual boost::shared_ptr < WProgressCombiner > | getRootProgressCombiner () |
Gets the modules base progress. | |
virtual const char ** | getXPMIcon () const |
Get the icon for this module in XPM format. | |
virtual MODULE_TYPE | getType () const |
Gets the type of the module. | |
void | disconnect () |
Completely disconnects all connected connectors of this module. | |
WCombinerTypes::WDisconnectList | getPossibleDisconnections () |
Gives a list of all WDisconnectCombiners possible. | |
boost::filesystem::path | getLocalPath () const |
Returns the local path of the module. | |
boost::filesystem::path | getLibPath () const |
Returns the absolute path to the library containing this module. | |
std::string | getPackageName () const |
Returns the name of the package the module belongs to, The package name basically is the name of the library containing this and maybe other modules. | |
bool | isDeprecated () const |
Checks whether the module was marked as deprecated. | |
std::string | getDeprecationMessage () const |
Queries the deprecation message of a module if specified. | |
virtual WModuleMetaInformation::ConstSPtr | getMetaInformation () const |
The meta information of this module. | |
const std::string & | getUUID () const |
Get the UUID of the module instance. | |
Static Public Member Functions | |
static SPtr | findByUUID (std::string uuid) |
Find a module instance by UUID. | |
Protected Types | |
typedef std::vector < WRequirement * > | Requirements |
The type of the requirement list. | |
Protected Member Functions | |
virtual void | moduleMain ()=0 |
Entry point after loading the module. | |
void | threadMain () |
Thread entry point. | |
virtual void | onThreadException (const WException &e) |
This method is called if an exception was caught, which came from the custom thread code. | |
void | setAssociatedContainer (boost::shared_ptr< WModuleContainer > container) |
Sets the container this module is associated with. | |
virtual void | connectors () |
Initialize connectors in this function. | |
virtual void | properties () |
Initialize properties in this function. | |
virtual void | requirements () |
Initialize requirements in this function. | |
virtual std::string | deprecated () const |
This function allows module programmers to mark their modules deprecated in a user-friendly way. | |
void | initialize () |
Manages initialization. | |
virtual void | cleanup () |
Called whenever the module should shutdown. | |
void | addConnector (boost::shared_ptr< WModuleInputConnector > con) |
Adds the specified connector to the list of inputs. | |
void | addConnector (boost::shared_ptr< WModuleOutputConnector > con) |
Adds the specified connector to the list of outputs. | |
void | removeConnectors () |
Removes all connectors properly. | |
virtual void | activate () |
Callback for m_active. | |
virtual const t_GenericSignalHandlerType | getSignalHandler (MODULE_CONNECTOR_SIGNAL signal) |
Gives the signal handler function responsible for a given signal. | |
virtual void | notifyConnectionEstablished (boost::shared_ptr< WModuleConnector > here, boost::shared_ptr< WModuleConnector > there) |
Gets called whenever a connector gets connected to the specified input. | |
virtual void | notifyConnectionClosed (boost::shared_ptr< WModuleConnector > here, boost::shared_ptr< WModuleConnector > there) |
Gets called whenever a connection between a remote and local connector gets closed. | |
virtual void | notifyDataChange (boost::shared_ptr< WModuleConnector > input, boost::shared_ptr< WModuleConnector > output) |
Gets called when the data on one input connector changed. | |
void | ready () |
Call this whenever your module is ready and can react on property changes. | |
wlog::WStreamedLogger | infoLog () const |
Logger instance for comfortable info logging. | |
wlog::WStreamedLogger | debugLog () const |
Logger instance for comfortable debug logging. | |
wlog::WStreamedLogger | warnLog () const |
Logger instance for comfortable warning- logs. | |
wlog::WStreamedLogger | errorLog () const |
Logger instance for comfortable error logging. | |
void | setLocalPath (boost::filesystem::path path) |
Sets the local module path. | |
void | setLibPath (boost::filesystem::path path) |
Set the path to the library which contains this module. | |
void | setPackageName (std::string name) |
Set the package name. | |
Protected Attributes | |
boost::shared_ptr< WProperties > | m_properties |
The property object for the module. | |
boost::shared_ptr< WProperties > | m_infoProperties |
The property object for the module containing only module whose purpose is "PV_PURPOSE_INFORMNATION". | |
boost::shared_ptr < WProgressCombiner > | m_progress |
Progress indicator used as parent for all progress' of this module. | |
WBoolFlag | m_initialized |
True if everything is initialized and ready to be used. | |
WBoolFlag | m_isAssociated |
True if container got associated with this flag. | |
WBoolFlag | m_isUsable |
True if associated && initialized. | |
WBoolFlag | m_isReady |
True if ready() was called. | |
WBoolFlag | m_isReadyOrCrashed |
It is true whenever m_isReady or WThreadedRunner::m_isCrashed is true. | |
WBoolFlag | m_isRunning |
True if the module currently is running. | |
WBoolFlag | m_isLoadFinished |
Flag to denote whether the module container and the project loader have finished their work. | |
bool | m_restoreMode |
Flag denoting the current restore mode. | |
boost::shared_ptr< WProgress > | m_readyProgress |
Progress indicator for the "ready" state. | |
WConditionSet | m_moduleState |
The internal state of the module. | |
boost::shared_ptr < WModuleContainer > | m_container |
The container this module belongs to. | |
InputConnectorList | m_inputConnectors |
Set of input connectors associated with this module. | |
OutputConnectorList | m_outputConnectors |
Set of output connectors associated with this module. | |
WPropBool | m_active |
True whenever the module should be active. | |
WPropString | m_runtimeName |
This property holds a user specified name for the current module instance. | |
boost::filesystem::path | m_localPath |
The path where the module binary resides in. | |
boost::filesystem::path | m_libPath |
The absolute path to the library containing this module. | |
std::string | m_packageName |
The name of the lib/the package containing this module. | |
Requirements | m_requirements |
The list of requirements. | |
Private Member Functions | |
const WRequirement * | checkRequirements () const |
This method checks whether all the requirements of the module are complied. | |
void | setUUID (std::string uuid) |
Set a uuid. | |
Private Attributes | |
WModuleMetaInformation::SPtr | m_meta |
Lock for m_inputConnectors. | |
t_ModuleGenericSignalType | signal_ready |
Signal fired whenever a module main thread is ready. | |
t_ModuleErrorSignalType | signal_error |
Signal fired whenever a module main thread throws an exception/error. | |
std::string | m_uuid |
The unique ID of the module instance. | |
Friends | |
class | WModuleConnector |
class | WModuleInputData |
class | WModuleInputForwardData |
class | WModuleOutputData |
class | WModuleOutputForwardData |
class | WModuleFactory |
class | WModuleContainer |
class | WModuleLoader |
typedef boost::shared_ptr< const WModule > WModule::ConstSPtr |
Shared pointer to a const WModule.
Reimplemented in WDataModule.
typedef std::vector< boost::shared_ptr< WModuleInputConnector > > WModule::InputConnectorList |
typedef std::vector< boost::shared_ptr< WModuleOutputConnector > > WModule::OutputConnectorList |
typedef std::vector< WRequirement* > WModule::Requirements [protected] |
typedef boost::shared_ptr< WModule > WModule::SPtr |
Shared pointer to a WModule.
Reimplemented in WDataModule.
WModule::WModule | ( | ) |
Constructs a new WModule instance.
Definition at line 61 of file WModule.cpp.
References activate(), WConditionSet::add(), WFlag< T >::getCondition(), m_active, m_container, m_infoProperties, WThreadedRunner::m_isCrashed, m_isReady, m_isReadyOrCrashed, m_moduleState, m_progress, m_properties, m_readyProgress, m_runtimeName, WThreadedRunner::m_shutdownFlag, and WConditionSet::setResetable().
WModule::~WModule | ( | ) | [virtual] |
Destructor.
Definition at line 104 of file WModule.cpp.
void WModule::activate | ( | ) | [protected, virtual] |
Callback for m_active.
Overwrite this in your modules to handle m_active changes separately.
Definition at line 221 of file WModule.cpp.
Referenced by WModule().
void WModule::addConnector | ( | boost::shared_ptr< WModuleInputConnector > | con | ) | [protected] |
Adds the specified connector to the list of inputs.
con | the connector. |
Definition at line 109 of file WModule.cpp.
References m_inputConnectors, and m_outputConnectors.
Referenced by WModuleImpl::connectors().
void WModule::addConnector | ( | boost::shared_ptr< WModuleOutputConnector > | con | ) | [protected] |
Adds the specified connector to the list of outputs.
con | the connector. |
Definition at line 128 of file WModule.cpp.
References m_inputConnectors, and m_outputConnectors.
const WRequirement * WModule::checkRequirements | ( | ) | const [private] |
This method checks whether all the requirements of the module are complied.
Definition at line 513 of file WModule.cpp.
References m_requirements.
Referenced by threadMain().
void WModule::cleanup | ( | ) | [protected, virtual] |
Called whenever the module should shutdown.
Definition at line 263 of file WModule.cpp.
References removeConnectors().
void WModule::connectors | ( | ) | [protected, virtual] |
Initialize connectors in this function.
This function must not be called multiple times for one module instance. The module container manages calling those functions -> so just implement it.
Reimplemented in WModuleImpl.
Definition at line 209 of file WModule.cpp.
Referenced by initialize().
wlog::WStreamedLogger WModule::debugLog | ( | ) | const [protected] |
Logger instance for comfortable debug logging.
Simply use logDebug() << "my debug".
Definition at line 576 of file WModule.cpp.
References wlog::debug(), and WPrototyped::getName().
std::string WModule::deprecated | ( | ) | const [protected, virtual] |
This function allows module programmers to mark their modules deprecated in a user-friendly way.
If you implement this function, you need to specify an text which should mention an alternative module.
Definition at line 225 of file WModule.cpp.
Referenced by getDeprecationMessage(), and isDeprecated().
void WModule::disconnect | ( | ) |
Completely disconnects all connected connectors of this module.
This is useful to isolate a module (for deletion, removal from a container and so on.)
Definition at line 147 of file WModule.cpp.
References m_inputConnectors, and m_outputConnectors.
Referenced by onThreadException(), removeConnectors(), and threadMain().
wlog::WStreamedLogger WModule::errorLog | ( | ) | const [protected] |
Logger instance for comfortable error logging.
Simply use logError() << "my error".
Definition at line 571 of file WModule.cpp.
References wlog::error(), and WPrototyped::getName().
Referenced by WModuleContainer::moduleError().
virtual boost::shared_ptr< WModule > WModule::factory | ( | ) | const [pure virtual] |
Due to the prototype design pattern used to build modules, this method returns a new instance of this module.
NOTE: it should never be initialized or modified in some other way.
Implemented in WModuleContainer, and WModuleImpl.
WModule::SPtr WModule::findByUUID | ( | std::string | uuid | ) | [static] |
Find a module instance by UUID.
uuid | the uuid to search for. |
Definition at line 670 of file WModule.cpp.
boost::shared_ptr< WModuleConnector > WModule::findConnector | ( | std::string | name | ) |
Finds the named connector for the module.
This searches for inputs and outputs. This is similar to getConnector but it does not throw an exception if the connector could not be found.
name | the name. This can be a canonical name or the connector name. |
Definition at line 357 of file WModule.cpp.
References findInputConnector(), and findOutputConnector().
Referenced by getConnector().
boost::shared_ptr< WModuleInputConnector > WModule::findInputConnector | ( | std::string | name | ) |
Finds the named connector for the module.
This is similar to getInputConnector but it does not throw an exception if the connector could not be found.
name | the name. This can be a canonical name or the connector name. |
Definition at line 298 of file WModule.cpp.
References m_inputConnectors.
Referenced by findConnector(), and getInputConnector().
boost::shared_ptr< WModuleOutputConnector > WModule::findOutputConnector | ( | std::string | name | ) |
Finds the named connector for the module.
This is similar to getOutputConnector but it does not throw an exception if the connector could not be found.
name | the name. This can be a canonical name or the connector name. |
Definition at line 327 of file WModule.cpp.
References m_outputConnectors.
Referenced by findConnector(), and getOutputConnector().
boost::shared_ptr< WModuleContainer > WModule::getAssociatedContainer | ( | ) | const |
The container this module is associated with.
Definition at line 269 of file WModule.cpp.
References m_container.
boost::shared_ptr< WModuleConnector > WModule::getConnector | ( | std::string | name | ) |
Finds the named connector for the module.
This searches for inputs and outputs.
name | the name. This can be a canonical name or the connector name. |
WModuleConnectorNotFound | thrown whenever the module does not provide the specified connector. |
Definition at line 370 of file WModule.cpp.
References findConnector(), and WPrototyped::getName().
std::string WModule::getDeprecationMessage | ( | ) | const |
Queries the deprecation message of a module if specified.
If not specified, an empty string is returned. Check isDeprecated first.
Definition at line 621 of file WModule.cpp.
References deprecated().
boost::shared_ptr< WProperties > WModule::getInformationProperties | ( | ) | const |
Return a pointer to the information properties object of the module.
The module intends these properties to not be modified.
Definition at line 484 of file WModule.cpp.
References m_infoProperties.
boost::shared_ptr< WModuleInputConnector > WModule::getInputConnector | ( | std::string | name | ) |
Finds the named connector for the module.
name | the name. This can be a canonical name or the connector name. |
WModuleConnectorNotFound | thrown whenever the module does not provide the specified connector. |
Definition at line 314 of file WModule.cpp.
References findInputConnector(), and WPrototyped::getName().
const WModule::InputConnectorList & WModule::getInputConnectors | ( | ) | const |
Gives back input connectors.
Definition at line 288 of file WModule.cpp.
References m_inputConnectors.
boost::filesystem::path WModule::getLibPath | ( | ) | const |
Returns the absolute path to the library containing this module.
Definition at line 601 of file WModule.cpp.
References m_libPath.
boost::filesystem::path WModule::getLocalPath | ( | ) | const |
Returns the local path of the module.
Whenever you try to load local resources, use this path. It is especially useful for shader loading.
Definition at line 591 of file WModule.cpp.
References m_localPath.
WModuleMetaInformation::ConstSPtr WModule::getMetaInformation | ( | ) | const [virtual] |
The meta information of this module.
This contains several information like name, description, icons, help links and so on. It, at least, contains the name.
Definition at line 230 of file WModule.cpp.
References m_meta.
boost::shared_ptr< WModuleOutputConnector > WModule::getOutputConnector | ( | std::string | name | ) |
Finds the named connector for the module.
name | the name. This can be a canonical name or the connector name. |
WModuleConnectorNotFound | thrown whenever the module does not provide the specified connector. |
Definition at line 343 of file WModule.cpp.
References findOutputConnector(), and WPrototyped::getName().
const WModule::OutputConnectorList & WModule::getOutputConnectors | ( | ) | const |
Gives back output connectors.
Definition at line 293 of file WModule.cpp.
References m_outputConnectors.
std::string WModule::getPackageName | ( | ) | const |
Returns the name of the package the module belongs to, The package name basically is the name of the library containing this and maybe other modules.
Your build system manages this. The package name is used to identify the resources for the modules in the library (a.k.a package).
Definition at line 611 of file WModule.cpp.
References m_packageName.
WCombinerTypes::WDisconnectList WModule::getPossibleDisconnections | ( | ) |
Gives a list of all WDisconnectCombiners possible.
Please note that while the list exists, connections might change.
Definition at line 162 of file WModule.cpp.
References m_inputConnectors, and m_outputConnectors.
boost::shared_ptr< WProperties > WModule::getProperties | ( | ) | const |
Return a pointer to the properties object of the module.
Definition at line 479 of file WModule.cpp.
References m_properties.
boost::shared_ptr< WProgressCombiner > WModule::getRootProgressCombiner | ( | ) | [virtual] |
Gets the modules base progress.
This is actually a progress combiner, which bundles all progresses.
Definition at line 489 of file WModule.cpp.
References m_progress.
const t_GenericSignalHandlerType WModule::getSignalHandler | ( | MODULE_CONNECTOR_SIGNAL | signal | ) | [protected, virtual] |
Gives the signal handler function responsible for a given signal.
Modules defining own signal handlers should overwrite this function. This function is protected since boost::functions are callable, which is what is not wanted here. Just signals should call them.
signal | the signal to get the handler for. |
Definition at line 412 of file WModule.cpp.
References notifyConnectionClosed(), notifyConnectionEstablished(), and notifyDataChange().
MODULE_TYPE WModule::getType | ( | ) | const [virtual] |
Gets the type of the module.
This is useful for FAST differentiation between several modules like standard modules and data modules which play a special role in OpenWalnut/Kernel.
Reimplemented in WDataModule.
Definition at line 283 of file WModule.cpp.
const std::string & WModule::getUUID | ( | ) | const |
Get the UUID of the module instance.
Use this when you need to guarantee a unique instance name, even across multiple OW sessions. The UUID gets set by the initialize method once and can never be changed.
Definition at line 652 of file WModule.cpp.
References m_uuid.
const char ** WModule::getXPMIcon | ( | ) | const [virtual] |
Get the icon for this module in XPM format.
Definition at line 494 of file WModule.cpp.
wlog::WStreamedLogger WModule::infoLog | ( | ) | const [protected] |
Logger instance for comfortable info logging.
Simply use logInfo() << "my info".
Definition at line 566 of file WModule.cpp.
References WPrototyped::getName(), and wlog::info().
Referenced by WModuleContainer::moduleError().
void WModule::initialize | ( | ) | [protected] |
Manages initialization.
Gets called by module container and ensures all properties, requirements, and connectors are properly set up.
WModuleConnectorInitFailed | if called multiple times. |
Definition at line 235 of file WModule.cpp.
References connectors(), WPrototyped::getName(), isInitialized(), m_initialized, m_isAssociated, m_isUsable, m_meta, m_runtimeName, properties(), requirements(), and WThreadedRunner::setThreadName().
const WBoolFlag & WModule::isAssociated | ( | ) | const |
Checks whether this module is associated with an container.
Definition at line 435 of file WModule.cpp.
References m_isAssociated.
bool WModule::isDeprecated | ( | ) | const |
Checks whether the module was marked as deprecated.
Definition at line 616 of file WModule.cpp.
References deprecated().
const WBoolFlag & WModule::isInitialized | ( | ) | const |
Determines whether the module instance is properly initialized.
Definition at line 430 of file WModule.cpp.
References m_initialized.
Referenced by initialize().
const WBoolFlag & WModule::isReady | ( | ) | const |
Checks whether this module is ready.
Definition at line 446 of file WModule.cpp.
References m_isReady.
const WBoolFlag & WModule::isReadyOrCrashed | ( | ) | const |
This is the logical or of isReady and isCrashed.
You should use this condition if you need to wait for a module to get ready. If it crashed before ready() got called, you most probably would wait endlessly.
Definition at line 451 of file WModule.cpp.
References m_isReadyOrCrashed.
bool WModule::isRestoreNeeded | ( | ) | const |
Check whether this module is in restore mode.
This means that some loader is currently handling the module. You are allowed to ignore this flag. But be aware that the loader can set connections and properties even if you do not expect this.
Definition at line 637 of file WModule.cpp.
References m_restoreMode.
const WBoolFlag & WModule::isRunning | ( | ) | const |
Returns a flag denoting whether the thread currently is running or nor.
It is also useful to get a callback whenever a module stops.
Definition at line 456 of file WModule.cpp.
References m_isRunning.
const WBoolFlag & WModule::isUseable | ( | ) | const |
Checks whether the module instance is ready to be used.
This is the case if isInitialized && isAssociated.
Definition at line 440 of file WModule.cpp.
References m_isUsable.
virtual void WModule::moduleMain | ( | ) | [protected, pure virtual] |
Entry point after loading the module.
Runs in separate thread.
Implemented in WModuleContainer, and WModuleImpl.
Referenced by threadMain().
void WModule::notifyConnectionClosed | ( | boost::shared_ptr< WModuleConnector > | here, |
boost::shared_ptr< WModuleConnector > | there | ||
) | [protected, virtual] |
Gets called whenever a connection between a remote and local connector gets closed.
here | the connector of THIS module getting disconnected. |
there | the connector of the other module getting disconnected. |
Reimplemented in WModuleImpl.
Definition at line 467 of file WModule.cpp.
Referenced by getSignalHandler().
void WModule::notifyConnectionEstablished | ( | boost::shared_ptr< WModuleConnector > | here, |
boost::shared_ptr< WModuleConnector > | there | ||
) | [protected, virtual] |
Gets called whenever a connector gets connected to the specified input.
here | the connector of THIS module that got connected to "there" |
there | the connector that has been connected with the connector "here" of this module. |
Reimplemented in WModuleImpl.
Definition at line 461 of file WModule.cpp.
Referenced by getSignalHandler().
void WModule::notifyDataChange | ( | boost::shared_ptr< WModuleConnector > | input, |
boost::shared_ptr< WModuleConnector > | output | ||
) | [protected, virtual] |
Gets called when the data on one input connector changed.
input | the input connector receiving the change. |
output | the output connector sending the change notification. |
Reimplemented in WModuleImpl.
Definition at line 473 of file WModule.cpp.
Referenced by getSignalHandler().
void WModule::onThreadException | ( | const WException & | e | ) | [protected, virtual] |
This method is called if an exception was caught, which came from the custom thread code.
This method is virtual and allows you to overwrite the default behaviour. If you overwrite this method, you should call WThreadedRunner::handleDeadlyException or WThreadedRunner::onThreadException if you are finished with your customized code.
e | the exception that was caught. |
Reimplemented from WThreadedRunner.
Definition at line 551 of file WModule.cpp.
References disconnect(), WPrototyped::getName(), WThreadedRunner::handleDeadlyException(), m_isRunning, and signal_error.
void WModule::properties | ( | ) | [protected, virtual] |
Initialize properties in this function.
This function must not be called multiple times for one module instance. The module container manages calling those functions -> so just implement it. Once initialized the number and type of all properties should be set.
Definition at line 213 of file WModule.cpp.
Referenced by initialize().
void WModule::ready | ( | ) | [protected] |
Call this whenever your module is ready and can react on property changes.
Definition at line 506 of file WModule.cpp.
References m_isReady, m_readyProgress, and signal_ready.
Referenced by WModuleContainer::moduleMain().
void WModule::removeConnectors | ( | ) | [protected] |
Removes all connectors properly.
It disconnects the connectors and cleans the connectors list.
Definition at line 195 of file WModule.cpp.
References disconnect(), m_initialized, m_inputConnectors, m_isAssociated, m_isUsable, and m_outputConnectors.
Referenced by cleanup().
void WModule::reportRestoreComplete | ( | ) |
Called by loaders to tell the module that loading has been completed.
Definition at line 647 of file WModule.cpp.
References m_isLoadFinished, and WFlag< T >::set().
void WModule::requirements | ( | ) | [protected, virtual] |
Initialize requirements in this function.
This function must not be called multiple times for one module instance. The module should always implement this. Using this method, a module can tell the kernel what it needs to run properly. For example, it can require a running graphics engine or, in the case of module containers, other modules.
Definition at line 217 of file WModule.cpp.
Referenced by initialize().
void WModule::setAssociatedContainer | ( | boost::shared_ptr< WModuleContainer > | container | ) | [protected] |
Sets the container this module is associated with.
container | the container to associate with. |
Definition at line 274 of file WModule.cpp.
References m_container, m_initialized, m_isAssociated, and m_isUsable.
void WModule::setLibPath | ( | boost::filesystem::path | path | ) | [protected] |
Set the path to the library which contains this module.
This is usually set by WModuleLoader.
path | the path to the library. Needs to be absolute. |
Definition at line 596 of file WModule.cpp.
References m_libPath.
void WModule::setLocalPath | ( | boost::filesystem::path | path | ) | [protected] |
Sets the local module path.
This gets called by the module loader.
path | the local path. |
Definition at line 586 of file WModule.cpp.
References m_localPath.
void WModule::setPackageName | ( | std::string | name | ) | [protected] |
Set the package name.
This basically is the library name of the lib containing this module. The package name is used to identify resources and other things which belong to a library (a.k.a. package).
name | the name to set |
Definition at line 606 of file WModule.cpp.
References m_packageName.
void WModule::setRestoreNeeded | ( | bool | restore = true | ) |
Change the restore mode.
restore | the mode. |
Definition at line 642 of file WModule.cpp.
References m_restoreMode.
void WModule::setUUID | ( | std::string | uuid | ) | [private] |
Set a uuid.
If the specified string is empty, a new one gets created.
uuid | the uuid to set. |
Definition at line 657 of file WModule.cpp.
References m_uuid.
boost::signals2::connection WModule::subscribeSignal | ( | MODULE_SIGNAL | signal, |
t_ModuleGenericSignalHandlerType | notifier | ||
) | [virtual] |
Connects a specified notify function with a signal this module instance is offering.
WModuleSignalSubscriptionFailed | thrown if the signal can't be connected. |
signal | the signal to connect to. |
notifier | the notifier function to bind. |
Definition at line 384 of file WModule.cpp.
References signal_ready.
boost::signals2::connection WModule::subscribeSignal | ( | MODULE_SIGNAL | signal, |
t_ModuleErrorSignalHandlerType | notifier | ||
) | [virtual] |
Connects a specified notify function with a signal this module instance is offering.
Please note that there also is a WThreadedRunner::subscribeSignal which allows error callbacks. The difference to this one is that the WThreadedRunner's version does not provide the sender information (shared_ptr).
WModuleSignalSubscriptionFailed | thrown if the signal can't be connected. |
signal | the signal to connect to. |
notifier | the notifier function to bind. |
Definition at line 398 of file WModule.cpp.
References signal_error.
void WModule::threadMain | ( | ) | [protected, virtual] |
Thread entry point.
Calls moduleMain and sends error notification if needed.
Reimplemented from WThreadedRunner.
Definition at line 527 of file WModule.cpp.
References WLogger::addLogMessage(), checkRequirements(), disconnect(), WLogger::getLogger(), WPrototyped::getName(), m_isRunning, and moduleMain().
void WModule::waitRestored | ( | ) |
This method waits for the module to be restored completely.
Use this instead of m_isLoadFinished->wait() as this is not properly defined when adding modules without using the project file loader.
Definition at line 626 of file WModule.cpp.
References m_isLoadFinished, m_restoreMode, and WFlag< T >::wait().
wlog::WStreamedLogger WModule::warnLog | ( | ) | const [protected] |
Logger instance for comfortable warning- logs.
Simply use logWarning() << "my warning".
Definition at line 581 of file WModule.cpp.
References WPrototyped::getName(), and wlog::warn().
WPropBool WModule::m_active [protected] |
boost::shared_ptr< WModuleContainer > WModule::m_container [protected] |
The container this module belongs to.
Definition at line 694 of file WModule.h.
Referenced by getAssociatedContainer(), setAssociatedContainer(), and WModule().
boost::shared_ptr< WProperties > WModule::m_infoProperties [protected] |
The property object for the module containing only module whose purpose is "PV_PURPOSE_INFORMNATION".
It is useful to define some property to only be of informational nature. The GUI does not modify them. As it is a WProperties instance, you can use it the same way as m_properties.
Definition at line 633 of file WModule.h.
Referenced by getInformationProperties(), and WModule().
WBoolFlag WModule::m_initialized [protected] |
True if everything is initialized and ready to be used.
Definition at line 643 of file WModule.h.
Referenced by initialize(), isInitialized(), removeConnectors(), and setAssociatedContainer().
InputConnectorList WModule::m_inputConnectors [protected] |
Set of input connectors associated with this module.
Definition at line 699 of file WModule.h.
Referenced by addConnector(), disconnect(), findInputConnector(), getInputConnectors(), getPossibleDisconnections(), and removeConnectors().
WBoolFlag WModule::m_isAssociated [protected] |
True if container got associated with this flag.
Definition at line 648 of file WModule.h.
Referenced by initialize(), isAssociated(), removeConnectors(), and setAssociatedContainer().
WBoolFlag WModule::m_isLoadFinished [protected] |
Flag to denote whether the module container and the project loader have finished their work.
Definition at line 674 of file WModule.h.
Referenced by reportRestoreComplete(), and waitRestored().
WBoolFlag WModule::m_isReady [protected] |
WBoolFlag WModule::m_isReadyOrCrashed [protected] |
It is true whenever m_isReady or WThreadedRunner::m_isCrashed is true.
This is mostly useful for functions which need to wait for a module to get ready.
Definition at line 664 of file WModule.h.
Referenced by isReadyOrCrashed(), and WModule().
WBoolFlag WModule::m_isRunning [protected] |
True if the module currently is running.
Definition at line 669 of file WModule.h.
Referenced by isRunning(), onThreadException(), and threadMain().
WBoolFlag WModule::m_isUsable [protected] |
True if associated && initialized.
Definition at line 653 of file WModule.h.
Referenced by initialize(), isUseable(), removeConnectors(), and setAssociatedContainer().
boost::filesystem::path WModule::m_libPath [protected] |
The absolute path to the library containing this module.
Definition at line 725 of file WModule.h.
Referenced by getLibPath(), and setLibPath().
boost::filesystem::path WModule::m_localPath [protected] |
The path where the module binary resides in.
This path should be used whenever the module needs to load resources. It gets set by the module loader. Use this to load shaders and so on.
Definition at line 720 of file WModule.h.
Referenced by getLocalPath(), and setLocalPath().
WModuleMetaInformation::SPtr WModule::m_meta [private] |
Lock for m_inputConnectors.
Lock for m_outputConnectors. Module meta information. Set by the factory creating the module instance.
Definition at line 756 of file WModule.h.
Referenced by getMetaInformation(), and initialize().
WConditionSet WModule::m_moduleState [protected] |
The internal state of the module.
This is, by default, simply the exit flag from WThreadedRunner.
Definition at line 689 of file WModule.h.
Referenced by WModule().
OutputConnectorList WModule::m_outputConnectors [protected] |
Set of output connectors associated with this module.
Definition at line 704 of file WModule.h.
Referenced by addConnector(), disconnect(), findOutputConnector(), getOutputConnectors(), getPossibleDisconnections(), and removeConnectors().
std::string WModule::m_packageName [protected] |
The name of the lib/the package containing this module.
Definition at line 730 of file WModule.h.
Referenced by getPackageName(), and setPackageName().
boost::shared_ptr< WProgressCombiner > WModule::m_progress [protected] |
Progress indicator used as parent for all progress' of this module.
Definition at line 638 of file WModule.h.
Referenced by WModuleContainer::add(), getRootProgressCombiner(), WModuleContainer::remove(), and WModule().
boost::shared_ptr< WProperties > WModule::m_properties [protected] |
The property object for the module.
Definition at line 626 of file WModule.h.
Referenced by getProperties(), and WModule().
boost::shared_ptr< WProgress > WModule::m_readyProgress [protected] |
Requirements WModule::m_requirements [protected] |
The list of requirements.
Definition at line 740 of file WModule.h.
Referenced by checkRequirements().
bool WModule::m_restoreMode [protected] |
Flag denoting the current restore mode.
Definition at line 679 of file WModule.h.
Referenced by isRestoreNeeded(), setRestoreNeeded(), and waitRestored().
WPropString WModule::m_runtimeName [protected] |
This property holds a user specified name for the current module instance.
Definition at line 714 of file WModule.h.
Referenced by initialize(), and WModule().
std::string WModule::m_uuid [private] |
t_ModuleErrorSignalType WModule::signal_error [private] |
Signal fired whenever a module main thread throws an exception/error.
Definition at line 766 of file WModule.h.
Referenced by WModuleContainer::moduleError(), onThreadException(), and subscribeSignal().
t_ModuleGenericSignalType WModule::signal_ready [private] |
Signal fired whenever a module main thread is ready.
Definition at line 761 of file WModule.h.
Referenced by ready(), and subscribeSignal().