MRPT logo

mrpt::utils::CMessageQueue Class Reference

A thread-safe class for message passing between threads. More...

#include <mrpt/utils/CMessageQueue.h>

List of all members.

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.
CMessageget ()
 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.


Detailed Description

A thread-safe class for message passing between threads.

Definition at line 41 of file CMessageQueue.h.


Constructor & Destructor Documentation

mrpt::utils::CMessageQueue::CMessageQueue (  ) 

virtual mrpt::utils::CMessageQueue::~CMessageQueue (  )  [virtual]


Member Function Documentation

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.


Member Data Documentation

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.5.9 for MRPT 0.7.1 SVN: at Mon Aug 17 22:21:34 EDT 2009