20#ifndef RTC_BUFFERBASE_H
21#define RTC_BUFFERBASE_H
24#include <coil/Properties.h>
104 template <
class DataType>
133 virtual void init(
const coil::Properties& prop) = 0;
230 virtual DataType*
wptr(
long int n = 0) = 0;
309 std::chrono::nanoseconds timeout
310 = std::chrono::nanoseconds(-1)) = 0;
377 virtual DataType*
rptr(
long int n = 0) = 0;
449 virtual DataType&
get() = 0;
475 std::chrono::nanoseconds nsec
476 = std::chrono::nanoseconds(-1)) = 0;
550 template <
class DataType>
645 virtual bool write(
const DataType& value)
674 virtual bool read(DataType& value)
748 virtual void put(
const DataType& data)
772 virtual const DataType&
get()
Buffer status enum definition.
BufferBase abstract class.
Definition BufferBase.h:106
virtual size_t writable() const =0
Get a writable number.
virtual BufferStatus advanceRptr(long int n=1, bool unlock_enable=true)=0
Forward n reading pointers.
virtual BufferStatus put(const DataType &value)=0
Write data into the buffer.
virtual size_t length() const =0
Get the buffer length.
virtual BufferStatus get(DataType &value)=0
Read data from the buffer.
virtual DataType & get()=0
Read data from the buffer.
virtual ~BufferBase()=default
Virtual destructor.
virtual void init(const coil::Properties &prop)=0
Set the buffer.
virtual BufferStatus reset()=0
Reset the buffer status.
virtual size_t readable() const =0
Write data into the buffer.
virtual BufferStatus read(DataType &value, std::chrono::nanoseconds nsec=std::chrono::nanoseconds(-1))=0
Read data from the buffer.
virtual BufferStatus length(size_t n)=0
Set the buffer length.
virtual BufferStatus write(const DataType &value, std::chrono::nanoseconds timeout=std::chrono::nanoseconds(-1))=0
Write data into the buffer.
virtual DataType * wptr(long int n=0)=0
Get the writing pointer.
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 bool empty() const =0
Check on whether the buffer is empty.
virtual BufferStatus advanceWptr(long int n=1, bool unlock_enable=true)=0
Forward n writing pointers.
Concrete buffer class for dummy.
Definition BufferBase.h:553
virtual void put(const DataType &data)
Store data into the buffer.
Definition BufferBase.h:748
virtual bool isFull() const
Check on whether the buffer is full.
Definition BufferBase.h:699
virtual const DataType & get()
Get data from the buffer.
Definition BufferBase.h:772
virtual long int length() const
Get the buffer length (always 1)
Definition BufferBase.h:617
virtual ~NullBuffer()=default
Destructor.
virtual DataType & getRef()
Get the buffer's reference to be written the next.
Definition BufferBase.h:799
NullBuffer(long int size=1)
Constructer.
Definition BufferBase.h:576
virtual bool read(DataType &value)
Read data from the buffer.
Definition BufferBase.h:674
virtual bool write(const DataType &value)
Write data into the buffer.
Definition BufferBase.h:645
virtual bool isEmpty() const
Check on whether the buffer is empty.
Definition BufferBase.h:723
BufferStatus
DataPortStatus return codes.
Definition BufferStatus.h:57