|
ORIGINAL
|
Heap-based priority queue container. More...
#include <prique.h>


Public Member Functions | |
| prique (const SERIAL< TYPE, ALLOC< TYPE > > &serial=SERIAL< TYPE, ALLOC< TYPE > >{}, const Callback< TYPE > &compare=Callback< TYPE >{}) | |
| Constructs priority queue with container, comparator and allocator. | |
| prique (const std::initializer_list< TYPE > &lst, const Callback< TYPE > &compare=Callback< TYPE >{}) | |
| Constructs from initializer list with comparator and allocator. | |
| prique (const prique &other) | |
| Copy constructs a priority queue with allocator propagation. | |
| prique & | operator= (const prique &other) |
| Copy assignment operator. | |
| prique (prique &&other) noexcept | |
| Move constructs a priority queue with allocator propagation. | |
| prique & | operator= (prique &&other) noexcept |
| Move assignment operator. | |
| void | swap (prique &other) noexcept |
| Swaps contents with another priority queue. | |
| void | push (const TYPE &e) |
| Inserts element maintaining heap property. | |
| TYPE | pop () |
| Extracts highest priority element. | |
| TYPE | top () const |
| Accesses highest priority element. | |
| std::string | className () const override |
| Gets class name identifier. | |
Public Member Functions inherited from original::containerAdapter< TYPE, SERIAL, ALLOC > | |
| u_integer | size () const override |
| Returns the number of elements in the adapter. | |
| void | swap (containerAdapter &other) noexcept |
| Swaps the contents of this container adapter with another. | |
| void | clear () |
| Removes all elements from the adapter. | |
| bool | contains (const TYPE &e) const override |
| Checks for element existence in the adapter. | |
| integer | compareTo (const containerAdapter &other) const override |
| Compares two container adapters lexicographically. | |
| u_integer | toHash () const noexcept override |
| Computes hash value for the container adapter. | |
| std::string | toString (bool enter) const override |
| Generates formatted string representation. | |
| ~containerAdapter () override=default | |
| Virtual destructor for proper polymorphic cleanup. | |
Public Member Functions inherited from original::printable | |
| operator std::string () const | |
| Explicit conversion to std::string. | |
| operator const char * () const | |
| Explicit conversion to C-style string. | |
| const char * | toCString (bool enter) const |
| Direct C-string access with formatting control. | |
| template<typename TYPE > | |
| auto | formatString (const TYPE &t) -> std::string |
| template<typename TYPE > | |
| auto | formatCString (const TYPE &t) -> const char * |
| template<typename TYPE > | |
| auto | formatEnum (const TYPE &t) -> std::string |
| template<typename TYPE > | |
| auto | formatString (TYPE *const &ptr) -> std::string |
Public Member Functions inherited from original::container< TYPE, ALLOC< TYPE > > | |
| bool | empty () const |
| Checks if the container is empty. | |
| virtual | ~container ()=default |
| Destructor for the container class. | |
Public Member Functions inherited from original::comparable< containerAdapter< TYPE, SERIAL, ALLOC > > | |
| bool | operator== (const containerAdapter< TYPE, SERIAL, ALLOC > &other) const |
| Checks if the current object is equal to another. | |
| bool | operator!= (const containerAdapter< TYPE, SERIAL, ALLOC > &other) const |
| Checks if the current object is not equal to another. | |
| bool | operator< (const containerAdapter< TYPE, SERIAL, ALLOC > &other) const |
| Checks if the current object is less than another. | |
| bool | operator> (const containerAdapter< TYPE, SERIAL, ALLOC > &other) const |
| Checks if the current object is greater than another. | |
| bool | operator<= (const containerAdapter< TYPE, SERIAL, ALLOC > &other) const |
| Checks if the current object is less than or equal to another. | |
| bool | operator>= (const containerAdapter< TYPE, SERIAL, ALLOC > &other) const |
| Checks if the current object is greater than or equal to another. | |
| virtual | ~comparable ()=default |
| Virtual destructor for proper cleanup of derived objects. | |
Public Member Functions inherited from original::hashable< containerAdapter< TYPE, SERIAL, ALLOC > > | |
| virtual bool | equals (const containerAdapter< TYPE, SERIAL, ALLOC > &other) const noexcept |
| Compares two objects for equality. | |
| virtual | ~hashable ()=0 |
| Virtual destructor. | |
Additional Inherited Members | |
Static Public Member Functions inherited from original::printable | |
| template<typename TYPE > | |
| static std::string | formatString (const TYPE &t) |
| Universal value-to-string conversion with type-specific formatting. | |
| template<Printable TYPE> | |
| static std::string | formatString (const TYPE &t) |
| Specialization for types deriving from printable. | |
| template<EnumType TYPE> | |
| static std::string | formatString (const TYPE &t) |
| Specialization for enum types with type-safe formatting. | |
| template<typename TYPE > | |
| static std::string | formatString (TYPE *const &ptr) |
| Pointer-specific formatting with null safety. | |
| template<typename TYPE > | |
| static const char * | formatCString (const TYPE &t) |
| C-string cache for temporary usage with static storage. | |
| template<typename TYPE > | |
| static std::string | formatEnum (const TYPE &t) |
| Enum formatting utility with underlying value extraction. | |
| template<> | |
| auto | formatString (const char &t) -> std::string |
| template<> | |
| auto | formatString (const bool &t) -> std::string |
| template<> | |
| auto | formatString (const char *const &ptr) -> std::string |
Protected Member Functions inherited from original::containerAdapter< TYPE, SERIAL, ALLOC > | |
| containerAdapter (const SERIAL< TYPE, ALLOC< TYPE > > &serial) | |
| Constructs a container adapter with specified underlying container. | |
Protected Member Functions inherited from original::container< TYPE, ALLOC< TYPE > > | |
| container (ALLOC< TYPE > alloc=ALLOC< TYPE > {}) | |
| Constructs a container with specified allocator. | |
| TYPE * | allocate (u_integer size) |
| Allocates raw memory for elements. | |
| void | deallocate (TYPE *ptr, u_integer size) |
| Deallocates memory previously allocated by allocate() | |
| void | construct (O_TYPE *o_ptr, Args &&... args) |
| Constructs an element in-place. | |
| void | destroy (O_TYPE *o_ptr) |
| Destroys an element. | |
Protected Attributes inherited from original::containerAdapter< TYPE, SERIAL, ALLOC > | |
| SERIAL< TYPE, ALLOC< TYPE > > | serial_ |
| The underlying container instance. | |
Protected Attributes inherited from original::container< TYPE, ALLOC< TYPE > > | |
| ALLOC< TYPE > | allocator |
| The allocator instance used for memory management. | |
Heap-based priority queue container.
| TYPE | Type of elements stored in the priority queue |
| Callback | Comparison functor type (default: increaseComparator) |
| SERIAL | Underlying container type (default: blocksList) |
| ALLOC | Allocator template for memory management (default: allocator) |
Implements a priority queue using heap algorithms over an underlying container. The element priority is determined by the provided comparator.
The allocator is propagated to both the priority queue and the underlying serial container for consistent memory management of elements.
|
explicit |
Constructs priority queue with container, comparator and allocator.
| serial | Underlying container instance (default: empty) |
| compare | Comparison functor instance (default: default-constructed) |
Initializes heap structure using algorithms::heapInit. The allocator from the provided container will be used for all memory operations.
| original::prique< TYPE, Callback, SERIAL, ALLOC >::prique | ( | const std::initializer_list< TYPE > & | lst, |
| const Callback< TYPE > & | compare = Callback<TYPE>{} |
||
| ) |
Constructs from initializer list with comparator and allocator.
| lst | Elements to initialize the queue |
| compare | Comparison functor instance |
Uses the default allocator to construct the underlying container and populate it with elements from the initializer list.
| original::prique< TYPE, Callback, SERIAL, ALLOC >::prique | ( | const prique< TYPE, Callback, SERIAL, ALLOC > & | other | ) |
Copy constructs a priority queue with allocator propagation.
| other | Priority queue to copy from |
|
noexcept |
Move constructs a priority queue with allocator propagation.
| other | Queue to move from |
|
overridevirtual |
Gets class name identifier.
Reimplemented from original::containerAdapter< TYPE, SERIAL, ALLOC >.
| auto original::prique< TYPE, Callback, SERIAL, ALLOC >::operator= | ( | const prique< TYPE, Callback, SERIAL, ALLOC > & | other | ) |
Copy assignment operator.
| other | Priority queue to copy from |
|
noexcept |
Move assignment operator.
| other | Queue to move from |
| auto original::prique< TYPE, Callback, SERIAL, ALLOC >::pop | ( | ) |
Extracts highest priority element.
| original::noElementError | if queue is empty |
Uses algorithms::heapAdjustDown after extraction. The element is properly destroyed using the queue's allocator.
| auto original::prique< TYPE, Callback, SERIAL, ALLOC >::push | ( | const TYPE & | e | ) |
Inserts element maintaining heap property.
| e | Element to insert |
Uses algorithms::heapAdjustUp after insertion. The element is constructed using the queue's allocator.
|
noexcept |
Swaps contents with another priority queue.
| other | Priority queue to swap with |
Exchanges both the underlying container and the comparison functor. This method shadows the base class swap to ensure all resources (container and comparator) are properly exchanged.
Example usage:
| auto original::prique< TYPE, Callback, SERIAL, ALLOC >::top | ( | ) | const |
Accesses highest priority element.