sipxportlib  Version 3.3
Protected Attributes | List of all members
OsMsgDispatcher Class Reference

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...
 

Detailed Description

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.

Constructor & Destructor Documentation

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.

~OsMsgDispatcher ( )
virtual

Destructor.

Member Function Documentation

OsStatus post ( const OsMsg msg)
virtual

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.

Parameters
[in]msg- the message to post.
Return values
OS_SUCCESS- if it was able to add to the queue,
OS_LIMIT_REACHEDotherwise.
OsStatus receive ( OsMsg *&  rpMsg,
const OsTime rTimeout = OsTime::OS_INFINITY 
)
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.

Parameters
[in]rpMsg- pointer to msg will be stored here.
[in]rTimeout- how long to wait for a notification..
Return values
OS_SUCCESSif the message was received and rpMsg filled in.
OS_WAIT_TIMEOUTif no message is in the queue before the timeout value.
int numMsgs ( void  )
inlinevirtual

Return the number of messages in the queue.

int maxMsgs ( ) const
inline

Returns the maximum number of messages that can be queued.

UtlBoolean isEmpty ( void  )
inlinevirtual

Return TRUE if the message queue is empty, FALSE otherwise.

UtlBoolean isMsgsLost ( ) const
inline

Member Data Documentation

OsMsgQ* mMsgQueue
protected

The message queue that this dispatcher is using.

UtlBoolean mQueueOwned
protected

Indicates whether or not mMsgQueue is owned by the dispatcher.

UtlBoolean mMsgsLost
protected

Whether any messages have been dropped on the < floor due to the queue being full.