Implements internal recycling interface. Used by container types of module ALib Containers that use private recycling (when their template parameter TRecycling evaluates to Private).
TAllocator | The allocator to store and use. |
TNode | The type to recycle. Has to be derived of lang::SidiNodeBase. |
Definition at line 240 of file recycler.hpp.
#include <recycler.hpp>
Public Static Method Index: | |
static constexpr bool | IsRecycling () noexcept |
Public Method Index: | |
RecyclerPrivate () noexcept=default | |
Parameterless constructor. Used with type HeapAllocator. | |
RecyclerPrivate (const RecyclerPrivate ©) noexcept | |
RecyclerPrivate (RecyclerPrivate &&move) noexcept | |
RecyclerPrivate (TAllocator &pAllocator) noexcept | |
~RecyclerPrivate () noexcept | |
Destructor. Frees all recyclables with the allocator. | |
lang::AllocatorInterface< TAllocator > | AI () const noexcept |
integer | Count () const noexcept |
template<typename TChunk > | |
void | DisposeChunk (TChunk *chunk, size_t length) noexcept |
void | DisposeList (TNode *begin) noexcept |
void | DisposeList (TNode *begin, TNode *end) noexcept |
TNode * | Get () |
TAllocator & | GetAllocator () const noexcept |
void | Recycle (TNode *elem) noexcept |
template<typename TChunk > | |
void | RecycleChunk (TChunk *chunk, size_t length) noexcept |
void | RecycleList (TNode *begin) noexcept |
std::pair< TNode *, integer > | RecycleList (TNode *begin, TNode *end) noexcept |
void | Reserve (integer qty) noexcept |
void | Reset () noexcept |
Resets this recycler. Frees all recyclables with the allocator. | |
![]() | |
AllocatorMember ()=delete | |
Deleted default constructor. (The allocator has to be given with construction) | |
AllocatorMember (TAllocator &pAllocator) noexcept | |
AllocatorInterface< TAllocator > | AI () const noexcept |
TAllocator & | GetAllocator () const noexcept |
Protected Type Index: | |
using | base = lang::AllocatorMember<TAllocator> |
The base type. | |
Protected Field Index: | |
lang::SidiListHook< TNode > | recyclables |
The list of recyclables. | |
![]() | |
TAllocator & | allocator |
A reference to the allocator. | |
Additional Inherited Members | |
![]() | |
using | AllocatorType = TAllocator |
Exposes the allocator type. | |
|
protected |
The base type.
Definition at line 244 of file recycler.hpp.
|
protected |
The list of recyclables.
Definition at line 247 of file recycler.hpp.
|
inlineexplicitnoexcept |
Constructor taking an allocator.
pAllocator | The allocator to use. |
Definition at line 256 of file recycler.hpp.
|
inlinenoexcept |
Copy constructor. Does not copy the recycle node, but clears this one.
copy | The object to copy. |
Definition at line 261 of file recycler.hpp.
|
inlinenoexcept |
Move constructor. Grabs the recyclables from the moved one and sets moved to nulled.
move | The private recycler to move. |
Definition at line 266 of file recycler.hpp.
|
inlinenoexcept |
Destructor. Frees all recyclables with the allocator.
Definition at line 274 of file recycler.hpp.
|
inlinenoexcept |
Definition at line 299 of file recycler.hpp.
|
inlinenodiscardnoexcept |
Counts the number of recyclables.
Attention: This method runs in linear time.
Definition at line 308 of file recycler.hpp.
|
inlinenoexcept |
Frees the given memory. Note that the shared recycler calls RecycleChunk with this method.
TChunk | The type of array that is to be freed. |
chunk | The chunk array to convert into nodes |
length | The length of the chunk array (pass 1 if the chunk is not an array type). |
Definition at line 374 of file recycler.hpp.
|
inlinenoexcept |
Deletes the given list. This shared recycler does not free the node, but recycles them.
begin | The first element of the list to free. |
Definition at line 341 of file recycler.hpp.
|
inlinenoexcept |
Deletes a list of elements for recycling. Both given nodes have to exist.
begin | The first element of the list to free. |
end | The first element not to be freed. |
Definition at line 346 of file recycler.hpp.
|
inlinenodiscard |
Returns a recycled object or allocates a new one.
Definition at line 318 of file recycler.hpp.
|
inlinenoexcept |
Definition at line 296 of file recycler.hpp.
|
inlinestaticconstexprnoexcept |
true
to indicate that this is not a non-recycling version. Definition at line 302 of file recycler.hpp.
|
inlinenoexcept |
Stores an element for recycling.
elem | The element to store. |
Definition at line 324 of file recycler.hpp.
|
inlinenoexcept |
Converts a given chunk of memory, previously allocated with the same allocator that this type uses, into recyclable node objects.
This is only done if Allocator::allowsMemSplit returns true
.
TChunk | The type of array that is to be cut into node elements. |
chunk | The chunk array to convert into nodes |
length | The length of the chunk array (pass 1 if the chunk is not an array type). |
Definition at line 357 of file recycler.hpp.
|
inlinenoexcept |
Stores a list of elements for recycling (from the begin element to the last one).
begin | The first element of the list store, must not be nullptr . |
Definition at line 328 of file recycler.hpp.
|
inlinenoexcept |
Stores a list of elements for recycling. Both given nodes have to exist.
begin | The first element of the list to recycle. |
end | The first element not to be recycled. |
Definition at line 335 of file recycler.hpp.
|
inlinenoexcept |
Reserves the given number of recyclables.
qty | The number of new recyclables to allocate. |
Definition at line 313 of file recycler.hpp.
|
inlinenoexcept |
Resets this recycler. Frees all recyclables with the allocator.
Definition at line 286 of file recycler.hpp.