5#ifndef SAPPHIRE_LOGGER_RING_BUFFER_GUARD
6#define SAPPHIRE_LOGGER_RING_BUFFER_GUARD
33 T* mHandleBuffer =
nullptr;
36 std::atomic<bool>* mPushCompleted =
nullptr;
38 const uint32_t mCapacity = 0;
40 std::atomic<uint64_t> mPushCursor = 0u;
41 std::atomic<uint64_t> mPopCursor = 0u;
72 bool Pop(T& _obj, std::atomic<bool>& _bIsRunning);
75 uint32_t
Size() const noexcept;
88#include "RindBuffer.inl"
RingBuffer class implementation.
Definition RingBuffer.hpp:31
bool Pop(T &_obj, std::atomic< bool > &_bIsRunning)
Pop an object from the queue. Yield current thread if queue is empty.
bool IsEmpty() const noexcept
Whether the queue is empty.
uint32_t Capacity() const noexcept
Maximum capacity of the queue.
RingBuffer(uint32_t _capacity=32)
Value constructor
uint32_t Size() const noexcept
Current size of the queue.
void Push(T &&_obj)
Push an object to the queue Yield current thread if queue is full.