![]() |
Public API Reference |
![]() |
This class is used to represent the event namespace (tree). More...
#include <csutil/cssubscription.h>
Classes | |
class | SubscriberIterator |
The SubscriberIterator is a wrapper for the messy internals of figuring out which event handler to call next. More... | |
Public Member Functions | |
void | Dispatch (iEvent &e) |
Send the provided event to all subscribers, using the normal return and Broadcast rules. | |
csEventTree * | FindNode (csEventID name, csEventQueue *q) |
Find a node with a given name in the event tree owned by q . | |
SubscriberIterator * | GetIterator () |
Return a csEventTree::SubscriberIterator for all subscribers to this event name (and to its parents). | |
void | Notify () |
Send the provided event to all subscribers, regardless of their return values. | |
bool | Subscribe (csHandlerID, csEventID, csEventQueue *q) |
Subscribe a given handler to a given event name subtree via a given event queue. | |
void | Unsubscribe (csHandlerID, csEventID, csEventQueue *q) |
Unubscribe a given handler to a given event name subtree via a given event queue. |
This class is used to represent the event namespace (tree).
Each node represents an event name (e.g., "crystalspace.input.mouse") and contains two data structures: a partial order graph representing subscribers to this event (including those who subscribed to parent event names) along with their ordering constraints, and a queue of subscribers representing a valid total order of that graph (used to speed up the common case).
Definition at line 41 of file cssubscription.h.
void csEventTree::Dispatch | ( | iEvent & | e | ) |
Send the provided event to all subscribers, using the normal return and Broadcast rules.
csEventTree* csEventTree::FindNode | ( | csEventID | name, |
csEventQueue * | q | ||
) |
Find a node with a given name in the event tree owned by q .
If no such node yet exists, create it (along with any necessary parent nodes, including the name root).
Return a csEventTree::SubscriberIterator for all subscribers to this event name (and to its parents).
void csEventTree::Notify | ( | ) |
Send the provided event to all subscribers, regardless of their return values.
bool csEventTree::Subscribe | ( | csHandlerID | , |
csEventID | , | ||
csEventQueue * | q | ||
) |
Subscribe a given handler to a given event name subtree via a given event queue.
This is wrapped by csEventQueue::Subscribe which may be easier to use in some situations.
void csEventTree::Unsubscribe | ( | csHandlerID | , |
csEventID | , | ||
csEventQueue * | q | ||
) |
Unubscribe a given handler to a given event name subtree via a given event queue.
This is wrapped by csEventQueue::Unsubscribe which may be easier to use in some situations. Note that unsubscribing is reentrant (an event handler can unsubscribe itself) but NOT thread-safe (only event handlers in the same thread as the event queue can unsubscribe).