25 #ifndef WMODULEINPUTDATA_H
26 #define WMODULEINPUTDATA_H
30 #include <boost/shared_ptr.hpp>
31 #include <boost/thread/locks.hpp>
35 #include "WModuleOutputData.h"
36 #include "exceptions/WModuleConnectorUnconnected.h"
37 #include "../common/WTransferable.h"
38 #include "../common/WPrototyped.h"
40 #include "WModuleInputConnector.h"
41 #include "WModuleOutputConnector.h"
47 template <
typename T >
54 typedef boost::shared_ptr< WModuleInputData< T > >
PtrType;
80 static PtrType create( boost::shared_ptr< WModule > module, std::string name =
"", std::string description =
"" );
92 static PtrType createAndAdd( boost::shared_ptr< WModule > module, std::string name =
"", std::string description =
"" );
101 WModuleInputData( boost::shared_ptr< WModule > module, std::string name =
"", std::string description =
"" ):
120 virtual void disconnect( boost::shared_ptr<WModuleConnector> con,
bool removeFromOwnList =
true );
129 const boost::shared_ptr< T >
getData(
bool reset =
true )
132 boost::shared_lock<boost::shared_mutex> lock = boost::shared_lock<boost::shared_mutex>(
m_connectionListLock );
144 return boost::shared_ptr< T >();
148 boost::shared_ptr< T > dat = boost::dynamic_pointer_cast<
T >(
165 virtual bool connectable( boost::shared_ptr<WModuleConnector> con )
177 boost::shared_ptr< WPrototyped > tProto =
181 return dynamic_cast< T*
>( tProto.get() );
192 template <
typename T >
195 m_disconnecting =
true;
197 m_disconnecting =
false;
200 template <
typename T >
202 std::string description )
206 return PTR(
new TYPE( module, name, description ) );
209 template <
typename T >
211 std::string description )
214 module->addConnector( c );
218 #endif // WMODULEINPUTDATA_H