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 458 of file recycler.hpp.
#include <recycler.hpp>
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 462 of file recycler.hpp.
|
inlinenoexcept |
Constructor taking an allocator and the hook.
hook | The external, shared recycling list. |
Definition at line 468 of file recycler.hpp.
|
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 478 of file recycler.hpp.
|
inlinenoexcept |
Destructor.
Definition at line 482 of file recycler.hpp.
|
inlinenoexcept |
Definition at line 491 of file recycler.hpp.
|
inlinenodiscardnoexcept |
Counts the number of recyclables.
Attention: This method runs in linear time.
Definition at line 501 of file recycler.hpp.
|
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 559 of file recycler.hpp.
|
inlinenoexcept |
Does not free, but recycles instead.
begin | The first element of the list to free. |
Definition at line 532 of file recycler.hpp.
|
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 537 of file recycler.hpp.
|
inlinenodiscard |
Returns a recycled object or allocates a new one.
Definition at line 510 of file recycler.hpp.
|
inlinenoexcept |
Definition at line 488 of file recycler.hpp.
|
inlinestaticconstexprnoexcept |
true
to indicate that this is not a non-recycling version. Definition at line 495 of file recycler.hpp.
|
inlinenoexcept |
Stores an element for recycling.
elem | The element to store. |
Definition at line 516 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 546 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 520 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 527 of file recycler.hpp.
|
inline |
Reserves the given number of recyclables.
qty | The number of new recyclables to allocate. |
Definition at line 505 of file recycler.hpp.
|
inlinenoexcept |
Does nothing. Shared recyclers can't be reset.
Definition at line 485 of file recycler.hpp.