semf
semf::LastInDmaBuffer< T > Class Template Reference

The LastInDmaBuffer class implements a kind of circular buffer. More...

#include <lastindmabuffer.h>

Inheritance diagram for semf::LastInDmaBuffer< T >:
Inheritance graph
Collaboration diagram for semf::LastInDmaBuffer< T >:
Collaboration graph

Public Member Functions

virtual void put (T data)
 Write data in the buffer. More...
 
virtual T & operator[] (size_t pos) const
 Returns the entry from a specific position in the buffer. More...
 
void setStride (size_t stride)
 Set the stride between to entries of the same input. More...
 
size_t size () const
 Returns the size of the buffer. More...
 
size_t count () const override
 Returns the number of entries stored in the buffer. More...
 
- Public Member Functions inherited from semf::LastInBuffer< T >
virtual ~LastInBuffer ()=default
 
virtual void put (T data)
 Writes data in the buffer. More...
 
void fill (T data)
 Fills the whole buffer with the same object content. More...
 
virtual T & operator[] (size_t pos) const
 Returns the entry from a specific position in the buffer. More...
 
void setPos (size_t pos)
 Sets the write position of the buffer. More...
 
size_t pos () const
 Returns the current write position. More...
 
- Public Member Functions inherited from semf::Buffer< T >
 Buffer ()=default
 
 Buffer (T buffer[], size_t bufferSize)
 Constructor with data array initialization. More...
 
virtual ~Buffer ()=default
 
void setBuffer (T buffer[], size_t bufferSize)
 Sets the data array. More...
 
virtual T & operator[] (size_t pos) const
 Returns the entry from a specific position in the buffer. More...
 
size_t size () const
 Returns the size of the buffer. More...
 
virtual size_t count () const
 Returns the number of entries stored in the buffer. More...
 
T * data () const
 Returns the pointer to the first element of the data array. More...
 

Detailed Description

template<typename T>
class semf::LastInDmaBuffer< T >

The LastInDmaBuffer class implements a kind of circular buffer.

LastInDmaBuffer handles multiple LastInBuffer in one data array.

The data base is an array with the data type defined by the template parameter T. To use the LastInDmaBuffer set the array in the constructor or by the function setData().

The data can be accessed by the functions

  • data() to get the pointer to the data array,
  • at() to get the element on a specific position and

The data can be stored in the buffer by the function put().

See also Buffer, LastInBuffer RingBuffer and Average.

Note
For using LastInDmaBuffer a global CriticalSection object is required.
Template Parameters
Typeof data to handle.

Definition at line 38 of file lastindmabuffer.h.

Member Function Documentation

◆ count()

template<typename T >
size_t semf::LastInDmaBuffer< T >::count
overridevirtual

Returns the number of entries stored in the buffer.

Note
For LastInDmaBuffer count() returns size().
Returns
Number of entries.

Reimplemented from semf::Buffer< T >.

Definition at line 105 of file lastindmabuffer.h.

◆ operator[]()

template<typename T >
T & semf::LastInDmaBuffer< T >::operator[] ( size_t  pos) const
virtual

Returns the entry from a specific position in the buffer.

Parameters
posPosition in the buffer.
Returns
The Entry.

Reimplemented from semf::LastInBuffer< T >.

Definition at line 87 of file lastindmabuffer.h.

Here is the call graph for this function:

◆ put()

template<typename T >
void semf::LastInDmaBuffer< T >::put ( data)
virtual

Write data in the buffer.

Parameters
dataData to write in the buffer.

Reimplemented from semf::LastInBuffer< T >.

Definition at line 78 of file lastindmabuffer.h.

Here is the call graph for this function:

◆ setStride()

template<typename T >
void semf::LastInDmaBuffer< T >::setStride ( size_t  stride)

Set the stride between to entries of the same input.

Note
For example: Use a dma sampling three different data, the stride between two entries in this buffer is 3.
Parameters
strideStride between to entries.

Definition at line 93 of file lastindmabuffer.h.

◆ size()

template<typename T >
size_t semf::LastInDmaBuffer< T >::size

Returns the size of the buffer.

Returns
Buffer size.

Definition at line 99 of file lastindmabuffer.h.

Here is the call graph for this function: