The message queue class is used to send and wait for Message objects, see MessageThread. More...
#include "murl_util_message_queue.h"
Public Types | |
enum | Result { FAILED , RECEIVED , TIMEOUT , QUIT } |
Enumeration of the message queue results. More... | |
Public Member Functions | |
MessageQueue () | |
The default constructor. More... | |
virtual | ~MessageQueue () |
The destructor. | |
UInt32 | GetMaxMessageQueueLength () const |
Get the maximum number of messages the queue can store. More... | |
void | SetMaxMessageQueueLength (UInt32 maxLength) |
Set the maximum number of messages the queue can store. More... | |
void | ClearMessageQueue () |
Clear the message queue. | |
Bool | SendMessage (Message::AutoPtr message) |
Add a message to the message queue. More... | |
Bool | SendSyncMessage (Message::AutoPtr message) |
Add a message the the message queue and wait until the message is delivered and processed, see Message. More... | |
Result | WaitMessage (Message::AutoPtr &message, UInt32 msgIdStart, UInt32 msgIdEnd) |
Wait for a message. More... | |
Result | WaitMessage (Message::AutoPtr &message, const System::Time &timeout, UInt32 msgIdStart, UInt32 msgIdEnd) |
Wait for a message with time out. More... | |
Result | GetMessage (Message::AutoPtr &message, UInt32 msgIdStart, UInt32 msgIdEnd) |
Get a message from the message queue. More... | |
Result | PeekMessage (const Message *&message, UInt32 msgIdStart, UInt32 msgIdEnd) |
Peek a message from the message queue. More... | |
Protected Member Functions | |
Result | GetMessage (Message *&message, UInt32 msgIdStart, UInt32 msgIdEnd, Bool remove) |
Get a message raw pointer from the message queue. More... | |
Protected Attributes | |
System::Mutex | mMutex |
The message class mutex. | |
System::Semaphore | mMessageArrived |
The message queue semaphore. | |
UInt32 | mMaxMessageQueueLength |
The maximum message queue length. | |
Array< Message::AutoPtr > | mMessages |
The message queue. | |
Detailed Description
The message queue class is used to send and wait for Message objects, see MessageThread.
Member Enumeration Documentation
◆ Result
Constructor & Destructor Documentation
◆ MessageQueue()
Murl::Util::MessageQueue::MessageQueue | ( | ) |
The default constructor.
Set the message queue length to 1000.
Member Function Documentation
◆ GetMaxMessageQueueLength()
UInt32 Murl::Util::MessageQueue::GetMaxMessageQueueLength | ( | ) | const |
Get the maximum number of messages the queue can store.
The default message queue length is 1000.
- Returns
- The maximum number of messages the queue can store.
◆ SetMaxMessageQueueLength()
void Murl::Util::MessageQueue::SetMaxMessageQueueLength | ( | UInt32 | maxLength | ) |
Set the maximum number of messages the queue can store.
- Parameters
-
maxLength The maximum number of messages the queue can store.
◆ SendMessage()
Bool Murl::Util::MessageQueue::SendMessage | ( | Message::AutoPtr | message | ) |
Add a message to the message queue.
- Parameters
-
message The message to send.
- Returns
- true if successful, false if the maximum message queue length is reached.
◆ SendSyncMessage()
Bool Murl::Util::MessageQueue::SendSyncMessage | ( | Message::AutoPtr | message | ) |
Add a message the the message queue and wait until the message is delivered and processed, see Message.
- Parameters
-
message The message to send.
- Returns
- true if successful, false if the maximum message queue length is reached.
◆ WaitMessage() [1/2]
Result Murl::Util::MessageQueue::WaitMessage | ( | Message::AutoPtr & | message, |
UInt32 | msgIdStart, | ||
UInt32 | msgIdEnd | ||
) |
Wait for a message.
- Parameters
-
message The message return value. The message returned is removed from the message queue. msgIdStart Message identifier range start. Use Message::ID_ANY to receive any message (set msgIdEnd to zero). msgIdEnd Message identifier range end.
- Returns
- The message queue result.
◆ WaitMessage() [2/2]
Result Murl::Util::MessageQueue::WaitMessage | ( | Message::AutoPtr & | message, |
const System::Time & | timeout, | ||
UInt32 | msgIdStart, | ||
UInt32 | msgIdEnd | ||
) |
Wait for a message with time out.
- Parameters
-
message The message return value. The message returned is removed from the message queue. timeout The maximum time to wait. msgIdStart Message identifier range start. Use Message::ID_ANY to receive any message (set msgIdEnd to zero). msgIdEnd Message identifier range end.
- Returns
- The message queue result.
◆ GetMessage() [1/2]
Result Murl::Util::MessageQueue::GetMessage | ( | Message::AutoPtr & | message, |
UInt32 | msgIdStart, | ||
UInt32 | msgIdEnd | ||
) |
Get a message from the message queue.
- Parameters
-
message The message return value. The message returned is removed from the message queue. msgIdStart Message identifier range start. Use Message::ID_ANY to receive any message (set msgIdEnd to zero). msgIdEnd Message identifier range end.
- Returns
- The message queue result.
◆ PeekMessage()
Result Murl::Util::MessageQueue::PeekMessage | ( | const Message *& | message, |
UInt32 | msgIdStart, | ||
UInt32 | msgIdEnd | ||
) |
Peek a message from the message queue.
Checks if a message is in the message queue but does not remove the message from the message queue.
- Parameters
-
message The message return value. msgIdStart Message identifier range start. Use Message::ID_ANY to receive any message (set msgIdEnd to zero). msgIdEnd Message identifier range end.
- Returns
- The message queue result.
◆ GetMessage() [2/2]
|
protected |
Get a message raw pointer from the message queue.
- Parameters
-
message The message return value. msgIdStart Message identifier range start. Use Message::ID_ANY to receive any message (set msgIdEnd to zero). msgIdEnd Message identifier range end. remove If true remove the message from the queue.
- Returns
- The message queue result.
The documentation for this class was generated from the following file:
- murl_util_message_queue.h