OpenWalnut  1.2.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Public Types | Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
WModuleOutputData< T > Class Template Reference

Class offering an instantiate-able data connection between modules. More...

#include <WModuleOutputData.h>

+ Inheritance diagram for WModuleOutputData< T >:

Public Types

typedef boost::shared_ptr
< WModuleOutputData< T > > 
PtrType
 Pointer to this.
typedef WModuleOutputData< T > & RefType
 Reference to this type.
typedef WModuleOutputData< T > Type
 Type of the connector.
typedef T TransferType
 Typedef to the contained transferable.

Public Member Functions

 WModuleOutputData (boost::shared_ptr< WModule > module, std::string name="", std::string description="")
 Constructor.
virtual ~WModuleOutputData ()
 Destructor.
virtual void updateData (boost::shared_ptr< T > data)
 Update the data associated.
virtual void reset ()
 Resets the data on this output.
virtual void triggerUpdate ()
 This method simply propagates an update but does not actually change the data.
virtual const
boost::shared_ptr
< WTransferable
getRawData () const
 Gives back the currently set data as WTransferable.
const boost::shared_ptr< T > getData () const
 Gives back the currently set data.
virtual bool connectable (boost::shared_ptr< WModuleConnector > con)
 Checks whether the specified connector is an input connector and compatible with T.
virtual boost::shared_ptr
< WPrototyped
getTransferPrototype ()
 Returns the prototype of the Type T used in this connector.
- Public Member Functions inherited from WModuleOutputConnector
 WModuleOutputConnector (boost::shared_ptr< WModule > module, std::string name="", std::string description="")
 Constructor.
virtual ~WModuleOutputConnector ()
 Destructor.
boost::signals2::connection subscribeSignal (MODULE_CONNECTOR_SIGNAL signal, t_GenericSignalHandlerType notifier)
 Connects (subscribes) a specified notify function with a signal this module instance is offering.
virtual bool isInputConnector () const
 Returns true if this instance is an WModuleInputConnector.
virtual bool isOutputConnector () const
 Returns true if this instance is an WModuleOutputConnector.
- Public Member Functions inherited from WModuleConnector
 WModuleConnector (boost::shared_ptr< WModule > module, std::string name="", std::string description="")
 Constructor.
virtual ~WModuleConnector ()
 Destructor.
boost::shared_ptr< WModulegetModule () const
 Returns the module which owns this connector.
virtual void disconnect (boost::shared_ptr< WModuleConnector > con, bool removeFromOwnList=true)
 Disconnects this connector if connected.
virtual void disconnectAll ()
 Disconnects ALL connected connectors.
virtual void connect (boost::shared_ptr< WModuleConnector > con)
 Connects this Module Connector with another one.
bool isConnectedTo (boost::shared_ptr< WModuleConnector > con)
 Checks whether this connector is connected to the given one.
unsigned int isConnected ()
 Gets the count of connections currently established.
const std::string getDescription () const
 Gives information about this connection.
void setDescription (std::string desc)
 Sets the connector's description.
const std::string getName () const
 Gives name of connection.
const std::string getCanonicalName () const
 Gives canonical name of connection.
void setName (std::string name)
 Sets the connector's name.
WCombinerTypes::WOneToOneCombiners getPossibleDisconnections ()
 Returns a list of possible disconnections for this connector.
boost::shared_ptr
< WModuleInputConnector
toInputConnector ()
 Tries to convert this instance to an input connector.
boost::shared_ptr
< WModuleOutputConnector
toOutputConnector ()
 Tries to convert this instance to an output connector.

Static Public Member Functions

