OpenWalnut  1.5.0dev
Public Member Functions | Protected Member Functions | Private Attributes | List of all members
WModuleOutputConnector Class Referenceabstract

Class implementing output connection functionality between modules. More...

#include <WModuleOutputConnector.h>

+ Inheritance diagram for WModuleOutputConnector:
+ Collaboration diagram for WModuleOutputConnector:

Public Member Functions

 WModuleOutputConnector (std::shared_ptr< WModule > module, std::string name="", std::string description="")
 Constructor. More...
 
virtual ~WModuleOutputConnector ()
 Destructor. More...
 
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. More...
 
virtual bool connectable (std::shared_ptr< WModuleConnector > con)
 Checks whether the specified connector is an input connector. More...
 
virtual bool lazyConnectable (std::shared_ptr< WModuleConnector > con)
 Checks whether the specified connector is connectable to this one, but ignores compatibility the type to be transferred. More...
 
virtual std::shared_ptr< WPrototypedgetTransferPrototype ()=0
 Returns the prototype of the WTransferable used in this connector. More...
 
virtual const std::shared_ptr< WTransferablegetRawData () const =0
 Gives back the currently set data as WTransferable. More...
 
virtual bool isInputConnector () const
 Returns true if this instance is an WModuleInputConnector. More...
 
virtual bool isOutputConnector () const
 Returns true if this instance is an WModuleOutputConnector. More...
 
- Public Member Functions inherited from WModuleConnector
 WModuleConnector (std::shared_ptr< WModule > module, std::string name="", std::string description="")
 Constructor. More...
 
virtual ~WModuleConnector ()
 Destructor. More...
 
std::shared_ptr< WModulegetModule () const
 Returns the module which owns this connector. More...
 
virtual void disconnect (std::shared_ptr< WModuleConnector > con, bool removeFromOwnList=true)
 Disconnects this connector if connected. More...
 
virtual void disconnectAll ()
 Disconnects ALL connected connectors. More...
 
virtual void connect (std::shared_ptr< WModuleConnector > con, bool force=false)
 Connects this Module Connector with another one. More...
 
bool isConnectedTo (std::shared_ptr< WModuleConnector > con)
 Checks whether this connector is connected to the given one. More...
 
unsigned int isConnected ()
 Gets the count of connections currently established. More...
 
const std::string getDescription () const
 Gives information about this connection. More...
 
void setDescription (std::string desc)
 Sets the connector's description. More...
 
const std::string getName () const
 Gives name of connection. More...
 
const std::string getCanonicalName () const
 Gives canonical name of connection. More...
 
void setName (std::string name)
 Sets the connector's name. More...
 
WCombinerTypes::WOneToOneCombiners getPossibleDisconnections ()
 Returns a list of possible disconnections for this connector. More...
 
std::shared_ptr< WModuleInputConnectortoInputConnector ()
 Tries to convert this instance to an input connector. More...
 
std::shared_ptr< WModuleOutputConnectortoOutputConnector ()
 Tries to convert this instance to an output connector. More...
 
std::shared_ptr< WConditiongetDataChangedCondition ()
 Gets the condition variable that gets fired whenever new data has been sent. More...
 

Protected Member Functions

virtual void propagateDataChange ()
 Propagates the signal "DATA_CHANGED" to all connected items. More...
 
- Protected Member Functions inherited from WModuleConnector
virtual void connectSignals (std::shared_ptr< WModuleConnector > con)
 Connect additional signals. More...
 
virtual void disconnectSignals (std::shared_ptr< WModuleConnector > con)
 Disconnect all signals subscribed by this connector from "con". More...
 
virtual const t_GenericSignalHandlerType getSignalHandler (MODULE_CONNECTOR_SIGNAL signal)
 Gives the signal handler function responsible for a given signal. More...
 
virtual void notifyConnectionEstablished (std::shared_ptr< WModuleConnector > here, std::shared_ptr< WModuleConnector > there)
 Gets called whenever a connector gets connected to the specified input. More...
 
virtual void notifyConnectionClosed (std::shared_ptr< WModuleConnector > here, std::shared_ptr< WModuleConnector > there)
 Gets called whenever a connection between a remote and local connector gets closed. More...
 

Private Attributes

t_GenericSignalType signal_DataChanged
 Signal fired whenever new data should be propagated. More...
 

Additional Inherited Members

- Public Types inherited from WModuleConnector
typedef std::shared_ptr< WModuleConnectorSPtr
 Shared pointer to this class. More...
 
typedef std::shared_ptr< const WModuleConnectorConstSPtr
 Const shared pointer to this class. More...
 
- Protected Attributes inherited from WModuleConnector
std::set< std::shared_ptr< WModuleConnector > > m_connected
 List of connectors connected to this connector. More...
 
