|
OpenRTM-aist 2.1.0
|
Ring buffer implementation class. More...
#include <RingBuffer.h>


Public Member Functions | |
| RingBuffer (long int length=RINGBUFFER_DEFAULT_LENGTH) | |
| Constructor. More... | |
| ~RingBuffer () override | |
| Virtual destractor. More... | |
| void | init (const coil::Properties &prop) override |
| size_t | length () const override |
| Get the buffer length. More... | |
| BufferStatus | length (size_t n) override |
| Get the buffer length. More... | |
| BufferStatus | reset () override |
| Get the buffer length. More... | |
| DataType * | wptr (long int n=0) override |
| Get the buffer length. More... | |
| BufferStatus | advanceWptr (long int n=1, bool unlock_enable=true) override |
| Get the buffer length. More... | |
| BufferStatus | put (const DataType &value) override |
| Write data into the buffer. More... | |
| BufferStatus | write (const DataType &value, std::chrono::nanoseconds timeout=std::chrono::nanoseconds(-1)) override |
| Write data into the buffer. More... | |
| size_t | writable () const override |
| Write data into the buffer. More... | |
| bool | full () const override |
| Check on whether the buffer is full. More... | |
| DataType * | rptr (long int n=0) override |
| Get the buffer length. More... | |
| BufferStatus | advanceRptr (long int n=1, bool unlock_enable=true) override |
| Get the buffer length. More... | |
| BufferStatus | get (DataType &value) override |
| Write data into the buffer. More... | |
| DataType & | get () override |
| Reading data from the buffer. More... | |
| BufferStatus | read (DataType &value, std::chrono::nanoseconds timeout=std::chrono::nanoseconds(-1)) override |
| Readout data from the buffer. More... | |
| size_t | readable () const override |
| Write data into the buffer. More... | |
| bool | empty () const override |
| Check on whether the buffer is empty. More... | |
Public Member Functions inherited from RTC::BufferBase< DataType > | |
| virtual | ~BufferBase ()=default |
| Virtual destructor. More... | |
| virtual void | init (const coil::Properties &prop)=0 |
| Set the buffer. More... | |
| virtual size_t | length () const =0 |
| Get the buffer length. More... | |
| virtual BufferStatus | length (size_t n)=0 |
| Set the buffer length. More... | |
| virtual BufferStatus | reset ()=0 |
| Reset the buffer status. More... | |
| virtual DataType * | wptr (long int n=0)=0 |
| Get the writing pointer. More... | |
| virtual BufferStatus | advanceWptr (long int n=1, bool unlock_enable=true)=0 |
| Forward n writing pointers. More... | |
| virtual BufferStatus | put (const DataType &value)=0 |
| Write data into the buffer. More... | |
| virtual BufferStatus | write (const DataType &value, std::chrono::nanoseconds timeout=std::chrono::nanoseconds(-1))=0 |
| Write data into the buffer. More... | |
| virtual size_t | writable () const =0 |
| Get a writable number. More... | |
| virtual bool | full () const =0 |
| Check on whether the buffer is full. More... | |
| virtual DataType * | rptr (long int n=0)=0 |
| Get the reading pointer. More... | |
| virtual BufferStatus | advanceRptr (long int n=1, bool unlock_enable=true)=0 |
| Forward n reading pointers. More... | |
| virtual BufferStatus | get (DataType &value)=0 |
| Read data from the buffer. More... | |
| virtual DataType & | get ()=0 |
| Read data from the buffer. More... | |
| virtual BufferStatus | read (DataType &value, std::chrono::nanoseconds nsec=std::chrono::nanoseconds(-1))=0 |
| Read data from the buffer. More... | |
| virtual size_t | readable () const =0 |
| Write data into the buffer. More... | |
| virtual bool | empty () const =0 |
| Check on whether the buffer is empty. More... | |
Ring buffer implementation class.
This is the buffer implementation class with ring shaped buffer of specified length. If data is stored in the entire buffer, data from now on will be overwritten from old data one by one. Therefore, only the length of latest data is stored in the buffer.
Note: In the current implementation, only last stored data can be read from the buffer.
| DataType | Data type to store in the buffer |
|
inlineexplicit |
Constructor.
Constructor. Initialize the buffer by specified buffer length. However, if the specified length is less than two, the buffer should be initialized by two in length.
| length | Buffer length |
References RTC::RingBuffer< DataType >::reset().
|
overridedefault |
Virtual destractor.
Virtual destractor
|
inlineoverridevirtual |
Get the buffer length.
Pure virtual function to get the buffer length.
Implements RTC::BufferBase< DataType >.
References RTC::RingBuffer< DataType >::full(), RTC::OK, and RTC::PRECONDITION_NOT_MET.
Referenced by RTC::RingBuffer< DataType >::read(), and RTC::RingBuffer< DataType >::write().
|
inlineoverridevirtual |
Get the buffer length.
Pure virtual function to get the buffer length.
Implements RTC::BufferBase< DataType >.
References RTC::RingBuffer< DataType >::empty(), RTC::OK, and RTC::PRECONDITION_NOT_MET.
Referenced by RTC::RingBuffer< DataType >::write().
|
inlineoverridevirtual |
Check on whether the buffer is empty.
Pure virtual function to check on whether the buffer is empty.
Implements RTC::BufferBase< DataType >.
Referenced by RTC::RingBuffer< DataType >::advanceWptr(), and RTC::RingBuffer< DataType >::read().
|
inlineoverridevirtual |
Check on whether the buffer is full.
Pure virtual function to check on whether the buffer is full.
Implements RTC::BufferBase< DataType >.
Referenced by RTC::RingBuffer< DataType >::advanceRptr(), and RTC::RingBuffer< DataType >::write().
|
inlineoverridevirtual |
Reading data from the buffer.
Implements RTC::BufferBase< DataType >.
Referenced by RTC::RingBuffer< DataType >::read().
|
inlineoverridevirtual |
Write data into the buffer.
Pure virtual function to write data into the buffer.
| value | Target data to write. |
Implements RTC::BufferBase< DataType >.
References RTC::OK.
|
inlineoverridevirtual |
Implements RTC::BufferBase< DataType >.
|
inlineoverridevirtual |
Get the buffer length.
Get the buffer length.
Implements RTC::BufferBase< DataType >.
|
inlineoverridevirtual |
Get the buffer length.
Pure virtual function to get the buffer length.
Implements RTC::BufferBase< DataType >.
References RTC::OK, and RTC::RingBuffer< DataType >::reset().
|
inlineoverridevirtual |
Write data into the buffer.
Pure virtual function to write data into the buffer. Always OK will be returned in this implementation.
| value | Target data to write. |
Implements RTC::BufferBase< DataType >.
References RTC::OK.
Referenced by RTC::RingBuffer< DataType >::write().
|
inlineoverridevirtual |
Readout data from the buffer.
Readout data stored into the buffer.
| value | Readout data |
Implements RTC::BufferBase< DataType >.
References RTC::RingBuffer< DataType >::advanceRptr(), RTC::EMPTY, RTC::RingBuffer< DataType >::empty(), RTC::RingBuffer< DataType >::get(), RTC::OK, RTC::PRECONDITION_NOT_MET, and RTC::TIMEOUT.
|
inlineoverridevirtual |
Write data into the buffer.
Pure virtual function to write data into the buffer.
| value | Target data to write. |
Implements RTC::BufferBase< DataType >.
|
inlineoverridevirtual |
Get the buffer length.
Pure virtual function to get the buffer length.
Implements RTC::BufferBase< DataType >.
References RTC::OK.
Referenced by RTC::RingBuffer< DataType >::length(), and RTC::RingBuffer< DataType >::RingBuffer().
|
inlineoverridevirtual |
Get the buffer length.
Pure virtual function to get the buffer length.
Implements RTC::BufferBase< DataType >.
|
inlineoverridevirtual |
Get the buffer length.
Pure virtual function to get the buffer length.
Implements RTC::BufferBase< DataType >.
|
inlineoverridevirtual |
Write data into the buffer.
Pure virtual function to write data into the buffer.
| value | Target data to write. |
Implements RTC::BufferBase< DataType >.
|
inlineoverridevirtual |
Write data into the buffer.
Write data which is given argument into the buffer.
| value | Target data for writing |
Implements RTC::BufferBase< DataType >.
References RTC::RingBuffer< DataType >::advanceRptr(), RTC::RingBuffer< DataType >::advanceWptr(), RTC::FULL, RTC::RingBuffer< DataType >::full(), RTC::OK, RTC::PRECONDITION_NOT_MET, RTC::RingBuffer< DataType >::put(), and RTC::TIMEOUT.