Flan
Public Member Functions | List of all members
r8b::CFixedBuffer< T > Class Template Reference

Templated memory buffer class for element buffers of fixed capacity. More...

#include <r8bbase.h>

Inheritance diagram for r8b::CFixedBuffer< T >:
Inheritance graph
[legend]
Collaboration diagram for r8b::CFixedBuffer< T >:
Collaboration graph
[legend]

Public Member Functions

 CFixedBuffer (const int Capacity)
 Constructor allocates memory so that the specified number of elements of type T can be stored in *this buffer object. More...
 
void alloc (const int Capacity)
 Function allocates memory so that the specified number of elements of type T can be stored in *this buffer object. More...
 
void realloc (const int PrevCapacity, const int NewCapacity)
 Function reallocates memory so that the specified number of elements of type T can be stored in *this buffer object. More...
 
void free ()
 Function deallocates a previously allocated buffer.
 
T * getPtr () const
 
 operator T* () const
 

Detailed Description

template<class T>
class r8b::CFixedBuffer< T >

Templated memory buffer class for element buffers of fixed capacity.

Fixed memory buffer object. Supports allocation of a fixed amount of memory. Does not store buffer's capacity - the user should know the actual capacity of the buffer. Does not feature "internal" storage, memory is always allocated via the R8B_MEMALLOCCLASS class's functions. Thus the object of this class can be moved in memory.

This class manages memory space only - it does not perform element class construction nor destruction operations.

This class applies 256-bit memory address alignment to the allocated data block.

Parameters
TThe class of the stored elements (e.g. "double").

Constructor & Destructor Documentation

◆ CFixedBuffer()

template<class T>
r8b::CFixedBuffer< T >::CFixedBuffer ( const int  Capacity)
inline

Constructor allocates memory so that the specified number of elements of type T can be stored in *this buffer object.

Parameters
CapacityStorage for this number of elements to allocate.

Member Function Documentation

◆ alloc()

template<class T>
void r8b::CFixedBuffer< T >::alloc ( const int  Capacity)
inline

Function allocates memory so that the specified number of elements of type T can be stored in *this buffer object.

Parameters
CapacityStorage for this number of elements to allocate.

◆ getPtr()

template<class T>
T* r8b::CFixedBuffer< T >::getPtr ( ) const
inline
Returns
Pointer to the first element of the allocated buffer, NULL if not allocated.

◆ operator T*()

template<class T>
r8b::CFixedBuffer< T >::operator T* ( ) const
inline
Returns
Pointer to the first element of the allocated buffer, NULL if not allocated.

◆ realloc()

template<class T>
void r8b::CFixedBuffer< T >::realloc ( const int  PrevCapacity,
const int  NewCapacity 
)
inline

Function reallocates memory so that the specified number of elements of type T can be stored in *this buffer object.

Previously allocated data is copied to the new memory buffer.

Parameters
PrevCapacityPrevious capacity of *this buffer.
NewCapacityStorage for this number of elements to allocate.

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