OpenRTM-aist 2.0.2
Loading...
Searching...
No Matches
RTC::BufferBase< DataType > Class Template Referenceabstract

BufferBase abstract class. More...

#include <BufferBase.h>

Inheritance diagram for RTC::BufferBase< DataType >:

Public Member Functions

virtual ~BufferBase ()=default
 Virtual destructor.
 
virtual void init (const coil::Properties &prop)=0
 Set the buffer.
 
virtual size_t length () const =0
 Get the buffer length.
 
virtual BufferStatus length (size_t n)=0
 Set the buffer length.
 
virtual BufferStatus reset ()=0
 Reset the buffer status.
 
virtual DataType * wptr (long int n=0)=0
 Get the writing pointer.
 
virtual BufferStatus advanceWptr (long int n=1, bool unlock_enable=true)=0
 Forward n writing pointers.
 
virtual BufferStatus put (const DataType &value)=0
 Write data into the buffer.
 
virtual BufferStatus write (const DataType &value, std::chrono::nanoseconds timeout=std::chrono::nanoseconds(-1))=0
 Write data into the buffer.
 
virtual size_t writable () const =0
 Get a writable number.
 
virtual bool full () const =0
 Check on whether the buffer is full.
 
virtual DataType * rptr (long int n=0)=0
 Get the reading pointer.
 
virtual BufferStatus advanceRptr (long int n=1, bool unlock_enable=true)=0
 Forward n reading pointers.
 
virtual BufferStatus get (DataType &value)=0
 Read data from the buffer.
 
virtual DataType & get ()=0
 Read data from the buffer.
 
virtual BufferStatus read (DataType &value, std::chrono::nanoseconds nsec=std::chrono::nanoseconds(-1))=0
 Read data from the buffer.
 
virtual size_t readable () const =0
 Write data into the buffer.
 
virtual bool empty () const =0
 Check on whether the buffer is empty.
 

Detailed Description

template<class DataType>
class RTC::BufferBase< DataType >

BufferBase abstract class.

This is the abstract interface class for various Buffer. Concrete buffer classes must implement the following pure virtual functions. The users specify data type to hold it in a buffer as <DataType>.

This class provides public interface as follows.

  • write(): Write data into the buffer.
  • read(): Read data from the buffer.
  • length(): Get the buffer length.
  • isFull(): Check on whether the buffer is full.
  • isEmpty(): Check on whether the buffer is empty.

This class provides protected interface as follows.

  • put(): Store data into the buffer.
  • get(): Get data from the buffer.
Parameters
DataTypeData type to be stored to the buffer.
Since
0.4.0

Constructor & Destructor Documentation

◆ ~BufferBase()

template<class DataType >
virtual RTC::BufferBase< DataType >::~BufferBase ( )
virtualdefault

Virtual destructor.

Member Function Documentation

◆ advanceRptr()

template<class DataType >
virtual BufferStatus RTC::BufferBase< DataType >::advanceRptr ( long int n = 1,
bool unlock_enable = true )
pure virtual

Forward n reading pointers.

Pure virtual function to forward n reading pointers.

Returns
OK: Successful BUFFER_ERROR: Failed

Implemented in RTC::RingBuffer< DataType >, and RTC::RingBuffer< RTC::EventBase * >.

◆ advanceWptr()

template<class DataType >
virtual BufferStatus RTC::BufferBase< DataType >::advanceWptr ( long int n = 1,
bool unlock_enable = true )
pure virtual

Forward n writing pointers.

Pure virtual function to forward n writing pointers.

Returns
OK: Successful BUFFER_ERROR: Failed

Implemented in RTC::RingBuffer< DataType >, and RTC::RingBuffer< RTC::EventBase * >.

◆ empty()

template<class DataType >
virtual bool RTC::BufferBase< DataType >::empty ( ) const
pure virtual

Check on whether the buffer is empty.

Pure virtual function to check on whether the buffer is empty.

Returns
True if the buffer is empty, else false.

Implemented in RTC::RingBuffer< DataType >, and RTC::RingBuffer< RTC::EventBase * >.

◆ full()

template<class DataType >
virtual bool RTC::BufferBase< DataType >::full ( ) const
pure virtual

Check on whether the buffer is full.

Pure virtual function to check on whether the buffer is full.

Returns
True if the buffer is full, else false.

Implemented in RTC::RingBuffer< DataType >, and RTC::RingBuffer< RTC::EventBase * >.

◆ get() [1/2]

template<class DataType >
virtual DataType & RTC::BufferBase< DataType >::get ( )
pure virtual

Read data from the buffer.

Pure virtual function to read data from the buffer.

Returns
Data got from buffer.

