#include <StackAllocator.hpp>
Classes | |
struct | Conf |
Stack allocator configuration data. More... | |
Public Types | |
using | size_type = std::size_t |
Size type. More... | |
Public Member Functions | |
StackAllocator (Conf config=GetDefaultConf()) noexcept | |
Initializing constructor. More... | |
~StackAllocator () noexcept | |
StackAllocator (const StackAllocator ©)=delete | |
Copy constructor. More... | |
StackAllocator (StackAllocator &&other)=delete | |
StackAllocator & | operator= (const StackAllocator &other)=delete |
Copy assignment operator. More... | |
StackAllocator & | operator= (StackAllocator &&other)=delete |
void * | Allocate (size_type size) noexcept |
void | Free (void *p) noexcept |
Frees the given pointer. More... | |
template<typename T > | |
T * | AllocateArray (size_type size) noexcept |
Allocates and array of the given size number of elements. More... | |
void | operator() (void *p) noexcept |
auto | GetMaxAllocation () const noexcept |
Gets the max allocation. More... | |
auto | GetEntryCount () const noexcept |
auto | GetIndex () const noexcept |
auto | GetAllocation () const noexcept |
Gets the total number of bytes that this object has currently allocated. More... | |
auto | GetPreallocatedSize () const noexcept |
Gets the preallocated size. More... | |
auto | GetMaxEntries () const noexcept |
Gets the max entries. More... | |
Static Public Member Functions | |
static PLAYRHO_CONSTEXPR Conf | GetDefaultConf () |
Gets the default configuration. More... | |
Detailed Description
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.
- Note
- This class satisfies the C++11
std::unique_ptr()
Deleter concept. - This data structure is 64-bytes large (on at least one 64-bit platform).
Definition at line 34 of file StackAllocator.hpp.
Member Typedef Documentation
◆ size_type
using playrho::StackAllocator::size_type = std::size_t |
Size type.
Definition at line 39 of file StackAllocator.hpp.
Constructor & Destructor Documentation
◆ StackAllocator() [1/3]
|
explicitnoexcept |
Initializing constructor.
Definition at line 39 of file StackAllocator.cpp.
◆ ~StackAllocator()
|
noexcept |
Definition at line 48 of file StackAllocator.cpp.
◆ StackAllocator() [2/3]
|
delete |
Copy constructor.
◆ StackAllocator() [3/3]
|
delete |
Member Function Documentation
◆ GetDefaultConf()
|
inlinestatic |
Gets the default configuration.
Definition at line 49 of file StackAllocator.hpp.
◆ operator=() [1/2]
|
delete |
Copy assignment operator.
◆ operator=() [2/2]
|
delete |
◆ Allocate()
|
noexcept |
Allocates an aligned block of memory of the given size.
- Returns
- Pointer to memory if the allocator has allocation records left,
nullptr
otherwise.
- See also
- GetEntryCount.
Definition at line 56 of file StackAllocator.cpp.
◆ Free()
|
noexcept |
Frees the given pointer.
Definition at line 90 of file StackAllocator.cpp.
◆ AllocateArray()
|
inlinenoexcept |
Allocates and array of the given size number of elements.
Definition at line 80 of file StackAllocator.hpp.
◆ operator()()
|
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
.
Definition at line 88 of file StackAllocator.hpp.
◆ GetMaxAllocation()
|
inlinenoexcept |
Gets the max allocation.
Definition at line 94 of file StackAllocator.hpp.
◆ GetEntryCount()
|
inlinenoexcept |
Gets the current allocation record entry usage count.
- Returns
- Value between 0 and the maximum number of entries possible for this allocator.
- See also
- GetMaxEntries.
Definition at line 102 of file StackAllocator.hpp.
◆ GetIndex()
|
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
.
- Returns
- Value between 0 and
StackSize
.
Definition at line 112 of file StackAllocator.hpp.
◆ GetAllocation()
|
inlinenoexcept |
Gets the total number of bytes that this object has currently allocated.
Definition at line 118 of file StackAllocator.hpp.
◆ GetPreallocatedSize()
|
inlinenoexcept |
Gets the preallocated size.
Definition at line 124 of file StackAllocator.hpp.
◆ GetMaxEntries()
|
inlinenoexcept |
Gets the max entries.
Definition at line 130 of file StackAllocator.hpp.
The documentation for this class was generated from the following files:
- Common/StackAllocator.hpp
- Common/StackAllocator.cpp