DCSModulesAPI  1.0.0
DCS sub project containing all the control modules as libraries.
Public Member Functions | List of all members
DCS::Memory::LinearAllocator Class Reference

Linearly allocates memory for a single use. More...

#include <DCS_ModuleCore.h>

Public Member Functions

 LinearAllocator (u64 size, u64 align)
 Creates a new LinearAllocator. More...
 
template<typename T , typename... Args>
T * allocate (Args...args)
 Allocates a new section of the pool for a new type T. More...
 
template<typename T >
T * allocate ()
 Allocates a new section of the pool for a new type T. More...
 
void release ()
 Free all the linear allocated memory of the buffer. More...
 
void reset ()
 Invalidate all pool data. Return buffer pointer to start. More...
 

Detailed Description

Linearly allocates memory for a single use.

Can be reused upon reset. Can't be realoc'ed.

Constructor & Destructor Documentation

DCS::Memory::LinearAllocator::LinearAllocator ( u64  size,
u64  align 
)

Creates a new LinearAllocator.

Parameters
sizeSize of the linear pool to alocate
alignAlign the data to align-bits. (Currently disabled.)

Member Function Documentation

template<typename T , typename... Args>
T* DCS::Memory::LinearAllocator::allocate ( Args...  args)
inline

Allocates a new section of the pool for a new type T.

Template Parameters
TType to allocate.
Parameters
argsArguments to the costructor of T.
template<typename T >
T* DCS::Memory::LinearAllocator::allocate ( )
inline

Allocates a new section of the pool for a new type T.

Template Parameters
TType to allocate.
void DCS::Memory::LinearAllocator::release ( )

Free all the linear allocated memory of the buffer.

This invalidates the buffer data.

void DCS::Memory::LinearAllocator::reset ( )

Invalidate all pool data. Return buffer pointer to start.

Effectively setting memory usage to zero.


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