Box2D
3.0.0
A Real-Time-Oriented 2-D Physics Engine
|
Stack allocator. More...
#include <StackAllocator.hpp>
Classes | |
struct | Configuration |
Public Types | |
using | size_type = size_t |
Public Member Functions | |
StackAllocator (Configuration config=GetDefaultConfiguration()) noexcept | |
~StackAllocator () noexcept | |
StackAllocator (const StackAllocator ©)=delete | |
void * | Allocate (size_type size) noexcept |
Allocates an aligned block of memory of the given size. More... | |
void | Free (void *p) noexcept |
template<typename T > | |
T * | AllocateArray (size_type size) noexcept |
void | operator() (void *p) noexcept |
Functional operator for freeing memory allocated by this object. More... | |
auto | GetMaxAllocation () const noexcept |
auto | GetEntryCount () const noexcept |
Gets the current allocation record entry usage count. More... | |
auto | GetIndex () const noexcept |
Gets the current index location. More... | |
auto | GetAllocation () const noexcept |
Gets the total number of bytes that this object has currently allocated. More... | |
auto | GetPreallocatedSize () const noexcept |
auto | GetMaxEntries () const noexcept |
Static Public Member Functions | |
static constexpr Configuration | GetDefaultConfiguration () |
Stack allocator.
This is a stack allocator used for fast per step allocations. You must nest allocate/free pairs. The code will assert if you try to interleave multiple allocate/free pairs.
|
noexcept |
|
noexcept |
|
delete |
|
noexcept |
Allocates an aligned block of memory of the given size.
nullptr
otherwise.
|
inlinenoexcept |
|
noexcept |
|
inlinenoexcept |
Gets the total number of bytes that this object has currently allocated.
|
inlinestatic |
|
inlinenoexcept |
Gets the current allocation record entry usage count.
|
inlinenoexcept |
Gets the current index location.
This represents the number of bytes used (of the storage allocated at construction time by this object). Storage remaining is calculated by subtracting this value from StackSize
.
StackSize
.
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
Functional operator for freeing memory allocated by this object.
This method frees memory (like called Free) and allows this object to be used as deleter to std::unique_ptr.