30 #include <boost/shared_ptr.hpp>
31 #include <boost/uuid/uuid.hpp>
32 #include <boost/uuid/uuid_generators.hpp>
33 #include <boost/uuid/uuid_io.hpp>
35 #include "WModuleInputConnector.h"
36 #include "WModuleOutputConnector.h"
37 #include "WModuleInputData.h"
38 #include "WModuleOutputData.h"
39 #include "WModuleConnectorSignals.h"
40 #include "WModuleContainer.h"
41 #include "WModuleFactory.h"
42 #include "WModuleMetaInformation.h"
43 #include "exceptions/WModuleConnectorInitFailed.h"
44 #include "exceptions/WModuleConnectorNotFound.h"
45 #include "exceptions/WModuleUninitialized.h"
46 #include "exceptions/WModuleRequirementNotMet.h"
47 #include "../common/WException.h"
48 #include "../common/exceptions/WNameNotUnique.h"
49 #include "../common/exceptions/WSignalUnknown.h"
50 #include "../common/exceptions/WSignalSubscriptionFailed.h"
51 #include "../common/WLogger.h"
52 #include "../common/WCondition.h"
53 #include "../common/WConditionOneShot.h"
54 #include "../common/WConditionSet.h"
55 #include "../common/WPathHelper.h"
56 #include "../common/WProgressCombiner.h"
57 #include "../common/WPredicateHelper.h"
71 m_restoreMode( false ),
72 m_readyProgress( boost::shared_ptr<
WProgress >( new
WProgress(
"Initializing Module" ) ) ),
78 m_infoProperties = boost::shared_ptr< WProperties >(
new WProperties(
"Informational Properties",
"Module's information properties" ) );
79 m_infoProperties->setPurpose( PV_PURPOSE_INFORMATION );
81 m_runtimeName =
m_properties->addProperty(
"Name",
"The name of the module defined by the user. This is, by default, the module name but "
82 "can be changed by the user to provide some kind of simple identification upon many modules.",
83 std::string(
"" ),
false );
85 m_active =
m_properties->addProperty(
"active",
"Determines whether the module should be activated.",
true,
true );
94 m_container = boost::shared_ptr< WModuleContainer >();
122 throw WNameNotUnique( std::string(
"Could not add the connector " + con->getCanonicalName() +
" since names must be unique." ) );
141 throw WNameNotUnique( std::string(
"Could not add the connector " + con->getCanonicalName() +
" since names must be unique." ) );
153 ( *listIter )->disconnectAll();
158 ( *listIter )->disconnectAll();
164 WCombinerTypes::WDisconnectList discons;
170 WCombinerTypes::WDisconnectGroup g = WCombinerTypes::WDisconnectGroup( ( *listIter )->getName(),
171 ( *listIter )->getPossibleDisconnections() );
173 if( g.second.size() )
175 discons.push_back( g );
183 WCombinerTypes::WDisconnectGroup g = WCombinerTypes::WDisconnectGroup( ( *listIter )->getName(),
184 ( *listIter )->getPossibleDisconnections() );
186 if( g.second.size() )
188 discons.push_back( g );
241 std::string(
". Reason: already initialized." ) );
285 return MODULE_ARBITRARY;
305 if( ( name == ( *listIter )->getCanonicalName() ) || ( name == ( *listIter )->getName() ) )
307 return ( *listIter );
311 return boost::shared_ptr< WModuleInputConnector >();
321 std::string(
"\" does not exist in the module \"" ) +
getName() + std::string(
"\"." ) );
334 if( ( name == ( *listIter )->getCanonicalName() ) || ( name == ( *listIter )->getName() ) )
336 return ( *listIter );
340 return boost::shared_ptr< WModuleOutputConnector >();
350 std::string(
"\" does not exist in the module \"" ) +
getName() +
351 std::string(
"\"." ) );
372 boost::shared_ptr< WModuleConnector > p =
findConnector( name );
377 std::string(
"\" does not exist in the module \"" ) +
getName() +
378 std::string(
"\"." ) );
391 std::ostringstream s;
392 s <<
"Could not subscribe to unknown signal.";
405 std::ostringstream s;
406 s <<
"Could not subscribe to unknown signal.";
416 case CONNECTION_ESTABLISHED:
418 case CONNECTION_CLOSED:
423 std::ostringstream s;
424 s <<
"Could not subscribe to unknown signal. You need to implement this signal type explicitly in your module.";
462 boost::shared_ptr< WModuleConnector > )
468 boost::shared_ptr< WModuleConnector > )
474 boost::shared_ptr< WModuleConnector > )
497 static const char * o_xpm[] =
518 if( !( *i )->isComplied() )
665 boost::uuids::random_generator gen;
666 m_uuid = boost::uuids::to_string( gen() );