A thread-safe class for message passing between threads. More...
#include <mrpt/utils/CMessageQueue.h>
Public Member Functions | |
CMessageQueue () | |
virtual | ~CMessageQueue () |
void | clear () |
Clear the queue of messages, freeing memory as required. | |
void | push (CMessage *msg) |
Insert a new message in the queue - The object must be created with "new", and do not delete is after calling this, it must be deleted later. | |
CMessage * | get () |
Retrieve the next message in the queue, or NULL if there is no message. | |
bool | empty () const |
Return true if there are no messages. | |
Protected Attributes | |
std::queue< CMessage * > | m_msgs |
The queue of messages. Memory is freed at destructor or by clients gathering messages. | |
synch::CCriticalSection | m_csQueue |
The critical section. |
A thread-safe class for message passing between threads.
Definition at line 41 of file CMessageQueue.h.
mrpt::utils::CMessageQueue::CMessageQueue | ( | ) |
virtual mrpt::utils::CMessageQueue::~CMessageQueue | ( | ) | [virtual] |
void mrpt::utils::CMessageQueue::clear | ( | ) |
Clear the queue of messages, freeing memory as required.
bool mrpt::utils::CMessageQueue::empty | ( | ) | const |
Return true if there are no messages.
CMessage* mrpt::utils::CMessageQueue::get | ( | ) |
Retrieve the next message in the queue, or NULL if there is no message.
The user MUST call "delete" with the returned object after use.
void mrpt::utils::CMessageQueue::push | ( | CMessage * | msg | ) |
Insert a new message in the queue - The object must be created with "new", and do not delete is after calling this, it must be deleted later.
The critical section.
Definition at line 46 of file CMessageQueue.h.
std::queue< CMessage* > mrpt::utils::CMessageQueue::m_msgs [protected] |
The queue of messages. Memory is freed at destructor or by clients gathering messages.
Definition at line 44 of file CMessageQueue.h.
Page generated by Doxygen 1.6.1 for MRPT 0.7.1 SVN: at Tue Dec 22 08:29:35 CET 2009 |