Orocos Real-Time Toolkit
2.5.0
|
This object represents the default thread-safe buffer implementation used by Orocos objects. More...
#include <rtt/base/Buffer.hpp>
Public Types | |
typedef BufferInterface< T > ::reference_t | reference_t |
typedef BufferInterface< 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 fifo queue of fixed size. | |
virtual void | data_sample (const T &sample) |
Initializes this buffer with a data sample, such that for dynamical allocated types T, the buffer can reserve place to hold these elements. | |
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 | Push (param_t item) |
Write a single value to the buffer. | |
size_type | Push (const std::vector< T > &items) |
Write a sequence of values to the buffer. | |
bool | Pop (reference_t item) |
Read the oldest value from the buffer. | |
size_type | Pop (std::vector< T > &items) |
Read the whole buffer. | |
value_t * | PopWithoutRelease () |
Returns a pointer to the first element in the buffer. | |
void | Release (value_t *item) |
Releases the pointer. |
This object represents the default thread-safe buffer implementation used by Orocos objects.
Definition at line 67 of file Buffer.hpp.
size_type RTT::base::BufferLockFree< T >::capacity | ( | ) | const [inline, virtual, inherited] |
Returns the maximum number of items that can be stored in the buffer.
Implements RTT::base::BufferBase.
Definition at line 103 of file BufferLockFree.hpp.
References RTT::internal::AtomicMWSRQueue< T >::capacity().
void RTT::base::BufferLockFree< T >::clear | ( | ) | [inline, virtual, inherited] |
Clears all contents of this buffer.
Implements RTT::base::BufferBase.
Definition at line 123 of file BufferLockFree.hpp.
References RTT::internal::AtomicMWSRQueue< T >::dequeue().
virtual void RTT::base::BufferLockFree< T >::data_sample | ( | const T & | sample | ) | [inline, virtual, inherited] |
Initializes this buffer with a data sample, such that for dynamical allocated types T, the buffer can reserve place to hold these elements.
Implements RTT::base::BufferInterface< T >.
Definition at line 97 of file BufferLockFree.hpp.
References RTT::internal::TsPool< T >::data_sample().
bool RTT::base::BufferLockFree< T >::empty | ( | ) | const [inline, virtual, inherited] |
Check if this buffer is empty.
Implements RTT::base::BufferBase.
Definition at line 113 of file BufferLockFree.hpp.
References RTT::internal::AtomicMWSRQueue< T >::isEmpty().
bool RTT::base::BufferLockFree< T >::full | ( | ) | const [inline, virtual, inherited] |
Check if this buffer is full.
Implements RTT::base::BufferBase.
Definition at line 118 of file BufferLockFree.hpp.
References RTT::internal::AtomicMWSRQueue< T >::isFull().
bool RTT::base::BufferLockFree< T >::Pop | ( | reference_t | item | ) | [inline, virtual, inherited] |
Read the oldest value from the buffer.
item | is to be set with a value from the buffer. |
Implements RTT::base::BufferInterface< T >.
Definition at line 158 of file BufferLockFree.hpp.
References RTT::internal::AtomicMWSRQueue< T >::dequeue().
size_type RTT::base::BufferLockFree< T >::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::base::BufferInterface< T >.
Definition at line 169 of file BufferLockFree.hpp.
References RTT::internal::AtomicMWSRQueue< T >::dequeue().
value_t* RTT::base::BufferLockFree< T >::PopWithoutRelease | ( | ) | [inline, virtual, inherited] |
Returns a pointer to the first element in the buffer.
The pointer is only garanteed to stay valid until the next pop operation.
Note the pointer needs the be released by calling Release on the buffer.
Implements RTT::base::BufferInterface< T >.
Definition at line 181 of file BufferLockFree.hpp.
References RTT::internal::AtomicMWSRQueue< T >::dequeue().
bool RTT::base::BufferLockFree< T >::Push | ( | param_t | item | ) | [inline, virtual, inherited] |
Write a single value to the buffer.
item | the value to write |
Implements RTT::base::BufferInterface< T >.
Definition at line 130 of file BufferLockFree.hpp.
References RTT::internal::AtomicMWSRQueue< T >::enqueue().
Referenced by RTT::base::BufferLockFree< T >::Push().
size_type RTT::base::BufferLockFree< T >::Push | ( | const std::vector< T > & | items | ) | [inline, virtual, inherited] |
Write a sequence of values to the buffer.
items | the values to write |
Implements RTT::base::BufferInterface< T >.
Definition at line 147 of file BufferLockFree.hpp.
References RTT::base::BufferLockFree< T >::Push().
void RTT::base::BufferLockFree< T >::Release | ( | value_t * | item | ) | [inline, virtual, inherited] |
Releases the pointer.
item | pointer aquired using PopWithoutRelease() |
Implements RTT::base::BufferInterface< T >.
Definition at line 189 of file BufferLockFree.hpp.
size_type RTT::base::BufferLockFree< T >::size | ( | ) | const [inline, virtual, inherited] |
Returns the actual number of items that are stored in the buffer.
Implements RTT::base::BufferBase.
Definition at line 108 of file BufferLockFree.hpp.
References RTT::internal::AtomicMWSRQueue< T >::size().