A simple signal class. More...
#include <managers.hpp>
Public Member Functions | |
unsigned int | capacity () const |
The reserved capacity for this signaller. More... | |
sigslots::Error | connect (sigslots::SlotBase< Data > &slot) |
Connect the signal to the specified slot. More... | |
void | emit (Data data) const |
Signal slots with the specified data. More... | |
Signal () | |
Initialise the storage. More... | |
unsigned int | stored () const |
The current number of connections stored. More... | |
Private Attributes | |
sigslots::SlotBase< Data > * | slots [Capacity] |
A simple signal class.
This class, once instantiated and connected is a fixed entity. Memory reserved for slots is fixed and disconnects are not possible This allows us to avoid the use of new and in most low level control programs, such disconnects are rarely used anyway.
To reserve the capacity (i.e. no. of slots that can be attached) configure the second template parameter upon instantiation. Note that the default is 1.
Data | : the data type to emit. |
Capacity | : the number of slot connections to reserve. |
Definition at line 32 of file managers.hpp.
|
inline |
Initialise the storage.
Definition at line 68 of file signal.hpp.
|
inline |
The reserved capacity for this signaller.
Definition at line 103 of file signal.hpp.
|
inline |
Connect the signal to the specified slot.
This will attach the slot (note that it is a permanent attachment) so long as the reserved capacity isn't already fully utilised.
Valid return values:
slot | : the slot to connect. |
Definition at line 88 of file signal.hpp.
|
inline |
Signal slots with the specified data.
data | : the data to send to the slots. |
Definition at line 125 of file signal.hpp.
|
inline |
The current number of connections stored.
Definition at line 109 of file signal.hpp.
|
private |
Definition at line 136 of file signal.hpp.