PX4 Firmware
PX4 Autopilot Software http://px4.io
|
#include <ringbuffer.h>
Public Member Functions | |
RingBuffer (unsigned num_items, size_t item_size) | |
virtual | ~RingBuffer () |
bool | put (const void *val, size_t val_size=0) |
Put an item into the buffer. More... | |
bool | put (int8_t val) |
bool | put (uint8_t val) |
bool | put (int16_t val) |
bool | put (uint16_t val) |
bool | put (int32_t val) |
bool | put (uint32_t val) |
bool | put (int64_t val) |
bool | put (uint64_t val) |
bool | put (float val) |
bool | put (double val) |
bool | force (const void *val, size_t val_size=0) |
Force an item into the buffer, discarding an older item if there is not space. More... | |
bool | force (int8_t val) |
bool | force (uint8_t val) |
bool | force (int16_t val) |
bool | force (uint16_t val) |
bool | force (int32_t val) |
bool | force (uint32_t val) |
bool | force (int64_t val) |
bool | force (uint64_t val) |
bool | force (float val) |
bool | force (double val) |
bool | get (void *val, size_t val_size=0) |
Get an item from the buffer. More... | |
bool | get (int8_t &val) |
bool | get (uint8_t &val) |
bool | get (int16_t &val) |
bool | get (uint16_t &val) |
bool | get (int32_t &val) |
bool | get (uint32_t &val) |
bool | get (int64_t &val) |
bool | get (uint64_t &val) |
bool | get (float &val) |
bool | get (double &val) |
unsigned | space (void) |
unsigned | count (void) |
bool | empty () |
bool | full () |
unsigned | size () |
void | flush () |
bool | resize (unsigned new_size) |
void | print_info (const char *name) |
Private Member Functions | |
unsigned | _next (unsigned index) |
RingBuffer (const RingBuffer &) | |
RingBuffer | operator= (const RingBuffer &) |
Private Attributes | |
unsigned | _num_items |
const size_t | _item_size |
char * | _buf |
volatile unsigned | _head |
insertion point in _item_size units More... | |
volatile unsigned | _tail |
removal point in _item_size units More... | |
Definition at line 49 of file ringbuffer.h.
RingBuffer< data_type >::RingBuffer | ( | unsigned | num_items, |
size_t | item_size | ||
) |
Definition at line 46 of file ringbuffer.cpp.
References _buf, and ~RingBuffer().
|
virtual |
|
private |
|
private |
Definition at line 60 of file ringbuffer.cpp.
References _num_items.
Referenced by flush(), and full().
unsigned RingBuffer< data_type >::count | ( | void | ) |
Definition at line 378 of file ringbuffer.cpp.
References _num_items, and space().
bool RingBuffer< data_type >::empty | ( | ) |
Definition at line 66 of file ringbuffer.cpp.
Referenced by flush().
void RingBuffer< data_type >::flush | ( | ) |
Definition at line 84 of file ringbuffer.cpp.
References _buf, _head, _item_size, _next(), _tail, empty(), and put().
bool __EXPORT::RingBuffer::force | ( | const void * | val, |
size_t | val_size = 0 |
||
) |
bool RingBuffer< data_type >::force | ( | int8_t | val | ) |
Definition at line 188 of file ringbuffer.cpp.
References force().
bool RingBuffer< data_type >::force | ( | uint8_t | val | ) |
Definition at line 194 of file ringbuffer.cpp.
References force().
bool RingBuffer< data_type >::force | ( | int16_t | val | ) |
Definition at line 200 of file ringbuffer.cpp.
References force().
bool RingBuffer< data_type >::force | ( | uint16_t | val | ) |
Definition at line 206 of file ringbuffer.cpp.
References force().
bool RingBuffer< data_type >::force | ( | int32_t | val | ) |
Definition at line 212 of file ringbuffer.cpp.
References force().
bool RingBuffer< data_type >::force | ( | uint32_t | val | ) |
Definition at line 218 of file ringbuffer.cpp.
References force().
bool RingBuffer< data_type >::force | ( | int64_t | val | ) |
Definition at line 224 of file ringbuffer.cpp.
References force().
bool RingBuffer< data_type >::force | ( | uint64_t | val | ) |
Definition at line 230 of file ringbuffer.cpp.
References force().
bool RingBuffer< data_type >::force | ( | float | val | ) |
Definition at line 236 of file ringbuffer.cpp.
References force().
bool RingBuffer< data_type >::force | ( | double | val | ) |
Definition at line 242 of file ringbuffer.cpp.
References force().
bool RingBuffer< data_type >::full | ( | ) |
Definition at line 72 of file ringbuffer.cpp.
References _head, _next(), and _tail.
bool __EXPORT::RingBuffer::get | ( | void * | val, |
size_t | val_size = 0 |
||
) |
Get an item from the buffer.
val | Item that was gotten |
bool RingBuffer< data_type >::get | ( | int8_t & | val | ) |
Definition at line 297 of file ringbuffer.cpp.
bool RingBuffer< data_type >::get | ( | uint8_t & | val | ) |
Definition at line 303 of file ringbuffer.cpp.
bool RingBuffer< data_type >::get | ( | int16_t & | val | ) |
Definition at line 309 of file ringbuffer.cpp.
bool RingBuffer< data_type >::get | ( | uint16_t & | val | ) |
Definition at line 315 of file ringbuffer.cpp.
bool RingBuffer< data_type >::get | ( | int32_t & | val | ) |
Definition at line 321 of file ringbuffer.cpp.
bool RingBuffer< data_type >::get | ( | uint32_t & | val | ) |
Definition at line 327 of file ringbuffer.cpp.
bool RingBuffer< data_type >::get | ( | int64_t & | val | ) |
Definition at line 333 of file ringbuffer.cpp.
bool RingBuffer< data_type >::get | ( | uint64_t & | val | ) |
Definition at line 339 of file ringbuffer.cpp.
bool RingBuffer< data_type >::get | ( | float & | val | ) |
Definition at line 345 of file ringbuffer.cpp.
bool RingBuffer< data_type >::get | ( | double & | val | ) |
Definition at line 351 of file ringbuffer.cpp.
|
private |
void RingBuffer< data_type >::print_info | ( | const char * | name | ) |
Definition at line 407 of file ringbuffer.cpp.
References _buf, _head, _item_size, _num_items, and _tail.
bool __EXPORT::RingBuffer::put | ( | const void * | val, |
size_t | val_size = 0 |
||
) |
bool RingBuffer< data_type >::put | ( | int8_t | val | ) |
Definition at line 111 of file ringbuffer.cpp.
References put().
bool RingBuffer< data_type >::put | ( | uint8_t | val | ) |
Definition at line 117 of file ringbuffer.cpp.
References put().
bool RingBuffer< data_type >::put | ( | int16_t | val | ) |
Definition at line 123 of file ringbuffer.cpp.
References put().
bool RingBuffer< data_type >::put | ( | uint16_t | val | ) |
Definition at line 129 of file ringbuffer.cpp.
References put().
bool RingBuffer< data_type >::put | ( | int32_t | val | ) |
Definition at line 135 of file ringbuffer.cpp.
References put().
bool RingBuffer< data_type >::put | ( | uint32_t | val | ) |
Definition at line 141 of file ringbuffer.cpp.
References put().
bool RingBuffer< data_type >::put | ( | int64_t | val | ) |
Definition at line 147 of file ringbuffer.cpp.
References put().
bool RingBuffer< data_type >::put | ( | uint64_t | val | ) |
Definition at line 153 of file ringbuffer.cpp.
References put().
bool RingBuffer< data_type >::put | ( | float | val | ) |
Definition at line 159 of file ringbuffer.cpp.
References put().
bool RingBuffer< data_type >::put | ( | double | val | ) |
Definition at line 165 of file ringbuffer.cpp.
References force(), and put().
bool RingBuffer< data_type >::resize | ( | unsigned | new_size | ) |
Definition at line 388 of file ringbuffer.cpp.
References _buf, _head, _item_size, _num_items, and _tail.
unsigned RingBuffer< data_type >::size | ( | ) |
Definition at line 78 of file ringbuffer.cpp.
References _buf, and _num_items.
unsigned RingBuffer< data_type >::space | ( | void | ) |
Definition at line 357 of file ringbuffer.cpp.
References _head, _num_items, and _tail.
Referenced by count().
|
private |
Definition at line 168 of file ringbuffer.h.
Referenced by flush(), print_info(), resize(), RingBuffer(), and size().
|
private |
insertion point in _item_size units
Definition at line 169 of file ringbuffer.h.
Referenced by empty(), flush(), full(), print_info(), resize(), and space().
|
private |
Definition at line 167 of file ringbuffer.h.
Referenced by flush(), print_info(), and resize().
|
private |
Definition at line 166 of file ringbuffer.h.
Referenced by _next(), count(), print_info(), resize(), size(), and space().
|
private |
removal point in _item_size units
Definition at line 170 of file ringbuffer.h.
Referenced by empty(), flush(), full(), print_info(), resize(), and space().