S3FC project page | S3FC home page |
#include <s3_event.h>
Inheritance diagram for s3_event_dispatcher:
Public Types | |
typedef T_Event | event_t |
Type of the event that this handler handles. More... | |
typedef s3_event_handler< event_t > | event_handler_t |
Type of the event handler that can subscribe. More... | |
Public Methods | |
void | subscribe_handler (event_handler_t &handler) |
Subscribe the specified handler to this dispatcher. More... | |
void | unsubscribe_handler (event_handler_t &handler) |
Unsubscribe the specified handler to this dispatcher. More... | |
bool | is_subscribed (const event_handler_t &handler) const |
Test and return whether the specified handler is subscribed. More... | |
void | dispatch_event (const event_t &event) |
Dispatch the specified event to all subscribed handlers. More... | |
Private Types | |
typedef std::list< event_handler_t * > | hlist_t |
Private Methods | |
bool | is_subscribed (const event_handler_t &handler, int critical) const |
Private Attributes | |
hlist_t | hlist |
s3_mutex | s3_event_dispatcher_lock |
It is templated on the type of event that it dispatches. Event handlers, that handle the same types of events that this one dispatches, can be subscribed and unsubscribed. A handler may only be subscribed once, and attempting to re-subscribe a subscribed handler is a programming error. Only subscribed handlers may be unsubscribed and attempting to unsubscribe a subscribed handler is a programming error.
An event is dispatched to all subscribed handlers by invoking a single function call.
Definition at line 113 of file s3_event.h.
|
Type of the event handler that can subscribe.
Definition at line 123 of file s3_event.h. |
|
Type of the event that this handler handles.
Definition at line 119 of file s3_event.h. |
|
Definition at line 126 of file s3_event.h. |
|
Dispatch the specified event to all subscribed handlers.
Definition at line 87 of file s3_event.tcc. References hlist, s3_mutex::lock, s3_event_dispatcher_lock, and s3_mutex::unlock. Referenced by s3_txport_tcp::connect, s3_txport_tcp::listen, s3_txport_tcp::main_loop, s3_txport_tcp::reap, and s3_txport_tcp::spawn_handler. |
|
Definition at line 103 of file s3_event.tcc. References hlist. |
|
Test and return whether the specified handler is subscribed.
Definition at line 75 of file s3_event.tcc. References s3_mutex::lock, s3_event_dispatcher_lock, and s3_mutex::unlock. Referenced by subscribe_handler, and unsubscribe_handler. |
|
Subscribe the specified handler to this dispatcher.
It is the responsibility of the caller to ensure that
Definition at line 39 of file s3_event.tcc. References hlist, is_subscribed, s3_mutex::lock, s3_event_dispatcher_lock, and s3_mutex::unlock. |
|
Unsubscribe the specified handler to this dispatcher.
All resources allocated to and by
Definition at line 56 of file s3_event.tcc. References hlist, is_subscribed, s3_mutex::lock, s3_event_dispatcher_lock, and s3_mutex::unlock. |
|
Definition at line 128 of file s3_event.h. Referenced by dispatch_event, is_subscribed, subscribe_handler, and unsubscribe_handler. |
|
Definition at line 130 of file s3_event.h. Referenced by dispatch_event, is_subscribed, subscribe_handler, and unsubscribe_handler. |
Send comments to: s3fc@stonethree.com |
|