CoreFlow 1.0.0
A modern orchestration and execution runtime
Loading...
Searching...
No Matches
CircularQueue< T, MaxDepth > Class Template Reference

Circular queue implementation. More...

#include <circular_queue.hpp>

Public Member Functions

 CircularQueue ()
 Construct a new Circular Queue object.
 
bool enqueue (const T &ref)
 Enqueue an element into the queue.
 
bool dequeue (T &out)
 Dequeue an element from the queue.
 
bool peek (T &out) const
 Peek at the element at the front of the queue without removing it.
 
std::size_t size () const
 Get the size of the queue.
 
bool empty () const
 Check if the queue is empty.
 
bool full () const
 Check if the queue is full.
 

Detailed Description

template<typename T, std::size_t MaxDepth>
class CircularQueue< T, MaxDepth >

Circular queue implementation.

Template Parameters
TType of elements in the queue
MaxDepthMaximum depth of the queue

Constructor & Destructor Documentation

◆ CircularQueue()

template<typename T, std::size_t MaxDepth>
CircularQueue< T, MaxDepth >::CircularQueue ( )
inline

Construct a new Circular Queue object.

See also
Extension: AI/ML

Member Function Documentation

◆ dequeue()

template<typename T, std::size_t MaxDepth>
bool CircularQueue< T, MaxDepth >::dequeue ( T & out)
inline

Dequeue an element from the queue.

Parameters
outReference to store the dequeued element
Returns
true if successful, false if the queue is empty

◆ empty()

template<typename T, std::size_t MaxDepth>
bool CircularQueue< T, MaxDepth >::empty ( ) const
inline

Check if the queue is empty.

Returns
true if empty, false otherwise

◆ enqueue()

template<typename T, std::size_t MaxDepth>
bool CircularQueue< T, MaxDepth >::enqueue ( const T & ref)
inline

Enqueue an element into the queue.

Parameters
refElement to enqueue
Returns
true if successful, false if the queue is full

◆ full()

template<typename T, std::size_t MaxDepth>
bool CircularQueue< T, MaxDepth >::full ( ) const
inline

Check if the queue is full.

Returns
true if full, false otherwise

◆ peek()

template<typename T, std::size_t MaxDepth>
bool CircularQueue< T, MaxDepth >::peek ( T & out) const
inline

Peek at the element at the front of the queue without removing it.

Parameters
outReference to store the peeked element
Returns
true if successful, false if the queue is empty

◆ size()

template<typename T, std::size_t MaxDepth>
std::size_t CircularQueue< T, MaxDepth >::size ( ) const
inline

Get the size of the queue.

Returns
std::size_t Size of the queue