MAV'RIC
Public Member Functions
Buffer_T< S, T > Class Template Reference

Circular buffer. More...

#include <buffer.hpp>

List of all members.

Public Member Functions

 Buffer_T (void)
 Constructor.
bool put_lossy (const T &data)
 Stores data in the buffer even of it overwrites existing data.
bool put (const T &data)
 Stores data in the buffer, until the buffer is full.
bool get (T &data)
 Get the oldest element in the buffer.
void clear (void)
 Clear the buffer.
uint32_t readable (void) const
 Returns the number of available bytes in the buffer.
uint32_t writeable (void) const
 Returns the number of free bytes in the buffer.
bool full (void) const
 Tests whether the buffer is full.
bool empty (void) const
 Tests whether the buffer is empty.
bool get_element (uint32_t index, T &elem) const
 Get value of i-th element in buffer, but does not modify anything.

Detailed Description

template<uint32_t S = 256, typename T = uint8_t>
class Buffer_T< S, T >

Circular buffer.

Template Parameters:
SSize of the buffer (256 by default)
TType of buffered data (uint8_t by default)

Member Function Documentation

template<uint32_t S, typename T >
void Buffer_T< S, T >::clear ( void  )

Clear the buffer.

This function erases the buffer, note that it does not erase all the bytes one by one so the function call is fast

Parameters:
bufferPointer to buffer

Here is the caller graph for this function:

template<uint32_t S, typename T >
bool Buffer_T< S, T >::empty ( void  ) const

Tests whether the buffer is empty.

Returns:
Boolean, 1 if empty, 0 if not

Here is the caller graph for this function:

template<uint32_t S, typename T >
bool Buffer_T< S, T >::full ( void  ) const

Tests whether the buffer is full.

Returns:
Boolean, 1 if full, 0 if not
template<uint32_t S, typename T>
bool Buffer_T< S, T >::get ( T &  data)

Get the oldest element in the buffer.

Parameters:
dataData read
Returns:
Success

Here is the caller graph for this function:

template<uint32_t S, typename T>
bool Buffer_T< S, T >::get_element ( uint32_t  index,
T &  elem 
) const

Get value of i-th element in buffer, but does not modify anything.

Parameters:
indexIndex of the element to read (input)
elemReturned element (output)
Returns:
success (false if does not exist)

Here is the caller graph for this function:

template<uint32_t S, typename T>
bool Buffer_T< S, T >::put ( const T &  data)

Stores data in the buffer, until the buffer is full.

Parameters:
datadata to write
Returns:
Success

Here is the caller graph for this function:

template<uint32_t S, typename T>
bool Buffer_T< S, T >::put_lossy ( const T &  data)

Stores data in the buffer even of it overwrites existing data.

Parameters:
datadata to write
Returns:
Success

Here is the caller graph for this function:

template<uint32_t S, typename T >
uint32_t Buffer_T< S, T >::readable ( void  ) const

Returns the number of available bytes in the buffer.

Returns:
Number of available bytes

Here is the caller graph for this function:

template<uint32_t S, typename T >
uint32_t Buffer_T< S, T >::writeable ( void  ) const

Returns the number of free bytes in the buffer.

Returns:
Number of free bytes

Here is the caller graph for this function:


The documentation for this class was generated from the following files:
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines