F´ Flight Software - C/C++ Documentation  NASA-v1.5.0
A framework for building embedded system applications to NASA flight quality standards.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Types::CircularBuffer Class Reference

#include <Utils/Types/CircularBuffer.hpp>

Public Member Functions

 CircularBuffer (U8 *const buffer, const NATIVE_UINT_TYPE size)
 
Fw::SerializeStatus serialize (const U8 *const buffer, const NATIVE_UINT_TYPE size)
 
Fw::SerializeStatus peek (char &value, NATIVE_UINT_TYPE offset=0)
 
Fw::SerializeStatus peek (U8 &value, NATIVE_UINT_TYPE offset=0)
 
Fw::SerializeStatus peek (U32 &value, NATIVE_UINT_TYPE offset=0)
 
Fw::SerializeStatus peek (U8 *buffer, NATIVE_UINT_TYPE size, NATIVE_UINT_TYPE offset=0)
 
Fw::SerializeStatus rotate (NATIVE_UINT_TYPE amount)
 
NATIVE_UINT_TYPE get_remaining_size (bool serialization=false)
 

Detailed Description

Definition at line 31 of file CircularBuffer.hpp.

Constructor & Destructor Documentation

◆ CircularBuffer()

Types::CircularBuffer::CircularBuffer ( U8 *const  buffer,
const NATIVE_UINT_TYPE  size 
)

Circular buffer constructor. Wraps the supplied buffer as the new data store. Buffer size is supplied in the 'size' argument.

Note: ownership of the supplied buffer is held until the circular buffer is destructed.

Parameters
constU8* buffer: supplied buffer used as a data store.
NATIVE_UINT_TYPEsize: size of the supplied data store.

Definition at line 26 of file CircularBuffer.cpp.

Member Function Documentation

◆ get_remaining_size()

NATIVE_UINT_TYPE Types::CircularBuffer::get_remaining_size ( bool  serialization = false)

Get the remaining size in this circular buffer.

Parameters
boolserialization: is this serialization (opposed to deserialization)

Definition at line 33 of file CircularBuffer.cpp.

◆ peek() [1/4]

Fw::SerializeStatus Types::CircularBuffer::peek ( char &  value,
NATIVE_UINT_TYPE  offset = 0 
)

Deserialize data into the given variable without moving the head pointer

Parameters
U8&value: value to fill

Definition at line 76 of file CircularBuffer.cpp.

◆ peek() [2/4]

Fw::SerializeStatus Types::CircularBuffer::peek ( U32 &  value,
NATIVE_UINT_TYPE  offset = 0 
)

Deserialize data into the given variable without moving the head pointer

Parameters
U32&value: value to fill

Definition at line 94 of file CircularBuffer.cpp.

◆ peek() [3/4]

Fw::SerializeStatus Types::CircularBuffer::peek ( U8 value,
NATIVE_UINT_TYPE  offset = 0 
)

Deserialize data into the given variable without moving the head pointer

Parameters
U8&value: value to fill

Definition at line 80 of file CircularBuffer.cpp.

◆ peek() [4/4]

Fw::SerializeStatus Types::CircularBuffer::peek ( U8 buffer,
NATIVE_UINT_TYPE  size,
NATIVE_UINT_TYPE  offset = 0 
)

Deserialize data into the given buffer without moving the head variable.

Parameters
U32&value: value to fill

Definition at line 115 of file CircularBuffer.cpp.

◆ rotate()

Fw::SerializeStatus Types::CircularBuffer::rotate ( NATIVE_UINT_TYPE  amount)

Rotate the head pointer effectively erasing data from the circular buffer and making space. Cannot rotate more than the available space.

Parameters
NATIVE_UINT_TYPEamount: amount to rotate by (in bytes)

Definition at line 136 of file CircularBuffer.cpp.

◆ serialize()

Fw::SerializeStatus Types::CircularBuffer::serialize ( const U8 *const  buffer,
const NATIVE_UINT_TYPE  size 
)

Serialize a given buffer into this this circular buffer. Will not accept more data then space available. This means it will not overwrite existing data.

Parameters
constU8* buffer: supplied buffer to be serialized.
NATIVE_UINT_TYPEsize: size of the supplied buffer.

Definition at line 54 of file CircularBuffer.cpp.


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