25 #ifndef WMODULEINPUTDATA_H
26 #define WMODULEINPUTDATA_H
31 #include <boost/shared_ptr.hpp>
34 #include <boost/thread/locks.hpp>
39 #include "WModuleOutputData.h"
40 #include "exceptions/WModuleConnectorUnconnected.h"
41 #include "../common/WTransferable.h"
42 #include "../common/WPrototyped.h"
44 #include "WModuleInputConnector.h"
45 #include "WModuleOutputConnector.h"
51 template <
typename T >
58 typedef boost::shared_ptr< WModuleInputData< T > >
PtrType;
63 typedef boost::shared_ptr< WModuleInputData< T > >
SPtr;
68 typedef boost::shared_ptr< const WModuleInputData< T > >
ConstSPtr;
94 static PtrType
create( boost::shared_ptr< WModule > module, std::string name =
"", std::string description =
"" );
106 static PtrType
createAndAdd( boost::shared_ptr< WModule > module, std::string name =
"", std::string description =
"" );
115 WModuleInputData( boost::shared_ptr< WModule > module, std::string name =
"", std::string description =
"" ):
134 virtual void disconnect( boost::shared_ptr<WModuleConnector> con,
bool removeFromOwnList =
true );
143 const boost::shared_ptr< T >
getData(
bool reset =
true )
146 boost::shared_lock<boost::shared_mutex> lock = boost::shared_lock<boost::shared_mutex>(
m_connectionListLock );
158 return boost::shared_ptr< T >();
162 boost::shared_ptr< T > dat = boost::dynamic_pointer_cast< T >(
179 virtual bool connectable( boost::shared_ptr<WModuleConnector> con )
191 boost::shared_ptr< WPrototyped > tProto =
195 return dynamic_cast< T*
>( tProto.get() );
206 template <
typename T >
209 m_disconnecting =
true;
211 m_disconnecting =
false;
214 template <
typename T >
216 std::string description )
220 return PTR(
new TYPE( module, name, description ) );
223 template <
typename T >
225 std::string description )
228 module->addConnector( c );
232 #endif // WMODULEINPUTDATA_H
virtual void disconnect(boost::shared_ptr< WModuleConnector > con, bool removeFromOwnList=true)
Disconnects this connector if connected.
Class offering an instantiate-able data connection between modules.
Class implementing output connection functionality between modules.
boost::shared_mutex m_connectionListLock
Lock for avoiding concurrent write to m_Connected (multiple reader, single writer lock)...
std::set< boost::shared_ptr< WModuleConnector > > m_connected
List of connectors connected to this connector.