std::shared_mutex m_connectionListLock
 Lock for avoiding concurrent write to m_Connected (multiple reader, single writer lock). More...
 
std::weak_ptr< WModulem_module
 The Module this connector belongs to. More...
 
std::string m_moduleName
 The name of the module owning this connector. More...
 
t_GenericSignalType signal_ConnectionEstablished
 Signal emitted whenever connection has been established. More...
 
t_GenericSignalType signal_ConnectionClosed
 Signal emitted whenever connection has been closed. More...
 
std::shared_ptr< WConditionm_dataChangedCondition
 Condition fired whenever data changes. More...
 

Detailed Description

Class implementing output connection functionality between modules.

Definition at line 44 of file WModuleOutputConnector.h.

Constructor & Destructor Documentation

◆ WModuleOutputConnector()

WModuleOutputConnector::WModuleOutputConnector ( std::shared_ptr< WModule module,
std::string  name = "",
std::string  description = "" 
)

Constructor.

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

Definition at line 36 of file WModuleOutputConnector.cpp.

◆ ~WModuleOutputConnector()

WModuleOutputConnector::~WModuleOutputConnector ( )
virtual

Destructor.

Definition at line 41 of file WModuleOutputConnector.cpp.

Member Function Documentation

◆ connectable()

bool WModuleOutputConnector::connectable ( std::shared_ptr< WModuleConnector con)
virtual

Checks whether the specified connector is an input connector.

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

Implements WModuleConnector.

Reimplemented in WModuleOutputData< T >, and WModuleOutputData< WDataSetSingle >.

Definition at line 46 of file WModuleOutputConnector.cpp.

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

+ Here is the caller graph for this function:

◆ getRawData()

virtual const std::shared_ptr< WTransferable > WModuleOutputConnector::getRawData ( ) const
pure virtual

Gives back the currently set data as WTransferable.

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

Implemented in WModuleOutputData< T >, and WModuleOutputData< WDataSetSingle >.

◆ getTransferPrototype()

virtual std::shared_ptr< WPrototyped > WModuleOutputConnector::getTransferPrototype ( )
pure virtual

Returns the prototype of the WTransferable used in this connector.

Returns
the prototype of the transfered type.

Implemented in WModuleOutputData< T >, and WModuleOutputData< WDataSetSingle >.

◆ isInputConnector()

bool WModuleOutputConnector::isInputConnector ( ) const
virtual

Returns true if this instance is an WModuleInputConnector.

Returns
true if castable to WModuleInputConnector.

Implements WModuleConnector.

Definition at line 87 of file WModuleOutputConnector.cpp.

◆ isOutputConnector()

bool WModuleOutputConnector::isOutputConnector ( ) const
virtual

Returns true if this instance is an WModuleOutputConnector.

Returns
true if castable to WModuleOutputConnector.

Implements WModuleConnector.

Definition at line 92 of file WModuleOutputConnector.cpp.

◆ lazyConnectable()

bool WModuleOutputConnector::lazyConnectable ( std::shared_ptr< WModuleConnector con)
virtual

Checks whether the specified connector is connectable to this one, but ignores compatibility the type to be transferred.

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

Implements WModuleConnector.

Definition at line 57 of file WModuleOutputConnector.cpp.

◆ propagateDataChange()

void WModuleOutputConnector::propagateDataChange ( )
protectedvirtual

Propagates the signal "DATA_CHANGED" to all connected items.

Definition at line 81 of file WModuleOutputConnector.cpp.

References WModuleConnector::m_dataChangedCondition, and signal_DataChanged.

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

+ Here is the caller graph for this function:

◆ subscribeSignal()

boost::signals2::connection WModuleOutputConnector::subscribeSignal ( MODULE_CONNECTOR_SIGNAL  signal,
t_GenericSignalHandlerType  notifier 
)
virtual

Connects (subscribes) a specified notify function with a signal this module instance is offering.

Exceptions
WModuleSignalSubscriptionFailedthrown if the signal can't be connected.
Parameters
signalthe signal to connect to.
notifierthe notifier function to bind.
Returns
the connection object. Disconnect manually if not needed anymore.

Reimplemented from WModuleConnector.

Definition at line 68 of file WModuleOutputConnector.cpp.

References signal_DataChanged, and WModuleConnector::subscribeSignal().

+ Here is the call graph for this function:

Member Data Documentation

◆ signal_DataChanged

t_GenericSignalType WModuleOutputConnector::signal_DataChanged
private

Signal fired whenever new data should be propagated.

Represented by DATA_CHANGED enum- element.

Definition at line 137 of file WModuleOutputConnector.h.

Referenced by propagateDataChange(), and subscribeSignal().


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