sipxportlib
Version 3.3
|
#include <OsMsgQ.h>
Public Types | |
enum | Options { Q_FIFO = 0x0, Q_PRIORITY = 0x1 } |
Public Member Functions | |
OsMsgQBase (const UtlString &name) | |
Constructor. More... | |
virtual | ~OsMsgQBase () |
Destructor. More... | |
virtual OsStatus | send (const OsMsg &rMsg, const OsTime &rTimeout=OsTime::OS_INFINITY)=0 |
Insert a copy of the message at the tail of the queue. More... | |
virtual OsStatus | sendNoCopy (OsMsg *pMsg, const OsTime &rTimeout=OsTime::OS_INFINITY)=0 |
Insert an original of the message at the tail of the queue. More... | |
virtual OsStatus | sendUrgent (const OsMsg &rMsg, const OsTime &rTimeout=OsTime::OS_INFINITY)=0 |
Insert a copy of the message at the head of the queue. More... | |
virtual OsStatus | sendFromISR (OsMsg &rMsg)=0 |
Insert a copy of the message at the tail of the queue with ISR flag. More... | |
virtual OsStatus | receive (OsMsg *&rpMsg, const OsTime &rTimeout=OsTime::OS_INFINITY)=0 |
Remove a message from the head of the queue. More... | |
virtual void | flush () |
Delete all messages currently in the queue. More... | |
virtual void | setSendHook (OsMsgQSendHookPtr func) |
Set the function that is invoked whenever a msg is sent to the queue. More... | |
virtual void | setFlushHook (OsMsgQFlushHookPtr func) |
Set the function that is invoked whenever a msg is flushed from the queue. More... | |
virtual int | numMsgs ()=0 |
Return the number of messages in the queue. More... | |
int | maxMsgs () const |
Returns the maximum number of messages that can be queued. More... | |
virtual OsMsgQSendHookPtr | getSendHook () const |
Return a pointer to the current send hook function. More... | |
virtual UtlBoolean | isEmpty () |
Return TRUE if the message queue is empty, FALSE otherwise. More... | |
const UtlString & | getName () const |
Get the name associated with the queue. More... | |
Static Public Member Functions | |
static OsMsgQBase * | getMsgQByName (const UtlString &name) |
Return a pointer to the named queue, or NULL if not found. More... | |
Static Public Attributes | |
static const int | DEF_MAX_MSGS = 100 |
Default maximum number of messages. More... | |
static const int | DEF_MAX_MSG_LEN = 32 |
Default maximum msg length (in bytes) More... | |
static const UtlString | MSGQ_PREFIX |
Prefix for OsMsgQ names stored in < the name database. More... | |
Protected Attributes | |
OsMsgQSendHookPtr | mSendHookFunc |
Method that is invoked whenever a message is sent to the queue. More... | |
OsMsgQFlushHookPtr | mFlushHookFunc |
Method that is invoked whenever a message is flushed from the queue. More... | |
int | mMaxMsgs |
maximum number of messages the queue can hold More... | |
enum Options |
OsMsgQBase | ( | const UtlString & | name | ) |
Constructor.
If name is specified but is already in use, throw an exception.
|
virtual |
Destructor.
|
static |
Return a pointer to the named queue, or NULL if not found.
|
pure virtual |
Insert a copy of the message at the tail of the queue.
Wait until there is either room on the queue or the timeout expires.
This method creates a copy of the pMsg
, before inserting it to the queue.
Implemented in OsMsgQShared.
|
pure virtual |
Insert an original of the message at the tail of the queue.
Wait until there is either room on the queue or the timeout expires.
This method does not create a copy of the pMsg
, inserting it to the queue as is.
Implemented in OsMsgQShared.
|
pure virtual |
Insert a copy of the message at the head of the queue.
Wait until there is either room on the queue or the timeout expires.
Implemented in OsMsgQShared.
Insert a copy of the message at the tail of the queue with ISR flag.
Sending from an ISR has a couple of implications. Since we can't allocate memory within an ISR, we don't create a copy of the message before sending it and the sender and receiver need to agree on a protocol (outside this class) for when the message can be freed. The sentFromISR flag in the OsMsg object will be TRUE for messages sent using this method.
Implemented in OsMsgQShared.
|
pure virtual |
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.
Implemented in OsMsgQShared.
|
virtual |
Delete all messages currently in the queue.
|
virtual |
Set the function that is invoked whenever a msg is sent to the queue.
The function takes the message to be sent as an argument and returns a boolean value indicating whether the SendHook method has handled the message. If TRUE, the message is not inserted into the queue (since it has already been handled. If FALSE, the (possibly modified) message is inserted into the queue.
|
virtual |
Set the function that is invoked whenever a msg is flushed from the queue.
Messages get flushed when the OsMsgQ is deleted while there are messages still queued.
The function takes an OsMsg reference as an argument.
|
pure virtual |
Return the number of messages in the queue.
Implemented in OsMsgQShared.
int maxMsgs | ( | ) | const |
Returns the maximum number of messages that can be queued.
|
virtual |
Return a pointer to the current send hook function.
|
virtual |
Return TRUE if the message queue is empty, FALSE otherwise.
|
inline |
Get the name associated with the queue.
|
static |
Default maximum number of messages.
|
static |
Default maximum msg length (in bytes)
|
static |
Prefix for OsMsgQ names stored in < the name database.
|
protected |
Method that is invoked whenever a message is sent to the queue.
|
protected |
Method that is invoked whenever a message is flushed from the queue.
|
protected |
maximum number of messages the queue can hold