#include <ClearQueue.h>
|
| struct | node |
| | Node structure for the linked list implementation. More...
|
| |
|
| typedef std::function< void(const T &)> | VoidCallback |
| | Callback function type for forEach operations.
|
| |
|
| | ClearQueue (ClearQueue const &)=delete |
| | Deleted copy constructor to prevent copying.
|
| |
| void | operator= (ClearQueue const &)=delete |
| | Deleted assignment operator to prevent copying.
|
| |
| | ClearQueue () |
| | Constructs an empty queue.
|
| |
| virtual | ~ClearQueue () |
| | Destroys the queue and releases all allocated memory.
|
| |
| void | push (const T &value) |
| | Adds an element to the end of the queue.
|
| |
| bool | pushUnique (const T &value) |
| | Adds an element to the queue only if it doesn't already exist.
|
| |
| T | hardPop () |
| | Removes and returns the element at the front of the queue.
|
| |
| const T & | hardPeek () const |
| | Returns the element at the front of the queue without removing it.
|
| |
| T | pop (const T &errorCode) |
| | Safely removes and returns the element at the front of the queue.
|
| |
| const T & | peek (const T &errorCode) const |
| | Safely returns the element at the front of the queue without removing it.
|
| |
| bool | removeOne (const T &value) |
| | Removes the first occurrence of a specific value from the queue.
|
| |
| bool | contains (const T &value) const |
| | Checks if the queue contains a specific value.
|
| |
| T * | find (const T &value) const |
| | Finds and returns a pointer to the first occurrence of a value.
|
| |
| bool | isEmpty () const |
| | Checks if the queue is empty.
|
| |
| size_t | calcSize () const |
| | Calculate the number of elements in the queue by traversal.
|
| |
| void | clean () |
| | Removes all elements from the queue.
|
| |
| void | forEach (VoidCallback callback) const |
| | Executes a callback function on each element in the queue.
|
| |
|
| pnode | mHead |
| | Pointer to the first node in the queue.
|
| |
| pnode | mTail |
| | Pointer to the last node in the queue.
|
| |
◆ pnode
Node structure for the linked list implementation.
◆ VoidCallback
template<typename T>
| typedef std::function<void(const T &)> ClearQueue< T >::VoidCallback |
Callback function type for forEach operations.
◆ ClearQueue() [1/2]
Deleted copy constructor to prevent copying.
◆ ClearQueue() [2/2]
Constructs an empty queue.
◆ ~ClearQueue()
Destroys the queue and releases all allocated memory.
◆ calcSize()
Calculate the number of elements in the queue by traversal.
This method traverses the entire queue to count elements. Useful for debugging or when you need an accurate count.
- Return values
-
| size_t | The actual number of elements in the queue |
◆ clean()
Removes all elements from the queue.
◆ contains()
template<typename T>
| bool ClearQueue< T >::contains |
( |
const T & | value | ) |
const |
Checks if the queue contains a specific value.
- Parameters
-
| value | The value to search for |
- Return values
-
| true | The value exists in the queue |
| false | The value does not exist in the queue |
◆ find()
template<typename T>
| T * ClearQueue< T >::find |
( |
const T & | value | ) |
const |
Finds and returns a pointer to the first occurrence of a value.
- Parameters
-
| value | The value to search for |
- Return values
-
| T* | Pointer to the found element |
| nullptr | The value was not found in the queue |
◆ forEach()
Executes a callback function on each element in the queue.
- Parameters
-
| callback | Function to execute on each element |
◆ hardPeek()
Returns the element at the front of the queue without removing it.
- Warning
- This method assumes the queue is not empty. Call isEmpty() before using.
- Return values
-
| T& | Reference to the front element of the queue |
◆ hardPop()
Removes and returns the element at the front of the queue.
- Warning
- This method assumes the queue is not empty. Call isEmpty() before using.
- Return values
-
| T | The front element of the queue |
◆ isEmpty()
Checks if the queue is empty.
- Return values
-
| true | The queue is empty |
| false | The queue contains elements |
◆ operator=()
Deleted assignment operator to prevent copying.
◆ peek()
template<typename T>
| const T & ClearQueue< T >::peek |
( |
const T & | errorCode | ) |
const |
Safely returns the element at the front of the queue without removing it.
- Parameters
-
| errorCode | Value to return if the queue is empty |
- Return values
-
| T& | Reference to the front element of the queue |
| errorCode | The value to return if the queue is empty |
◆ pop()
Safely removes and returns the element at the front of the queue.
- Parameters
-
| errorCode | Value to return if the queue is empty |
- Return values
-
| T | The front element of the queue |
| errorCode | The value to return if the queue is empty |
◆ push()
Adds an element to the end of the queue.
- Parameters
-
| value | The value to add to the queue |
◆ pushUnique()
template<typename T>
| bool ClearQueue< T >::pushUnique |
( |
const T & | value | ) |
|
Adds an element to the queue only if it doesn't already exist.
- Parameters
-
| value | The value to add to the queue |
- Return values
-
| true | The element was added to the queue |
| false | The element already exists in the queue |
◆ removeOne()
template<typename T>
| bool ClearQueue< T >::removeOne |
( |
const T & | value | ) |
|
Removes the first occurrence of a specific value from the queue.
- Parameters
-
- Return values
-
| true | The value was found and removed |
| false | The value was not found in the queue |
◆ mHead
Pointer to the first node in the queue.
◆ mTail
Pointer to the last node in the queue.
The documentation for this class was generated from the following file: