SA_Logger
Sapphire's Suite's C++ Logger.
Loading...
Searching...
No Matches
Public Member Functions | List of all members
SA::RingBuffer< T > Class Template Reference

RingBuffer class implementation. More...

#include <RingBuffer.hpp>

Public Member Functions

 RingBuffer (uint32_t _capacity=32)
 Value constructor
 
 ~RingBuffer ()
 
void Push (T &&_obj)
 Push an object to the queue Yield current thread if queue is full.
 
bool Pop (T &_obj, std::atomic< bool > &_bIsRunning)
 Pop an object from the queue. Yield current thread if queue is empty.
 
uint32_t Size () const noexcept
 Current size of the queue.
 
uint32_t Capacity () const noexcept
 Maximum capacity of the queue.
 
bool IsEmpty () const noexcept
 Whether the queue is empty.
 

Detailed Description

template<typename T>
class SA::RingBuffer< T >

RingBuffer class implementation.

Template Parameters
ExcepTObject's type to buffer.

Constructor & Destructor Documentation

◆ RingBuffer()

template<typename T >
SA::RingBuffer< T >::RingBuffer ( uint32_t _capacity = 32)

Value constructor

Parameters
[in]_capacityRingBuffer capacity.

◆ ~RingBuffer()

template<typename T >
SA::RingBuffer< T >::~RingBuffer ( )

Destructor Does NOT check for remaining size before destroy.

Member Function Documentation

◆ Pop()

template<typename T >
bool SA::RingBuffer< T >::Pop ( T & _obj,
std::atomic< bool > & _bIsRunning )

Pop an object from the queue. Yield current thread if queue is empty.

Parameters
[out]_objObject to pop from the queue.
[in]_bIsRunningCurrent running thread state.

◆ Push()

template<typename T >
void SA::RingBuffer< T >::Push ( T && _obj)

Push an object to the queue Yield current thread if queue is full.

Parameters
[in,out]_objObject to move to the queue.

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