Orocos Real-Time Toolkit  2.6.0
Public Types | Public Member Functions
RTT::internal::AtomicMWSRQueue< T > Class Template Reference

Create an atomic, non-blocking Multi-Writer Single-Reader FIFO for storing a pointer T by value. More...

#include <rtt/internal/AtomicMWSRQueue.hpp>

Inheritance diagram for RTT::internal::AtomicMWSRQueue< T >:
RTT::internal::MWSRQueue< T >

List of all members.

Public Types

typedef unsigned int size_type

Public Member Functions

 AtomicMWSRQueue (unsigned int size)
 Create an AtomicMWSRQueue with queue size size.
bool isFull () const
 Inspect if the Queue is full.
bool isEmpty () const
 Inspect if the Queue is empty.
size_type capacity () const
 Return the maximum number of items this queue can contain.
size_type size () const
 Return the number of elements in the queue.
bool enqueue (const T &value)
 Enqueue an item.
bool dequeue (T &result)
 Dequeue an item.
const T front () const
 Return the next to be read value.
void clear ()
 Clear all contents of the Queue and thus make it empty.

Detailed Description

template<class T>
class RTT::internal::AtomicMWSRQueue< T >

Create an atomic, non-blocking Multi-Writer Single-Reader FIFO for storing a pointer T by value.

Any number of writer threads may access the queue concurrently, but only one thread may read it.

Warning:
You can not store null pointers.
Parameters:
TThe pointer type to be stored in the Queue. Example : AtomicMWSRQueue< A* > is a queue of pointers to A.

Definition at line 59 of file AtomicMWSRQueue.hpp.


Constructor & Destructor Documentation

template<class T>
RTT::internal::AtomicMWSRQueue< T >::AtomicMWSRQueue ( unsigned int  size) [inline]

Create an AtomicMWSRQueue with queue size size.

Parameters:
sizeThe size of the queue, should be 1 or greater.

Definition at line 167 of file AtomicMWSRQueue.hpp.


Member Function Documentation

template<class T>
bool RTT::internal::AtomicMWSRQueue< T >::dequeue ( T &  result) [inline]

Dequeue an item.

Parameters:
valueStores the dequeued value. It is unchanged when dequeue returns false and contains the dequeued value when it returns true.
Returns:
false if queue is empty, true if result was written.

Definition at line 247 of file AtomicMWSRQueue.hpp.

Referenced by RTT::base::BufferLockFree< T >::clear(), RTT::base::BufferLockFree< T >::Pop(), RTT::base::BufferLockFree< T >::PopWithoutRelease(), RTT::base::BufferLockFree< T >::Push(), and RTT::ExecutionEngine::removeSelfFunction().

template<class T>
bool RTT::internal::AtomicMWSRQueue< T >::enqueue ( const T &  value) [inline]

Enqueue an item.

Parameters:
valueThe value to enqueue.
Returns:
false if queue is full, true if queued.

Definition at line 229 of file AtomicMWSRQueue.hpp.

Referenced by RTT::ExecutionEngine::process(), RTT::base::BufferLockFree< T >::Push(), RTT::ExecutionEngine::removeSelfFunction(), and RTT::ExecutionEngine::runFunction().

template<class T>
bool RTT::internal::AtomicMWSRQueue< T >::isEmpty ( ) const [inline]

Inspect if the Queue is empty.

Returns:
true if empty, false otherwise.

Definition at line 197 of file AtomicMWSRQueue.hpp.

Referenced by RTT::base::BufferLockFree< T >::empty(), and RTT::ExecutionEngine::hasWork().

template<class T>
bool RTT::internal::AtomicMWSRQueue< T >::isFull ( ) const [inline]

Inspect if the Queue is full.

Returns:
true if full, false otherwise.

Definition at line 183 of file AtomicMWSRQueue.hpp.

Referenced by RTT::base::BufferLockFree< T >::full().


The documentation for this class was generated from the following file: