ALib C++ Library
Library Version: 2412 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
RecyclerVoid< TAllocator, TNode > Struct Template Reference

Description:

template<typename TAllocator, typename TNode>
struct alib::containers::detail::RecyclerVoid< TAllocator, TNode >

Implements internal recycling interface. Used by container types of module ALib Containers that omit recycling (when their template parameter TRecycling evaluates to None).

Template Parameters
TAllocatorThe allocator to store and use.
TNodeThe type to recycle. Has to be derived of lang::SidiNodeBase.

Definition at line 570 of file recycler.hpp.

#include <recycler.hpp>

Inheritance diagram for RecyclerVoid< TAllocator, TNode >:
[legend]
Collaboration diagram for RecyclerVoid< TAllocator, TNode >:
[legend]

Public Static Method Index:

static constexpr bool IsRecycling () noexcept
 

Public Method Index:

 RecyclerVoid ()=default
 Parameterless constructor. Used with type HeapAllocator.
 
 RecyclerVoid (TAllocator &pAllocator) noexcept
 
constexpr integer Count () const noexcept
 
template<typename TChunk >
void DisposeChunk (TChunk *chunk, size_t length) noexcept
 
void DisposeList (TNode *begin) noexcept
 
std::pair< TNode *, integerDisposeList (TNode *begin, TNode *end) noexcept
 
TNode * Get ()
 
void Recycle (TNode *elem) noexcept
 
template<typename TChunk >
constexpr void RecycleChunk (TChunk *chunk, size_t length) noexcept
 
void RecycleList (TNode *begin) noexcept
 
std::pair< TNode *, integerRecycleList (TNode *begin, TNode *end) noexcept
 
void Reserve (integer) noexcept
 Does nothing. In debug-compilations a warning is raised.
 
void Reset () noexcept
 Does nothing. Shared recyclers can't be reset.
 
- Public Method Index: inherited from 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.
 

Additional Inherited Members

- Public Type Index: inherited from AllocatorMember< TAllocator >
using AllocatorType = TAllocator
 Exposes the allocator type.
 
- Protected Field Index: inherited from AllocatorMember< TAllocator >
TAllocator & allocator
 A reference to the allocator.
 

Type Definition Details:

◆ base

template<typename TAllocator , typename TNode >
using base = lang::AllocatorMember<TAllocator>
protected

The base type.

Definition at line 574 of file recycler.hpp.

Constructor(s) / Destructor Details:

◆ RecyclerVoid()

template<typename TAllocator , typename TNode >
RecyclerVoid ( TAllocator & pAllocator)
inlinenoexcept

Defaulted default constructor.

Parameters
pAllocatorThe allocator to use.

Definition at line 582 of file recycler.hpp.

Method Details:

◆ Count()

template<typename TAllocator , typename TNode >
integer Count ( ) const
inlinenodiscardconstexprnoexcept

This recycler just returns 0. Attention: With other implementations, this method may run in linear time.

Returns
0, which in this case is always the number of available elements.

Definition at line 595 of file recycler.hpp.

◆ DisposeChunk()

template<typename TAllocator , typename TNode >
template<typename TChunk >
void DisposeChunk ( TChunk * chunk,
size_t length )
inlinenoexcept

Frees the given memory. Note that the shared recycler calls RecycleChunk with this method.

Template Parameters
TChunkThe type of array that is to be freed.
Parameters
chunkThe chunk array to convert into nodes
lengthThe length of the chunk array (pass 1 if the chunk is not an array type).

Definition at line 657 of file recycler.hpp.

Here is the call graph for this function:

◆ DisposeList() [1/2]

template<typename TAllocator , typename TNode >
void DisposeList ( TNode * begin)
inlinenoexcept

Deletes a list of elements (from the begin element to the last one).

Parameters
beginThe first element of the list recycle, must not be nullptr.

Definition at line 625 of file recycler.hpp.

Here is the call graph for this function:

◆ DisposeList() [2/2]

template<typename TAllocator , typename TNode >
std::pair< TNode *, integer > DisposeList ( TNode * begin,
TNode * end )
inlinenoexcept

Deletes a list of elements for recycling. Both given nodes have to exist.

Parameters
beginThe first element of the list to free.
endThe first element not to be freed.
Returns
A pair of values. The first is a pointer to the last node deleted, and the second provides the number of nodes deleted.

Definition at line 632 of file recycler.hpp.

Here is the call graph for this function:

◆ Get()

template<typename TAllocator , typename TNode >
TNode * Get ( )
inlinenodiscard

Allocates a new one.

Returns
An allocated element.

Definition at line 604 of file recycler.hpp.

Here is the call graph for this function:

◆ IsRecycling()

template<typename TAllocator , typename TNode >
static constexpr bool IsRecycling ( )
inlinestaticconstexprnoexcept
Returns
Returns false to indicate that this is a non-recycling version.

Definition at line 589 of file recycler.hpp.

◆ Recycle()

template<typename TAllocator , typename TNode >
void Recycle ( TNode * elem)
inlinenoexcept

Frees an element.

Parameters
elemThe element to store.

Definition at line 608 of file recycler.hpp.

Here is the call graph for this function:

◆ RecycleChunk()

template<typename TAllocator , typename TNode >
template<typename TChunk >
void RecycleChunk ( TChunk * chunk,
size_t length )
inlineconstexprnoexcept

With other recyclers, this method converts a given chunk of memory, previously allocated with the same allocator that this type uses, into recyclable node objects.
This recycler just frees the object.

Template Parameters
TChunkThe type of array that is to be cut into node elements.
Parameters
chunkThe chunk array to convert into nodes
lengthThe length of the chunk array (pass 1 if the chunk is not an array type).

Definition at line 643 of file recycler.hpp.

Here is the call graph for this function:

◆ RecycleList() [1/2]

template<typename TAllocator , typename TNode >
void RecycleList ( TNode * begin)
inlinenoexcept

Frees the list.

Parameters
beginThe first element of the list store, must not be nullptr.

Definition at line 612 of file recycler.hpp.

Here is the call graph for this function:

◆ RecycleList() [2/2]

template<typename TAllocator , typename TNode >
std::pair< TNode *, integer > RecycleList ( TNode * begin,
TNode * end )
inlinenoexcept

Frees the list (as this is a non-recycling recycler).

Parameters
beginThe first element of the list recycled.
endThe first element not to be recycled.
Returns
A pair of values. The first is a pointer to the last node deleted, and the second provides the number of nodes deleted.

Definition at line 619 of file recycler.hpp.

Here is the call graph for this function:

◆ Reserve()

template<typename TAllocator , typename TNode >
void Reserve ( integer )
inlinenoexcept

Does nothing. In debug-compilations a warning is raised.

Definition at line 598 of file recycler.hpp.

◆ Reset()

template<typename TAllocator , typename TNode >
void Reset ( )
inlinenoexcept

Does nothing. Shared recyclers can't be reset.

Definition at line 586 of file recycler.hpp.


The documentation for this struct was generated from the following file: