Main MRPT website > C++ reference
MRPT logo

mrpt::utils::CThreadSafeQueue< T > Class Template Reference

A thread-safe template queue for object passing between threads, with objects being passed being "T*". More...

#include <mrpt/utils/CThreadSafeQueue.h>

Collaboration diagram for mrpt::utils::CThreadSafeQueue< T >:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 CThreadSafeQueue ()
virtual ~CThreadSafeQueue ()
void clear ()
void push (T *msg)
T * 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< T * > m_msgs
 The queue of messages. Memory is freed at destructor or by clients gathering messages.
mrpt::synch::CCriticalSection m_csQueue
 The critical section.

Detailed Description

template<class T>
class mrpt::utils::CThreadSafeQueue< T >

A thread-safe template queue for object passing between threads, with objects being passed being "T*".

See also:
mrpt::utils::CMessageQueue

Definition at line 43 of file CThreadSafeQueue.h.


Constructor & Destructor Documentation

template<class T>
mrpt::utils::CThreadSafeQueue< T >::CThreadSafeQueue (  )  [inline]

Definition at line 49 of file CThreadSafeQueue.h.

template<class T>
virtual mrpt::utils::CThreadSafeQueue< T >::~CThreadSafeQueue (  )  [inline, virtual]

Definition at line 53 of file CThreadSafeQueue.h.


Member Function Documentation

template<class T>
void mrpt::utils::CThreadSafeQueue< T >::clear ( void   )  [inline]
template<class T>
bool mrpt::utils::CThreadSafeQueue< T >::empty (  )  const [inline]

< Return true if there are no messages.

Definition at line 90 of file CThreadSafeQueue.h.

template<class T>
T* mrpt::utils::CThreadSafeQueue< T >::get (  )  [inline]

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.

Definition at line 77 of file CThreadSafeQueue.h.

template<class T>
void mrpt::utils::CThreadSafeQueue< T >::push ( T *  msg  )  [inline]
Parameters:
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.

Definition at line 68 of file CThreadSafeQueue.h.


Member Data Documentation

template<class T>
std::queue<T*> mrpt::utils::CThreadSafeQueue< T >::m_msgs [protected]
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines



Page generated by Doxygen 1.6.1 for MRPT 0.9.0 SVN: at Mon Jun 7 06:47:58 UTC 2010