#include <queue.h>
A Queue that holds elements of type T, stored in a circular buffer. Supports access from both ends.
| Public Types | |
| using | ValueType = T | 
| Public Member Functions | |
| Queue ()=default | |
| Queue (const Queue &)=delete | |
| Queue & | operator= (const Queue &)=delete | 
| Queue (Queue &&src) | |
| Queue & | operator= (Queue &&src) | 
| Int | GetCount () const | 
| Bool | IsEmpty () const | 
| Bool | IsPopulated () const | 
| Optional< T & > | Peek () | 
| Optional< const T & > | Peek () const | 
| Optional< T & > | PeekBack () | 
| Optional< const T & > | PeekBack () const | 
| ResultMem | Push (T value) | 
| ResultMem | PushFront (T value) | 
| template<typename ... ARGS> | |
| ResultMem | Emplace (ARGS &&... args) | 
| template<typename ... ARGS> | |
| ResultMem | EmplaceFront (ARGS &&... args) | 
| Optional< T > | Pop () | 
| Optional< T > | PopBack () | 
| Bool | Truncate () | 
| Bool | TruncateBack () | 
| void | Flush () | 
| void | Reset () | 
| Block< T > | AlignAsBlock () | 
| ~Queue () | |
| Result< void > | CopyFrom (const Queue &src) | 
| ResultMem | EnsureCapacity (Int requestedSize) | 
| Private Member Functions | |
| void | Linearize () | 
| Bool | IsAtFullCapacity () const | 
| Int | CalcNewCapacity (Int targetSize) const | 
| Bool | Grow (Int targetSize=0) | 
| Result< void > | CopyDataToNewBuffer (T *destPtr) const | 
| void | MoveDataToNewBuffer (T *destPtr) | 
| void | PushToHead (T &&value) | 
| void | PushToTail (T &&value) | 
| template<typename ... ARGS> | |
| void | EmplaceAtHead (ARGS &&... args) | 
| template<typename ... ARGS> | |
| void | EmplaceAtTail (ARGS &&... args) | 
| T | PopFromTail () | 
| T | PopFromHead () | 
| void | TruncateTail () | 
| void | TruncateHead () | 
| Static Private Member Functions | |
| static MAXON_ATTRIBUTE_FORCE_INLINE void | IncrementIndex (Int &index, Int capacity) | 
| static MAXON_ATTRIBUTE_FORCE_INLINE void | DecrementIndex (Int &index, Int capacity) | 
| Private Attributes | |
| AutoMem< T > | _data | 
| Int | _headIndex | 
| Int | _tailIndex | 
| Int | _count | 
| Int | _capacity | 
| Static Private Attributes | |
| static const Int | GROW_INIT | 
| static const Int | GROW_FACTOR | 
| using ValueType = T | 
| 
 | default | 
Default constructor. Creates an empty queue.
| ~Queue | ( | ) | 
The destructor resets the queue.
| Int GetCount | ( | ) | const | 
Returns the number of elements in the queue.
| Bool IsEmpty | ( | ) | const | 
Checks if the queue contains no elements.
| Bool IsPopulated | ( | ) | const | 
Checks if the queue contains any elements.
| Optional<T&> Peek | ( | ) | 
Returns a reference to the element at the front of the queue without removing it, or NO_VALUE if the queue was empty.
| Optional<const T&> Peek | ( | ) | const | 
| Optional<T&> PeekBack | ( | ) | 
Returns a reference to the element at the back of the queue without removing it, or NO_VALUE if the queue was empty.
| Optional<const T&> PeekBack | ( | ) | const | 
| ResultMem Push | ( | T | value | ) | 
Pushes an element to the back of the queue.
| ResultMem PushFront | ( | T | value | ) | 
Pushes an element to the front of the queue.
| ResultMem Emplace | ( | ARGS &&... | args | ) | 
Constructs an element in-place at the back of the queue with the given arguments as constructor arguments.
| ResultMem EmplaceFront | ( | ARGS &&... | args | ) | 
Constructs an element in-place at the front of the queue with the given arguments.
| Optional<T> Pop | ( | ) | 
Returns the element at the front of the queue and removes it, or NO_VALUE if the queue was empty.
| Optional<T> PopBack | ( | ) | 
Returns the element at the back of the queue and removes it, or NO_VALUE if the queue was empty.
| Bool Truncate | ( | ) | 
Removes the element at the front of the queue without returning it. Returns true if the operation succeeded, or false if the queue was empty.
| Bool TruncateBack | ( | ) | 
Removes the element at the back of the queue without returning it. Returns true if the operation succeeded, or false if the queue was empty.
| void Flush | ( | ) | 
Removes all elements from the queue by calling their destructors, but does not de-allocate the memory yet.
| void Reset | ( | ) | 
Removes all elements from the queue by calling their destructors and frees the allocated memory.
| Block<T> AlignAsBlock | ( | ) | 
Linearizes the internal data storage and returns the elements as a block, from front to back.
Ensures that the queue can hold requestedSize items without allocating additional memory. Can be used for optimization to pre-allocate a sufficiently large internal buffer instead of growing on-demand. 
| 
 | staticprivate | 
| 
 | staticprivate | 
| 
 | private | 
| 
 | private | 
| 
 | private | 
| 
 | private | 
| 
 | private | 
| 
 | private | 
| 
 | private | 
| 
 | private | 
| 
 | private | 
| 
 | private | 
| 
 | private | 
| 
 | private | 
| 
 | staticprivate | 
| 
 | staticprivate | 
| 
 | private | 
| 
 | private | 
| 
 | private | 
| 
 | private | 
| 
 | private |