ORIGINAL
|
Abstract base class for containers. More...
#include <container.h>
Public Member Functions | |
virtual u_integer | size () const =0 |
Gets the number of elements in the container. | |
bool | empty () const |
Checks if the container is empty. | |
virtual bool | contains (const TYPE &e) const =0 |
Checks if an element is contained in the container. | |
virtual | ~container ()=default |
Destructor for the container class. | |
Protected Member Functions | |
container (ALLOC alloc=ALLOC{}) | |
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() | |
template<typename O_TYPE , typename... Args> | |
void | construct (O_TYPE *o_ptr, Args &&... args) |
Constructs an element in-place. | |
template<typename O_TYPE > | |
void | destroy (O_TYPE *o_ptr) |
Destroys an element. | |
Protected Attributes | |
ALLOC | allocator |
The allocator instance used for memory management. | |
Abstract base class for containers.
TYPE | Type of the elements stored in the container. |
ALLOC | Allocator type for memory management (default is allocator<TYPE>) |
Provides a common interface for container classes to manage a collection of elements. Supports querying the size, checking for emptiness, and checking if an element is contained. Uses the provided allocator for all memory management operations.
|
explicitprotected |
Constructs a container with specified allocator.
alloc | Allocator instance to use for memory management (has default-constructed ALLOC) |
Initializes the container with the given allocator. The allocator will be used for all memory operations performed by the container.
|
virtualdefault |
Destructor for the container class.
Ensures proper cleanup of resources if necessary.
|
protected |
Allocates raw memory for elements.
size | Number of elements to allocate memory for |
Constructs an element in-place.
O_TYPE | Type of object to construct (must be compatible with TYPE) |
Args | Types of constructor arguments |
o_ptr | Pointer to the memory where the object should be constructed |
args | Arguments to forward to the constructor |
Uses the container's allocator to construct an object of type O_TYPE
Checks if an element is contained in the container.
e | Element to check for presence in the container. |
This method must be implemented by derived classes to provide the actual containment check.
Implemented in original::serial< bool, allocator< bool > >, original::serial< hashNode *, rebind_alloc_pointer >, original::serial< opts, allocator< opts > >, original::serial< original::hashTable::hashNode *, rebind_alloc_pointer >, original::serial< original::skipList::skipListNode *, allocator< original::skipList::skipListNode * > >, original::serial< original::strongPtr< original::filter< TYPE > >, allocator< original::strongPtr< original::filter< TYPE > > > >, original::serial< original::strongPtr< original::transform< TYPE > >, allocator< original::strongPtr< original::transform< TYPE > > > >, original::serial< original::strongPtr< taskBase >, allocator< original::strongPtr< taskBase > > >, original::serial< original::thread, allocator< original::thread > >, original::containerAdapter< priorityTask, vector, allocator >, original::serial< priorityTask, allocator< priorityTask > >, original::containerAdapter< TYPE, SERIAL, ALLOC >, original::containerAdapter< TYPE, blocksList, allocator >, original::containerAdapter< TYPE, chain, allocator >, original::serial< TYPE, ALLOC >, original::serial< TYPE, allocator< TYPE > >, original::serial< TYPE *, allocator< TYPE * > >, and original::serial< underlying_type, rebind_alloc_underlying >.
Deallocates memory previously allocated by allocate()
ptr | Pointer to the memory to deallocate |
size | Number of elements the memory was allocated for |
|
protected |
Destroys an element.
O_TYPE | Type of object to destroy (must be compatible with TYPE) |
o_ptr | Pointer to the object to destroy |
Uses the container's allocator to properly destroy the object
|
pure virtual |
Gets the number of elements in the container.
This method must be implemented by derived classes to return the correct size.
Implemented in original::array< TYPE, ALLOC >, original::array< original::thread >, original::array< underlying_type, rebind_alloc_underlying >, original::bitSet< ALLOC >, original::blocksList< TYPE, ALLOC >, original::blocksList< TYPE, allocator< TYPE > >, original::chain< TYPE, ALLOC >, original::chain< opts >, original::chain< original::strongPtr< original::filter< TYPE > > >, original::chain< original::strongPtr< original::transform< TYPE > > >, original::chain< original::strongPtr< taskBase >, allocator< original::strongPtr< taskBase > > >, original::chain< TYPE, allocator< TYPE > >, original::containerAdapter< TYPE, SERIAL, ALLOC >, original::containerAdapter< original::strongPtr< taskBase >, chain, allocator >, original::containerAdapter< priorityTask, vector, allocator >, original::containerAdapter< TYPE, blocksList, allocator >, original::containerAdapter< TYPE, chain, allocator >, original::forwardChain< TYPE, ALLOC >, original::vector< TYPE, ALLOC >, original::vector< hashNode *, rebind_alloc_pointer >, original::vector< original::hashTable::hashNode *, rebind_alloc_pointer >, original::vector< original::skipList::skipListNode * >, original::vector< priorityTask, allocator< priorityTask > >, and original::vector< TYPE * >.
|
protected |
The allocator instance used for memory management.
Used by derived classes to allocate/deallocate memory and construct/destroy elements