![]() |
F´ Flight Software - C/C++ Documentation
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 FwSizeType size) | |
void | setup (U8 *const buffer, const FwSizeType size) |
Fw::SerializeStatus | serialize (const U8 *const buffer, const FwSizeType size) |
Fw::SerializeStatus | peek (char &value, FwSizeType offset=0) const |
Fw::SerializeStatus | peek (U8 &value, FwSizeType offset=0) const |
Fw::SerializeStatus | peek (U32 &value, FwSizeType offset=0) const |
Fw::SerializeStatus | peek (U8 *buffer, FwSizeType size, FwSizeType offset=0) const |
Fw::SerializeStatus | rotate (FwSizeType amount) |
FwSizeType | get_allocated_size () const |
FwSizeType | get_free_size () const |
FwSizeType | get_capacity () const |
FwSizeType | get_high_water_mark () const |
void | clear_high_water_mark () |
Definition at line 25 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 21 of file CircularBuffer.cpp.
Types::CircularBuffer::CircularBuffer | ( | U8 *const | buffer, |
const FwSizeType | 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 31 of file CircularBuffer.cpp.
void Types::CircularBuffer::clear_high_water_mark | ( | ) |
Clear tracking of the largest allocated size
Definition at line 161 of file CircularBuffer.cpp.
FwSizeType Types::CircularBuffer::get_allocated_size | ( | ) | const |
Get the number of bytes allocated in the buffer
Definition at line 54 of file CircularBuffer.cpp.
FwSizeType 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 152 of file CircularBuffer.cpp.
FwSizeType 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 58 of file CircularBuffer.cpp.
FwSizeType Types::CircularBuffer::get_high_water_mark | ( | ) | const |
Return the largest tracked allocated size
Definition at line 157 of file CircularBuffer.cpp.
Fw::SerializeStatus Types::CircularBuffer::peek | ( | char & | value, |
FwSizeType | 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 89 of file CircularBuffer.cpp.
Fw::SerializeStatus Types::CircularBuffer::peek | ( | U8 & | value, |
FwSizeType | 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 94 of file CircularBuffer.cpp.
Fw::SerializeStatus Types::CircularBuffer::peek | ( | U32 & | value, |
FwSizeType | 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 106 of file CircularBuffer.cpp.
Fw::SerializeStatus Types::CircularBuffer::peek | ( | U8 * | buffer, |
FwSizeType | size, | ||
FwSizeType | 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 124 of file CircularBuffer.cpp.
Fw::SerializeStatus Types::CircularBuffer::rotate | ( | FwSizeType | 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 141 of file CircularBuffer.cpp.
Fw::SerializeStatus Types::CircularBuffer::serialize | ( | const U8 *const | buffer, |
const FwSizeType | 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 69 of file CircularBuffer.cpp.
void Types::CircularBuffer::setup | ( | U8 *const | buffer, |
const FwSizeType | 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 41 of file CircularBuffer.cpp.