|
|
using | DataPointer = uint8_t * |
| |
|
| | LinearAllocator () |
| |
| void | Init (DataPointer data, size_t bytes) |
| |
| | LinearAllocator (DataPointer data, size_t bytes) |
| |
| DataPointer | GetBase () |
| |
| DataPointer | RawAlloc (size_t bytes, size_t align=1) |
| |
| template<typename T , typename... Args> |
| T * | Alloc (Args &&... args) |
| |
| template<typename T > |
| void | Free (T *value) |
| |
| template<typename T , typename... Args> |
| auto | StackAlloc (Args &&... args) |
| |
| void | Dump (std::ostream &out) |
| |
§ LinearAllocator() [1/2]
| MxEngine::LinearAllocator::LinearAllocator |
( |
| ) |
|
|
inline |
creates empty linear allocator (nullptr chunk pointer, size = 0)
§ LinearAllocator() [2/2]
| MxEngine::LinearAllocator::LinearAllocator |
( |
DataPointer |
data, |
|
|
size_t |
bytes |
|
) |
| |
|
inline |
constructs linear allocator, assigning it memory chunk
- Parameters
-
| data | begin of memory chunk |
| bytes | size in bytes of memory chunk |
§ Alloc()
template<typename T , typename... Args>
| T* MxEngine::LinearAllocator::Alloc |
( |
Args &&... |
args | ) |
|
|
inline |
constructs object of type T in memory and returns pointer to it
- Parameters
-
| args | arguments for object construction |
- Returns
- pointer to unmanaged object
§ Dump()
| void MxEngine::LinearAllocator::Dump |
( |
std::ostream & |
out | ) |
|
|
inline |
prints whole memory chunk byte by byte in hex format into stream provided
- Parameters
-
§ Free()
template<typename T >
| void MxEngine::LinearAllocator::Free |
( |
T * |
value | ) |
|
|
inline |
destroyes object of type T, calling its destructor memory is not freed, as linear allocator does not support it
- Parameters
-
§ GetBase()
| DataPointer MxEngine::LinearAllocator::GetBase |
( |
| ) |
|
|
inline |
memory chunk getter
- Returns
- pointer to begin of memory chunk
§ Init()
| void MxEngine::LinearAllocator::Init |
( |
DataPointer |
data, |
|
|
size_t |
bytes |
|
) |
| |
|
inline |
assigns new memory chunk to linear allocator
- Parameters
-
| data | begin of memory chunk |
| bytes | size in bytes of memory chunk |
§ RawAlloc()
| DataPointer MxEngine::LinearAllocator::RawAlloc |
( |
size_t |
bytes, |
|
|
size_t |
align = 1 |
|
) |
| |
|
inline |
returns pointer to raw allocated memory
- Parameters
-
| bytes | minimal requested block size |
| align | minimal alignment of pointer (defaults to 1) |
- Returns
- pointer to memory
§ StackAlloc()
template<typename T , typename... Args>
| auto MxEngine::LinearAllocator::StackAlloc |
( |
Args &&... |
args | ) |
|
|
inline |
constructs object of type T in memory and returns smart pointer to it
- Parameters
-
| args | arguments for object construction |
- Returns
- smart pointer to object with custom deleter
The documentation for this class was generated from the following file: