This is the global slot interface. More...
#include <managers.hpp>
Static Public Attributes | |
static const unsigned int | capacity |
Number of global functions of this type that can be slotted. | |
Static Private Member Functions | |
static sigslots::GlobalSlot < Data > * | addSlot (void(*func)(Data)) |
Add a slot. | |
static unsigned int | stored (const bool increment=false) |
Number of slots currently stored. | |
Friends | |
template<typename Data_ , unsigned int Capacity_> | |
sigslots::Error | connect (Signal< Data_, Capacity_ > &signal, void(*function)(Data_)) |
template<typename Data_ > | |
unsigned int | global_slots_stored () |
This is the global slot interface.
You'll need to preconfigure the capacity for this slot interface. Note that the capacity corresponds to the number of global functions with the specified footprint (Data arg), not the total number of slottable global functions overall.
// reserve the number of global slots that you'll use. template<> const unsigned int ecl::lite::GlobalSlots<const char*>::capacity = 2; void f(const char* str) { std::cout << "f() " << str << std::endl; } void g(const char* str) { std::cout << "g() " << str << std::endl; } int main() { ecl::lite::Signal<const char*,2> signal; connect(signal,f); connect(signal,g); signal.emit("Dude");
Data | : the footprint for the type of global functions to slot. |
Dummy | : dummy argument to enable capacity to be a const expr for array bounds |
Definition at line 191 of file managers.hpp.
static sigslots::GlobalSlot<Data>* ecl::lite::GlobalSlots< Data, Dummy >::addSlot | ( | void(*)(Data) | func | ) | [inline, static, private] |
Add a slot.
This is used 'under the hood' by the connectors.
func | : the function to slot. |
Definition at line 231 of file managers.hpp.
static unsigned int ecl::lite::GlobalSlots< Data, Dummy >::stored | ( | const bool | increment = false | ) | [inline, static, private] |
Number of slots currently stored.
This is used for two purposes, 1) for recall and 2) to increment since it holds a static variable internally. This is triggered by the boolean argument which has a default value that can be hidden when doing 1).
increment | : increment the storage value (called from addSlot) |
Definition at line 218 of file managers.hpp.
sigslots::Error connect | ( | Signal< Data_, Capacity_ > & | signal, |
void(*)(Data_) | function | ||
) | [friend] |
unsigned int global_slots_stored | ( | ) | [friend] |
Definition at line 29 of file utilities.hpp.
const unsigned int ecl::lite::GlobalSlots< Data, Dummy >::capacity [static] |
Number of global functions of this type that can be slotted.
Definition at line 193 of file managers.hpp.