NDEVR
API Documentation
BufferAllocator< t_type, t_aligned_size, t_is_primitive, t_index_type, t_null_term, t_allow_reference >

Specific logic for reserving memory for a Buffer. More...

Public Types

typedef ObjectAllocator< t_type, t_is_primitive, t_index_type > allocator
 The object allocator type for constructing and destructing elements.
using index_type = t_index_type
 The index type used for element addressing.

Public Member Functions

constexpr BufferAllocator () noexcept
 Default constructor.
constexpr BufferAllocator (BufferAllocator &&allocator) noexcept
 Move constructor.
 ~BufferAllocator () noexcept
 Destructor.
constexpr void addIndex () noexcept
 Appends one uninitialized element at the end of the buffer without managed growth.
constexpr void addIndex (t_index_type location) noexcept
 Inserts one uninitialized element at the specified location, shifting subsequent elements.
void addLast () noexcept
 Appends one uninitialized element to the end of the buffer without managed growth.
template<bool t_auto_set_capacity>
constexpr void allocationSizeCheck (t_index_type new_size) noexcept
 Checks if the buffer needs to grow and allocates accordingly.
void autoSetCapacity (t_index_type size) noexcept
 Automatically sets the buffer capacity using the growth strategy defined by NextCapacityBytes.
constexpr decltype(auto) begin () const noexcept
 Returns a const pointer to the beginning of the buffer.
constexpr decltype(auto) begin () noexcept
 Returns a pointer to the beginning of the buffer.
constexpr decltype(auto) begin (t_index_type index) const noexcept
 Returns a const pointer to the element at the given index.
constexpr decltype(auto) begin (t_index_type index) noexcept
 Returns a pointer to the element at the given index.
constexpr t_index_type capacity () const noexcept
 Returns the total allocated capacity of the buffer in elements.
void clear () noexcept
 Clears the buffer by resetting the filled size to zero without freeing memory.
sint04 compare (const BufferAllocator &allocator) const noexcept
 Performs a byte-level comparison of this buffer with another.
sint04 compare (const BufferAllocator &allocator, t_index_type start, t_index_type end) const noexcept
 Performs a byte-level comparison of a sub-range of this buffer with another.
template<class t_comparable_type>
constexpr bool contains (const t_comparable_type &value, t_index_type start, t_index_type size) const noexcept
 Checks whether the buffer contains a given value within the specified range.
constexpr t_index_type count (const t_type &value) const noexcept
 Counts the number of occurrences of a value in the buffer.
template<bool t_managed>
constexpr void createSpace (t_index_type location, t_index_type size) noexcept
 Creates additional space at a specific location, shifting existing elements forward.
template<bool t_managed>
constexpr void createSpace (t_index_type size) noexcept
 Creates additional space at the end of the buffer, optionally auto-managing capacity.
template<bool t_is_null>
decltype(auto) emptyPtr () const noexcept
 Returns a pointer to a static empty object for use when the buffer has no allocation.
constexpr decltype(auto) end () const noexcept
 Returns a const pointer to one past the last filled element.
constexpr decltype(auto) end () noexcept
 Returns a pointer to one past the last filled element.
constexpr decltype(auto) end (t_index_type index) noexcept
 Returns a pointer to the element at the given offset from the end.
constexpr t_index_type filledSize () const noexcept
 Returns the number of elements currently stored in the buffer.
const t_type & get (t_index_type index) const noexcept
 Gets a const reference to the element at the given index.
t_type & get (t_index_type index) noexcept
 Gets a mutable reference to the element at the given index.
constexpr size_t memSize () const noexcept
 Returns the total memory size of the filled portion of the buffer in bytes.
template<bool t_is_null>
void nullTerminatorCheck () noexcept
 Writes a null terminator after the last filled element if null termination is enabled.
BufferAllocatoroperator= (BufferAllocator &&value) noexcept
 Move assignment operator.
constexpr bool ownsMemory () const
 Checks whether this allocator owns its memory (i.e., has allocated capacity).
constexpr decltype(auto) ptr () const noexcept
 Returns a const pointer to the underlying buffer, with optional alignment hint.
constexpr decltype(auto) ptr () noexcept
 Returns a pointer to the underlying buffer, with optional alignment hint.
constexpr void reference (t_type *reference, t_index_type new_size)
 Sets this allocator to reference external memory without owning it.
void removeAllIndex (t_index_type start, t_index_type end) noexcept
 Removes a contiguous range of elements from the buffer.
template<class t_range_buffer>
void removeAllIndices (const t_range_buffer &ranges) noexcept
 Removes multiple contiguous ranges of elements from the buffer in a single pass.
void removeIndex (t_index_type location) noexcept
 Removes an element at the specified location by shifting subsequent elements backward.
void removeLast () noexcept
 Removes the last element from the buffer by decrementing the filled size.
void removeLast (t_index_type count) noexcept
 Removes a specified number of elements from the end of the buffer.
void resizeSpace (t_index_type new_size) noexcept
 Resizes the allocated memory to the specified number of elements.
template<bool t_is_other_primitive, class t_other_index_type, bool t_other_null_term>
void setAll (const BufferAllocator< t_type, t_aligned_size, t_is_other_primitive, t_other_index_type, t_other_null_term > &allocator, t_index_type offset, t_index_type other_offset, t_index_type size) noexcept
 Copies elements from another BufferAllocator into this buffer.
void setAll (const t_type &object, t_index_type offset, t_index_type size) noexcept
 Fills a range of elements in the buffer with a single value.
template<bool is_primitive>
void setAll (const t_type *src, t_index_type offset, t_index_type size) noexcept
 Copies elements from a source array into this buffer.
template<class t_other_allocator>
void setAllFromSource (const t_other_allocator &allocator, t_index_type offset, t_index_type other_offset, t_index_type size) noexcept
 Copies elements from a generic source allocator into this buffer using element-wise assignment.
void setSize (t_index_type size) noexcept
 Sets the filled size of the buffer, allocating more space if necessary.
void swap (t_index_type index_a, t_index_type index_b) noexcept
 Swaps two elements in the buffer by index.

Static Public Member Functions

static constexpr bool IsNullTerm () noexcept
 Checks whether this allocator uses null termination.

Public Attributes

t_index_type m_allocated_size
 The total allocated capacity in elements.
t_type * m_buffer
 The buffer that stores the actual data.
t_index_type m_filled_size
 The number of elements currently stored in the buffer.

Detailed Description

template<class t_type, size_t t_aligned_size, bool t_is_primitive, class t_index_type = uint04, bool t_null_term = false, bool t_allow_reference = false>
class BufferAllocator< t_type, t_aligned_size, t_is_primitive, t_index_type, t_null_term, t_allow_reference >

Specific logic for reserving memory for a Buffer.


When managed, and more memory is needed memory is reserved using the ([Current Capacity] * 3) / 2) + 1

See also
Buffer

Definition at line 527 of file MemoryManager.h.

Constructor & Destructor Documentation

◆ BufferAllocator() [1/2]

template<class t_type, size_t t_aligned_size, bool t_is_primitive, class t_index_type = uint04, bool t_null_term = false, bool t_allow_reference = false>
BufferAllocator< t_type, t_aligned_size, t_is_primitive, t_index_type, t_null_term, t_allow_reference >::BufferAllocator ( )
inlineexplicitconstexprnoexcept

Default constructor.

Initializes the allocator with an empty buffer and zero size.

Definition at line 542 of file MemoryManager.h.

References emptyPtr(), and m_buffer.

Referenced by BufferAllocator(), compare(), compare(), operator=(), and setAll().

◆ BufferAllocator() [2/2]

template<class t_type, size_t t_aligned_size, bool t_is_primitive, class t_index_type = uint04, bool t_null_term = false, bool t_allow_reference = false>
BufferAllocator< t_type, t_aligned_size, t_is_primitive, t_index_type, t_null_term, t_allow_reference >::BufferAllocator ( BufferAllocator< t_type, t_aligned_size, t_is_primitive, t_index_type, t_null_term, t_allow_reference > && allocator)
inlineconstexprnoexcept

Move constructor.

Takes ownership of the other allocator's memory via swap.

Parameters
[in]allocatorThe allocator to move from.

Definition at line 551 of file MemoryManager.h.

References BufferAllocator(), emptyPtr(), and m_buffer.

◆ ~BufferAllocator()

template<class t_type, size_t t_aligned_size, bool t_is_primitive, class t_index_type = uint04, bool t_null_term = false, bool t_allow_reference = false>
BufferAllocator< t_type, t_aligned_size, t_is_primitive, t_index_type, t_null_term, t_allow_reference >::~BufferAllocator ( )
inlinenoexcept

Destructor.

Frees the allocated memory using the appropriate deallocation strategy.

