Abstract 'Event Dispatcher'. More...
#include <Signal.hxx>
Public Types | |
typedef std::stack< unsigned > | tConnectionIdStack |
typedef unsigned | tConnectionId |
Public Member Functions | |
virtual | ~Signal () |
Destructor. | |
virtual void | FreeConnection (Connection *conn)=0 |
Removes a connection. | |
Protected Member Functions | |
void | FreeConnectionId (tConnectionId) |
tConnectionId | AssignConnection () |
Static Protected Attributes | |
static tConnectionId | smLastConnectionId = 0 |
Abstract 'Event Dispatcher'.
Sometimes, is very useful that when an object is subject of a certain message, or state change, must notify this change to a number of listeners. This situation, albeit it can be modeled quite neatly in OOP suffers a major drawback: coupling. Coupling tipically risks the possibility of reusing a certain object due to the fact that the caller must know to some extent the callee interface.
However there exist some solutions to this known problem. One of them is the 'Signal and Slot' idiom, which features an extremely low coupling between callers and callees. For more details, take a look on the CLAM Signal & Slot Library.
This class is an abstract one, already implementing common behaviour, the signal and slot connection handling issues.
Definition at line 50 of file Signal.hxx.
Definition at line 54 of file Signal.hxx.
typedef std::stack< unsigned > SigSlot::Signal::tConnectionIdStack |
Definition at line 53 of file Signal.hxx.
SigSlot::Signal::~Signal | ( | ) | [virtual] |
Signal::tConnectionId SigSlot::Signal::AssignConnection | ( | ) | [protected] |
Definition at line 33 of file Signal.cxx.
References SigSlot::smFreeIdStack, and smLastConnectionId.
Referenced by SigSlot::Signalv4< ParmType1, ParmType2, ParmType3, ParmType4 >::Connect(), SigSlot::Signalv3< ParmType1, ParmType2, ParmType3 >::Connect(), SigSlot::Signalv2< ParmType1, ParmType2 >::Connect(), SigSlot::Signalv1< ParmType1 >::Connect(), and SigSlot::Signalv0::Connect().
virtual void SigSlot::Signal::FreeConnection | ( | Connection * | conn | ) | [pure virtual] |
Removes a connection.
Removes the given connections, so the Signal does not notify anymore the Slot behind that Connection.
conn | The connection to be freed |
Implemented in SigSlot::Signalv0, SigSlot::Signalv0, SigSlot::Signalv1< ParmType1 >, SigSlot::Signalv1< ParmType1 >, SigSlot::Signalv2< ParmType1, ParmType2 >, SigSlot::Signalv2< ParmType1, ParmType2 >, SigSlot::Signalv3< ParmType1, ParmType2, ParmType3 >, SigSlot::Signalv3< ParmType1, ParmType2, ParmType3 >, SigSlot::Signalv4< ParmType1, ParmType2, ParmType3, ParmType4 >, and SigSlot::Signalv4< ParmType1, ParmType2, ParmType3, ParmType4 >.
void SigSlot::Signal::FreeConnectionId | ( | Signal::tConnectionId | freedConnectionId | ) | [protected] |
Definition at line 43 of file Signal.cxx.
References SigSlot::smFreeIdStack.
Referenced by SigSlot::Signalv4< ParmType1, ParmType2, ParmType3, ParmType4 >::FreeConnection(), SigSlot::Signalv3< ParmType1, ParmType2, ParmType3 >::FreeConnection(), SigSlot::Signalv2< ParmType1, ParmType2 >::FreeConnection(), SigSlot::Signalv1< ParmType1 >::FreeConnection(), and SigSlot::Signalv0::FreeConnection().
Signal::tConnectionId SigSlot::Signal::smLastConnectionId = 0 [static, protected] |
Definition at line 76 of file Signal.hxx.
Referenced by AssignConnection().