PhysicsBasedAnimationToolkit 0.0.10
Cross-platform C++20 library of algorithms and data structures commonly used in computer graphics research on physically-based simulation.
Loading...
Searching...
No Matches
pbat::common::Queue< T, kCapacity > Class Template Reference

Fixed-size queue implementation. More...

#include <Queue.h>

Public Member Functions

PBAT_HOST_DEVICE Queue ()
 Construct empty Queue.
 
PBAT_HOST_DEVICE void Push (T value)
 Add element to the queue.
 
PBAT_HOST_DEVICE T const & Top () const
 Get the next element in the queue.
 
PBAT_HOST_DEVICE void Pop ()
 Remove the next element in the queue.
 
PBAT_HOST_DEVICE bool IsFull () const
 Check if the queue is full.
 
PBAT_HOST_DEVICE bool IsEmpty () const
 Check if the queue is empty.
 
PBAT_HOST_DEVICE auto Size () const
 Get the number of elements in the queue.
 
PBAT_HOST_DEVICE void Clear ()
 Clear the queue.
 
PBAT_HOST_DEVICE constexpr auto Capacity () const
 Get the maximum number of elements in the queue.
 

Detailed Description

template<class T, auto kCapacity = 64>
class pbat::common::Queue< T, kCapacity >

Fixed-size queue implementation.

Template Parameters
TType of the elements in the queue
kCapacityMaximum number of elements in the queue

Member Function Documentation

◆ Capacity()

template<class T, auto kCapacity = 64>
PBAT_HOST_DEVICE constexpr auto pbat::common::Queue< T, kCapacity >::Capacity ( ) const
inlineconstexpr

Get the maximum number of elements in the queue.

Returns
Maximum number of elements in the queue

◆ IsEmpty()

template<class T, auto kCapacity = 64>
PBAT_HOST_DEVICE bool pbat::common::Queue< T, kCapacity >::IsEmpty ( ) const
inline

Check if the queue is empty.

Returns
True if the queue is empty

◆ IsFull()

template<class T, auto kCapacity = 64>
PBAT_HOST_DEVICE bool pbat::common::Queue< T, kCapacity >::IsFull ( ) const
inline

Check if the queue is full.

Returns
True if the queue is full

◆ Pop()

template<class T, auto kCapacity = 64>
PBAT_HOST_DEVICE void pbat::common::Queue< T, kCapacity >::Pop ( )
inline

Remove the next element in the queue.

Precondition
The queue is not empty

◆ Push()

template<class T, auto kCapacity = 64>
PBAT_HOST_DEVICE void pbat::common::Queue< T, kCapacity >::Push ( T value)
inline

Add element to the queue.

Parameters
valueElement to add
Precondition
The queue is not full

◆ Size()

template<class T, auto kCapacity = 64>
PBAT_HOST_DEVICE auto pbat::common::Queue< T, kCapacity >::Size ( ) const
inline

Get the number of elements in the queue.

Returns
Number of elements in the queue

◆ Top()

template<class T, auto kCapacity = 64>
PBAT_HOST_DEVICE T const & pbat::common::Queue< T, kCapacity >::Top ( ) const
inline

Get the next element in the queue.

Returns
Next element in the queue
Precondition
The queue is not empty

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