Gaia-ECS v1.0.0
A simple and powerful entity component system
Loading...
Searching...
No Matches
gaia::mem::AllocHelper Struct Reference

Typed allocation facade for allocator adaptors. More...

#include <mem_alloc.h>

Static Public Member Functions

template<typename T , typename Adaptor = DefaultAllocatorAdaptor>
static GAIA_NODISCARD T * alloc (uint32_t cnt=1)
 Allocates storage for objects without constructing them.
 
template<typename T , typename Adaptor = DefaultAllocatorAdaptor>
static GAIA_NODISCARD T * alloc (const char *name, uint32_t cnt=1)
 Allocates named storage for objects without constructing them.
 
template<typename T , typename Adaptor = DefaultAllocatorAdaptor>
static GAIA_NODISCARD T * alloc_alig (size_t alig, uint32_t cnt=1)
 Allocates aligned storage for objects without constructing them.
 
template<typename T , typename Adaptor = DefaultAllocatorAdaptor>
static GAIA_NODISCARD T * alloc_alig (const char *name, size_t alig, uint32_t cnt=1)
 Allocates named aligned storage for objects without constructing them.
 
template<typename Adaptor = DefaultAllocatorAdaptor>
static void free (void *ptr)
 Releases storage allocated through an adaptor.
 
template<typename Adaptor = DefaultAllocatorAdaptor>
static void free (const char *name, void *ptr)
 Releases named storage allocated through an adaptor.
 
template<typename Adaptor = DefaultAllocatorAdaptor>
static void free_alig (void *ptr)
 Releases aligned storage allocated through an adaptor.
 
template<typename Adaptor = DefaultAllocatorAdaptor>
static void free_alig (const char *name, void *ptr)
 Releases named aligned storage allocated through an adaptor.
 

Detailed Description

Typed allocation facade for allocator adaptors.

Member Function Documentation

◆ alloc() [1/2]

template<typename T , typename Adaptor = DefaultAllocatorAdaptor>
static GAIA_NODISCARD T * gaia::mem::AllocHelper::alloc ( const char *  name,
uint32_t  cnt = 1 
)
inlinestatic

Allocates named storage for objects without constructing them.

Template Parameters
TObject type.
AdaptorAllocator adaptor type.
Parameters
nameAllocation name reported to the profiler.
cntNumber of objects to reserve storage for.
Returns
Typed pointer to the allocated storage.

◆ alloc() [2/2]

template<typename T , typename Adaptor = DefaultAllocatorAdaptor>
static GAIA_NODISCARD T * gaia::mem::AllocHelper::alloc ( uint32_t  cnt = 1)
inlinestatic

Allocates storage for objects without constructing them.

Template Parameters
TObject type.
AdaptorAllocator adaptor type.
Parameters
cntNumber of objects to reserve storage for.
Returns
Typed pointer to the allocated storage.

◆ alloc_alig() [1/2]

template<typename T , typename Adaptor = DefaultAllocatorAdaptor>
static GAIA_NODISCARD T * gaia::mem::AllocHelper::alloc_alig ( const char *  name,
size_t  alig,
uint32_t  cnt = 1 
)
inlinestatic

Allocates named aligned storage for objects without constructing them.

Template Parameters
TObject type.
AdaptorAllocator adaptor type.
Parameters
nameAllocation name reported to the profiler.
aligRequired byte alignment.
cntNumber of objects to reserve storage for.
Returns
Typed pointer to the allocated storage.

◆ alloc_alig() [2/2]

template<typename T , typename Adaptor = DefaultAllocatorAdaptor>
static GAIA_NODISCARD T * gaia::mem::AllocHelper::alloc_alig ( size_t  alig,
uint32_t  cnt = 1 
)
inlinestatic

Allocates aligned storage for objects without constructing them.

Template Parameters
TObject type.
AdaptorAllocator adaptor type.
Parameters
aligRequired byte alignment.
cntNumber of objects to reserve storage for.
Returns
Typed pointer to the allocated storage.

◆ free() [1/2]

template<typename Adaptor = DefaultAllocatorAdaptor>
static void gaia::mem::AllocHelper::free ( const char *  name,
void *  ptr 
)
inlinestatic

Releases named storage allocated through an adaptor.

Template Parameters
AdaptorAllocator adaptor type.
Parameters
nameAllocation name reported to the profiler.
ptrPointer to release.

◆ free() [2/2]

template<typename Adaptor = DefaultAllocatorAdaptor>
static void gaia::mem::AllocHelper::free ( void *  ptr)
inlinestatic

Releases storage allocated through an adaptor.

Template Parameters
AdaptorAllocator adaptor type.
Parameters
ptrPointer to release.

◆ free_alig() [1/2]

template<typename Adaptor = DefaultAllocatorAdaptor>
static void gaia::mem::AllocHelper::free_alig ( const char *  name,
void *  ptr 
)
inlinestatic

Releases named aligned storage allocated through an adaptor.

Template Parameters
AdaptorAllocator adaptor type.
Parameters
nameAllocation name reported to the profiler.
ptrPointer to release.

◆ free_alig() [2/2]

template<typename Adaptor = DefaultAllocatorAdaptor>
static void gaia::mem::AllocHelper::free_alig ( void *  ptr)
inlinestatic

Releases aligned storage allocated through an adaptor.

Template Parameters
AdaptorAllocator adaptor type.
Parameters
ptrPointer to release.

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