Mistake on this page?
Report an issue in GitHub or email us
Public Member Functions
mbed::CircularBuffer< T, BufferSize, CounterType > Class Template Reference

#include <CircularBuffer.h>

Public Member Functions

void push (const T &data)
 
bool pop (T &data)
 
bool empty () const
 
bool full () const
 
void reset ()
 
CounterType size () const
 
bool peek (T &data) const
 

Detailed Description

template<typename T, uint32_t BufferSize, typename CounterType = uint32_t>
class mbed::CircularBuffer< T, BufferSize, CounterType >

Templated Circular buffer class

Note
Synchronization level: Interrupt safe
CounterType must be unsigned and consistent with BufferSize

Member Function Documentation

template<typename T, uint32_t BufferSize, typename CounterType = uint32_t>
bool mbed::CircularBuffer< T, BufferSize, CounterType >::empty ( ) const
inline

Check if the buffer is empty

Returns
True if the buffer is empty, false if not
template<typename T, uint32_t BufferSize, typename CounterType = uint32_t>
bool mbed::CircularBuffer< T, BufferSize, CounterType >::full ( ) const
inline

Check if the buffer is full

Returns
True if the buffer is full, false if not
template<typename T, uint32_t BufferSize, typename CounterType = uint32_t>
bool mbed::CircularBuffer< T, BufferSize, CounterType >::peek ( T &  data) const
inline

Peek into circular buffer without popping

Parameters
dataData to be peeked from the buffer
Returns
True if the buffer is not empty and data contains a transaction, false otherwise
template<typename T, uint32_t BufferSize, typename CounterType = uint32_t>
bool mbed::CircularBuffer< T, BufferSize, CounterType >::pop ( T &  data)
inline

Pop the transaction from the buffer

Parameters
dataData to be popped from the buffer
Returns
True if the buffer is not empty and data contains a transaction, false otherwise
template<typename T, uint32_t BufferSize, typename CounterType = uint32_t>
void mbed::CircularBuffer< T, BufferSize, CounterType >::push ( const T &  data)
inline

Push the transaction to the buffer. This overwrites the buffer if it's full

Parameters
dataData to be pushed to the buffer
template<typename T, uint32_t BufferSize, typename CounterType = uint32_t>
void mbed::CircularBuffer< T, BufferSize, CounterType >::reset ( void  )
inline

Reset the buffer

template<typename T, uint32_t BufferSize, typename CounterType = uint32_t>
CounterType mbed::CircularBuffer< T, BufferSize, CounterType >::size ( ) const
inline

Get the number of elements currently stored in the circular_buffer


The documentation for this class was generated from the following file:
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.