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 244 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 > | |
| 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. | |
Protected Field Index: inherited from alib::lang::AllocatorMember< TAllocator > | |
| TAllocator & | allocator |
| A reference to the allocator. | |
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 248 of file recycling.inl.
|
protected |
The list of recyclables.
Definition at line 251 of file recycling.inl.
|
inlineexplicitnoexcept |
Constructor taking an allocator.
| pAllocator | The allocator to use. |
Definition at line 260 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 265 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 270 of file recycling.inl.
|
inlinenoexcept |
Destructor. Frees all recyclables with the allocator.
Definition at line 278 of file recycling.inl.
|
inlinenoexcept |
Definition at line 303 of file recycling.inl.
|
inlinenodiscardnoexcept |
Counts the number of recyclables.
Attention: This method runs in linear time.
Definition at line 312 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 378 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 345 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 350 of file recycling.inl.
|
inlinenodiscard |
Returns a recycled object or allocates a new one.
Definition at line 322 of file recycling.inl.
|
inlinenoexcept |
Definition at line 300 of file recycling.inl.
|
inlinestaticconstexprnoexcept |
true to indicate that this is not a non-recycling version. Definition at line 306 of file recycling.inl.
|
inlinenoexcept |
Stores an element for recycling.
| elem | The element to store. |
Definition at line 328 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 361 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 332 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 339 of file recycling.inl.
|
inlinenoexcept |
Reserves the given number of recyclables.
| qty | The number of new recyclables to allocate. |
Definition at line 317 of file recycling.inl.
|
inlinenoexcept |
Resets this recycler. Frees all recyclables with the allocator.
Definition at line 290 of file recycling.inl.