APM:Libraries
|
#include <AP_Buffer.h>
Public Member Functions | |
AP_Buffer () | |
void | clear () |
void | push_back (const T &item) |
bool | pop_front (T &ret) |
const T & | peek (uint8_t position) const |
T & | peek_mutable (uint8_t position) |
const T & | front () const |
uint8_t | size () const |
bool | is_full () const |
bool | is_empty () const |
Private Attributes | |
uint8_t | _num_items |
uint8_t | _head |
T | _buff [SIZE] |
Definition at line 9 of file AP_Buffer.h.
Constructor
Definition at line 68 of file AP_Buffer.h.
void AP_Buffer< T, SIZE >::clear | ( | ) |
clear - removes all elements from the queue
Definition at line 74 of file AP_Buffer.h.
|
inline |
front - return a reference to the element at the begin of the queue (i.e. the oldest element) If the queue is empty, 0 is returned.
Definition at line 43 of file AP_Buffer.h.
|
inline |
|
inline |
is_full - return true if the queue is full (i.e. size() == SIZE)
Definition at line 51 of file AP_Buffer.h.
const T & AP_Buffer< T, SIZE >::peek | ( | uint8_t | position | ) | const |
peek - returns a reference to an element of the buffer if position isn't valid (i.e. >= size()) 0 is returned
position | : index of the element "0" is the oldest, size()-1 is the newest |
Definition at line 128 of file AP_Buffer.h.
Referenced by AP_Buffer< AP_ADSB::adsb_vehicle_t, max_samples >::front().
T & AP_Buffer< T, SIZE >::peek_mutable | ( | uint8_t | position | ) |
Definition at line 141 of file AP_Buffer.h.
bool AP_Buffer< T, SIZE >::pop_front | ( | T & | ret | ) |
pop_front - removes an element from the beginning of the buffer (i.e. the oldest element) and returns it in ret.
ret | : the removed element, if exists |
Definition at line 105 of file AP_Buffer.h.
void AP_Buffer< T, SIZE >::push_back | ( | const T & | item | ) |
push_back - adds an item to the end of the buffer. If the buffer is full, the oldest element (i.e. the element at the begin) is removed
item |
Definition at line 81 of file AP_Buffer.h.
|
inline |
size - returns the number of elements in the queue
Definition at line 47 of file AP_Buffer.h.
|
private |
Definition at line 60 of file AP_Buffer.h.
Referenced by AP_Buffer< AP_ADSB::adsb_vehicle_t, max_samples >::peek(), AP_Buffer< AP_ADSB::adsb_vehicle_t, max_samples >::peek_mutable(), AP_Buffer< AP_ADSB::adsb_vehicle_t, max_samples >::pop_front(), and AP_Buffer< AP_ADSB::adsb_vehicle_t, max_samples >::push_back().
|
private |
Definition at line 59 of file AP_Buffer.h.
Referenced by AP_Buffer< AP_ADSB::adsb_vehicle_t, max_samples >::clear(), AP_Buffer< AP_ADSB::adsb_vehicle_t, max_samples >::peek(), AP_Buffer< AP_ADSB::adsb_vehicle_t, max_samples >::peek_mutable(), AP_Buffer< AP_ADSB::adsb_vehicle_t, max_samples >::pop_front(), and AP_Buffer< AP_ADSB::adsb_vehicle_t, max_samples >::push_back().
|
private |
Definition at line 58 of file AP_Buffer.h.
Referenced by AP_Buffer< AP_ADSB::adsb_vehicle_t, max_samples >::clear(), AP_Buffer< AP_ADSB::adsb_vehicle_t, max_samples >::is_empty(), AP_Buffer< AP_ADSB::adsb_vehicle_t, max_samples >::is_full(), AP_Buffer< AP_ADSB::adsb_vehicle_t, max_samples >::pop_front(), AP_Buffer< AP_ADSB::adsb_vehicle_t, max_samples >::push_back(), and AP_Buffer< AP_ADSB::adsb_vehicle_t, max_samples >::size().