template<typename TSidiNode, typename TList>
struct aworx::lib::monomem::detail::RecyclerPSBase< TSidiNode, TList >
This struct is used for recycling of "node elements" which are derived of type detail::SidiNodeBase. This class provides the common base for detail::RecyclerPrivate and detail::RecyclerShared.
- Template Parameters
-
TSidiNode | The type to recycle. Has to be derived of detail::SidiNodeBase. |
TList | The type of the list of recyclables: Either the same as TSidiNode or a reference to it. |
Definition at line 59 of file recycler.inl.
◆ RecyclerPSBase() [1/2]
◆ RecyclerPSBase() [2/2]
◆ count()
Counts the number of recyclables.
Attention: This method runs in linear time.
- Returns
- The number of available elements.
Definition at line 164 of file recycler.inl.
◆ get()
Returns a stored element. If no elements are available, nullptr
is returned.
- Returns
- A recycled element or
nullptr
if no recyclables are available.
Definition at line 156 of file recycler.inl.
◆ recycle() [1/2]
void recycle |
( |
TSidiNode * |
elem | ) |
|
|
inline |
Stores an element for recycling.
- Parameters
-
elem | The element to store.
|
Definition at line 79 of file recycler.inl.
◆ recycle() [2/2]
void recycle |
( |
TSidiNode * |
first, |
|
|
TSidiNode * |
last |
|
) |
| |
|
inline |
Stores a list of elements for recycling.
- Parameters
-
first | The first element of the list store. |
last | The last element of the list store.
|
Definition at line 87 of file recycler.inl.
◆ recycleChunk()
void recycleChunk |
( |
TChunk * |
chunk, |
|
|
size_t |
count |
|
) |
| |
|
inline |
Recycles a chunk of memory that is not of the node type. Such recycling is useful for example, in combination with hash tables, which usually allocate a "bucket array" that grows over time. In this case, the former smaller bucket array may be passed to this method to recycle it as future node elements.
- Template Parameters
-
TChunk | The type of the chunk. |
- Parameters
-
chunk | The recyclable chunk's address. |
count | The number of objects (1 for non-array types, >1 for arrays.
|
Definition at line 100 of file recycler.inl.
◆ recyclables
The documentation for this struct was generated from the following file: