RTT::LockedQueue< T, ReadPolicy, WritePolicy > Class Template Reference

A lock-based queue implementation to enqueue or dequeue a pointer of type T. More...

#include <rtt/LockedQueue.hpp>

List of all members.

Public Types

typedef T value_t
typedef unsigned int size_type

Public Member Functions

 LockedQueue (unsigned int lsize, unsigned int unused=0)
 Create a lock-based queue wich can store lsize elements.
size_type capacity () const
size_type size () const
bool isEmpty () const
 Inspect if the Queue is empty.
bool isFull () const
 Inspect if the Queue is full.
void clear ()
bool enqueue (const T &value)
 Enqueue an item.
int enqueueCounted (const T &value)
 Enqueue an item and return its 'ticket' number.
bool dequeue (T &result)
 Dequeue an item.
int dequeueCounted (T &result)
 Dequeue an item and return the same 'ticket' number when it was queued.
value_t front () const
 Returns the first element of the queue.
value_t back () const
 Returns the last element of the queue.

Detailed Description

template<class T, class ReadPolicy = NonBlockingPolicy, class WritePolicy = NonBlockingPolicy>
class RTT::LockedQueue< T, ReadPolicy, WritePolicy >

A lock-based queue implementation to enqueue or dequeue a pointer of type T.

No memory allocation is done during read or write.

Parameters:
T The pointer type to be stored in the queue. Example : LockedQueue<A*> is a queue which holds values of type A.
ReadPolicy The Policy to block (wait) on empty (during dequeue) using BlockingPolicy, or to return false, using NonBlockingPolicy (Default). This does not influence partial filled queue behaviour.
WritePolicy The Policy to block (wait) on full (during enqueue), using BlockingPolicy, or to return false, using NonBlockingPolicy (Default). This does not influence partial filled buffer behaviour.

Definition at line 26 of file LockedQueue.hpp.


Constructor & Destructor Documentation

template<class T , class ReadPolicy = NonBlockingPolicy, class WritePolicy = NonBlockingPolicy>
RTT::LockedQueue< T, ReadPolicy, WritePolicy >::LockedQueue ( unsigned int  lsize,
unsigned int  unused = 0 
) [inline]

Create a lock-based queue wich can store lsize elements.

Parameters:
lsize the capacity of the queue. '

Definition at line 50 of file LockedQueue.hpp.


Member Function Documentation

template<class T , class ReadPolicy = NonBlockingPolicy, class WritePolicy = NonBlockingPolicy>
bool RTT::LockedQueue< T, ReadPolicy, WritePolicy >::dequeue ( T &  result  )  [inline]

Dequeue an item.

Parameters:
result The value dequeued.
Returns:
false if queue is empty, true if dequeued.

Definition at line 143 of file LockedQueue.hpp.

template<class T , class ReadPolicy = NonBlockingPolicy, class WritePolicy = NonBlockingPolicy>
int RTT::LockedQueue< T, ReadPolicy, WritePolicy >::dequeueCounted ( T &  result  )  [inline]

Dequeue an item and return the same 'ticket' number when it was queued.

Parameters:
value The value dequeued.
Returns:
zero if the queue is empty, the 'ticket' number otherwise.
Deprecated:
Do not use this function

Definition at line 163 of file LockedQueue.hpp.

template<class T , class ReadPolicy = NonBlockingPolicy, class WritePolicy = NonBlockingPolicy>
bool RTT::LockedQueue< T, ReadPolicy, WritePolicy >::enqueue ( const T &  value  )  [inline]

Enqueue an item.

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

Definition at line 104 of file LockedQueue.hpp.

template<class T , class ReadPolicy = NonBlockingPolicy, class WritePolicy = NonBlockingPolicy>
int RTT::LockedQueue< T, ReadPolicy, WritePolicy >::enqueueCounted ( const T &  value  )  [inline]

Enqueue an item and return its 'ticket' number.

Parameters:
value The value to enqueue.
Returns:
zero if the queue is full, the 'ticket' number otherwise.
Deprecated:
Do not use this function

Definition at line 123 of file LockedQueue.hpp.

template<class T , class ReadPolicy = NonBlockingPolicy, class WritePolicy = NonBlockingPolicy>
bool RTT::LockedQueue< T, ReadPolicy, WritePolicy >::isEmpty (  )  const [inline]

Inspect if the Queue is empty.

Returns:
true if empty, false otherwise.

Definition at line 77 of file LockedQueue.hpp.

template<class T , class ReadPolicy = NonBlockingPolicy, class WritePolicy = NonBlockingPolicy>
bool RTT::LockedQueue< T, ReadPolicy, WritePolicy >::isFull (  )  const [inline]

Inspect if the Queue is full.

Returns:
true if full, false otherwise.

Definition at line 87 of file LockedQueue.hpp.


The documentation for this class was generated from the following file:
Generated on Thu Dec 23 13:22:43 2010 for Orocos Real-Time Toolkit by  doxygen 1.6.3