DUNE: Uniform Navigational Environment
2019.02.1
|
Implementation of a First In First Out data structure, that can hold raw data (byte streams).
Data is stored internally in a circular buffer. This structure can be accessed without locks when there is only one concurrent writer and one concurrent reader.
Public Member Functions | |
RawFifo (uint32_t size) | |
RawFifo (uint8_t *data, uint32_t size) | |
~RawFifo (void) | |
void | reset (void) |
uint32_t | size (void) |
uint32_t | put (const uint8_t *buffer, uint32_t length) |
uint32_t | get (uint8_t *buffer, uint32_t length) |
uint32_t | getHead (uint8_t *buffer, uint32_t length) |
uint32_t | discard (uint32_t length) |
DUNE::Utils::RawFifo::RawFifo | ( | uint32_t | size | ) |
Creates a new FIFO, allocating necessary space.
size | size of the FIFO data (will be transformed to the nearest power of two). |
References DUNE::Math::computeNextPowerOfTwo().
DUNE::Utils::RawFifo::RawFifo | ( | uint8_t * | data, |
uint32_t | size | ||
) |
Creates a FIFO from an existing array.
data | array of data. |
size | size of the array (must be a power of two). |
|
inline |
Class destructor.
uint32_t DUNE::Utils::RawFifo::discard | ( | uint32_t | length | ) |
Discards data from the FIFO.
length | amount of bytes to discard. |
Referenced by get().
|
inline |
uint32_t DUNE::Utils::RawFifo::getHead | ( | uint8_t * | buffer, |
uint32_t | length | ||
) |
Retrieves the head of the FIFO.
buffer | buffer that will hold the retrieved data. |
length | amount of bytes to retrieve. |
Referenced by get().
uint32_t DUNE::Utils::RawFifo::put | ( | const uint8_t * | buffer, |
uint32_t | length | ||
) |
Inserts data into the FIFO.
buffer | data to be inserted. |
length | length of the data to be inserted. |
Referenced by size().
|
inline |
Resets the FIFO contents.
|
inline |