template<typename TSidiNode, typename TList>
struct alib::monomem::detail::RecyclerPSBase< TSidiNode, TList >
This struct is used for recycling of "node elements" which are derived of type lang::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 lang::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.
◆ recyclables
template<typename TSidiNode , typename TList >
◆ RecyclerPSBase() [1/2]
template<typename TSidiNode , typename TList >
◆ RecyclerPSBase() [2/2]
template<typename TSidiNode , typename TList >
◆ count()
template<typename TSidiNode , typename TList >
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()
template<typename TSidiNode , typename TList >
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]
template<typename TSidiNode , typename TList >
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]
template<typename TSidiNode , typename TList >
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()
template<typename TSidiNode , typename TList >
template<typename TChunk >
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.
The documentation for this struct was generated from the following file: