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

Templated Circular buffer class. More...

#include <CircularBuffer.h>

Public Member Functions

void push (const T &data)
 Push the transaction to the buffer. More...
 
bool pop (T &data)
 Pop the transaction from the buffer. More...
 
bool empty () const
 Check if the buffer is empty. More...
 
bool full () const
 Check if the buffer is full. More...
 
void reset ()
 Reset the buffer. More...
 
CounterType size () const
 Get the number of elements currently stored in the circular_buffer. More...
 
bool peek (T &data) const
 Peek into circular buffer without popping. More...
 

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

Definition at line 66 of file CircularBuffer.h.

Member Function Documentation

bool empty ( ) const

Check if the buffer is empty.

Returns
True if the buffer is empty, false if not

Definition at line 135 of file CircularBuffer.h.

bool full ( ) const

Check if the buffer is full.

Returns
True if the buffer is full, false if not

Definition at line 147 of file CircularBuffer.h.

bool peek ( T &  data) const

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

Definition at line 190 of file CircularBuffer.h.

bool pop ( T &  data)

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

Definition at line 115 of file CircularBuffer.h.

void push ( const T &  data)

Push the transaction to the buffer.

This overwrites the buffer if it's full

Parameters
dataData to be pushed to the buffer

Definition at line 91 of file CircularBuffer.h.

void reset ( void  )

Reset the buffer.

Definition at line 158 of file CircularBuffer.h.

CounterType size ( ) const

Get the number of elements currently stored in the circular_buffer.

Definition at line 168 of file CircularBuffer.h.

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.