#include <utils.hpp>
|
| CircularBuffer (const std::size_t size) |
| Constructor.
|
|
void | Reset () |
| Reset buffer, discard all data.
|
|
std::size_t | Size () const |
| Get size (capacity) of buffer.
|
|
bool | Empty () const |
| Check if empty.
|
|
bool | Full () const |
| Check if full.
|
|
std::size_t | Used () const |
| Get size used.
|
|
std::size_t | Avail () const |
| Get size available.
|
|
bool | Write (const uint8_t *data, const std::size_t size) |
| Write chunk of data to buffer.
|
|
bool | Read (uint8_t *data, const std::size_t size) |
| Read chunk of data from buffer.
|
|
bool | Peek (uint8_t *data, const std::size_t size) |
| Read chunk of data from buffer (but don't remove it from the buffer)
|
|
Circular buffer for chunks of data (bytes, memory). For objects use use boost::circular_buffer or std::deque.
Definition at line 64 of file utils.hpp.
◆ CircularBuffer()
fpsdk::common::utils::CircularBuffer::CircularBuffer |
( |
const std::size_t | size | ) |
|
Constructor.
- Parameters
-
[in] | size | Size of buffer [bytes] |
◆ Size()
std::size_t fpsdk::common::utils::CircularBuffer::Size |
( |
| ) |
const |
Get size (capacity) of buffer.
- Returns
- the size (capacity) of the buffer
◆ Empty()
bool fpsdk::common::utils::CircularBuffer::Empty |
( |
| ) |
const |
Check if empty.
- Returns
- true if the buffer is empty, false otherwise
◆ Full()
bool fpsdk::common::utils::CircularBuffer::Full |
( |
| ) |
const |
Check if full.
- Returns
- true if the buffer is completely full
◆ Used()
std::size_t fpsdk::common::utils::CircularBuffer::Used |
( |
| ) |
const |
Get size used.
- Returns
- the size of the used part of the buffer
◆ Avail()
std::size_t fpsdk::common::utils::CircularBuffer::Avail |
( |
| ) |
const |
Get size available.
- Returns
- the size of the unused part of the buffer
◆ Write()
bool fpsdk::common::utils::CircularBuffer::Write |
( |
const uint8_t * | data, |
|
|
const std::size_t | size ) |
Write chunk of data to buffer.
- Parameters
-
[in] | data | Pointer to the data |
[in] | size | Size of the data (> 0) |
- Returns
- true if data was copied to the buffer, false otherwise (not enough free space, bad params)
◆ Read()
bool fpsdk::common::utils::CircularBuffer::Read |
( |
uint8_t * | data, |
|
|
const std::size_t | size ) |
Read chunk of data from buffer.
- Parameters
-
[in] | data | Pointer to the data |
[out] | size | Size of the data (> 0) |
- Returns
- true if data was copied from the buffer, false otherwise (not enough available data, bad params)
◆ Peek()
bool fpsdk::common::utils::CircularBuffer::Peek |
( |
uint8_t * | data, |
|
|
const std::size_t | size ) |
Read chunk of data from buffer (but don't remove it from the buffer)
- Parameters
-
[in] | data | Pointer to the data |
[out] | size | Size of the data (> 0) |
- Returns
- true if data was copied from the buffer, false otherwise (not enough available data, bad params)
The documentation for this class was generated from the following file: