TinyRobotics
Loading...
Searching...
No Matches
Public Member Functions | List of all members
BaseBuffer< T > Class Template Referenceabstract

Shared functionality of all buffers. More...

#include <Buffers.h>

Inheritance diagram for BaseBuffer< T >:
Inheritance graph
[legend]

Public Member Functions

 BaseBuffer (BaseBuffer &)=default
 
BaseBufferoperator= (BaseBuffer &)=default
 
virtual bool read (T &result)=0
 reads a single value
 
virtual int readArray (T data[], int len)
 reads multiple values
 
virtual int clearArray (int len)
 Removes the next len entries.
 
virtual int writeArray (const T data[], int len)
 Fills the buffer data.
 
virtual int writeArrayOverwrite (const T data[], int len)
 Fills the buffer data and overwrites the oldest data if the buffer is full.
 
virtual bool peek (T &result)=0
 peeks the actual entry from the buffer
 
virtual bool isFull ()
 checks if the buffer is full
 
bool isEmpty ()
 
virtual bool write (T data)=0
 write add an entry to the buffer
 
virtual void reset ()=0
 clears the buffer
 
void clear ()
 same as reset
 
virtual int available ()=0
 provides the number of entries that are available to read
 
virtual int availableForWrite ()=0
 provides the number of entries that are available to write
 
virtual T * address ()=0
 returns the address of the start of the physical read buffer
 
virtual size_t size ()=0
 
virtual float levelPercent ()
 Returns the level of the buffer in %.
 
virtual bool resize (int bytes)
 Resizes the buffer if supported: returns false if not supported.
 

Detailed Description

template<typename T = int16_t>
class tinyrobotics::BaseBuffer< T >

Shared functionality of all buffers.

Author
Phil Schatzmann

Member Function Documentation

◆ address()

virtual T * address ( )
pure virtual

◆ available()

virtual int available ( )
pure virtual

◆ availableForWrite()

virtual int availableForWrite ( )
pure virtual

◆ clearArray()

virtual int clearArray ( int  len)
inlinevirtual

Removes the next len entries.

Reimplemented in SingleBuffer< T >, SingleBuffer< T >, and SingleBuffer< uint8_t >.

◆ isFull()

virtual bool isFull ( )
inlinevirtual

◆ peek()

virtual bool peek ( T &  result)
pure virtual

◆ read()

virtual bool read ( T &  result)
pure virtual

◆ readArray()

virtual int readArray ( data[],
int  len 
)
inlinevirtual

reads multiple values

Reimplemented in BufferRTOS< T, TAllocator >, SynchronizedBuffer< T >, and BufferRP2040T< T >.

◆ reset()

virtual void reset ( )
pure virtual

◆ resize()

virtual bool resize ( int  bytes)
inlinevirtual

Resizes the buffer if supported: returns false if not supported.

Reimplemented in RingBuffer< T >, RingBuffer< uint8_t >, SingleBuffer< T >, SingleBuffer< T >, and SingleBuffer< uint8_t >.

◆ size()

virtual size_t size ( )
pure virtual

Implemented in RingBuffer< T >, and RingBuffer< uint8_t >.

◆ write()

virtual bool write ( data)
pure virtual

◆ writeArray()

virtual int writeArray ( const T  data[],
int  len 
)
inlinevirtual

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