Implements internal recycling interface. Used by container types of module ALib Containers that use shared recycling (when their template parameter TRecycling evaluates to Shared).
| TAllocator | The allocator to store and use. |
| TNode | The type to recycle. Has to be derived of lang::SidiNodeBase. |
Definition at line 462 of file recycling.inl.
Public Static Method Index: | |
| static constexpr bool | IsRecycling () noexcept |
Public Method Index: | |
| RecyclerShared (const RecyclerShared ©) noexcept=default | |
| RecyclerShared (RecyclerShared &&move) noexcept | |
| RecyclerShared (SharedRecycler< TAllocator, TNode > &hook) noexcept | |
| ~RecyclerShared () noexcept | |
| Destructor. | |
| 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) |
| void | Reset () noexcept |
| Does nothing. Shared recyclers can't be reset. | |
Protected Field Index: | |
| SharedRecycler< TAllocator, TNode > & | sr |
| The reference to the list of recyclables. | |
|
protected |
The reference to the list of recyclables.
Definition at line 466 of file recycling.inl.
|
inlinenoexcept |
Constructor taking an allocator and the hook.
| hook | The external, shared recycling list. |
Definition at line 472 of file recycling.inl.
|
defaultnoexcept |
Copy constructor. Copies the reference to the shared recycler.
| copy | The private recycler to copy. |
|
inlinenoexcept |
Move constructor. Just copies the reference but leaves original intact. (We don't care)
| move | The private recycler to move. |
Definition at line 482 of file recycling.inl.
|
inlinenoexcept |
Destructor.
Definition at line 486 of file recycling.inl.
|
inlinenoexcept |
Definition at line 495 of file recycling.inl.
|
inlinenodiscardnoexcept |
Counts the number of recyclables.
Attention: This method runs in linear time.
Definition at line 505 of file recycling.inl.
|
inlinenoexcept |
This 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 563 of file recycling.inl.
|
inlinenoexcept |
Does not free, but recycles instead.
| begin | The first element of the list to free. |
Definition at line 536 of file recycling.inl.
|
inlinenoexcept |
Does not free, but recycles instead.
| begin | The first element of the list to free. |
| end | The first element not to be freed. |
Definition at line 541 of file recycling.inl.
|
inlinenodiscard |
Returns a recycled object or allocates a new one.
Definition at line 514 of file recycling.inl.
|
inlinenoexcept |
Definition at line 492 of file recycling.inl.
|
inlinestaticconstexprnoexcept |
true to indicate that this is not a non-recycling version. Definition at line 499 of file recycling.inl.
|
inlinenoexcept |
Stores an element for recycling.
| elem | The element to store. |
Definition at line 520 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 550 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 524 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 531 of file recycling.inl.
|
inline |
Reserves the given number of recyclables.
| qty | The number of new recyclables to allocate. |
Definition at line 509 of file recycling.inl.
|
inlinenoexcept |
Does nothing. Shared recyclers can't be reset.
Definition at line 489 of file recycling.inl.