Definition at line 563 of file MemoryManager.h.

References capacity(), and ptr().

Member Function Documentation

◆ addIndex()

template<class t_type, size_t t_aligned_size, bool t_is_primitive, class t_index_type = uint04, bool t_null_term = false, bool t_allow_reference = false>
void BufferAllocator< t_type, t_aligned_size, t_is_primitive, t_index_type, t_null_term, t_allow_reference >::addIndex ( t_index_type location)
inlineconstexprnoexcept

Inserts one uninitialized element at the specified location, shifting subsequent elements.

Parameters
[in]locationThe index at which to insert the element.

Definition at line 665 of file MemoryManager.h.

References createSpace(), m_filled_size, and ptr().

◆ allocationSizeCheck()

template<class t_type, size_t t_aligned_size, bool t_is_primitive, class t_index_type = uint04, bool t_null_term = false, bool t_allow_reference = false>
template<bool t_auto_set_capacity>
void BufferAllocator< t_type, t_aligned_size, t_is_primitive, t_index_type, t_null_term, t_allow_reference >::allocationSizeCheck ( t_index_type new_size)
inlineconstexprnoexcept

Checks if the buffer needs to grow and allocates accordingly.

When managed (t_auto_set_capacity), uses the growth strategy for gradual expansion. Otherwise, allocates exactly what is needed.

Parameters
[in]new_sizeThe required buffer size in elements.

Definition at line 1042 of file MemoryManager.h.

References autoSetCapacity(), m_allocated_size, and resizeSpace().

Referenced by createSpace(), and setSize().

◆ autoSetCapacity()

template<class t_type, size_t t_aligned_size, bool t_is_primitive, class t_index_type = uint04, bool t_null_term = false, bool t_allow_reference = false>
void BufferAllocator< t_type, t_aligned_size, t_is_primitive, t_index_type, t_null_term, t_allow_reference >::autoSetCapacity ( t_index_type size)
inlinenoexcept

Automatically sets the buffer capacity using the growth strategy defined by NextCapacityBytes.

Parameters
[in]sizeThe minimum required capacity in elements.

Definition at line 1016 of file MemoryManager.h.

References m_allocated_size, NextCapacityBytes(), and resizeSpace().

Referenced by allocationSizeCheck().

◆ begin() [1/4]

template<class t_type, size_t t_aligned_size, bool t_is_primitive, class t_index_type = uint04, bool t_null_term = false, bool t_allow_reference = false>
decltype(auto) BufferAllocator< t_type, t_aligned_size, t_is_primitive, t_index_type, t_null_term, t_allow_reference >::begin ( ) const
inlinenodiscardconstexprnoexcept

Returns a const pointer to the beginning of the buffer.

Returns
A const pointer to the first element.

Definition at line 787 of file MemoryManager.h.

References ptr().

◆ begin() [2/4]

template<class t_type, size_t t_aligned_size, bool t_is_primitive, class t_index_type = uint04, bool t_null_term = false, bool t_allow_reference = false>
decltype(auto) BufferAllocator< t_type, t_aligned_size, t_is_primitive, t_index_type, t_null_term, t_allow_reference >::begin ( )
inlinenodiscardconstexprnoexcept

Returns a pointer to the beginning of the buffer.

Returns
A pointer to the first element.

Definition at line 778 of file MemoryManager.h.

References ptr().

Referenced by createSpace().

◆ begin() [3/4]

template<class t_type, size_t t_aligned_size, bool t_is_primitive, class t_index_type = uint04, bool t_null_term = false, bool t_allow_reference = false>
decltype(auto) BufferAllocator< t_type, t_aligned_size, t_is_primitive, t_index_type, t_null_term, t_allow_reference >::begin ( t_index_type index) const
inlinenodiscardconstexprnoexcept

Returns a const pointer to the element at the given index.

Parameters
[in]indexThe index of the element.
Returns
A const pointer to the element at the specified index.

Definition at line 797 of file MemoryManager.h.

References ptr().

◆ begin() [4/4]

template<class t_type, size_t t_aligned_size, bool t_is_primitive, class t_index_type = uint04, bool t_null_term = false, bool t_allow_reference = false>
decltype(auto) BufferAllocator< t_type, t_aligned_size, t_is_primitive, t_index_type, t_null_term, t_allow_reference >::begin ( t_index_type index)
inlinenodiscardconstexprnoexcept

Returns a pointer to the element at the given index.

Parameters
[in]indexThe index of the element.
Returns
A pointer to the element at the specified index.

Definition at line 806 of file MemoryManager.h.

References ptr().

◆ capacity()

template<class t_type, size_t t_aligned_size, bool t_is_primitive, class t_index_type = uint04, bool t_null_term = false, bool t_allow_reference = false>
t_index_type BufferAllocator< t_type, t_aligned_size, t_is_primitive, t_index_type, t_null_term, t_allow_reference >::capacity ( ) const
inlinenodiscardconstexprnoexcept

Returns the total allocated capacity of the buffer in elements.

Returns
The allocated capacity.

Definition at line 840 of file MemoryManager.h.

References m_allocated_size.

Referenced by ~BufferAllocator(), nullTerminatorCheck(), and resizeSpace().

◆ compare() [1/2]

template<class t_type, size_t t_aligned_size, bool t_is_primitive, class t_index_type = uint04, bool t_null_term = false, bool t_allow_reference = false>
sint04 BufferAllocator< t_type, t_aligned_size, t_is_primitive, t_index_type, t_null_term, t_allow_reference >::compare ( const BufferAllocator< t_type, t_aligned_size, t_is_primitive, t_index_type, t_null_term, t_allow_reference > & allocator) const
inlinenodiscardnoexcept

Performs a byte-level comparison of this buffer with another.

Parameters
[in]allocatorThe other buffer allocator to compare against.
Returns
A negative, zero, or positive value indicating the comparison result.

Definition at line 689 of file MemoryManager.h.

References BufferAllocator(), cast(), getMin(), m_filled_size, and ptr().

◆ compare() [2/2]

template<class t_type, size_t t_aligned_size, bool t_is_primitive, class t_index_type = uint04, bool t_null_term = false, bool t_allow_reference = false>
sint04 BufferAllocator< t_type, t_aligned_size, t_is_primitive, t_index_type, t_null_term, t_allow_reference >::compare ( const BufferAllocator< t_type, t_aligned_size, t_is_primitive, t_index_type, t_null_term, t_allow_reference > & allocator,
t_index_type start,
t_index_type end ) const
inlinenodiscardnoexcept

Performs a byte-level comparison of a sub-range of this buffer with another.

Parameters
[in]allocatorThe other buffer allocator to compare against.
[in]startThe starting index for the comparison.
[in]endThe ending index for the comparison.
Returns
A negative, zero, or positive value indicating the comparison result.

Definition at line 700 of file MemoryManager.h.

References BufferAllocator(), cast(), end(), getMin(), m_filled_size, and ptr().

◆ contains()

template<class t_type, size_t t_aligned_size, bool t_is_primitive, class t_index_type = uint04, bool t_null_term = false, bool t_allow_reference = false>
template<class t_comparable_type>
bool BufferAllocator< t_type, t_aligned_size, t_is_primitive, t_index_type, t_null_term, t_allow_reference >::contains ( const t_comparable_type & value,
t_index_type start,
t_index_type size ) const
inlinenodiscardconstexprnoexcept

Checks whether the buffer contains a given value within the specified range.

Parameters
[in]valueThe value to search for.
[in]startThe starting index of the search range.
[in]sizeThe number of elements to search through.
Returns
True if the value is found within the range, false otherwise.

Definition at line 645 of file MemoryManager.h.

References ptr().

◆ count()

template<class t_type, size_t t_aligned_size, bool t_is_primitive, class t_index_type = uint04, bool t_null_term = false, bool t_allow_reference = false>
t_index_type BufferAllocator< t_type, t_aligned_size, t_is_primitive, t_index_type, t_null_term, t_allow_reference >::count ( const t_type & value) const
inlinenodiscardconstexprnoexcept

Counts the number of occurrences of a value in the buffer.

Parameters
[in]valueThe value to search for.
Returns
The number of times the value appears in the buffer.

Definition at line 627 of file MemoryManager.h.

References count(), m_filled_size, and ptr().

Referenced by count(), and removeLast().

◆ createSpace() [1/2]

template<class t_type, size_t t_aligned_size, bool t_is_primitive, class t_index_type = uint04, bool t_null_term = false, bool t_allow_reference = false>
template<bool t_managed>
void BufferAllocator< t_type, t_aligned_size, t_is_primitive, t_index_type, t_null_term, t_allow_reference >::createSpace ( t_index_type location,
t_index_type size )
inlineconstexprnoexcept

Creates additional space at a specific location, shifting existing elements forward.

