Classes | Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
RTT::internal::AtomicMWSRQueue< T > Class Template Reference

#include <AtomicMWSRQueue.hpp>

Inheritance diagram for RTT::internal::AtomicMWSRQueue< T >:
Inheritance graph
[legend]

Classes

union  SIndexes
 

Public Types

typedef AtomicQueue< T >::size_type size_type
 
- Public Types inherited from RTT::internal::AtomicQueue< T >
typedef unsigned int size_type
 

Public Member Functions

 AtomicMWSRQueue (unsigned int size)
 
size_type capacity () const
 
void clear ()
 
bool dequeue (T &result)
 
bool enqueue (const T &value)
 
const T front () const
 
bool isEmpty () const
 
bool isFull () const
 
size_type size () const
 
 ~AtomicMWSRQueue ()
 
- Public Member Functions inherited from RTT::internal::AtomicQueue< T >
virtual ~AtomicQueue ()
 

Private Types

typedef T C
 
typedef C *volatile CacheObjType
 
typedef volatile CCachePtrType
 
typedef CPtrType
 
typedef C ValueType
 

Private Member Functions

bool advance_r (T &result)
 
CachePtrType advance_w ()
 
 AtomicMWSRQueue (const AtomicMWSRQueue< T > &)
 

Private Attributes

CachePtrType _buf
 
volatile SIndexes _indxes
 
const int _size
 

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 60 of file AtomicMWSRQueue.hpp.

Member Typedef Documentation

template<class T >
typedef T RTT::internal::AtomicMWSRQueue< T >::C
private

Definition at line 64 of file AtomicMWSRQueue.hpp.

template<class T >
typedef C* volatile RTT::internal::AtomicMWSRQueue< T >::CacheObjType
private

Definition at line 66 of file AtomicMWSRQueue.hpp.

template<class T >
typedef volatile C* RTT::internal::AtomicMWSRQueue< T >::CachePtrType
private

Definition at line 65 of file AtomicMWSRQueue.hpp.

template<class T >
typedef C* RTT::internal::AtomicMWSRQueue< T >::PtrType
private

Definition at line 68 of file AtomicMWSRQueue.hpp.

template<class T >
typedef AtomicQueue<T>::size_type RTT::internal::AtomicMWSRQueue< T >::size_type

Definition at line 163 of file AtomicMWSRQueue.hpp.

template<class T >
typedef C RTT::internal::AtomicMWSRQueue< T >::ValueType
private

Definition at line 67 of file AtomicMWSRQueue.hpp.

Constructor & Destructor Documentation

template<class T >
RTT::internal::AtomicMWSRQueue< T >::AtomicMWSRQueue ( const AtomicMWSRQueue< T > &  )
private
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 169 of file AtomicMWSRQueue.hpp.

template<class T >
RTT::internal::AtomicMWSRQueue< T >::~AtomicMWSRQueue ( )
inline

Definition at line 176 of file AtomicMWSRQueue.hpp.

Member Function Documentation

template<class T >
bool RTT::internal::AtomicMWSRQueue< T >::advance_r ( T &  result)
inlineprivate

Advance and wrap of the Read pointer. Only one thread may call this.

Definition at line 129 of file AtomicMWSRQueue.hpp.

template<class T >
CachePtrType RTT::internal::AtomicMWSRQueue< T >::advance_w ( )
inlineprivate

Atomic advance and wrap of the Write pointer. Return the old position or zero if queue is full.

Definition at line 99 of file AtomicMWSRQueue.hpp.

template<class T >
size_type RTT::internal::AtomicMWSRQueue< T >::capacity ( ) const
inlinevirtual

Return the maximum number of items this queue can contain.

Implements RTT::internal::AtomicQueue< T >.

Definition at line 210 of file AtomicMWSRQueue.hpp.

template<class T >
void RTT::internal::AtomicMWSRQueue< T >::clear ( )
inlinevirtual

Clear all contents of the Queue and thus make it empty.

Implements RTT::internal::AtomicQueue< T >.

Definition at line 270 of file AtomicMWSRQueue.hpp.

template<class T >
bool RTT::internal::AtomicMWSRQueue< T >::dequeue ( T &  result)
inlinevirtual

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.

Implements RTT::internal::AtomicQueue< T >.

Definition at line 249 of file AtomicMWSRQueue.hpp.

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

Enqueue an item.

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

Implements RTT::internal::AtomicQueue< T >.

Definition at line 231 of file AtomicMWSRQueue.hpp.

template<class T >
const T RTT::internal::AtomicMWSRQueue< T >::front ( ) const
inlinevirtual

Return the next to be read value.

Implements RTT::internal::AtomicQueue< T >.

Definition at line 262 of file AtomicMWSRQueue.hpp.

template<class T >
bool RTT::internal::AtomicMWSRQueue< T >::isEmpty ( ) const
inlinevirtual

Inspect if the Queue is empty.

Returns
true if empty, false otherwise.

Implements RTT::internal::AtomicQueue< T >.

Definition at line 199 of file AtomicMWSRQueue.hpp.

template<class T >
bool RTT::internal::AtomicMWSRQueue< T >::isFull ( ) const
inlinevirtual

Inspect if the Queue is full.

Returns
true if full, false otherwise.

Implements RTT::internal::AtomicQueue< T >.

Definition at line 185 of file AtomicMWSRQueue.hpp.

template<class T >
size_type RTT::internal::AtomicMWSRQueue< T >::size ( ) const
inlinevirtual

Return the number of elements in the queue.

Implements RTT::internal::AtomicQueue< T >.

Definition at line 218 of file AtomicMWSRQueue.hpp.

Member Data Documentation

template<class T >
CachePtrType RTT::internal::AtomicMWSRQueue< T >::_buf
private

The pointer to the buffer can be cached, the contents are volatile.

Definition at line 87 of file AtomicMWSRQueue.hpp.

template<class T >
volatile SIndexes RTT::internal::AtomicMWSRQueue< T >::_indxes
private

The indexes are packed into one double word. Therefore the read and write index can be read and written atomically.

Definition at line 93 of file AtomicMWSRQueue.hpp.

template<class T >
const int RTT::internal::AtomicMWSRQueue< T >::_size
private

Definition at line 63 of file AtomicMWSRQueue.hpp.


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


rtt
Author(s): RTT Developers
autogenerated on Fri Oct 25 2019 03:59:46