ORIGINAL
|
Base class for variable-size serial containers. More...
#include <baseList.h>
Public Member Functions | |
virtual void | add (const TYPE &e) |
Adds an element to the end of the list. | |
virtual TYPE | remove (const TYPE &e) |
Removes an element from the list. | |
virtual void | clear () |
Removes all elements. | |
virtual void | push (integer index, const TYPE &e)=0 |
Inserts an element at a specific index. | |
virtual TYPE | pop (integer index)=0 |
Removes an element from a specific index. | |
virtual void | pushBegin (const TYPE &e)=0 |
Inserts an element at the beginning of the list. | |
virtual TYPE | popBegin ()=0 |
Removes an element from the beginning of the list. | |
virtual void | pushEnd (const TYPE &e)=0 |
Inserts an element at the end of the list. | |
virtual TYPE | popEnd ()=0 |
Removes an element from the end of the list. | |
![]() | |
virtual TYPE | get (integer index) const =0 |
Retrieves the element at the specified index. | |
virtual TYPE | getBegin () const |
Retrieves the first element in the container. | |
virtual TYPE | getEnd () const |
Retrieves the last element in the container. | |
virtual TYPE | operator[] (integer index) const |
Retrieves the element at the specified index (const version). | |
virtual TYPE & | operator[] (integer index)=0 |
Retrieves or sets the element at the specified index. | |
virtual void | set (integer index, const TYPE &e)=0 |
Sets the element at the specified index. | |
virtual u_integer | indexOf (const TYPE &e) const =0 |
Finds the index of the specified element. | |
bool | contains (const TYPE &e) const override |
Checks if the container contains the specified element. | |
![]() | |
virtual u_integer | size () const =0 |
Gets the number of elements in the container. | |
bool | empty () const |
Checks if the container is empty. | |
virtual | ~container ()=default |
Destructor for the container class. | |
Additional Inherited Members | |
![]() | |
bool | indexOutOfBound (integer index) const |
Checks if the provided index is out of bounds. | |
integer | parseNegIndex (integer index) const |
Converts negative indices into valid positive indices. | |
![]() | |
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. | |
![]() | |
ALLOC | allocator |
The allocator instance used for memory management. | |
Base class for variable-size serial containers.
TYPE | Type of the elements contained in the base list |
ALLOC | Allocator type for dynamic memory management (default depends on derived class) |
This class serves as the base class for containers that can dynamically grow or shrink in size. It inherits from original::serial and provides an interface for manipulating elements in a variable-size sequence.
The allocator is used for all dynamic memory operations including:
Key memory characteristics:
The ALLOC type must meet C++ allocator requirements and provide:
|
virtual |
Adds an element to the end of the list.
e | The element to be added to the list. |
This method adds an element to the end of the container by calling pushEnd
.
|
virtual |
Removes all elements.
Uses the allocator to:
|
pure virtual |
Removes an element from a specific index.
index | The index of the element to be removed. |
This method must be implemented by derived classes.
Implemented in 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< TYPE, allocator< TYPE > >, original::forwardChain< TYPE, ALLOC >, original::vector< TYPE, ALLOC >, and original::vector< TYPE * >.
|
pure virtual |
Removes an element from the beginning of the list.
This method must be implemented by derived classes.
Implemented in 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< TYPE, allocator< TYPE > >, original::forwardChain< TYPE, ALLOC >, original::vector< TYPE, ALLOC >, and original::vector< TYPE * >.
|
pure virtual |
Removes an element from the end of the list.
This method must be implemented by derived classes.
Implemented in 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< TYPE, allocator< TYPE > >, original::forwardChain< TYPE, ALLOC >, original::vector< TYPE, ALLOC >, and original::vector< TYPE * >.
|
pure virtual |
Inserts an element at a specific index.
index | The index where the element should be inserted. |
e | The element to be inserted. |
This method must be implemented by derived classes.
Implemented in 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< TYPE, allocator< TYPE > >, original::forwardChain< TYPE, ALLOC >, original::vector< TYPE, ALLOC >, and original::vector< TYPE * >.
|
pure virtual |
Inserts an element at the beginning of the list.
e | The element to be inserted. |
This method must be implemented by derived classes.
Implemented in 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< TYPE, allocator< TYPE > >, original::forwardChain< TYPE, ALLOC >, original::vector< TYPE, ALLOC >, and original::vector< TYPE * >.
|
pure virtual |
Inserts an element at the end of the list.
e | The element to be inserted. |
This method must be implemented by derived classes.
Implemented in 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< TYPE, allocator< TYPE > >, original::forwardChain< TYPE, ALLOC >, original::vector< TYPE, ALLOC >, and original::vector< TYPE * >.
|
virtual |
Removes an element from the list.
e | The element to be removed. |
This method finds the element in the list and removes it by calling pop
at the found index.