Internal type defining a memory buffer. The allocation space is found behind this object itself as it is placed at the start of each allocated buffer.
Definition at line 26 of file monoallocator.hpp.
#include <monoallocator.hpp>
|
| static constexpr unsigned char | CLEAR = 0xF1 |
| static constexpr unsigned char | MAGIC = 0xA1 |
|
| static constexpr size_t | firstOffset (size_t firstObject, size_t alignment) |
|
| char * | act |
| | Pointer to the next free space in the buffer.
|
| char * | end |
| | Pointer to the first byte behind the buffer.
|
| Buffer * | previous |
| | the previously allocated buffer.
|
|
|
| Buffer ()=default |
| | Defaulted default constructor.
|
| | Buffer (size_t size) |
| char * | allocate (size_t size, size_t alignment) |
| void | reset () |
| size_t | Size () |
◆ act
| char* alib::monomem::detail::Buffer::act |
◆ CLEAR
| unsigned char alib::monomem::detail::Buffer::CLEAR = 0xF1 |
|
staticconstexpr |
◆ end
| char* alib::monomem::detail::Buffer::end |
◆ MAGIC
| unsigned char alib::monomem::detail::Buffer::MAGIC = 0xA1 |
|
staticconstexpr |
◆ previous
| Buffer* alib::monomem::detail::Buffer::previous |
◆ Buffer()
| alib::monomem::detail::Buffer::Buffer |
( |
size_t | size | ) |
|
|
inline |
Initializes the members of this buffer to reflect the given size.
- Parameters
-
| size | The size of the given mem. |
Definition at line 51 of file monoallocator.hpp.
◆ allocate()
| char * alib::monomem::detail::Buffer::allocate |
( |
size_t | size, |
|
|
size_t | alignment ) |
|
inline |
Returns a pointer to an aligned piece of memory of the requested size inside this buffer. If there is not enough space left, nullptr is returned.
- Parameters
-
| size | The size to allocate. |
| alignment | The necessary alignment. |
- Returns
nullptr on failure, otherwise pointer to the requested memory.
Definition at line 78 of file monoallocator.hpp.
◆ firstOffset()
| constexpr size_t alib::monomem::detail::Buffer::firstOffset |
( |
size_t | firstObject, |
|
|
size_t | alignment ) |
|
inlinestaticconstexpr |
Returns the first offset of an object with given alignment behind an object with. smaller alignment.
- Parameters
-
| firstObject | The allocation size of the first object allocated in a buffer. |
| alignment | The allocation alignment of the first object allocated in a buffer. |
- Returns
- The value to add to the allocation size to ensure that an object with a certain alignment fits after placing firstObject at the start..
Definition at line 46 of file monoallocator.hpp.
◆ reset()
| void alib::monomem::detail::Buffer::reset |
( |
| ) |
|
|
inline |
"Frees" all allocated memory by simply resetting the fill marker of this buffer to the first usable byte of the allocated buffer.
Definition at line 65 of file monoallocator.hpp.
◆ Size()
| size_t alib::monomem::detail::Buffer::Size |
( |
| ) |
|
|
inline |
The documentation for this struct was generated from the following file: