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 224 of file recycling.inl.
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. | |
Public Method Index: inherited from alib::lang::AllocatorMember< TAllocator > | |
| template<typename TIf = TAllocator> requires std::is_default_constructible_v<TIf> | |
| AllocatorMember () | |
| 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. | |
Protected Field Index: inherited from alib::lang::AllocatorMember< TAllocator > | |
| TAllocator * | allocator |
| The allocator stored. | |
Additional Inherited Members | |
Public Type Index: inherited from alib::lang::AllocatorMember< TAllocator > | |
| using | AllocatorType = TAllocator |
| Exposes the allocator type. | |
|
protected |
The base type.
Definition at line 228 of file recycling.inl.
|
protected |
The list of recyclables.
Definition at line 231 of file recycling.inl.
|
inlineexplicitnoexcept |
Constructor taking an allocator.
| pAllocator | The allocator to use. |
Definition at line 240 of file recycling.inl.
|
inlinenoexcept |
Copy constructor. Does not copy the recycle node, but clears this one.
| copy | The object to copy. |
Definition at line 245 of file recycling.inl.
|
inlinenoexcept |
Move constructor. Grabs the recyclables from the moved one and sets moved to nulled.
| move | The private recycler to move. |
Definition at line 250 of file recycling.inl.
|
inlinenoexcept |
Destructor. Frees all recyclables with the allocator.
Definition at line 255 of file recycling.inl.
|
inlinenoexcept |
Definition at line 274 of file recycling.inl.
|
inlinenodiscardnoexcept |
Counts the number of recyclables.
Attention: This method runs in linear time.
Definition at line 283 of file recycling.inl.
|
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 349 of file recycling.inl.
|
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 317 of file recycling.inl.
|
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 322 of file recycling.inl.
|
inlinenodiscard |
Returns a recycled object or allocates a new one.
Definition at line 293 of file recycling.inl.
|
inlinenoexcept |
Definition at line 271 of file recycling.inl.
|
inlinestaticconstexprnoexcept |
true to indicate that this is not a non-recycling version. Definition at line 277 of file recycling.inl.
|
inlinenoexcept |
Stores an element for recycling.
| elem | The element to store. |
Definition at line 300 of file recycling.inl.
|
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 333 of file recycling.inl.
|
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 304 of file recycling.inl.
|
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 311 of file recycling.inl.
|
inlinenoexcept |
Reserves the given number of recyclables.
| qty | The number of new recyclables to allocate. |
Definition at line 288 of file recycling.inl.
|
inlinenoexcept |
Resets this recycler. Frees all recyclables with the allocator.
Definition at line 264 of file recycling.inl.