Public Member Functions | Private Attributes
ecl::Signal< Data > Class Template Reference

Signalling component of a callback system. More...

#include <signal.hpp>

List of all members.

Public Member Functions

void connect (const std::string &topic)
 Make a connection to the specified topic.
void connectAsSlot (const std::string &topic)
 Connect as a slot, with the emit function loaded.
void disconnect ()
 Disconnect the signal from all topics.
void emit (Data data)
 The primary purpose of the signal, to emit!
 Signal ()
 Default constructor.
 Signal (const std::string &topic)
 Creates a signal and connects.
 Signal (const Signal &signal)
 Copy constructor.
 ~Signal ()
 Default destructor.

Private Attributes

SigSlot< Data > * sigslot

Detailed Description

template<typename Data = Void>
class ecl::Signal< Data >

Signalling component of a callback system.

Anywhere that triggers an event requiring a callback to be executed can be implemented with a signal. These can be placed anywhere in your code and with slots, provide a many to many callback solution.

Usage examples are provided in the main page's documentation for this package.

See also:
Signal<Void>, Slot.

Definition at line 47 of file signal.hpp.


Constructor & Destructor Documentation

template<typename Data = Void>
ecl::Signal< Data >::Signal ( ) [inline]

Default constructor.

This creates a signal with no connections yet established. Use with connect().

Definition at line 55 of file signal.hpp.

template<typename Data = Void>
ecl::Signal< Data >::Signal ( const std::string &  topic) [inline]

Creates a signal and connects.

Definition at line 61 of file signal.hpp.

template<typename Data = Void>
ecl::Signal< Data >::Signal ( const Signal< Data > &  signal) [inline]

Copy constructor.

This is specially designed so that copying a signal is perfectly acceptable. Copies do not increase the number of emits that are fired - they just preserve the signal when used with things like stl containers. When the last copy disappears, the object destroys its connection automagically.

Parameters:
signal: the object to be copied.

Definition at line 77 of file signal.hpp.

template<typename Data = Void>
ecl::Signal< Data >::~Signal ( ) [inline]

Default destructor.

This handles the cleanup operation, first decrementing and then checking if its the last of its instance. If it is, it cleans up the sigslot connection with the sigslots manager.

Definition at line 89 of file signal.hpp.


Member Function Documentation

template<typename Data = Void>
void ecl::Signal< Data >::connect ( const std::string &  topic) [inline]

Make a connection to the specified topic.

This contacts the sigslots manager to connect the signal to the specified topic - creating the topic if it is not yet existing.

Parameters:
topic: the topic to connect to.

Definition at line 104 of file signal.hpp.

template<typename Data = Void>
void ecl::Signal< Data >::connectAsSlot ( const std::string &  topic) [inline]

Connect as a slot, with the emit function loaded.

This allows the signal to act as a relaying signal (effectively a slot with the emit() function loaded.

Parameters:
topic: the topic to connect to.

Definition at line 113 of file signal.hpp.

template<typename Data = Void>
void ecl::Signal< Data >::disconnect ( ) [inline]

Disconnect the signal from all topics.

This completely disconnects the signal.

Definition at line 119 of file signal.hpp.

template<typename Data = Void>
void ecl::Signal< Data >::emit ( Data  data) [inline]

The primary purpose of the signal, to emit!

Emits a signal with the specified data.

Parameters:
data: the data to emit.

Definition at line 128 of file signal.hpp.


Member Data Documentation

template<typename Data = Void>
SigSlot<Data>* ecl::Signal< Data >::sigslot [private]

Definition at line 131 of file signal.hpp.


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


ecl_sigslots
Author(s): Daniel Stonier
autogenerated on Thu Jun 6 2019 21:18:08