Aligned memory buffer.
More...
#include <memory.h>
|
static uint64_t | available () |
| Returns the size of available (free) operating memory in bytes. More...
|
|
static uint64_t | total () |
| Returns the size of total operating memory in bytes. More...
|
|
Aligned memory buffer.
Definition at line 27 of file memory.h.
◆ AlignedMemory() [1/4]
◆ AlignedMemory() [2/4]
Beatmup::AlignedMemory::AlignedMemory |
( |
| ) |
|
|
inline |
◆ AlignedMemory() [3/4]
Definition at line 70 of file memory.cpp.
72 DebugAssertion::check(
size > 0,
"Trying to allocate zero memory");
77 reinterpret_cast<std::uintptr_t
>(
rawAddr) + (align -
reinterpret_cast<std::uintptr_t
>(
rawAddr) % align)
static uint64_t available()
Returns the size of available (free) operating memory in bytes.
#define BEATMUP_DEBUG_I(...)
◆ AlignedMemory() [4/4]
AlignedMemory::AlignedMemory |
( |
size_t |
size, |
|
|
int |
value, |
|
|
size_t |
align = DEFAULT_ALIGNMENT |
|
) |
| |
◆ ~AlignedMemory()
AlignedMemory::~AlignedMemory |
( |
| ) |
|
◆ operator=()
◆ operator()() [1/2]
void* Beatmup::AlignedMemory::operator() |
( |
| ) |
|
|
inline |
◆ operator()() [2/2]
const void* Beatmup::AlignedMemory::operator() |
( |
| ) |
const |
|
inline |
◆ ptr() [1/2]
template<typename datatype >
datatype* Beatmup::AlignedMemory::ptr |
( |
int |
offset = 0 | ) |
|
|
inline |
◆ ptr() [2/2]
template<typename datatype >
const datatype* Beatmup::AlignedMemory::ptr |
( |
int |
offset = 0 | ) |
const |
|
inline |
Definition at line 50 of file memory.h.
51 return static_cast<const datatype*
>(
alignAddr) + offset;
◆ at() [1/2]
template<typename datatype >
datatype& Beatmup::AlignedMemory::at |
( |
int |
offset | ) |
|
|
inline |
Definition at line 54 of file memory.h.
55 return *(
static_cast<datatype*
>(
alignAddr) + offset);
◆ at() [2/2]
template<typename datatype >
const datatype& Beatmup::AlignedMemory::at |
( |
int |
offset | ) |
const |
|
inline |
Definition at line 58 of file memory.h.
59 return *(
static_cast<datatype*
>(
alignAddr) + offset);
◆ operator[]()
unsigned char Beatmup::AlignedMemory::operator[] |
( |
int |
offset | ) |
const |
|
inline |
Definition at line 62 of file memory.h.
62 {
return at<unsigned char>(offset); }
◆ operator bool()
Beatmup::AlignedMemory::operator bool |
( |
| ) |
const |
|
inline |
◆ free()
void AlignedMemory::free |
( |
| ) |
|
Frees the allocated memory.
Definition at line 104 of file memory.cpp.
◆ available()
uint64_t AlignedMemory::available |
( |
| ) |
|
|
static |
Returns the size of available (free) operating memory in bytes.
Definition at line 43 of file memory.cpp.
44 #if BEATMUP_PLATFORM_WINDOWS
45 MEMORYSTATUSEX status;
46 status.dwLength =
sizeof(status);
47 GlobalMemoryStatusEx(&status);
48 return status.ullAvailPhys;
52 return info.freeram * info.mem_unit;
◆ total()
uint64_t AlignedMemory::total |
( |
| ) |
|
|
static |
Returns the size of total operating memory in bytes.
Definition at line 56 of file memory.cpp.
57 #if BEATMUP_PLATFORM_WINDOWS
58 MEMORYSTATUSEX status;
59 status.dwLength =
sizeof(status);
60 GlobalMemoryStatusEx(&status);
61 return status.ullTotalPhys;
65 return info.totalram * info.mem_unit;
◆ rawAddr
void* Beatmup::AlignedMemory::rawAddr |
|
private |
◆ alignAddr
void* Beatmup::AlignedMemory::alignAddr |
|
private |
◆ DEFAULT_ALIGNMENT
const size_t AlignedMemory::DEFAULT_ALIGNMENT = 8 |
|
static |
default number of bytes to align the address
Definition at line 33 of file memory.h.
The documentation for this class was generated from the following files: