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;
59 typedef boost::shared_ptr< WModuleInputData< T > >
SPtr;
64 typedef boost::shared_ptr< const WModuleInputData< T > >
ConstSPtr;
90 static PtrType create( boost::shared_ptr< WModule > module, std::string name =
"", std::string description =
"" );
102 static PtrType createAndAdd( boost::shared_ptr< WModule > module, std::string name =
"", std::string description =
"" );
111 WModuleInputData( boost::shared_ptr< WModule > module, std::string name =
"", std::string description =
"" ):
130 virtual void disconnect( boost::shared_ptr<WModuleConnector> con,
bool removeFromOwnList =
true );
139 const boost::shared_ptr< T >
getData(
bool reset =
true )
142 boost::shared_lock<boost::shared_mutex> lock = boost::shared_lock<boost::shared_mutex>(
m_connectionListLock );
154 return boost::shared_ptr< T >();
158 boost::shared_ptr< T > dat = boost::dynamic_pointer_cast< T >(
175 virtual bool connectable( boost::shared_ptr<WModuleConnector> con )
187 boost::shared_ptr< WPrototyped > tProto =
191 return dynamic_cast< T*
>( tProto.get() );
202 template <
typename T >
205 m_disconnecting =
true;
207 m_disconnecting =
false;
210 template <
typename T >
212 std::string description )
216 return PTR(
new TYPE( module, name, description ) );
219 template <
typename T >
221 std::string description )
224 module->addConnector( c );
228 #endif // WMODULEINPUTDATA_H