F´ Flight Software - C/C++ Documentation
devel
A framework for building embedded system applications to NASA flight quality standards.
|
#include <Utils/Types/CircularBuffer.hpp>
Public Member Functions | |
CircularBuffer () | |
CircularBuffer (U8 *const buffer, const NATIVE_UINT_TYPE size) | |
void | setup (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) const |
Fw::SerializeStatus | peek (U8 &value, NATIVE_UINT_TYPE offset=0) const |
Fw::SerializeStatus | peek (U32 &value, NATIVE_UINT_TYPE offset=0) const |
Fw::SerializeStatus | peek (U8 *buffer, NATIVE_UINT_TYPE size, NATIVE_UINT_TYPE offset=0) const |
Fw::SerializeStatus | rotate (NATIVE_UINT_TYPE amount) |
NATIVE_UINT_TYPE | get_allocated_size () const |
NATIVE_UINT_TYPE | get_free_size () const |
NATIVE_UINT_TYPE | get_capacity () const |
NATIVE_UINT_TYPE | get_high_water_mark () const |
void | clear_high_water_mark () |
Definition at line 27 of file CircularBuffer.hpp.
Types::CircularBuffer::CircularBuffer | ( | ) |
Circular buffer constructor. Wraps the supplied buffer as the new data store. Buffer size is supplied in the 'size' argument.
Note: specification of storage buffer must be done using setup
before use.
Definition at line 25 of file CircularBuffer.cpp.
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. This is equivalent to calling the no-argument constructor followed by setup(buffer, size).
Note: ownership of the supplied buffer is held until the circular buffer is deallocated
buffer | supplied buffer used as a data store. |
size | the of the supplied data store. |
Definition at line 35 of file CircularBuffer.cpp.
void Types::CircularBuffer::clear_high_water_mark | ( | ) |
Clear tracking of the largest allocated size
Definition at line 165 of file CircularBuffer.cpp.
NATIVE_UINT_TYPE Types::CircularBuffer::get_allocated_size | ( | ) | const |
Get the number of bytes allocated in the buffer
Definition at line 58 of file CircularBuffer.cpp.
NATIVE_UINT_TYPE Types::CircularBuffer::get_capacity | ( | ) | const |
Get the logical capacity of the buffer, i.e., the number of available bytes when the buffer is empty
Definition at line 156 of file CircularBuffer.cpp.
NATIVE_UINT_TYPE Types::CircularBuffer::get_free_size | ( | ) | const |
Get the number of free bytes, i.e., the number of bytes that may be stored in the buffer without deleting data and without exceeding the buffer capacity
Definition at line 62 of file CircularBuffer.cpp.
NATIVE_UINT_TYPE Types::CircularBuffer::get_high_water_mark | ( | ) | const |
Return the largest tracked allocated size
Definition at line 161 of file CircularBuffer.cpp.
Fw::SerializeStatus Types::CircularBuffer::peek | ( | char & | value, |
NATIVE_UINT_TYPE | offset = 0 |
||
) | const |
Deserialize data into the given variable without moving the head index
value | value to fill |
offset | offset from head to start peak. Default: 0 |
Definition at line 93 of file CircularBuffer.cpp.
Fw::SerializeStatus Types::CircularBuffer::peek | ( | U32 & | value, |
NATIVE_UINT_TYPE | offset = 0 |
||
) | const |
Deserialize data into the given variable without moving the head index
value | value to fill |
offset | offset from head to start peak. Default: 0 |
Definition at line 110 of file CircularBuffer.cpp.
Fw::SerializeStatus Types::CircularBuffer::peek | ( | U8 & | value, |
NATIVE_UINT_TYPE | offset = 0 |
||
) | const |
Deserialize data into the given variable without moving the head index
value | value to fill |
offset | offset from head to start peak. Default: 0 |
Definition at line 98 of file CircularBuffer.cpp.
Fw::SerializeStatus Types::CircularBuffer::peek | ( | U8 * | buffer, |
NATIVE_UINT_TYPE | size, | ||
NATIVE_UINT_TYPE | offset = 0 |
||
) | const |
Deserialize data into the given buffer without moving the head variable.
buffer | buffer to fill with data of the peek |
size | size in bytes to peek at |
offset | offset from head to start peak. Default: 0 |
Definition at line 128 of file CircularBuffer.cpp.
Fw::SerializeStatus Types::CircularBuffer::rotate | ( | NATIVE_UINT_TYPE | amount | ) |
Rotate the head index, deleting data from the circular buffer and making space. Cannot rotate more than the available space.
amount | amount to rotate by (in bytes) |
Definition at line 145 of file CircularBuffer.cpp.
Fw::SerializeStatus Types::CircularBuffer::serialize | ( | const U8 *const | buffer, |
const NATIVE_UINT_TYPE | size | ||
) |
Serialize a given buffer into this circular buffer. Will not accept more data than space available. This means it will not overwrite existing data.
buffer | supplied buffer to be serialized. |
size | size of the supplied buffer. |
Definition at line 73 of file CircularBuffer.cpp.
void Types::CircularBuffer::setup | ( | U8 *const | buffer, |
const NATIVE_UINT_TYPE | size | ||
) |
Wraps the supplied buffer as the new data store. Buffer size is supplied in the 'size' argument. Cannot be called after successful setup.
Note: ownership of the supplied buffer is held until the circular buffer is deallocated
buffer | supplied buffer used as a data store. |
size | the of the supplied data store. |
Definition at line 45 of file CircularBuffer.cpp.