Implements a very simple blocking threadsafe buffer, using mutexes (locks). More...
#include <rtt/BufferLocked.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 | |
BufferLocked (size_type size, const T &initial_value=T()) | |
Create a buffer of size size. | |
~BufferLocked () | |
Destructor. | |
bool | Push (param_t item) |
size_type | Push (const std::vector< T > &items) |
Write a sequence of values to the buffer. | |
bool | Pop (reference_t item) |
size_type | Pop (std::vector< T > &items) |
Read the whole buffer. | |
value_t | front () const |
Get the next value to be Pop()'ed, or the default value if empty. | |
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. | |
void | clear () |
Clears all contents of this buffer. | |
bool | empty () const |
Check if this buffer is empty. | |
bool | full () const |
Check if this buffer is full. | |
virtual bool | Pop (reference_t item)=0 |
Read the oldest value from the buffer. | |
virtual bool | Push (param_t item)=0 |
Write a single value to the buffer. |
Implements a very simple blocking threadsafe buffer, using mutexes (locks).
Definition at line 61 of file BufferLocked.hpp.
size_type RTT::BufferLocked< T, ReadPolicy, WritePolicy >::capacity | ( | ) | const [inline, virtual] |
Returns the maximum number of items that can be stored in the buffer.
Implements RTT::BufferBase.
Definition at line 150 of file BufferLocked.hpp.
bool RTT::BufferLocked< T, ReadPolicy, WritePolicy >::empty | ( | ) | const [inline, virtual] |
Check if this buffer is empty.
Implements RTT::BufferBase.
Definition at line 165 of file BufferLocked.hpp.
bool RTT::BufferLocked< T, ReadPolicy, WritePolicy >::full | ( | ) | const [inline, virtual] |
Check if this buffer is full.
Implements RTT::BufferBase.
Definition at line 170 of file BufferLocked.hpp.
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::BufferLocked< T, ReadPolicy, WritePolicy >::Pop | ( | std::vector< T > & | items | ) | [inline, virtual] |
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 127 of file BufferLocked.hpp.
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::BufferLocked< T, ReadPolicy, WritePolicy >::Push | ( | const std::vector< T > & | items | ) | [inline, virtual] |
Write a sequence of values to the buffer.
items | the values to write |
Implements RTT::WriteInterface< T >.
Definition at line 99 of file BufferLocked.hpp.
size_type RTT::BufferLocked< T, ReadPolicy, WritePolicy >::size | ( | ) | const [inline, virtual] |
Returns the actual number of items that are stored in the buffer.
Implements RTT::BufferBase.
Definition at line 155 of file BufferLocked.hpp.