Template Class Signal
Defined in File signal.hpp
Class Documentation
-
template<typename Data = Void>
class Signal 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
Public Functions
-
inline Signal()
Default constructor.
This creates a signal with no connections yet established. Use with connect().
-
inline Signal(const std::string &topic)
Creates a signal and connects.
-
inline Signal(const Signal<Data> &signal)
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.
-
inline ~Signal()
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.
-
inline void connect(const std::string &topic)
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.
-
inline void connectAsSlot(const std::string &topic)
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.
-
inline void disconnect()
Disconnect the signal from all topics.
This completely disconnects the signal.
-
inline Signal()