#include <tdisp.h>
Public Methods | |
TipcDispatcher (T_IPC_DISPATCHER dispatcher, bool destroyFlag=false, bool isDetached=false) throw (TipcException) | |
TipcDispatcher (bool isDetached=false) throw (TipcException) | |
virtual | ~TipcDispatcher () throw () |
operator T_IPC_DISPATCHER () const throw () | |
bool | dispatch (real8 timeout=T_TIMEOUT_FOREVER) throw (TipcException) |
bool | mainLoop (real8 timeout=T_TIMEOUT_FOREVER) throw (TipcException) |
void | eventTraverse (TipcDispatcherTraverser *travObj) throw (TipcException) |
MessageEvent * | createMsgTypeEvent (const TipcSrv &srv, const TipcMt &mt, MessageEventHandler *handlerObj) throw (TipcException) |
MessageEvent * | createMsgSubjEvent (const TipcSrv &srv, const char *subject, MessageEventHandler *handlerObj) throw (TipcException) |
TimerEvent * | createTimerEvent (real8 interval, TimerEventHandler *handlerObj) throw (TipcException) |
ConnEvent * | createConnEvent (const TipcConn &connection, T_IO_CHECK_MODE checkMode, ConnEventHandler *handlerObj) throw (TipcException) |
SocketEvent * | createSocketEvent (sock socketFd, T_IO_CHECK_MODE checkMode, SocketEventHandler *handlerObj) throw (TipcException) |
UserEvent * | createUserEvent (void *data, UserEventHandler *handlerObj) throw (TipcException) |
void | destroyEvent (TipcEvent *event) throw (TipcException) |
void | addInboundConnection (const TipcSrv &srv) throw (TipcException) |
void | removeInboundConnection (const TipcSrv &srv) throw (TipcException) |
If a programmer chooses to use callbacks rather than events, the dispatcher is still useful; it can be used to service the callbacks of different connections all within the same thread. In order to achieve this, a call to addInboundConnection() should be made.
Multiple dispatchers are allowed within a process. Any number of connections and events may be added to a dispatcher. A dispatcher is thread-safe and may be operated on from any thread.
|
Constructor compatible with the C API.
|
|
Creates a dispatcher
|
|
Destructor. Note that the destructor will destroy the C dispatcher structure unless the _destroyFlag is set to false. |
|
Adds a connection to the dispatcher. The connection added will behave as a source for messages. Messages coming from this connection will be read and processed by invoking the approriate connection callback (e.g. a ProcessCallback, a SubjectCallback, etc. Note that currently there's a limitation in the C API that enforces the fact that one connection can only belong to one dispatcher.
|
|
Creates an event that will be triggered whenever there's data ready to be read or written to a TipcConn object. Note that unlike the Message events, there's no need to add a peer to peer connection to the dispatcher.
|
|
Creates an event that will be triggered if a message that matches the given subject (wildcards will also work) reaches the given server connection. Note that in order for this event to be triggered, at least one Dispatcher in the process should have added the server connection to it; this can be done by calling the addInboundConnection() method. Note that there's currently a limitation in the C API that mandates that a server connection must be added to at most one dispatcher in the process.
|
|
Creates an event that will be triggered if a message matching the given type reaches the given server connection. Note that in order for this event to be triggered, at least one Dispatcher in the process should have added the server connection to it; this can be done by calling the addInboundConnection() method. Note that there's currently a limitation in the C API that mandates that a server connection must be added to at most one dispatcher in the process.
|
|
Creates an event that will be triggered whenever there's data ready to be read or written to a Socket. Note that unlike the Message events, there's no need to add a socket to the dispatcher.
|
|
Creates an event that will be periodically triggered every interval. number of seconds. To simulate a one time event, call the TipcEvent::destroy() method once the event has been triggered once.
|
|
Creates an event that will be triggered immediately. User events are only useful for dispatchers running in detatched mode. It allows users to invoke methods in the Dispatcher thread. When a user event is added to a dispatcher, it is immediately queued to be invoked. There is not a trigger per se for user events.
|
|
Unregisters and destroys a event created by one the create methods. |
|
Dispatches one event if there aren't any events available, it waits timeout number of seconds for one.
|
|
Traverse the events waiting to be dispatched by the dispatcher.
|
|
Dispatch events continuously for timeout seconds.
|
|
Extracts underlying T_IPC_DISPATCHER handle. |
|
Removes a connection from the dispatcher.
|