Inheritance diagram for code::EventHandler:
The event-handling, for simplicity, is based on an event-loop. Typically, your main will contain the following code:
while (true) EventHandler::handle_events();
See also the configuration file w2config/misc/notifier
Public Member Functions | |
virtual | ~EventHandler () |
Static Public Member Functions | |
static void | handle_events () |
It is the user's responsibility to call this function once in a while. | |
static void | setIdleTime (size_t milliseconds) |
Change the idle time that handle_events will wait, so that the CPU is not caught in a do-nothing mode. | |
static void | pauseNotification () |
When calling a non-reentrant function (outside of a callback), it might be useful to turn off the signal, so that you are not interrupted. | |
static void | resumeNotification () |
Resume notification after it has been paused. | |
Protected Member Functions | |
virtual void | addCallbacks () |
This should effectively be a static function that adds to EventHandler's allCallbacks. | |
Static Protected Member Functions | |
static void | introduce (SmartPtr< EventHandler > subclass) |
static void | setMaxCallbacks () |
Static Protected Attributes | |
static std::vector< CallbackInfo > | allCallbacks |
The set of all the event callbacks. | |
Classes | |
struct | CallbackInfo |
The callback information stored for each callback. More... |
virtual code::EventHandler::~EventHandler | ( | ) | [virtual] |
virtual void code::EventHandler::addCallbacks | ( | ) | [inline, protected, virtual] |
This should effectively be a static function that adds to EventHandler's allCallbacks.
Reimplemented in code::ORBEventHandler, code::FAMEventHandler, code::LBEventHandler, code::SQLEventHandler, and code::TimedEventHandler.
static void code::EventHandler::handle_events | ( | ) | [static] |
It is the user's responsibility to call this function once in a while.
When the function is called, the callbacks associated with all the events that have happened so far are invoked.
If there are no callbacks to process, handle_events will sleep a while before returning, so as to avoid over-loading the CPU waiting for messages.
You can set this sleep interval using setIdleTime()
static void code::EventHandler::introduce | ( | SmartPtr< EventHandler > | subclass | ) | [static, protected] |
static void code::EventHandler::pauseNotification | ( | ) | [static] |
When calling a non-reentrant function (outside of a callback), it might be useful to turn off the signal, so that you are not interrupted.
In this case, signals will be queued up and delivered on a resume call.
Pauses may not be nested. If a re-entrant form of your function exists, you might want to use it instead of using the pause facility.
Note: This function is not needed in the threaded OPUP environment. Re-entrant functions are safe in that context.
static void code::EventHandler::resumeNotification | ( | ) | [static] |
Resume notification after it has been paused.
static void code::EventHandler::setIdleTime | ( | size_t | milliseconds | ) | [static] |
Change the idle time that handle_events will wait, so that the CPU is not caught in a do-nothing mode.
The default is 1 second.
You can set it to zero, if needed.
static void code::EventHandler::setMaxCallbacks | ( | ) | [static, protected] |
std::vector< CallbackInfo > code::EventHandler::allCallbacks [static, protected] |
The set of all the event callbacks.