|
|
using | DataPointer = uint8_t * |
| |
|
| | RandomAllocator () |
| |
| void | Init (DataPointer data, size_t bytes) |
| |
| | RandomAllocator (DataPointer data, size_t bytes) |
| |
| DataPointer | GetBase () |
| |
| DataPointer | RawAlloc (size_t bytes, size_t align=1) |
| |
| void | RawFree (uint8_t *ptr) |
| |
| template<typename T , typename... Args> |
| T * | Alloc (Args &&... args) |
| |
| template<typename T , typename... Args> |
| auto | StackAlloc (Args &&... args) |
| |
| template<typename T > |
| void | Free (T *ptr) |
| |
| void | Dump (std::ostream &out) const |
| |
§ RandomAllocator() [1/2]
| MxEngine::RandomAllocator::RandomAllocator |
( |
| ) |
|
|
inline |
creates empty random allocator (first node == last node == nullptr)
§ RandomAllocator() [2/2]
| MxEngine::RandomAllocator::RandomAllocator |
( |
DataPointer |
data, |
|
|
size_t |
bytes |
|
) |
| |
|
inline |
constructs random 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::RandomAllocator::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::RandomAllocator::Dump |
( |
std::ostream & |
out | ) |
const |
|
inline |
prints whole memory chunk byte by byte in hex format into stream provided
- Parameters
-
§ Free()
template<typename T >
| void MxEngine::RandomAllocator::Free |
( |
T * |
ptr | ) |
|
|
inline |
destroyes object of type T, calling its destructor
- Parameters
-
§ GetBase()
| DataPointer MxEngine::RandomAllocator::GetBase |
( |
| ) |
|
|
inline |
memory chunk getter
- Returns
- pointer to begin of memory chunk
§ Init()
| void MxEngine::RandomAllocator::Init |
( |
DataPointer |
data, |
|
|
size_t |
bytes |
|
) |
| |
|
inline |
assigns new memory chunk to random allocator
- Parameters
-
| data | begin of memory chunk |
| bytes | size in bytes of memory chunk |
§ RawAlloc()
| DataPointer MxEngine::RandomAllocator::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
§ RawFree()
| void MxEngine::RandomAllocator::RawFree |
( |
uint8_t * |
ptr | ) |
|
|
inline |
frees raw allocated memory by pointer to its begin
- Parameters
-
§ StackAlloc()
template<typename T , typename... Args>
| auto MxEngine::RandomAllocator::StackAlloc |
( |
Args &&... |
args | ) |
|
|
inline |
constructs object of type T
- 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: