25 #ifndef WMODULEOUTPUTDATA_H
26 #define WMODULEOUTPUTDATA_H
32 #include "../common/WLogger.h"
33 #include "../common/WPrototyped.h"
34 #include "../common/WTransferable.h"
35 #include "WModuleInputData.h"
36 #include "WModuleOutputConnector.h"
42 template <
typename T >
49 typedef std::shared_ptr< WModuleOutputData< T > >
PtrType;
54 typedef std::shared_ptr< WModuleOutputData< T > >
SPtr;
59 typedef std::shared_ptr< const WModuleOutputData< T > >
ConstSPtr;
85 static PtrType create( std::shared_ptr< WModule > module, std::string name =
"", std::string description =
"" );
97 static PtrType createAndAdd( std::shared_ptr< WModule > module, std::string name =
"", std::string description =
"" );
106 WModuleOutputData( std::shared_ptr< WModule > module, std::string name =
"", std::string description =
"" )
109 m_data = std::shared_ptr< T >();
154 virtual const std::shared_ptr< WTransferable >
getRawData()
const
190 return (
m_data == std::shared_ptr< T >() ) ? T::getPrototype() : std::static_pointer_cast< WPrototyped >(
m_data );
203 template <
typename T >
205 std::string description )
209 return PTR(
new TYPE( module, name, description ) );
212 template <
typename T >
214 std::string description )
217 module->addConnector( c );
Class implementing output connection functionality between modules.
virtual bool connectable(std::shared_ptr< WModuleConnector > con)
Checks whether the specified connector is an input connector.
virtual void propagateDataChange()
Propagates the signal "DATA_CHANGED" to all connected items.
Class offering an instantiate-able data connection between modules.
virtual std::shared_ptr< WPrototyped > getTransferPrototype()
Returns the prototype of the Type T used in this connector.
virtual void triggerUpdate()
This method simply propagates an update but does not actually change the data.
static PtrType createAndAdd(std::shared_ptr< WModule > module, std::string name="", std::string description="")
Convenience method to create a new instance of this out data connector with proper type and add it to...
T TransferType
Typedef to the contained transferable.
std::shared_ptr< WModuleOutputData< T > > SPtr
Pointer to this.
static PtrType create(std::shared_ptr< WModule > module, std::string name="", std::string description="")
Convenience method to create a new instance of this out data connector with proper type.
const std::shared_ptr< T > getData() const
Gives back the currently set data.
WModuleOutputData< T > Type
Type of the connector.
virtual bool connectable(std::shared_ptr< WModuleConnector > con)
Checks whether the specified connector is an input connector and compatible with T.
std::shared_ptr< const WModuleOutputData< T > > ConstSPtr
Pointer to this.
virtual void reset()
Resets the data on this output.
virtual const std::shared_ptr< WTransferable > getRawData() const
Gives back the currently set data as WTransferable.
WModuleOutputData(std::shared_ptr< WModule > module, std::string name="", std::string description="")
Constructor.
virtual ~WModuleOutputData()
Destructor.
WModuleOutputData< T > & RefType
Reference to this type.
virtual void updateData(std::shared_ptr< T > data)
Update the data associated.
std::shared_ptr< T > m_data
The data associated with this connector.
std::shared_ptr< WModuleOutputData< T > > PtrType
Pointer to this.