PX4 Firmware
PX4 Autopilot Software http://px4.io
RingBuffer< data_type > Class Template Reference

#include <RingBuffer.h>

Collaboration diagram for RingBuffer< data_type >:

Public Member Functions

 RingBuffer ()
 
 ~RingBuffer ()
 
 RingBuffer (const RingBuffer &)=delete
 
RingBufferoperator= (const RingBuffer &)=delete
 
 RingBuffer (RingBuffer &&)=delete
 
RingBufferoperator= (RingBuffer &&)=delete
 
bool allocate (uint8_t size)
 
void unallocate ()
 
void push (const data_type &sample)
 
uint8_t get_length () const
 
data_type & operator[] (const uint8_t index)
 
const data_type & get_newest ()
 
const data_type & get_oldest ()
 
uint8_t get_oldest_index () const
 
bool pop_first_older_than (const uint64_t &timestamp, data_type *sample)
 
int get_total_size ()
 

Private Attributes

data_type * _buffer {nullptr}
 
uint8_t _head {0}
 
uint8_t _tail {0}
 
uint8_t _size {0}
 
bool _first_write {true}
 

Detailed Description

template<typename data_type>
class RingBuffer< data_type >

Definition at line 45 of file RingBuffer.h.

Constructor & Destructor Documentation

◆ RingBuffer() [1/3]

template<typename data_type>
RingBuffer< data_type >::RingBuffer ( )
inline

Definition at line 48 of file RingBuffer.h.

Referenced by RingBuffer< gpsSample >::~RingBuffer().

Here is the caller graph for this function:

◆ ~RingBuffer()

template<typename data_type>
RingBuffer< data_type >::~RingBuffer ( )
inline

Definition at line 56 of file RingBuffer.h.

◆ RingBuffer() [2/3]

template<typename data_type>
RingBuffer< data_type >::RingBuffer ( const RingBuffer< data_type > &  )
delete

◆ RingBuffer() [3/3]

template<typename data_type>
RingBuffer< data_type >::RingBuffer ( RingBuffer< data_type > &&  )
delete

Member Function Documentation

◆ allocate()

template<typename data_type>
bool RingBuffer< data_type >::allocate ( uint8_t  size)
inline

◆ get_length()

◆ get_newest()

template<typename data_type>
const data_type& RingBuffer< data_type >::get_newest ( )
inline

Definition at line 121 of file RingBuffer.h.

Referenced by Ekf::calculateOutputStates(), Ekf::controlExternalVisionFusion(), Ekf::controlFusionModes(), Ekf::controlHeightSensorTimeouts(), Ekf::initHagl(), Ekf::initialiseFilter(), and Ekf::resetHeight().

Here is the caller graph for this function:

◆ get_oldest()

template<typename data_type>
const data_type& RingBuffer< data_type >::get_oldest ( )
inline

Definition at line 122 of file RingBuffer.h.

Referenced by Ekf::calculateOutputStates(), and Ekf::collect_imu().

Here is the caller graph for this function:

◆ get_oldest_index()

template<typename data_type>
uint8_t RingBuffer< data_type >::get_oldest_index ( ) const
inline

Definition at line 124 of file RingBuffer.h.

Referenced by Ekf::calculateOutputStates().

Here is the caller graph for this function:

◆ get_total_size()

template<typename data_type>
int RingBuffer< data_type >::get_total_size ( )
inline

Definition at line 161 of file RingBuffer.h.

Referenced by EstimatorInterface::print_status().

Here is the caller graph for this function:

◆ operator=() [1/2]

template<typename data_type>
RingBuffer& RingBuffer< data_type >::operator= ( const RingBuffer< data_type > &  )
delete

Referenced by RingBuffer< gpsSample >::~RingBuffer().

Here is the caller graph for this function:

◆ operator=() [2/2]

template<typename data_type>
RingBuffer& RingBuffer< data_type >::operator= ( RingBuffer< data_type > &&  )
delete

◆ operator[]()

template<typename data_type>
data_type& RingBuffer< data_type >::operator[] ( const uint8_t  index)
inline

Definition at line 119 of file RingBuffer.h.

◆ pop_first_older_than()

template<typename data_type>
bool RingBuffer< data_type >::pop_first_older_than ( const uint64_t &  timestamp,
data_type *  sample 
)
inline

Definition at line 126 of file RingBuffer.h.

Referenced by Ekf::controlAuxVelFusion(), Ekf::controlDragFusion(), Ekf::controlFusionModes(), and Ekf::initialiseFilter().

Here is the caller graph for this function:

◆ push()

template<typename data_type>
void RingBuffer< data_type >::push ( const data_type &  sample)
inline

◆ unallocate()

template<typename data_type>
void RingBuffer< data_type >::unallocate ( )
inline

Definition at line 91 of file RingBuffer.h.

Referenced by EkfRingBufferTest::TearDown(), and EstimatorInterface::unallocate_buffers().

Here is the caller graph for this function:

Member Data Documentation

◆ _buffer

◆ _first_write

template<typename data_type>
bool RingBuffer< data_type >::_first_write {true}
private

◆ _head

template<typename data_type>
uint8_t RingBuffer< data_type >::_head {0}
private

◆ _size

◆ _tail


The documentation for this class was generated from the following files: