The Open Master Hearing Aid (openMHA)
openMHA
Open community platform for hearing aid algorithm research
|
Patchbay which connects any event emitter with any member function of the parameter class. More...
Public Member Functions | |
~patchbay_t () | |
void | connect (emitter_t *, receiver_t *, void(receiver_t::*)()) |
Connect a receiver member function void (receiver_t::*)() with an event emitter. More... | |
void | connect (emitter_t *, receiver_t *, void(receiver_t::*)(const std::string &)) |
Connect a receiver member function void (receiver_t::*)(const std::string&) with an event emitter. More... | |
void | connect (emitter_t *, receiver_t *, void(receiver_t::*)(const std::string &, unsigned int, unsigned int)) |
Private Attributes | |
std::list< connector_t< receiver_t > * > | cons |
Patchbay which connects any event emitter with any member function of the parameter class.
The connections created by the connect() function are hold until the destructor is called. To avoid access to invalid function pointers, it is required to destruct the patchbay before the receiver, usually by declaring the patchbay as a member of the receiver.
The receiver can be any claas or structure; the event callback can be either a member function without arguments or with const std::string& argument.
MHAEvents::patchbay_t< receiver_t >::~patchbay_t |
void MHAEvents::patchbay_t< receiver_t >::connect | ( | emitter_t * | e, |
receiver_t * | r, | ||
void(receiver_t::*)() | rfun | ||
) |
Connect a receiver member function void (receiver_t::*)() with an event emitter.
Create a connection.
The connection is removed when the patchbay is destructed.
e | Pointer to an event emitter |
r | Pointer to the receiver |
rfun | Pointer to a member function of the receiver class |
void MHAEvents::patchbay_t< receiver_t >::connect | ( | emitter_t * | e, |
receiver_t * | r, | ||
void(receiver_t::*)(const std::string &) | rfun | ||
) |
Connect a receiver member function void (receiver_t::*)(const std::string&) with an event emitter.
Create a connection.
The connection is removed when the patchbay is destructed.
e | Pointer to an event emitter |
r | Pointer to the receiver |
rfun | Pointer to a member function of the receiver class |
void MHAEvents::patchbay_t< receiver_t >::connect | ( | emitter_t * | e, |
receiver_t * | r, | ||
void(receiver_t::*)(const std::string &, unsigned int, unsigned int) | rfun | ||
) |
|
private |