rasdaman complete source
|
#include <callbackmgr.hh>
Public Types | |
typedef void(* | callback_f )(void *) |
callback function type More... | |
Public Member Functions | |
CallBackManager (unsigned int size=1024) | |
constructor More... | |
~CallBackManager (void) | |
destructor More... | |
void | setMaximumSize (unsigned int size) |
Resizes the number of callback slots at run-time. More... | |
int | registerCallback (callback_f function, void *context) |
register new callback More... | |
int | registerUniqueCallback (callback_f function, void *context) |
register new callback, ensuring uniqueness More... | |
int | removeCallback (callback_f function, void *context) |
remove callback More... | |
unsigned int | getNumCallbacks (void) const |
Get the number of callback functions registered. More... | |
int | executePending (void) |
execute pending callbacks More... | |
typedef void(* CallBackManager::callback_f)(void *) |
callback function type
CallBackManager::CallBackManager | ( | unsigned int | size = 1024 | ) |
constructor
CallBackManager::~CallBackManager | ( | void | ) |
destructor
Constructor; size is the maximum number of callback slots to reserve.
int CallBackManager::executePending | ( | void | ) |
execute pending callbacks
unsigned int CallBackManager::getNumCallbacks | ( | void | ) | const |
Get the number of callback functions registered.
Deregister a callback function. Returns 0 for OK, -1 for not found.
int CallBackManager::registerCallback | ( | callback_f | function, |
void * | context | ||
) |
register new callback
The type of a callback function is void f(void *context). The value of context is the one specified when registering. It's up to the function to cast the value.
int CallBackManager::registerUniqueCallback | ( | callback_f | function, |
void * | context | ||
) |
register new callback, ensuring uniqueness
Register a new callback function. Returns 0 for OK, -1 if the callback table had an overflow. Since it must be possible to call this function from an alarm handler there may not be any mallocs or prints here.
int CallBackManager::removeCallback | ( | callback_f | function, |
void * | context | ||
) |
remove callback
Same as registerCallback, but makes sure this callback isn't pending already in which case it does nothing.
void CallBackManager::setMaximumSize | ( | unsigned int | size | ) |
Resizes the number of callback slots at run-time.