This object represents the default queue implementation used by Orocos objects. More...
#include <rtt/Buffer.hpp>
Public Types | |
typedef ReadInterface< T > ::reference_t | reference_t |
typedef WriteInterface< T > ::param_t | param_t |
typedef BufferInterface< T > ::size_type | size_type |
typedef T | value_t |
typedef boost::shared_ptr < BufferInterface< T > > | shared_ptr |
Public Member Functions | |
Buffer (int qsize, const T &initial_value=T()) | |
Create a queue of fixed size. | |
size_type | capacity () const |
Returns the maximum number of items that can be stored in the buffer. | |
size_type | size () const |
Returns the actual number of items that are stored in the buffer. | |
bool | empty () const |
Check if this buffer is empty. | |
bool | full () const |
Check if this buffer is full. | |
void | clear () |
Clears all contents of this buffer. | |
bool | write (param_t d) |
Write a single value to the buffer. | |
size_type | write (const std::vector< T > &d) |
Write a sequence of values to the buffer. | |
bool | Push (param_t item) |
size_type | Push (const std::vector< T > &items) |
Write a sequence of values to the buffer. | |
virtual bool | Push (param_t item)=0 |
Write a single value to the buffer. | |
bool | read (T &res) |
Read the oldest value from the buffer. | |
size_type | read (std::vector< T > &res) |
Read the whole buffer. | |
value_t | front () const |
Get the next value to be Pop()'ed, or the default value if empty. | |
bool | Pop (reference_t item) |
size_type | Pop (std::vector< T > &items) |
Read the whole buffer. | |
virtual bool | Pop (reference_t item)=0 |
Read the oldest value from the buffer. |
This object represents the default queue implementation used by Orocos objects.
Definition at line 22 of file Buffer.hpp.
RTT::Buffer< T, ReadPolicy, WritePolicy >::Buffer | ( | int | qsize, | |
const T & | initial_value = T() | |||
) | [inline] |
Create a queue of fixed size.
Optionally, add the number of threads that may concurrently access this queue.
Definition at line 29 of file Buffer.hpp.
size_type RTT::BufferLockFree< T, ReadPolicy, WritePolicy >::capacity | ( | ) | const [inline, virtual, inherited] |
Returns the maximum number of items that can be stored in the buffer.
Implements RTT::BufferBase.
Definition at line 99 of file BufferLockFree.hpp.
bool RTT::BufferLockFree< T, ReadPolicy, WritePolicy >::empty | ( | ) | const [inline, virtual, inherited] |
Check if this buffer is empty.
Implements RTT::BufferBase.
Definition at line 109 of file BufferLockFree.hpp.
References RTT::AtomicQueue< T, ReadPolicy, WritePolicy >::isEmpty().
bool RTT::BufferLockFree< T, ReadPolicy, WritePolicy >::full | ( | ) | const [inline, virtual, inherited] |
Check if this buffer is full.
Implements RTT::BufferBase.
Definition at line 114 of file BufferLockFree.hpp.
References RTT::AtomicQueue< T, ReadPolicy, WritePolicy >::isFull().
virtual bool RTT::ReadInterface< T >::Pop | ( | reference_t | item | ) | [pure virtual, inherited] |
Read the oldest value from the buffer.
item | is to be set with a value from the buffer. |
size_type RTT::BufferLockFree< T, ReadPolicy, WritePolicy >::Pop | ( | std::vector< T > & | items | ) | [inline, virtual, inherited] |
Read the whole buffer.
items | is to be filled with all values in the buffer, with items.begin() the oldest value. |
Implements RTT::ReadInterface< T >.
Definition at line 220 of file BufferLockFree.hpp.
References RTT::FixedSizeMemoryPool< T >::deallocate(), and RTT::AtomicQueue< T, ReadPolicy, WritePolicy >::dequeue().
virtual bool RTT::WriteInterface< T >::Push | ( | param_t | item | ) | [pure virtual, inherited] |
Write a single value to the buffer.
item | the value to write |
size_type RTT::BufferLockFree< T, ReadPolicy, WritePolicy >::Push | ( | const std::vector< T > & | items | ) | [inline, virtual, inherited] |
Write a sequence of values to the buffer.
items | the values to write |
Implements RTT::WriteInterface< T >.
Definition at line 162 of file BufferLockFree.hpp.
size_type RTT::BufferLockFree< T, ReadPolicy, WritePolicy >::read | ( | std::vector< T > & | res | ) | [inline, inherited] |
Read the whole buffer.
Block if empty if Policy is BlockingPolicy.
res | is to be filled with all values in the buffer, with res.begin() the oldest value. |
Definition at line 215 of file BufferLockFree.hpp.
bool RTT::BufferLockFree< T, ReadPolicy, WritePolicy >::read | ( | T & | res | ) | [inline, inherited] |
Read the oldest value from the buffer.
Block if empty if Policy is BlockingPolicy.
res | is to be filled with a value from the buffer. |
Definition at line 180 of file BufferLockFree.hpp.
size_type RTT::BufferLockFree< T, ReadPolicy, WritePolicy >::size | ( | ) | const [inline, virtual, inherited] |
Returns the actual number of items that are stored in the buffer.
Implements RTT::BufferBase.
Definition at line 104 of file BufferLockFree.hpp.
size_type RTT::BufferLockFree< T, ReadPolicy, WritePolicy >::write | ( | const std::vector< T > & | d | ) | [inline, inherited] |
Write a sequence of values to the buffer.
Block if full if Policy is BlockingPolicy.
d | the values to write |
Definition at line 158 of file BufferLockFree.hpp.
bool RTT::BufferLockFree< T, ReadPolicy, WritePolicy >::write | ( | param_t | d | ) | [inline, inherited] |
Write a single value to the buffer.
d | the value to write |
Definition at line 132 of file BufferLockFree.hpp.