sipxportlib
Version 3.3
|
Dispatcher for Resource Notification Messages. More...
#include <OsMsgDispatcher.h>
Public Member Functions | |
Creators | |
OsMsgDispatcher () | |
Default constructor. More... | |
OsMsgDispatcher (OsMsgQ *msgQ) | |
Constructor for using external message queue for dispatching. More... | |
virtual | ~OsMsgDispatcher () |
Destructor. More... | |
Manipulators | |
virtual OsStatus | post (const OsMsg &msg) |
Post a resource notification message. More... | |
virtual OsStatus | receive (OsMsg *&rpMsg, const OsTime &rTimeout=OsTime::OS_INFINITY) |
Receive a message from the dispatcher queue. More... | |
Accessors | |
virtual int | numMsgs (void) |
Return the number of messages in the queue. More... | |
int | maxMsgs () const |
Returns the maximum number of messages that can be queued. More... | |
Inquiry | |
virtual UtlBoolean | isEmpty (void) |
Return TRUE if the message queue is empty, FALSE otherwise. More... | |
UtlBoolean | isMsgsLost () const |
Protected Attributes | |
OsMsgQ * | mMsgQueue |
The message queue that this dispatcher is using. More... | |
UtlBoolean | mQueueOwned |
Indicates whether or not mMsgQueue is owned by the dispatcher. More... | |
UtlBoolean | mMsgsLost |
Whether any messages have been dropped on the < floor due to the queue being full. More... | |
Dispatcher for Resource Notification Messages.
The Message Dispatcher is used to hold and notify users of messages. If users are not interested in particular types of messages, they can subclass this Message dispatcher and provide filtering to enable only certain types of messages to be sent up through it's framework.
OsMsgDispatcher | ( | ) |
Default constructor.
This constructor creates a queue, which will be destroyed in destructor.
OsMsgDispatcher | ( | OsMsgQ * | msgQ | ) |
Constructor for using external message queue for dispatching.
This constructor does not own the passed queue, so won't be deleted in destructor. It's user responsibility to manage the queue.
|
virtual |
Destructor.
Post a resource notification message.
This posts a message to the dispatcher queue. If the queue is full, a flag will be set that messages were lost, and the new messages will be dropped on the floor until such time as the queue empties until there is room available. It is the application's duty to service and receive messages from the queue.
[in] | msg | - the message to post. |
OS_SUCCESS | - if it was able to add to the queue, |
OS_LIMIT_REACHED | otherwise. |
|
virtual |
Receive a message from the dispatcher queue.
Remove a message from the head of the queue Wait until either a message arrives or the timeout expires. Other than for messages sent from an ISR, the receiver is responsible for freeing the received message.
[in] | rpMsg | - pointer to msg will be stored here. |
[in] | rTimeout | - how long to wait for a notification.. |
OS_SUCCESS | if the message was received and rpMsg filled in. |
OS_WAIT_TIMEOUT | if no message is in the queue before the timeout value. |
|
inlinevirtual |
Return the number of messages in the queue.
|
inline |
Returns the maximum number of messages that can be queued.
|
inlinevirtual |
Return TRUE if the message queue is empty, FALSE otherwise.
|
inline |
|
protected |
The message queue that this dispatcher is using.
|
protected |
Indicates whether or not mMsgQueue is owned by the dispatcher.
|
protected |
Whether any messages have been dropped on the < floor due to the queue being full.