static PtrType create (boost::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.
static PtrType createAndAdd (boost::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 the list of connectors of the specified module.

Private Attributes

boost::shared_ptr< T > m_data
 The data associated with this connector.

Additional Inherited Members

- Protected Member Functions inherited from WModuleOutputConnector
virtual void propagateDataChange ()
 Propagates the signal "DATA_CHANGED" to all connected items.
- Protected Attributes inherited from WModuleConnector
std::set< boost::shared_ptr
< WModuleConnector > > 
m_connected
 List of connectors connected to this connector.
boost::shared_mutex m_connectionListLock
 Lock for avoiding concurrent write to m_Connected (multiple reader, single writer lock).
boost::weak_ptr< WModulem_module
 The Module this connector belongs to.
std::string m_moduleName
 The name of the module owning this connector.
t_GenericSignalType signal_ConnectionEstablished
 Signal emitted whenever connection has been established.
t_GenericSignalType signal_ConnectionClosed
 Signal emitted whenever connection has been closed.

Detailed Description

template<typename T>
class WModuleOutputData< T >

Class offering an instantiate-able data connection between modules.

Due to is template style it is possible to bind nearly arbitrary data.

Definition at line 47 of file WModuleOutputData.h.

Member Typedef Documentation

template<typename T>
typedef boost::shared_ptr< WModuleOutputData< T > > WModuleOutputData< T >::PtrType

Pointer to this.

For convenience.

Definition at line 53 of file WModuleOutputData.h.

template<typename T>
typedef WModuleOutputData< T >& WModuleOutputData< T >::RefType

Reference to this type.

Definition at line 58 of file WModuleOutputData.h.

template<typename T>
typedef T WModuleOutputData< T >::TransferType

Typedef to the contained transferable.

Definition at line 68 of file WModuleOutputData.h.

template<typename T>
typedef WModuleOutputData< T > WModuleOutputData< T >::Type

Type of the connector.

Definition at line 63 of file WModuleOutputData.h.

Constructor & Destructor Documentation

template<typename T>
WModuleOutputData< T >::WModuleOutputData ( boost::shared_ptr< WModule module,
std::string  name = "",
std::string  description = "" 
)
inline

Constructor.

Parameters
modulethe module which is owner of this connector.
nameThe name of this connector.
descriptionShort description of this connector.

Definition at line 100 of file WModuleOutputData.h.

References WModuleOutputData< T >::m_data.

template<typename T>
virtual WModuleOutputData< T >::~WModuleOutputData ( )
inlinevirtual

Destructor.

Definition at line 109 of file WModuleOutputData.h.

Member Function Documentation

template<typename T>
virtual bool WModuleOutputData< T >::connectable ( boost::shared_ptr< WModuleConnector con)
inlinevirtual

Checks whether the specified connector is an input connector and compatible with T.

Parameters
conthe connector to check against.
Returns
true if compatible.

Reimplemented from WModuleOutputConnector.

Definition at line 170 of file WModuleOutputData.h.

template<typename T >
WModuleOutputData< T >::PtrType WModuleOutputData< T >::create ( boost::shared_ptr< WModule module,
std::string  name = "",
std::string  description = "" 
)
static

Convenience method to create a new instance of this out data connector with proper type.

Parameters
modulethe module owning this instance
namethe name of this connector.
descriptionthe description of this connector.
Returns
the pointer to the created connector.

Definition at line 198 of file WModuleOutputData.h.

template<typename T >
WModuleOutputData< T >::PtrType WModuleOutputData< T >::createAndAdd ( boost::shared_ptr< WModule module,
std::string  name = "",
std::string  description = "" 
)
static

Convenience method to create a new instance of this out data connector with proper type and add it to the list of connectors of the specified module.

Parameters
modulethe module owning this instance
namethe name of this connector.
descriptionthe description of this connector.
Returns
the pointer to the created connector.

Definition at line 207 of file WModuleOutputData.h.

template<typename T>
const boost::shared_ptr< T > WModuleOutputData< T >::getData ( ) const
inline

Gives back the currently set data.

Returns
the data. If no data has been set: a NULL pointer is returned.

Definition at line 158 of file WModuleOutputData.h.

References WModuleOutputData< T >::m_data.

Referenced by WModuleImpl::notifyDataChange().

template<typename T>
virtual const boost::shared_ptr< WTransferable > WModuleOutputData< T >::getRawData ( ) const
inlinevirtual

Gives back the currently set data as WTransferable.

Returns
the data. If no data has been set: a NULL pointer is returned.

Implements WModuleOutputConnector.

Definition at line 148 of file WModuleOutputData.h.

References WModuleOutputData< T >::m_data.

template<typename T>
virtual boost::shared_ptr< WPrototyped > WModuleOutputData< T >::getTransferPrototype ( )
inlinevirtual

Returns the prototype of the Type T used in this connector.

Returns
the prototype of the transfered type.

Implements WModuleOutputConnector.

Definition at line 181 of file WModuleOutputData.h.

References WModuleOutputData< T >::m_data.

template<typename T>
virtual void WModuleOutputData< T >::reset ( )
inlinevirtual

Resets the data on this output.

It actually sets NULL and triggers an update.

Definition at line 129 of file WModuleOutputData.h.

References WModuleOutputData< T >::updateData().

template<typename T>
virtual void WModuleOutputData< T >::triggerUpdate ( )
inlinevirtual

This method simply propagates an update but does not actually change the data.

Definition at line 137 of file WModuleOutputData.h.

References WModuleOutputConnector::propagateDataChange().

Referenced by WModuleOutputData< T >::updateData().

template<typename T>
virtual void WModuleOutputData< T >::updateData ( boost::shared_ptr< T >  data)
inlinevirtual

Update the data associated.

Parameters
datathe data do send

Definition at line 118 of file WModuleOutputData.h.

References WModuleOutputData< T >::m_data, and WModuleOutputData< T >::triggerUpdate().

Referenced by WModuleOutputForwardData< T >::inputNotifyDataChange(), and WModuleOutputData< T >::reset().

Member Data Documentation

template<typename T>
boost::shared_ptr< T > WModuleOutputData< T >::m_data
private

The documentation for this class was generated from the following file: