Go to the documentation of this file.
9 #ifndef CThreadSafeQueue_H
10 #define CThreadSafeQueue_H
119 if (
m_msgs.empty())
return ret;
void push(T *msg)
Insert a new message in the queue - The object must be created with "new", and do not delete is after...
T * get_lastest_purge_old()
Skip all old messages in the queue and directly return the last one (the most recent,...
void clear()
Clear the queue of messages, freeing memory as required.
A class acquiring a CCriticalSection at its constructor, and releasing it at destructor.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
T * get()
Retrieve the next message in the queue, or NULL if there is no message.
size_t size() const
Return the number of queued messages.
A thread-safe template queue for object passing between threads; for a template argument of T,...
This class provides simple critical sections functionality.
mrpt::synch::CCriticalSection m_csQueue
The critical section.
std::queue< T * > m_msgs
The queue of messages. Memory is freed at destructor or by clients gathering messages.
virtual ~CThreadSafeQueue()
bool empty() const
Return true if there are no messages.
CThreadSafeQueue()
Default ctor.
Page generated by Doxygen 1.8.17 for MRPT 1.4.0 SVN: at Sat Jan 18 22:37:07 UTC 2020 | | |