MHVLib
20111011
An efficiency oriented runtime library for AVR microcontrollers
|
#include <MHV_RingBuffer.h>
Public Member Functions | |
MHV_RingBuffer (char *buffer, uint8_t length) | |
bool | append (char c) |
bool | append (const void *p, uint8_t pLength) |
uint8_t | length () |
uint8_t | size () |
bool | full () |
bool | full (uint8_t blockLength) |
void | flush () |
int | peekHead () |
int | consume () |
bool | consume (void *p, uint8_t length) |
void | copyLine (char *, uint8_t length) |
Definition at line 35 of file MHV_RingBuffer.h.
MHV_RingBuffer::MHV_RingBuffer | ( | char * | buffer, |
uint8_t | size | ||
) |
Create a new ringbuffer
buffer | memory to use for the ringbuffer |
size | the size of the available memory |
Definition at line 36 of file MHV_RingBuffer.cpp.
bool MHV_RingBuffer::append | ( | char | c | ) |
Append a character to the buffer
Definition at line 61 of file MHV_RingBuffer.cpp.
bool MHV_RingBuffer::append | ( | const void * | p, |
uint8_t | pLength | ||
) |
Append a block of data to the buffer
p | the pointer to append from |
pLength | the number of bytes to append |
Definition at line 81 of file MHV_RingBuffer.cpp.
int MHV_RingBuffer::consume | ( | ) |
Pop a byte off the ringbuffer
Definition at line 99 of file MHV_RingBuffer.cpp.
bool MHV_RingBuffer::consume | ( | void * | p, |
uint8_t | pLength | ||
) |
Pop a block off the ringbuffer
p | where to write the block |
pLength | the length of the block |
Definition at line 115 of file MHV_RingBuffer.cpp.
void MHV_RingBuffer::copyLine | ( | char * | , |
uint8_t | length | ||
) |
void MHV_RingBuffer::flush | ( | ) |
Discard the contents of the ringbuffer
Definition at line 134 of file MHV_RingBuffer.cpp.
bool MHV_RingBuffer::full | ( | ) |
Check if the ringbuffer is full
Definition at line 164 of file MHV_RingBuffer.cpp.
bool MHV_RingBuffer::full | ( | uint8_t | blockLength | ) |
Check if an object can fit in the ringbuffer
blockLength | the length of the object to fit in |
Definition at line 173 of file MHV_RingBuffer.cpp.
uint8_t MHV_RingBuffer::length | ( | ) |
Get the length of the contents of the ringbuffer Return the number of bytes in the ringbuffer
Definition at line 150 of file MHV_RingBuffer.cpp.
int MHV_RingBuffer::peekHead | ( | ) |
Check the first character in the buffer
Definition at line 182 of file MHV_RingBuffer.cpp.
uint8_t MHV_RingBuffer::size | ( | ) |
Get the size of the ringbuffer
Definition at line 142 of file MHV_RingBuffer.cpp.