Cogs.Foundation
|
Classes | |
class | Allocator |
Base allocator implementation. More... | |
class | MemoryBuffer |
struct | MemTypeAllocator |
class | StdAllocator |
class | TypedBuffer |
Functions | |
template<typename T > | |
T * | create (Allocator *allocator) |
Allocate storage and construct an object of the type T with the given allocator. | |
template<typename T , typename... Args> | |
T * | create (Allocator *allocator, Args &&... args) |
Allocate storage and construct an object of the type T with the given allocator, using the given arguments. | |
template<typename T > | |
void | destroy (T *t, Allocator *allocator) |
Destroy the given object and free the allocated memory using the given allocator. | |
COGSFOUNDATION_API std::string | MemToHexString (const void *memory, size_t size) |
Convert a memory buffer to a nicely formatted string of hex digits for debug purposes. | |
template<class T1 , Cogs::MemBlockType memType1, class T2 , Cogs::MemBlockType memType2> | |
bool | operator== (const MemTypeAllocator< T1, memType1 > &lhs, const MemTypeAllocator< T2, memType2 > &rhs) noexcept |
Variables | |
constexpr size_t | kDefaultAlignment = 8 |
Allocate storage and construct an object of the type T with the given allocator.
T | Type of object to construct. |
References Cogs::Memory::Allocator::allocate(), and Cogs::T.
T * Cogs::Memory::create | ( | Allocator * | allocator, |
Args &&... | args | ||
) |
Allocate storage and construct an object of the type T with the given allocator, using the given arguments.
T | Type of object to construct. |
args | Arguments passed on to the constructor of T. |
References Cogs::Memory::Allocator::allocate(), and Cogs::T.
Destroy the given object and free the allocated memory using the given allocator.
The memory must have been allocated using allocator.
t | Pointer to an instance of type T to destruct and deallocate. |
allocator | Pointer to the allocator used to allocate memory for t. |
References Cogs::Memory::Allocator::deallocate(), and Cogs::T.
std::string Cogs::Memory::MemToHexString | ( | const void * | memory, |
size_t | size | ||
) |
Convert a memory buffer to a nicely formatted string of hex digits for debug purposes.
Converts the provided block of memory to a string of hex digits for debug purposes.
*============================================================================================
|
noexcept |
|
constexpr |
Referenced by Cogs::Memory::Allocator::allocate().