Orocos Real-Time Toolkit  2.8.3
Public Types | Public Member Functions | List of all members
RTT::base::BufferInterface< T > Class Template Referenceabstract

A Buffer is an object which is used to store (Push) and retrieve (Pop) values from. More...

#include <rtt/base/BufferInterface.hpp>

Inheritance diagram for RTT::base::BufferInterface< T >:
RTT::base::BufferBase RTT::base::BufferLocked< T > RTT::base::BufferLockFree< T > RTT::base::BufferUnSync< T > RTT::base::Buffer< T >

Public Types

typedef T value_t
 
typedef BufferBase::size_type size_type
 
typedef boost::shared_ptr< BufferInterface< T > > shared_ptr
 
typedef boost::call_traits< T >::param_type param_t
 
typedef boost::call_traits< T >::reference reference_t
 

Public Member Functions

virtual ~BufferInterface ()
 
virtual bool Pop (reference_t item)=0
 Read the oldest value from the buffer. More...
 
virtual size_type Pop (std::vector< value_t > &items)=0
 Read the whole buffer. More...
 
virtual value_tPopWithoutRelease ()=0
 Returns a pointer to the first element in the buffer. More...
 
virtual void Release (value_t *item)=0
 Releases the pointer. More...
 
virtual bool Push (param_t item)=0
 Write a single value to the buffer. More...
 
virtual size_type Push (const std::vector< value_t > &items)=0
 Write a sequence of values to the buffer. More...
 
virtual void data_sample (const T &sample)=0
 Initializes this buffer with a data sample, such that for dynamical allocated types T, the buffer can reserve place to hold these elements. More...
 
virtual T data_sample () const =0
 Reads back a data sample. More...
 
virtual size_type capacity () const =0
 Returns the maximum number of items that can be stored in the buffer. More...
 
virtual size_type size () const =0
 Returns the actual number of items that are stored in the buffer. More...
 
virtual bool empty () const =0
 Check if this buffer is empty. More...
 
virtual bool full () const =0
 Check if this buffer is full. More...
 
virtual void clear ()=0
 Clears all contents of this buffer. More...
 
virtual size_type dropped () const =0
 Returns the number of dropped samples, because the buffer was full. More...
 

Detailed Description

template<class T>
class RTT::base::BufferInterface< T >

A Buffer is an object which is used to store (Push) and retrieve (Pop) values from.

Parameters
TThe value type stored in this buffer.

Definition at line 55 of file BufferInterface.hpp.

Member Typedef Documentation

template<class T>
typedef boost::call_traits<T>::param_type RTT::base::BufferInterface< T >::param_t

Definition at line 63 of file BufferInterface.hpp.

template<class T>
typedef boost::call_traits<T>::reference RTT::base::BufferInterface< T >::reference_t

Definition at line 64 of file BufferInterface.hpp.

template<class T>
typedef boost::shared_ptr< BufferInterface<T> > RTT::base::BufferInterface< T >::shared_ptr

Definition at line 62 of file BufferInterface.hpp.

Definition at line 60 of file BufferInterface.hpp.

template<class T>
typedef T RTT::base::BufferInterface< T >::value_t

Definition at line 59 of file BufferInterface.hpp.

Constructor & Destructor Documentation

template<class T>
virtual RTT::base::BufferInterface< T >::~BufferInterface ( )
inlinevirtual

Member Function Documentation

virtual size_type RTT::base::BufferBase::capacity ( ) const
pure virtualinherited

Returns the maximum number of items that can be stored in the buffer.

Returns
maximum number of items.

Implemented in RTT::base::BufferLocked< T >, RTT::base::BufferUnSync< T >, and RTT::base::BufferLockFree< T >.

Referenced by RTT::internal::ChannelBufferElement< T >::getBufferSize().

virtual void RTT::base::BufferBase::clear ( )
pure virtualinherited
template<class T>
virtual void RTT::base::BufferInterface< T >::data_sample ( const T &  sample)
pure virtual

Initializes this buffer with a data sample, such that for dynamical allocated types T, the buffer can reserve place to hold these elements.

Postcondition
Calling this function causes all data in the buffer to be lost and the size being reset to zero.

Implemented in RTT::base::BufferLockFree< T >, RTT::base::BufferLocked< T >, and RTT::base::BufferUnSync< T >.

Referenced by RTT::internal::ChannelBufferElement< T >::data_sample().

template<class T>
virtual T RTT::base::BufferInterface< T >::data_sample ( ) const
pure virtual
virtual size_type RTT::base::BufferBase::dropped ( ) const
pure virtualinherited

Returns the number of dropped samples, because the buffer was full.

Implemented in RTT::base::BufferLocked< T >, RTT::base::BufferUnSync< T >, and RTT::base::BufferLockFree< T >.

Referenced by RTT::internal::ChannelBufferElement< T >::getNumDroppedSamples().

virtual bool RTT::base::BufferBase::empty ( ) const
pure virtualinherited

Check if this buffer is empty.

Returns
true if size() == 0

Implemented in RTT::base::BufferLocked< T >, RTT::base::BufferUnSync< T >, and RTT::base::BufferLockFree< T >.

virtual bool RTT::base::BufferBase::full ( ) const
pure virtualinherited

Check if this buffer is full.

Returns
true if size() == capacity()

Implemented in RTT::base::BufferLocked< T >, RTT::base::BufferUnSync< T >, and RTT::base::BufferLockFree< T >.

template<class T>
virtual bool RTT::base::BufferInterface< T >::Pop ( reference_t  item)
pure virtual

Read the oldest value from the buffer.

Parameters
itemis to be set with a value from the buffer.
Returns
true if something was read.

Implemented in RTT::base::BufferLockFree< T >, RTT::base::BufferLocked< T >, and RTT::base::BufferUnSync< T >.

Referenced by RTT::base::BufferInterface< T >::~BufferInterface().

template<class T>
virtual size_type RTT::base::BufferInterface< T >::Pop ( std::vector< value_t > &  items)
pure virtual

Read the whole buffer.

Parameters
itemsis to be filled with all values in the buffer, with items.begin() the oldest value.
Returns
the number of items read.

Implemented in RTT::base::BufferLockFree< T >, RTT::base::BufferLocked< T >, and RTT::base::BufferUnSync< T >.

template<class T>
virtual value_t* RTT::base::BufferInterface< T >::PopWithoutRelease ( )
pure virtual

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.

Returns
a pointer to a sample or Zero if buffer is empty

Implemented in RTT::base::BufferLockFree< T >, RTT::base::BufferLocked< T >, and RTT::base::BufferUnSync< T >.

Referenced by RTT::internal::ChannelBufferElement< T >::read(), and RTT::base::BufferInterface< T >::~BufferInterface().

template<class T>
virtual bool RTT::base::BufferInterface< T >::Push ( param_t  item)
pure virtual

Write a single value to the buffer.

Parameters
itemthe value to write
Returns
false if the buffer is full.

Implemented in RTT::base::BufferLockFree< T >, RTT::base::BufferLocked< T >, and RTT::base::BufferUnSync< T >.

Referenced by RTT::internal::ChannelBufferElement< T >::write(), and RTT::base::BufferInterface< T >::~BufferInterface().

template<class T>
virtual size_type RTT::base::BufferInterface< T >::Push ( const std::vector< value_t > &  items)
pure virtual

Write a sequence of values to the buffer.

Parameters
itemsthe values to write
Returns
the number of values written (may be less than items.size())

Implemented in RTT::base::BufferLockFree< T >, RTT::base::BufferLocked< T >, and RTT::base::BufferUnSync< T >.

template<class T>
virtual void RTT::base::BufferInterface< T >::Release ( value_t item)
pure virtual
virtual size_type RTT::base::BufferBase::size ( ) const
pure virtualinherited

Returns the actual number of items that are stored in the buffer.

Returns
number of items.

Implemented in RTT::base::BufferLocked< T >, RTT::base::BufferUnSync< T >, and RTT::base::BufferLockFree< T >.

Referenced by RTT::internal::ChannelBufferElement< T >::getBufferFillSize().


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