Main MRPT website > C++ reference
MRPT logo
Public Member Functions | Protected Attributes

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


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.

#include <mrpt/utils/CThreadSafeQueue.h>

Inheritance diagram for mrpt::utils::CThreadSafeQueue< T >:
Inheritance 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.

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:
msgInsert 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]



Page generated by Doxygen 1.7.3 for MRPT 0.9.4 SVN:exported at Tue Jan 25 21:56:31 UTC 2011