ALib C++ Library
Library Version: 2510 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
alib::containers::detail::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 574 of file recycling.inl.

Inheritance diagram for alib::containers::detail::RecyclerVoid< TAllocator, TNode >:
[legend]
Collaboration diagram for alib::containers::detail::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 alib::lang::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 alib::lang::AllocatorMember< TAllocator >
using AllocatorType = TAllocator
 Exposes the allocator type.
 
- Protected Field Index: inherited from alib::lang::AllocatorMember< TAllocator >
TAllocator & allocator
 A reference to the allocator.
 

Type Definition Details:

◆ base

template<typename TAllocator, typename TNode>
using alib::containers::detail::RecyclerVoid< TAllocator, TNode >::base = lang::AllocatorMember<TAllocator>
protected

The base type.

Definition at line 578 of file recycling.inl.

Constructor(s) / Destructor Details:

◆ RecyclerVoid()

template<typename TAllocator, typename TNode>
alib::containers::detail::RecyclerVoid< TAllocator, TNode >::RecyclerVoid ( TAllocator & pAllocator)
inlinenoexcept

Defaulted default constructor.

Parameters
pAllocatorThe allocator to use.

Definition at line 586 of file recycling.inl.

Method Details:

◆ Count()

template<typename TAllocator, typename TNode>
integer alib::containers::detail::RecyclerVoid< TAllocator, TNode >::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 599 of file recycling.inl.

◆ DisposeChunk()

template<typename TAllocator, typename TNode>
template<typename TChunk>
void alib::containers::detail::RecyclerVoid< TAllocator, TNode >::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 661 of file recycling.inl.

Here is the call graph for this function:

◆ DisposeList() [1/2]

template<typename TAllocator, typename TNode>
void alib::containers::detail::RecyclerVoid< TAllocator, TNode >::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 629 of file recycling.inl.

Here is the call graph for this function:

◆ DisposeList() [2/2]

template<typename TAllocator, typename TNode>
std::pair< TNode *, integer > alib::containers::detail::RecyclerVoid< TAllocator, TNode >::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 636 of file recycling.inl.

Here is the call graph for this function:

◆ Get()

template<typename TAllocator, typename TNode>
TNode * alib::containers::detail::RecyclerVoid< TAllocator, TNode >::Get ( )
inlinenodiscard

Allocates a new one.

Returns
An allocated element.

Definition at line 608 of file recycling.inl.

Here is the call graph for this function:

◆ IsRecycling()

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

Definition at line 593 of file recycling.inl.

◆ Recycle()

template<typename TAllocator, typename TNode>
void alib::containers::detail::RecyclerVoid< TAllocator, TNode >::Recycle ( TNode * elem)
inlinenoexcept

Frees an element.

Parameters
elemThe element to store.

Definition at line 612 of file recycling.inl.

Here is the call graph for this function:

◆ RecycleChunk()

template<typename TAllocator, typename TNode>
template<typename TChunk>
void alib::containers::detail::RecyclerVoid< TAllocator, TNode >::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 647 of file recycling.inl.

Here is the call graph for this function:

◆ RecycleList() [1/2]

template<typename TAllocator, typename TNode>
void alib::containers::detail::RecyclerVoid< TAllocator, TNode >::RecycleList ( TNode * begin)
inlinenoexcept

Frees the list.

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

Definition at line 616 of file recycling.inl.

Here is the call graph for this function:

◆ RecycleList() [2/2]

template<typename TAllocator, typename TNode>
std::pair< TNode *, integer > alib::containers::detail::RecyclerVoid< TAllocator, TNode >::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 623 of file recycling.inl.

Here is the call graph for this function:

◆ Reserve()

template<typename TAllocator, typename TNode>
void alib::containers::detail::RecyclerVoid< TAllocator, TNode >::Reserve ( integer )
inlinenoexcept

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

Definition at line 602 of file recycling.inl.

◆ Reset()

template<typename TAllocator, typename TNode>
void alib::containers::detail::RecyclerVoid< TAllocator, TNode >::Reset ( )
inlinenoexcept

Does nothing. Shared recyclers can't be reset.

Definition at line 590 of file recycling.inl.


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