Parameters
[in]locationThe index at which to insert the space.
[in]sizeThe number of elements of space to create.

Definition at line 593 of file MemoryManager.h.

References begin(), createSpace(), and m_filled_size.

◆ createSpace() [2/2]

template<class t_type, size_t t_aligned_size, bool t_is_primitive, class t_index_type = uint04, bool t_null_term = false, bool t_allow_reference = false>
template<bool t_managed>
void BufferAllocator< t_type, t_aligned_size, t_is_primitive, t_index_type, t_null_term, t_allow_reference >::createSpace ( t_index_type size)
inlineconstexprnoexcept

Creates additional space at the end of the buffer, optionally auto-managing capacity.

Parameters
[in]sizeThe number of elements of space to create.

Definition at line 580 of file MemoryManager.h.

References allocationSizeCheck(), m_filled_size, and nullTerminatorCheck().

Referenced by addIndex(), addIndex(), addLast(), and createSpace().

◆ emptyPtr()

template<class t_type, size_t t_aligned_size, bool t_is_primitive, class t_index_type = uint04, bool t_null_term = false, bool t_allow_reference = false>
template<bool t_is_null>
decltype(auto) BufferAllocator< t_type, t_aligned_size, t_is_primitive, t_index_type, t_null_term, t_allow_reference >::emptyPtr ( ) const
inlinenodiscardnoexcept

Returns a pointer to a static empty object for use when the buffer has no allocation.

Provides null termination without requiring a heap allocation.

Returns
A pointer to a static zero-initialized object, or nullptr if not null-terminated.

Definition at line 1120 of file MemoryManager.h.

Referenced by BufferAllocator(), BufferAllocator(), and resizeSpace().

◆ end() [1/3]

template<class t_type, size_t t_aligned_size, bool t_is_primitive, class t_index_type = uint04, bool t_null_term = false, bool t_allow_reference = false>
decltype(auto) BufferAllocator< t_type, t_aligned_size, t_is_primitive, t_index_type, t_null_term, t_allow_reference >::end ( ) const
inlinenodiscardconstexprnoexcept

Returns a const pointer to one past the last filled element.

Returns
A const pointer to the end of the filled region.

Definition at line 823 of file MemoryManager.h.

References m_filled_size, and ptr().

◆ end() [2/3]

template<class t_type, size_t t_aligned_size, bool t_is_primitive, class t_index_type = uint04, bool t_null_term = false, bool t_allow_reference = false>
decltype(auto) BufferAllocator< t_type, t_aligned_size, t_is_primitive, t_index_type, t_null_term, t_allow_reference >::end ( )
inlinenodiscardconstexprnoexcept

Returns a pointer to one past the last filled element.

Returns
A pointer to the end of the filled region.

Definition at line 815 of file MemoryManager.h.

References m_filled_size, and ptr().

Referenced by compare(), removeAllIndex(), and removeAllIndices().

◆ end() [3/3]

template<class t_type, size_t t_aligned_size, bool t_is_primitive, class t_index_type = uint04, bool t_null_term = false, bool t_allow_reference = false>
decltype(auto) BufferAllocator< t_type, t_aligned_size, t_is_primitive, t_index_type, t_null_term, t_allow_reference >::end ( t_index_type index)
inlinenodiscardconstexprnoexcept

Returns a pointer to the element at the given offset from the end.

Parameters
[in]indexThe offset from the end of the buffer.
Returns
A pointer to the element at the offset from the end.

Definition at line 832 of file MemoryManager.h.

References get(), and m_filled_size.

◆ filledSize()

template<class t_type, size_t t_aligned_size, bool t_is_primitive, class t_index_type = uint04, bool t_null_term = false, bool t_allow_reference = false>
t_index_type BufferAllocator< t_type, t_aligned_size, t_is_primitive, t_index_type, t_null_term, t_allow_reference >::filledSize ( ) const
inlinenodiscardconstexprnoexcept

Returns the number of elements currently stored in the buffer.

Returns
The filled size.

Definition at line 848 of file MemoryManager.h.

References m_filled_size.

◆ get() [1/2]

template<class t_type, size_t t_aligned_size, bool t_is_primitive, class t_index_type = uint04, bool t_null_term = false, bool t_allow_reference = false>
const t_type & BufferAllocator< t_type, t_aligned_size, t_is_primitive, t_index_type, t_null_term, t_allow_reference >::get ( t_index_type index) const
inlinenodiscardnoexcept

