API Documentation
Loading...
Searching...
No Matches
BufferAllocator< t_type, t_index_type, t_null_term > Class Template 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. More...

#include <MemoryManager.h>

Public Member Functions

void addIndex ()
 
void addIndex (t_index_type location)
 
void addLast ()
 
template<bool t_managed>
void allocationSizeCheck ()
 
t_type * begin ()
 
const t_type * begin () const
 
t_type * begin (t_index_type index) const
 
constexpr BufferAllocator ()
 
constexpr BufferAllocator (BufferAllocator &&allocator) noexcept
 
t_index_type capacity () const
 
void clear ()
 
sint04 compare (const BufferAllocator &allocator) const
 
sint04 compare (const BufferAllocator &allocator, t_index_type start, t_index_type end) const
 
t_index_type count (const t_type &value) const
 
template<bool t_managed>
void createSpace (t_index_type location, t_index_type size)
 
template<bool t_managed>
void createSpace (t_index_type size)
 
template<bool t_is_null>
t_type * emptyPtr () const
 
t_type * end ()
 
const t_type * end () const
 
t_type * end (t_index_type index)
 
constexpr t_index_type filledSize () const
 
t_type & get (t_index_type index)
 
const t_type & get (t_index_type index) const
 
t_index_type memSize () const
 
template<bool t_is_null>
void nullTerminatorCheck ()
 
BufferAllocatoroperator= (BufferAllocator &&value) noexcept
 
t_type * ptr ()
 
const t_type * ptr () const
 
void removeAllIndex (t_index_type start, t_index_type end)
 
template<class t_range_buffer >
void removeAllIndices (const t_range_buffer &ranges)
 
void removeIndex (t_index_type location)
 
void removeLast ()
 
void resizeSpace (t_index_type new_size)
 
template<bool is_primitive, class t_other_index_type , bool t_other_null_term>
void setAll (const BufferAllocator< t_type, t_other_index_type, t_other_null_term > &allocator, t_index_type offset, t_index_type other_offset, t_index_type size)
 
void setAll (const t_type &object, t_index_type offset, t_index_type size)
 
template<bool is_primitive>
void setAll (const t_type *src, t_index_type offset, t_index_type size)
 
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)
 
void setSize (t_index_type size)
 
void swap (t_index_type index_a, t_index_type index_b)
 
 ~BufferAllocator ()
 

Static Public Member Functions

static constexpr bool IsNullTerm ()
 

Public Attributes

t_index_type m_allocated_size
 
t_type * m_buffer
 
t_index_type m_filled_size
 

Detailed Description

template<class t_type, class t_index_type, bool t_null_term>
class NDEVR::BufferAllocator< t_type, t_index_type, t_null_term >

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.


Constructor & Destructor Documentation

◆ BufferAllocator() [1/2]

template<class t_type , class t_index_type , bool t_null_term>
BufferAllocator ( )
inlineexplicitconstexpr

◆ BufferAllocator() [2/2]

template<class t_type , class t_index_type , bool t_null_term>
BufferAllocator ( BufferAllocator< t_type, t_index_type, t_null_term > && allocator)
inlineconstexprnoexcept

◆ ~BufferAllocator()

template<class t_type , class t_index_type , bool t_null_term>
~BufferAllocator ( )
inline

Member Function Documentation

◆ addIndex() [1/2]

template<class t_type , class t_index_type , bool t_null_term>
void addIndex ( )
inline

Adds index.

Author: Tyler Parke

Date: 2017-11-19

◆ addIndex() [2/2]

template<class t_type , class t_index_type , bool t_null_term>
void addIndex ( t_index_type location)
inline

Adds an index.

Author: Tyler Parke

Date: 2017-11-19

Parameters: location - The location.

◆ addLast()

template<class t_type , class t_index_type , bool t_null_term>
void addLast ( )
inline

◆ allocationSizeCheck()

template<class t_type , class t_index_type , bool t_null_term>
template<bool t_managed>
void allocationSizeCheck ( )
inline

Allocation size check.

Author: Tyler Parke

Date: 2017-11-19

◆ begin() [1/3]

template<class t_type , class t_index_type , bool t_null_term>
t_type * begin ( )
inlinenodiscard

Gets the begin.

Author: Tyler Parke

Date: 2017-11-19

Returns
Null if it fails, else a pointer to a t_type.

◆ begin() [2/3]

template<class t_type , class t_index_type , bool t_null_term>
const t_type * begin ( ) const
inlinenodiscard

Gets the begin.

Author: Tyler Parke

Date: 2017-11-19

Returns
Null if it fails, else a pointer to a const t_type.

◆ begin() [3/3]

template<class t_type , class t_index_type , bool t_null_term>
t_type * begin ( t_index_type index) const
inlinenodiscard

Begins the given index.

Author: Tyler Parke

Date: 2017-11-19

Parameters: index - Zero-based index of the.

Returns
Null if it fails, else a pointer to a t_type.

◆ capacity()

template<class t_type , class t_index_type , bool t_null_term>
t_index_type capacity ( ) const
inlinenodiscard

Gets the capacity of the buffer or total space allocated to it.

Author: Tyler Parke

Date: 2017-04-15

Returns
The capacity of the current allocated buffer.

◆ clear()

template<class t_type , class t_index_type , bool t_null_term>
void clear ( )
inline

Clears this object to its blank/initial state.

Author: Tyler Parke

Date: 2017-11-19

◆ compare() [1/2]

template<class t_type , class t_index_type , bool t_null_term>
sint04 compare ( const BufferAllocator< t_type, t_index_type, t_null_term > & allocator) const
inlinenodiscard

Compares this const BufferAllocator& object to another to determine their relative ordering.

Author: Tyler Parke

Date: 2017-11-19

Parameters: allocator - The constant buffer allocator& to compare to this object.

Returns
Negative if 'allocator' is less than '', 0 if they are equal, or positive if it is greater.

◆ compare() [2/2]

template<class t_type , class t_index_type , bool t_null_term>
sint04 compare ( const BufferAllocator< t_type, t_index_type, t_null_term > & allocator,
t_index_type start,
t_index_type end ) const
inlinenodiscard

Compares objects.

Author: Tyler Parke

Date: 2017-11-19

Parameters: allocator - Constant buffer allocator& to be compared. start - Uint 04 to be compared. end - Uint 04 to be compared.

Returns
Negative if 'allocator' is less than 'start', 0 if they are equal, or positive if it is greater.

◆ count()

template<class t_type , class t_index_type , bool t_null_term>
t_index_type count ( const t_type & value) const
inlinenodiscard

◆ createSpace() [1/2]

template<class t_type , class t_index_type , bool t_null_term>
template<bool t_managed>
void createSpace ( t_index_type location,
t_index_type size )
inline

◆ createSpace() [2/2]

template<class t_type , class t_index_type , bool t_null_term>
template<bool t_managed>
void createSpace ( t_index_type size)
inline

◆ emptyPtr()

template<class t_type , class t_index_type , bool t_null_term>
template<bool t_is_null>
t_type * emptyPtr ( ) const
inlinenodiscard

Null terminator check.

Author: Tyler Parke

Date: 2017-11-19

Typeparams: t_is_null - Type of the is null.

◆ end() [1/3]

template<class t_type , class t_index_type , bool t_null_term>
t_type * end ( )
inlinenodiscard

Gets the end.

Author: Tyler Parke

Date: 2017-11-19

Returns
Null if it fails, else a pointer to a t_type.

◆ end() [2/3]

template<class t_type , class t_index_type , bool t_null_term>
const t_type * end ( ) const
inlinenodiscard

Gets the end.

Author: Tyler Parke

Date: 2017-11-19

Returns
Null if it fails, else a pointer to a const t_type.

◆ end() [3/3]

template<class t_type , class t_index_type , bool t_null_term>
t_type * end ( t_index_type index)
inline

Ends the given index.

Author: Tyler Parke

Date: 2017-11-19

Parameters: index - Zero-based index of the.

Returns
Null if it fails, else a pointer to a t_type.

◆ filledSize()

template<class t_type , class t_index_type , bool t_null_term>
t_index_type filledSize ( ) const
inlinenodiscardconstexpr

Filled size.

Author: Tyler Parke

Date: 2017-11-19

Returns
An t_index_type.

◆ get() [1/2]

template<class t_type , class t_index_type , bool t_null_term>
t_type & get ( t_index_type index)
inline

Gets a t type& using the given index.

Author: Tyler Parke

Date: 2017-11-19

Parameters: index - The index to get.

Returns
A reference to a t_type.

◆ get() [2/2]

template<class t_type , class t_index_type , bool t_null_term>
const t_type & get ( t_index_type index) const
inlinenodiscard

Gets a constant type& using the given index.

Author: Tyler Parke

Date: 2017-11-19

Parameters: index - The index to get.

Returns
A reference to a const t_type.

◆ IsNullTerm()

template<class t_type , class t_index_type , bool t_null_term>
static constexpr bool IsNullTerm ( )
inlinestaticnodiscardconstexpr

◆ memSize()

template<class t_type , class t_index_type , bool t_null_term>
t_index_type memSize ( ) const
inlinenodiscard

◆ nullTerminatorCheck()

template<class t_type , class t_index_type , bool t_null_term>
template<bool t_is_null>
void nullTerminatorCheck ( )
inline

Null terminator check.

Author: Tyler Parke

Date: 2017-11-19

Typeparams: t_is_null - Type of the is null.

◆ operator=()

template<class t_type , class t_index_type , bool t_null_term>
BufferAllocator & operator= ( BufferAllocator< t_type, t_index_type, t_null_term > && value)
inlinenoexcept

Move assignment operator.

Author: Tyler Parke

Date: 2017-11-19

Parameters: value - [in,out] The value.

Returns
A shallow copy of this object.

◆ ptr() [1/2]

template<class t_type , class t_index_type , bool t_null_term>
t_type * ptr ( )
inline

◆ ptr() [2/2]

template<class t_type , class t_index_type , bool t_null_term>
const t_type * ptr ( ) const
inlinenodiscard

◆ removeAllIndex()

template<class t_type , class t_index_type , bool t_null_term>
void removeAllIndex ( t_index_type start,
t_index_type end )
inline

Removes all index.

Author: Tyler Parke

Date: 2017-11-19

Parameters: start - The start. end - The end.

◆ removeAllIndices()

template<class t_type , class t_index_type , bool t_null_term>
template<class t_range_buffer >
void removeAllIndices ( const t_range_buffer & ranges)
inline

◆ removeIndex()

template<class t_type , class t_index_type , bool t_null_term>
void removeIndex ( t_index_type location)
inline

Removes the index described by location.

Author: Tyler Parke

Date: 2017-11-19

Parameters: location - The location.

◆ removeLast()

template<class t_type , class t_index_type , bool t_null_term>
void removeLast ( )
inline

◆ resizeSpace()

template<class t_type , class t_index_type , bool t_null_term>
void resizeSpace ( t_index_type new_size)
inline

Resize space.

Author: Tyler Parke

Date: 2017-11-19

Parameters: new_size - Size of the new.

◆ setAll() [1/3]

template<class t_type , class t_index_type , bool t_null_term>
template<bool is_primitive, class t_other_index_type , bool t_other_null_term>
void setAll ( const BufferAllocator< t_type, t_other_index_type, t_other_null_term > & allocator,
t_index_type offset,
t_index_type other_offset,
t_index_type size )
inline

Sets all.

Author: Tyler Parke

Date: 2017-11-19

Typeparams: true - Type of the true. Parameters: src - Source for the. offset - The offset. size - The size.


Sets all.

Author: Tyler Parke

Date: 2017-11-19

Typeparams: false - Type of the false. Parameters: src - Source for the. offset - The offset. size - The size.


Sets all.

Author: Tyler Parke

Date: 2017-11-19

Typeparams: is_primitive - Type of the is primitive. Parameters: allocator - The allocator. offset - The offset. other_offset - The other offset. size - The size.

◆ setAll() [2/3]

template<class t_type , class t_index_type , bool t_null_term>
void setAll ( const t_type & object,
t_index_type offset,
t_index_type size )
inline

Sets all.

Author: Tyler Parke

Date: 2017-11-19

Parameters: object - The object. offset - The offset. size - The size.

◆ setAll() [3/3]

template<class t_type , class t_index_type , bool t_null_term>
template<bool is_primitive>
void setAll ( const t_type * src,
t_index_type offset,
t_index_type size )
inline

Sets all.

Author: Tyler Parke

Date: 2017-11-19

Typeparams: is_primitive - Type of the is primitive. Parameters: src - Source for the. offset - The offset. size - The size.

◆ setAllFromSource()

template<class t_type , class t_index_type , bool t_null_term>
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 )
inline

Sets all from source.

Author: Tyler Parke

Date: 2017-11-19

Parameters: allocator - The allocator. offset - The offset. other_offset - The other offset. size - The size.

◆ setSize()

template<class t_type , class t_index_type , bool t_null_term>
void setSize ( t_index_type size)
inline

Sets a size.

Author: Tyler Parke

Date: 2017-11-19

Parameters: size - The size.

◆ swap()

template<class t_type , class t_index_type , bool t_null_term>
void swap ( t_index_type index_a,
t_index_type index_b )
inline

Swaps.

Author: Tyler Parke

Date: 2017-11-19

Parameters: index_a - The index a. index_b - The index b.

Member Data Documentation

◆ m_allocated_size

template<class t_type , class t_index_type , bool t_null_term>
t_index_type m_allocated_size

◆ m_buffer

template<class t_type , class t_index_type , bool t_null_term>
t_type* m_buffer

The buffer that stores the actual data.

◆ m_filled_size

template<class t_type , class t_index_type , bool t_null_term>
t_index_type m_filled_size

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