Implemented in RTC::NullBuffer< DataType >, RTC::RingBuffer< DataType >, and RTC::RingBuffer< RTC::EventBase * >.

◆ get() [2/2]

template<class DataType >
virtual BufferStatus RTC::BufferBase< DataType >::get ( DataType & value)
pure virtual

Read data from the buffer.

Pure virtual function to read data form the buffer.

Parameters
valueData to read.
Returns
OK: Successful BUFFER_ERROR: Failed

Implemented in RTC::RingBuffer< DataType >, and RTC::RingBuffer< RTC::EventBase * >.

◆ init()

template<class DataType >
virtual void RTC::BufferBase< DataType >::init ( const coil::Properties & prop)
pure virtual

◆ length() [1/2]

template<class DataType >
virtual size_t RTC::BufferBase< DataType >::length ( ) const
pure virtual

Get the buffer length.

Pure virtual function to get the buffer length.

Returns
buffer length

Implemented in RTC::NullBuffer< DataType >, RTC::RingBuffer< DataType >, and RTC::RingBuffer< RTC::EventBase * >.

◆ length() [2/2]

template<class DataType >
virtual BufferStatus RTC::BufferBase< DataType >::length ( size_t n)
pure virtual

Set the buffer length.

Pure virtual function to set the buffer length.

Returns
OK: Successful NOT_SUPPORTED: The buffer length cannot be set. BUFFER_ERROR: Failed

Implemented in RTC::RingBuffer< DataType >, and RTC::RingBuffer< RTC::EventBase * >.

◆ put()

template<class DataType >
virtual BufferStatus RTC::BufferBase< DataType >::put ( const DataType & value)
pure virtual

Write data into the buffer.

Pure virtual function to write data into the buffer.

Parameters
valueTarget data to write.
Returns
OK: Successful BUFFER_ERROR: Failed

Implemented in RTC::NullBuffer< DataType >, RTC::RingBuffer< DataType >, and RTC::RingBuffer< RTC::EventBase * >.

◆ read()

template<class DataType >
virtual BufferStatus RTC::BufferBase< DataType >::read ( DataType & value,
std::chrono::nanoseconds nsec = std::chrono::nanoseconds(-1) )
pure virtual

Read data from the buffer.

Pure virtual function to read data from the buffer.

Parameters
valueRead data.
Returns
Result of having read (true:Successful, false:Failed)

Implemented in RTC::RingBuffer< DataType >, and RTC::RingBuffer< RTC::EventBase * >.

◆ readable()

template<class DataType >
virtual size_t RTC::BufferBase< DataType >::readable ( ) const
pure virtual

Write data into the buffer.

Pure virtual function to get a reading number.

Returns
readable number

Implemented in RTC::RingBuffer< DataType >, and RTC::RingBuffer< RTC::EventBase * >.

◆ reset()

template<class DataType >
virtual BufferStatus RTC::BufferBase< DataType >::reset ( )
pure virtual

Reset the buffer status.

Pure virtual function to reset the buffer status.

Returns
OK: Successful NOT_SUPPORTED: The buffer status cannot be reset. BUFFER_ERROR: Failed

Implemented in RTC::RingBuffer< DataType >, and RTC::RingBuffer< RTC::EventBase * >.

◆ rptr()

template<class DataType >
virtual DataType * RTC::BufferBase< DataType >::rptr ( long int n = 0)
pure virtual

Get the reading pointer.

Pure virtual function to get the reading pointer.

Returns
reading pointer

Implemented in RTC::RingBuffer< DataType >, and RTC::RingBuffer< RTC::EventBase * >.

◆ wptr()

template<class DataType >
virtual DataType * RTC::BufferBase< DataType >::wptr ( long int n = 0)
pure virtual

Get the writing pointer.

Pure virtual function to get the writing pointer.

Parameters
writeingpinter or n previous pointer
Returns
writing pointer

Implemented in RTC::RingBuffer< DataType >, and RTC::RingBuffer< RTC::EventBase * >.

◆ writable()

template<class DataType >
virtual size_t RTC::BufferBase< DataType >::writable ( ) const
pure virtual

Get a writable number.

Pure virtual function to get a writable number.

Returns
value writable number

Implemented in RTC::RingBuffer< DataType >, and RTC::RingBuffer< RTC::EventBase * >.

◆ write()

template<class DataType >
virtual BufferStatus RTC::BufferBase< DataType >::write ( const DataType & value,
std::chrono::nanoseconds timeout = std::chrono::nanoseconds(-1) )
pure virtual

Write data into the buffer.

Pure virtual function to write data into the buffer.

Parameters
valueTarget data to write.
Returns
OK: Successful BUFFER_ERROR: Failed

Implemented in RTC::RingBuffer< DataType >, and RTC::RingBuffer< RTC::EventBase * >.


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