Gets a const reference to the element at the given index.

Parameters
[in]indexThe index of the element.
Returns
A const reference to the element.

Definition at line 745 of file MemoryManager.h.

References ptr().

◆ get() [2/2]

template<class t_type, size_t t_aligned_size, bool t_is_primitive, class t_index_type = uint04, bool t_null_term = false, bool t_allow_reference = false>
t_type & BufferAllocator< t_type, t_aligned_size, t_is_primitive, t_index_type, t_null_term, t_allow_reference >::get ( t_index_type index)
inlinenodiscardnoexcept

Gets a mutable reference to the element at the given index.

Parameters
[in]indexThe index of the element.
Returns
A mutable reference to the element.

Definition at line 736 of file MemoryManager.h.

References ptr().

Referenced by end().

◆ IsNullTerm()

template<class t_type, size_t t_aligned_size, bool t_is_primitive, class t_index_type = uint04, bool t_null_term = false, bool t_allow_reference = false>
constexpr bool BufferAllocator< t_type, t_aligned_size, t_is_primitive, t_index_type, t_null_term, t_allow_reference >::IsNullTerm ( )
inlinestaticnodiscardconstexprnoexcept

Checks whether this allocator uses null termination.

Returns
True if the buffer is null-terminated, false otherwise.

Definition at line 537 of file MemoryManager.h.

◆ memSize()

template<class t_type, size_t t_aligned_size, bool t_is_primitive, class t_index_type = uint04, bool t_null_term = false, bool t_allow_reference = false>
size_t BufferAllocator< t_type, t_aligned_size, t_is_primitive, t_index_type, t_null_term, t_allow_reference >::memSize ( ) const
inlinenodiscardconstexprnoexcept

Returns the total memory size of the filled portion of the buffer in bytes.

Returns
The memory footprint in bytes.

Definition at line 864 of file MemoryManager.h.

References m_filled_size.

◆ operator=()

template<class t_type, size_t t_aligned_size, bool t_is_primitive, class t_index_type = uint04, bool t_null_term = false, bool t_allow_reference = false>
BufferAllocator & BufferAllocator< t_type, t_aligned_size, t_is_primitive, t_index_type, t_null_term, t_allow_reference >::operator= ( BufferAllocator< t_type, t_aligned_size, t_is_primitive, t_index_type, t_null_term, t_allow_reference > && value)
inlinenoexcept

Move assignment operator.

Swaps internal state with the other allocator.

Parameters
[in]valueThe allocator to move-assign from.
Returns
A reference to this allocator after the move.

Definition at line 1148 of file MemoryManager.h.

References BufferAllocator(), m_allocated_size, m_buffer, and m_filled_size.

◆ ownsMemory()

template<class t_type, size_t t_aligned_size, bool t_is_primitive, class t_index_type = uint04, bool t_null_term = false, bool t_allow_reference = false>
bool BufferAllocator< t_type, t_aligned_size, t_is_primitive, t_index_type, t_null_term, t_allow_reference >::ownsMemory ( ) const
inlinenodiscardconstexpr

Checks whether this allocator owns its memory (i.e., has allocated capacity).

Returns
True if memory has been allocated, false if referencing external memory.

Definition at line 856 of file MemoryManager.h.

References m_allocated_size.

◆ ptr() [1/2]

template<class t_type, size_t t_aligned_size, bool t_is_primitive, class t_index_type = uint04, bool t_null_term = false, bool t_allow_reference = false>
decltype(auto) BufferAllocator< t_type, t_aligned_size, t_is_primitive, t_index_type, t_null_term, t_allow_reference >::ptr ( ) const
inlinenodiscardconstexprnoexcept

Returns a const pointer to the underlying buffer, with optional alignment hint.

Returns
A const pointer to the internal data array.

Definition at line 766 of file MemoryManager.h.

References m_buffer.

◆ ptr() [2/2]

template<class t_type, size_t t_aligned_size, bool t_is_primitive, class t_index_type = uint04, bool t_null_term = false, bool t_allow_reference = false>
decltype(auto) BufferAllocator< t_type, t_aligned_size, t_is_primitive, t_index_type, t_null_term, t_allow_reference >::ptr ( )
inlinenodiscardconstexprnoexcept

Returns a pointer to the underlying buffer, with optional alignment hint.

Returns
A pointer to the internal data array.

Definition at line 754 of file MemoryManager.h.

References m_buffer.

Referenced by ~BufferAllocator(), addIndex(), begin(), begin(), begin(), begin(), compare(), compare(), contains(), count(), end(), end(), get(), get(), nullTerminatorCheck(), removeAllIndex(), removeAllIndices(), removeIndex(), resizeSpace(), setAll(), setAll(), setAll(), setAllFromSource(), and swap().

◆ reference()

template<class t_type, size_t t_aligned_size, bool t_is_primitive, class t_index_type = uint04, bool t_null_term = false, bool t_allow_reference = false>
void BufferAllocator< t_type, t_aligned_size, t_is_primitive, t_index_type, t_null_term, t_allow_reference >::reference ( t_type * reference,
t_index_type new_size )
inlineconstexpr

Sets this allocator to reference external memory without owning it.

Any previously allocated memory is freed first.

Parameters
[in]referencePointer to the external memory to reference.
[in]new_sizeThe number of elements in the referenced memory.

Definition at line 1029 of file MemoryManager.h.

References m_buffer, m_filled_size, reference(), and resizeSpace().

Referenced by reference().

◆ removeAllIndex()

template<class t_type, size_t t_aligned_size, bool t_is_primitive, class t_index_type = uint04, bool t_null_term = false, bool t_allow_reference = false>
void BufferAllocator< t_type, t_aligned_size, t_is_primitive, t_index_type, t_null_term, t_allow_reference >::removeAllIndex ( t_index_type start,
t_index_type end )
inlinenoexcept

Removes a contiguous range of elements from the buffer.

Parameters
[in]startThe starting index of the range to remove (inclusive).
[in]endThe ending index of the range to remove (exclusive).

Definition at line 1068 of file MemoryManager.h.

References end(), m_filled_size, nullTerminatorCheck(), and ptr().

◆ removeAllIndices()

template<class t_type, size_t t_aligned_size, bool t_is_primitive, class t_index_type = uint04, bool t_null_term = false, bool t_allow_reference = false>
template<class t_range_buffer>
void BufferAllocator< t_type, t_aligned_size, t_is_primitive, t_index_type, t_null_term, t_allow_reference >::removeAllIndices ( const t_range_buffer & ranges)
inlinenoexcept

Removes multiple contiguous ranges of elements from the buffer in a single pass.

Parameters
[in]rangesA buffer of index pairs defining the ranges to remove.

Definition at line 1087 of file MemoryManager.h.

References end(), m_filled_size, nullTerminatorCheck(), and ptr().

◆ removeIndex()

template<class t_type, size_t t_aligned_size, bool t_is_primitive, class t_index_type = uint04, bool t_null_term = false, bool t_allow_reference = false>
void BufferAllocator< t_type, t_aligned_size, t_is_primitive, t_index_type, t_null_term, t_allow_reference >::removeIndex ( t_index_type location)
inlinenoexcept

Removes an element at the specified location by shifting subsequent elements backward.

Parameters
[in]locationThe index of the element to remove.

Definition at line 677 of file MemoryManager.h.

References m_filled_size, nullTerminatorCheck(), and ptr().

◆ removeLast()

template<class t_type, size_t t_aligned_size, bool t_is_primitive, class t_index_type = uint04, bool t_null_term = false, bool t_allow_reference = false>
void BufferAllocator< t_type, t_aligned_size, t_is_primitive, t_index_type, t_null_term, t_allow_reference >::removeLast ( t_index_type count)
inlinenoexcept

Removes a specified number of elements from the end of the buffer.

Parameters
[in]countThe number of elements to remove.

Definition at line 617 of file MemoryManager.h.

References count(), m_filled_size, and nullTerminatorCheck().

◆ resizeSpace()

template<class t_type, size_t t_aligned_size, bool t_is_primitive, class t_index_type = uint04, bool t_null_term = false, bool t_allow_reference = false>
void BufferAllocator< t_type, t_aligned_size, t_is_primitive, t_index_type, t_null_term, t_allow_reference >::resizeSpace ( t_index_type new_size)
inlinenoexcept

Resizes the allocated memory to the specified number of elements.

Handles allocation, reallocation, freeing, and reference-to-owned transitions.

Parameters
[in]new_sizeThe new capacity in elements. If zero, the memory is freed.

Definition at line 873 of file MemoryManager.h.

References capacity(), emptyPtr(), m_allocated_size, m_buffer, m_filled_size, ptr(), and setAll().

Referenced by allocationSizeCheck(), autoSetCapacity(), and reference().

◆ setAll() [1/3]

template<class t_type, size_t t_aligned_size, bool t_is_primitive, class t_index_type = uint04, bool t_null_term = false, bool t_allow_reference = false>
template<bool t_is_other_primitive, class t_other_index_type, bool t_other_null_term>
void BufferAllocator< t_type, t_aligned_size, t_is_primitive, t_index_type, t_null_term, t_allow_reference >::setAll ( const BufferAllocator< t_type, t_aligned_size, t_is_other_primitive, t_other_index_type, t_other_null_term > & allocator,
t_index_type offset,
t_index_type other_offset,
t_index_type size )
inlinenoexcept

Copies elements from another BufferAllocator into this buffer.

Parameters
[in]allocatorThe source buffer allocator to copy from.
[in]offsetThe destination offset in this buffer.
[in]other_offsetThe source offset in the other allocator.
[in]sizeThe number of elements to copy.

Definition at line 985 of file MemoryManager.h.

References BufferAllocator(), and ptr().

◆ setAll() [2/3]

template<class t_type, size_t t_aligned_size, bool t_is_primitive, class t_index_type = uint04, bool t_null_term = false, bool t_allow_reference = false>
void BufferAllocator< t_type, t_aligned_size, t_is_primitive, t_index_type, t_null_term, t_allow_reference >::setAll ( const t_type & object,
t_index_type offset,
t_index_type size )
inlinenoexcept

Fills a range of elements in the buffer with a single value.

Parameters
[in]objectThe value to assign to each element.
[in]offsetThe starting index for the fill operation.
[in]sizeThe number of elements to fill.

Definition at line 950 of file MemoryManager.h.

References ptr().

Referenced by resizeSpace().

◆ setAll() [3/3]

template<class t_type, size_t t_aligned_size, bool t_is_primitive, class t_index_type = uint04, bool t_null_term = false, bool t_allow_reference = false>
template<bool is_primitive>
void BufferAllocator< t_type, t_aligned_size, t_is_primitive, t_index_type, t_null_term, t_allow_reference >::setAll ( const t_type * src,
t_index_type offset,
t_index_type size )
inlinenoexcept

Copies elements from a source array into this buffer.

Uses memmove for primitives and element-wise assignment for non-primitives.

Parameters
[in]srcPointer to the source data array.
[in]offsetThe destination offset in this buffer.
[in]sizeThe number of elements to copy.

Definition at line 963 of file MemoryManager.h.

References ptr().

◆ setAllFromSource()

template<class t_type, size_t t_aligned_size, bool t_is_primitive, class t_index_type = uint04, bool t_null_term = false, bool t_allow_reference = false>
template<class t_other_allocator>
void BufferAllocator< t_type, t_aligned_size, t_is_primitive, t_index_type, t_null_term, t_allow_reference >::setAllFromSource ( const t_other_allocator & allocator,
t_index_type offset,
t_index_type other_offset,
t_index_type size )
inlinenoexcept

Copies elements from a generic source allocator into this buffer using element-wise assignment.

Parameters
[in]allocatorThe source allocator to copy from.
[in]offsetThe destination offset in this buffer.
[in]other_offsetThe source offset in the other allocator.
[in]sizeThe number of elements to copy.

Definition at line 1005 of file MemoryManager.h.

References ptr().

◆ setSize()

template<class t_type, size_t t_aligned_size, bool t_is_primitive, class t_index_type = uint04, bool t_null_term = false, bool t_allow_reference = false>
void BufferAllocator< t_type, t_aligned_size, t_is_primitive, t_index_type, t_null_term, t_allow_reference >::setSize ( t_index_type size)
inlinenoexcept

Sets the filled size of the buffer, allocating more space if necessary.

Parameters
[in]sizeThe new filled size.

Definition at line 725 of file MemoryManager.h.

References allocationSizeCheck(), m_filled_size, and nullTerminatorCheck().

◆ swap()

template<class t_type, size_t t_aligned_size, bool t_is_primitive, class t_index_type = uint04, bool t_null_term = false, bool t_allow_reference = false>
void BufferAllocator< t_type, t_aligned_size, t_is_primitive, t_index_type, t_null_term, t_allow_reference >::swap ( t_index_type index_a,
t_index_type index_b )
inlinenoexcept

Swaps two elements in the buffer by index.

Parameters
[in]index_aThe index of the first element.
[in]index_bThe index of the second element.

Definition at line 709 of file MemoryManager.h.

References ptr().


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