Thrill
0.1
|
Storage area allocated on the stack and usable by a StackAllocator.
Definition at line 32 of file stack_allocator.hpp.
#include <stack_allocator.hpp>
Classes | |
union | AlignmentHelper |
union to enforce alignment of buffer area More... | |
Public Member Functions | |
StackArena () noexcept | |
default constructor: free pointer at the beginning. More... | |
StackArena (const StackArena &)=delete | |
~StackArena () | |
destructor clears ptr_ for debugging. More... | |
char * | allocate (size_t n) |
void | deallocate (char *p, size_t n) noexcept |
StackArena & | operator= (const StackArena &)=delete |
void | reset () noexcept |
reset memory area More... | |
size_t | used () const noexcept |
return number of bytes used in StackArena More... | |
Static Public Member Functions | |
static constexpr size_t | size () noexcept |
size of memory area More... | |
Private Member Functions | |
bool | pointer_in_buffer (char *p) noexcept |
debug method to check whether ptr_ is still in buf_. More... | |
Private Attributes | |
union { | |
char buf_ [Size] | |
stack memory area used for allocations. More... | |
AlignmentHelper dummy_for_alignment_ | |
enforce alignment More... | |
}; | |
char * | ptr_ |
pointer into free bytes in buf_ More... | |
Static Private Attributes | |
static constexpr size_t | alignment = 16 |
|
inlinenoexcept |
default constructor: free pointer at the beginning.
Definition at line 64 of file stack_allocator.hpp.
Referenced by StackArena< Size >::~StackArena().
|
inline |
destructor clears ptr_ for debugging.
Definition at line 67 of file stack_allocator.hpp.
References StackArena< Size >::operator=(), and StackArena< Size >::StackArena().
|
delete |
|
inline |
Definition at line 72 of file stack_allocator.hpp.
References StackArena< Size >::alignment, StackArena< Size >::buf_, malloc(), StackArena< Size >::pointer_in_buffer(), and StackArena< Size >::ptr_.
|
inlinenoexcept |
Definition at line 88 of file stack_allocator.hpp.
References free(), StackArena< Size >::AlignmentHelper::p, and StackArena< Size >::pointer_in_buffer().
|
delete |
Referenced by StackAllocator< Type, Size >::StackAllocator(), and StackArena< Size >::~StackArena().
|
inlineprivatenoexcept |
debug method to check whether ptr_ is still in buf_.
Definition at line 59 of file stack_allocator.hpp.
References StackArena< Size >::buf_, and StackArena< Size >::AlignmentHelper::p.
Referenced by StackArena< Size >::allocate(), and StackArena< Size >::deallocate().
|
inlinenoexcept |
reset memory area
Definition at line 110 of file stack_allocator.hpp.
References StackArena< Size >::buf_.
|
inlinestaticnoexcept |
size of memory area
Definition at line 104 of file stack_allocator.hpp.
|
inlinenoexcept |
return number of bytes used in StackArena
Definition at line 107 of file stack_allocator.hpp.
References StackArena< Size >::buf_.
union { ... } |
|
staticprivate |
Definition at line 34 of file stack_allocator.hpp.
Referenced by StackArena< Size >::allocate().
char buf_[Size] |
stack memory area used for allocations.
Definition at line 50 of file stack_allocator.hpp.
Referenced by StackArena< Size >::allocate(), StackArena< Size >::pointer_in_buffer(), StackArena< Size >::reset(), and StackArena< Size >::used().
AlignmentHelper dummy_for_alignment_ |
enforce alignment
Definition at line 52 of file stack_allocator.hpp.
|
private |
pointer into free bytes in buf_
Definition at line 56 of file stack_allocator.hpp.
Referenced by StackArena< Size >::allocate().