fw4spl
fwCom::Signal< R(A...) > Struct Template Reference

Signal implementation. Template parameter T must always be void. More...

#include <Signal.hpp>

+ Inheritance diagram for fwCom::Signal< R(A...) >:
+ Collaboration diagram for fwCom::Signal< R(A...) >:

Public Types

Typedefs
typedef R SignatureType(A...)
 
typedef Signal< SignatureType > SelfType
 
typedef std::shared_ptr< SelfTypesptr
 
typedef std::weak_ptr< SelfTypewptr
 
typedef SlotRun< SignatureType > SlotRunType
 
typedef std::shared_ptr< SlotRunTypeSlotSptr
 
typedef std::pair< bool, SlotRunType * > PairType
 
typedef std::list< PairType * > SlotContainerType
 
typedef std::map< std::weak_ptr< SlotBase >, std::weak_ptr< SlotConnectionBase >, std::owner_less< std::weak_ptr< SlotBase > > > ConnectionMapType
 
- Public Types inherited from fwCom::SignalBase
typedef std::shared_ptr< SignalBasesptr
 
typedef std::weak_ptr< SignalBasewptr
 

Public Member Functions

 ~Signal ()
 Destructor : disconnects all remaining connections.
 
Connection connect (std::shared_ptr< SlotBase > slot)
 Connects the given slot. More...
 
void disconnect (std::shared_ptr< SlotBase > slot)
 Disconnects the given slot. More...
 
void disconnectAll ()
 Disconnects all slots.
 
void emit (A...a) const
 Requests execution of slots with given arguments.
 
void asyncEmit (A...a) const
 Requests asynchronous execution of slots with given arguments.
 
size_t getNumberOfConnections () const
 Returns number of connected slots.
 
Connection getConnection (std::shared_ptr< SlotBase > slot, bool throws=false)
 Returns the connection handler matching given slot. More...
 
template<typename FROM_F >
Connection connect (SlotBase::sptr slot)
 
- Public Member Functions inherited from fwCore::BaseObject
virtual bool isA (const std::string &type) const
 
virtual const std::string & getLeafClassname () const
 return object's classname without its namespace, i.e. BaseObject
 
virtual const std::string & getClassname () const
 return full object's classname with its namespace, i.e. fwCore::BaseObject
 

Static Public Member Functions

static sptr New ()
 Constructs a new Signal of type Signal<R(A...)>.
 
- Static Public Member Functions inherited from fwCore::BaseObject
static bool isTypeOf (const std::string &type)
 
static const std::string & leafClassname ()
 return object's classname without its namespace, i.e. BaseObject
 
static const std::string & classname ()
 return object's classname without its namespace, i.e. BaseObject
 

Protected Member Functions

template<typename FROM_F >
Connection connect (std::shared_ptr< SlotBase > slot)
 Connects the given slot. Tries to connect a slot of type R (A1, A2, ..., Am, An) : returns a connection on success, otherwise try to connect the same slot with the type R (A1, A2, ..., Am). More...
 
- Protected Member Functions inherited from fwCom::SignalBase
 SignalBase (const SignalBase &)
 Copy constructor forbidden.
 
SignalBaseoperator= (const SignalBase &)
 Copy operator forbiden.
 

Protected Attributes

SlotContainerType m_slots
 Connected slots.
 
ConnectionMapType m_connections
 Container of current connections.
 
mutable::fwCore::mt::ReadWriteMutex m_connectionsMutex
 

Friends

template<typename F >
struct SlotConnection
 

Detailed Description

template<typename R, typename... A>
struct fwCom::Signal< R(A...) >

Signal implementation. Template parameter T must always be void.

Definition at line 37 of file Signal.hpp.

Member Function Documentation

template<typename R , typename... A>
Connection fwCom::Signal< R(A...) >::connect ( std::shared_ptr< SlotBase slot)
virtual

Connects the given slot.

Returns
an object managing the connection.
Exceptions
BadSlotIf given slot doesn't match signal type.
AlreadyConnectedIf given slot is already connected.

Implements fwCom::SignalBase.

template<typename R , typename... A>
template<typename FROM_F >
Connection fwCom::Signal< R(A...) >::connect ( std::shared_ptr< SlotBase slot)
protectedvirtual

Connects the given slot. Tries to connect a slot of type R (A1, A2, ..., Am, An) : returns a connection on success, otherwise try to connect the same slot with the type R (A1, A2, ..., Am).

Exceptions
BadSlotIf given slot doesn't match signal type.
AlreadyConnectedIf given slot is already connected.

Implements fwCom::SignalBase.

Definition at line 36 of file Signal.hxx.

template<typename R , typename... A>
void fwCom::Signal< R(A...) >::disconnect ( std::shared_ptr< SlotBase slot)
virtual

Disconnects the given slot.

Exceptions
BadSlotIf given slot is not found in current connections.

Implements fwCom::SignalBase.

Definition at line 44 of file Signal.hxx.

References SLM_ASSERT.

template<typename R , typename... A>
Connection fwCom::Signal< R(A...) >::getConnection ( std::shared_ptr< SlotBase slot,
bool  throws = false 
)

Returns the connection handler matching given slot.

Exceptions
BadSlotif given slot is not connected and throws is true.

Definition at line 194 of file Signal.hxx.


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