heap memory provider.
More...
#include <memory.hpp>
|
| | HeapMem () noexcept=default |
| | default constructor.
|
| |
| | HeapMem (uint64_t size) |
| | allocates a heap memory segment.
|
| |
| | HeapMem (const HeapMem &other)=delete |
| | copy constructor.
|
| |
| HeapMem & | operator= (const HeapMem &other)=delete |
| | copy assignment operator.
|
| |
| | HeapMem (HeapMem &&other) noexcept |
| | move constructor.
|
| |
| HeapMem & | operator= (HeapMem &&other) noexcept |
| | move assignment operator.
|
| |
| | ~HeapMem () noexcept |
| | releases the memory.
|
| |
| bool | mapped () const noexcept |
| | check if the memory is allocated.
|
| |
| const void * | get (uint64_t offset=0) const |
| | get a const pointer to the memory at a given offset.
|
| |
| void * | get (uint64_t offset=0) |
| | get a pointer to the memory at a given offset.
|
| |
◆ BumpAllocator
template<size_t Capacity, typename SyncPolicy = BumpAtomic>
◆ HeapMem() [1/4]
| join::HeapMem::HeapMem |
( |
| ) |
|
|
defaultnoexcept |
◆ HeapMem() [2/4]
| join::HeapMem::HeapMem |
( |
uint64_t | size | ) |
|
|
inlineexplicit |
allocates a heap memory segment.
- Parameters
-
| size | allocation size in bytes. |
- Exceptions
-
| std::bad_alloc | if size is 0, too large or malloc fails. |
◆ HeapMem() [3/4]
| join::HeapMem::HeapMem |
( |
const HeapMem & | other | ) |
|
|
delete |
copy constructor.
- Parameters
-
| other | other object to copy. |
◆ HeapMem() [4/4]
| join::HeapMem::HeapMem |
( |
HeapMem && | other | ) |
|
|
inlinenoexcept |
move constructor.
- Parameters
-
| other | other object to move. |
◆ ~HeapMem()
| join::HeapMem::~HeapMem |
( |
| ) |
|
|
inlinenoexcept |
◆ get() [1/2]
| void * join::HeapMem::get |
( |
uint64_t | offset = 0 | ) |
|
|
inline |
get a pointer to the memory at a given offset.
- Parameters
-
| offset | byte offset from the start of the memory. |
- Returns
- pointer to the memory at the specified offset.
- Exceptions
-
| std::runtime_error | if memory is not allocated. |
| std::out_of_range | if offset is out of bounds. |
◆ get() [2/2]
| const void * join::HeapMem::get |
( |
uint64_t | offset = 0 | ) |
const |
|
inline |
get a const pointer to the memory at a given offset.
- Parameters
-
| offset | byte offset from the start of the memory. |
- Returns
- pointer to the memory at the specified offset.
- Exceptions
-
| std::runtime_error | if memory is not allocated. |
| std::out_of_range | if offset is out of bounds. |
◆ mapped()
| bool join::HeapMem::mapped |
( |
| ) |
const |
|
inlinenoexcept |
check if the memory is allocated.
- Returns
- true if the memory is allocated, false otherwise.
◆ operator=() [1/2]
copy assignment operator.
- Parameters
-
| other | other object to copy. |
- Returns
- this.
◆ operator=() [2/2]
move assignment operator.
- Parameters
-
| other | other object to move. |
- Returns
- this.
The documentation for this class was generated from the following file: