Specialized Allocator class using a Memory Arena which manages the allocated memory; see PageArenaAllocator.h for an actual implementation. More...
#include <Allocator.h>
Public Types | |
typedef Base::pointer | pointer |
typedef Base::size_type | size_type |
Public Types inherited from Hypertable::AllocatorBase< T > | |
typedef size_t | size_type |
typedef ptrdiff_t | difference_type |
typedef T * | pointer |
typedef const T * | const_pointer |
typedef T & | reference |
typedef const T & | const_reference |
typedef T | value_type |
Public Member Functions | |
ArenaAllocatorBase () | |
Default constructor; creates an empty object. More... | |
ArenaAllocatorBase (ArenaT &arena) | |
Constructor; takes ownership of a pointer to a memory arena. More... | |
template<typename U > | |
ArenaAllocatorBase (const ArenaAllocatorBase< U, ArenaT > ©) | |
Copy Constructor; copies the memory arena. More... | |
void | check_allocate_size (size_type sz) const |
Sanity check the size of the requested buffer; if it's too large then most likely this is a bug in the application. More... | |
pointer | default_allocate (size_type sz) |
Allocate an array of objects using the regular operator new. More... | |
void | deallocate (pointer p, size_type sz) |
Deletes allocated objects unless an Arena Allocator was used (in this case the function is a nop) More... | |
template<typename U > | |
bool | operator== (const ArenaAllocatorBase< U, ArenaT > &x) const |
operator == returns true if the arena pointers are equal More... | |
template<typename U > | |
bool | operator!= (const ArenaAllocatorBase< U, ArenaT > &x) const |
operator != returns true if the arena pointers are not equal More... | |
template<typename U > | |
void | swap (ArenaAllocatorBase< U, ArenaT > &other) |
Swaps the memory arena from another allocator with the arena of 'this' allocator. More... | |
ArenaT * | arena () const |
Returns a pointer to the Arena. More... | |
void | set_arena (ArenaT *arena) |
Sets the Arena pointer. More... | |
Public Member Functions inherited from Hypertable::AllocatorBase< T > | |
pointer | address (reference x) const |
Returns a pointer to an object of type T. More... | |
const_pointer | address (const_reference x) const |
Returns a const pointer to an object of type T. More... | |
size_type | max_size () const throw () |
Returns the maximum number of objects that this Allocator can allocate; used to check for bad allocations. More... | |
template<class U , class... Args> | |
void | construct (U *p, Args &&...args) |
Creates a new object instance using placement new and the copy constructor. More... | |
void | construct (pointer p) |
Creates a new object instance using placement new and the default constructor. More... | |
void | destroy (pointer p) |
Calls the destructor of an object (unless it's a POD) More... | |
Private Types | |
typedef AllocatorBase< T > | Base |
Private Attributes | |
ArenaT * | m_arenap |
Specialized Allocator class using a Memory Arena which manages the allocated memory; see PageArenaAllocator.h for an actual implementation.
Definition at line 159 of file Allocator.h.
|
private |
Definition at line 160 of file Allocator.h.
typedef Base::pointer Hypertable::ArenaAllocatorBase< T, ArenaT >::pointer |
Definition at line 165 of file Allocator.h.
typedef Base::size_type Hypertable::ArenaAllocatorBase< T, ArenaT >::size_type |
Definition at line 166 of file Allocator.h.
|
inline |
Default constructor; creates an empty object.
Definition at line 169 of file Allocator.h.
|
inline |
Constructor; takes ownership of a pointer to a memory arena.
Definition at line 172 of file Allocator.h.
|
inline |
Copy Constructor; copies the memory arena.
Definition at line 176 of file Allocator.h.
|
inline |
Returns a pointer to the Arena.
Definition at line 246 of file Allocator.h.
|
inline |
Sanity check the size of the requested buffer; if it's too large then most likely this is a bug in the application.
sz | Size of the requested buffer |
Error::BAD_MEMORY_ALLOCATION | If the size is too large |
Definition at line 188 of file Allocator.h.
|
inline |
Deletes allocated objects unless an Arena Allocator was used (in this case the function is a nop)
p | Pointer to the object |
sz | Unused parameter, ignored |
Definition at line 210 of file Allocator.h.
|
inline |
Allocate an array of objects using the regular operator new.
sz | Number of elements in the allocated array |
Definition at line 199 of file Allocator.h.
|
inline |
operator != returns true if the arena pointers are not equal
x | Constant reference to the other object |
Definition at line 226 of file Allocator.h.
|
inline |
operator == returns true if the arena pointers are equal
x | Constant reference to the other object |
Definition at line 217 of file Allocator.h.
|
inline |
Sets the Arena pointer.
arena | Pointer to the arena allocator |
Definition at line 252 of file Allocator.h.
|
inline |
Swaps the memory arena from another allocator with the arena of 'this' allocator.
other | The other ArenaAllocatorBase object |
Definition at line 236 of file Allocator.h.
|
private |
Definition at line 162 of file Allocator.h.