#include <StackAllocator.h>
Public Member Functions | |
| void * | allocate (size_t bytes) |
| Allocate memory. | |
| void | deallocate (void *p, size_t bytes) |
| Deallocate memory. | |
| StackAllocator & | operator= (const StackAllocator &)=delete |
| StackAllocator & | operator= (StackAllocator &&) |
| StackAllocator () | |
| Empty constructor. | |
| StackAllocator (const StackAllocator &)=delete | |
| StackAllocator (size_t bytes, size_t blockSize=1024, std::function< void *(size_t)> allocator=::malloc, std::function< void(void *)> deallocator=::free) | |
| Default constructor. | |
| StackAllocator (StackAllocator &&) | |
| ~StackAllocator () | |
| Destructor. | |
Static Public Member Functions | |
| static constexpr bool | isLIFO () |
| Check if the allocator is Last-In-First-Out (LIFO) | |
Private Attributes | |
| std::function< void *(size_t)> | d_allocator |
| uint32_t | d_available |
| uint8_t | d_blockSize |
| uint32_t | d_capacity |
| std::function< void(void *)> | d_deallocator |
| void * | d_memory |
| uint32_t | d_N |
| void ** | d_ptr |
This class provides basic routines to allocate/deallocate memory. This allocator works like a stack and requires that items are free'd in the reverse order in which they are created. This class is not thread-safe.
Definition at line 17 of file StackAllocator.h.
|
explicit |
Default constructor.
| StackAllocator::StackAllocator | ( | ) |
Empty constructor.
| StackAllocator::~StackAllocator | ( | ) |
Destructor.
|
delete |
| StackAllocator::StackAllocator | ( | StackAllocator && | ) |
| void * StackAllocator::allocate | ( | size_t | bytes | ) |
Allocate memory.
| void StackAllocator::deallocate | ( | void * | p, |
| size_t | bytes | ||
| ) |
Deallocate memory.
|
inlinestaticconstexpr |
Check if the allocator is Last-In-First-Out (LIFO)
Definition at line 45 of file StackAllocator.h.
|
delete |
| StackAllocator & StackAllocator::operator= | ( | StackAllocator && | ) |
|
private |
Definition at line 55 of file StackAllocator.h.
|
private |
Definition at line 50 of file StackAllocator.h.
|
private |
Definition at line 49 of file StackAllocator.h.
|
private |
Definition at line 52 of file StackAllocator.h.
|
private |
Definition at line 56 of file StackAllocator.h.
|
private |
Definition at line 53 of file StackAllocator.h.
|
private |
Definition at line 51 of file StackAllocator.h.
|
private |
Definition at line 54 of file StackAllocator.h.
|
Advanced Multi-Physics (AMP) Oak Ridge National Laboratory Idaho National Laboratory Los Alamos National Laboratory |
This page automatically produced from the source code by Last updated: Tue Mar 10 2026 13:06:41. Comments on this page |