ATLAS Offline Software
|
Common header class for ArenaSharedHeapSTLAllocator. More...
#include <ArenaSharedHeapSTLAllocator.h>
Public Member Functions | |
ArenaSharedHeapSTLHeader (const void *owner, int nblock) | |
Constructor. More... | |
~ArenaSharedHeapSTLHeader () | |
Destructor. More... | |
void | maybe_delete (const void *a) |
Call this when an allocator is being deleted. More... | |
ArenaAllocatorBase::Stats | totstats () const |
Return allocator statistics summed over all our owned allocators. More... | |
template<class T > | |
ArenaHeapAllocator * | get_pool () |
Return the heap allocator for type T . More... | |
void | update_owner (const void *old_owner, const void *new_owner) |
Update the owner of this object. More... | |
void | report (std::ostream &os) const |
Generate printable report for all contained allocators. More... | |
void | protect () |
Write-protect the memory managed by these allocators. More... | |
void | unprotect () |
Write-enable the memory managed by these allocators. More... | |
Static Public Member Functions | |
template<class T > | |
static std::string | get_name () |
Return the name to use for an allocator for type T . More... | |
Static Private Member Functions | |
template<class T > | |
static size_t | get_index () |
Return the allocator index to use for type T . More... | |
Private Attributes | |
const void * | m_owner |
Address of the allocator that created this header. More... | |
size_t | m_nblock |
Saved value for nblock parameter. More... | |
std::vector< ArenaHeapAllocator * > | m_allocators |
List of allocators. More... | |
Common header class for ArenaSharedHeapSTLAllocator.
Each ArenaSharedHeapSTLAllocator has a pointer to a Header class. When a new ASHSTLAllocator object is constructed, we make a new Header; after that, the Header pointer is copied on copy-construction. The Header remembers the address of the object that created it, so that it can be deleted when that allocator is.
The Header contains a list of ArenaHeapAllocator objects, one for each type we're allocating.
Definition at line 90 of file ArenaSharedHeapSTLAllocator.h.
SG::ArenaSharedHeapSTLHeader::ArenaSharedHeapSTLHeader | ( | const void * | owner, |
int | nblock | ||
) |
Constructor.
owner | Address of the object that owns this Header. |
nblock | Value to set in the parameters structure for the number of elements to allocate per block. |
owner | Address of the object that owns this Header. |
nblock | Value to set in the parameters structure for the number of elements to allocate per block. |
name | Value to use as the base for the allocator names. |
Definition at line 26 of file ArenaSharedHeapSTLAllocator.cxx.
SG::ArenaSharedHeapSTLHeader::~ArenaSharedHeapSTLHeader | ( | ) |
Destructor.
Destroy all the allocators we own.
Definition at line 39 of file ArenaSharedHeapSTLAllocator.cxx.
|
staticprivate |
Return the allocator index to use for type T
.
|
static |
Return the name to use for an allocator for type T
.
ArenaHeapAllocator* SG::ArenaSharedHeapSTLHeader::get_pool | ( | ) |
Return the heap allocator for type T
.
void SG::ArenaSharedHeapSTLHeader::maybe_delete | ( | const void * | a | ) |
Call this when an allocator is being deleted.
a | The address of calling allocator. |
If the address matches the address we were given when we were created, this object will be destroyed.
void SG::ArenaSharedHeapSTLHeader::protect | ( | ) |
Write-protect the memory managed by these allocators.
Adjust protection on the memory managed by these allocators to disallow writes.
Definition at line 82 of file ArenaSharedHeapSTLAllocator.cxx.
void SG::ArenaSharedHeapSTLHeader::report | ( | std::ostream & | os | ) | const |
Generate printable report for all contained allocators.
os | Stream to which to write the report. |
Definition at line 67 of file ArenaSharedHeapSTLAllocator.cxx.
ArenaAllocatorBase::Stats SG::ArenaSharedHeapSTLHeader::totstats | ( | ) | const |
Return allocator statistics summed over all our owned allocators.
Definition at line 51 of file ArenaSharedHeapSTLAllocator.cxx.
void SG::ArenaSharedHeapSTLHeader::unprotect | ( | ) |
Write-enable the memory managed by these allocators.
Adjust protection on the memory managed by these allocators to allow writes.
Definition at line 98 of file ArenaSharedHeapSTLAllocator.cxx.
Update the owner of this object.
old_owner | Object giving up ownership. |
new_owner | Object acquiring ownership. |
If the current owner is old_owner
then change the owner to new_owner
.
|
private |
List of allocators.
Definition at line 189 of file ArenaSharedHeapSTLAllocator.h.
|
private |
Saved value for nblock parameter.
Definition at line 186 of file ArenaSharedHeapSTLAllocator.h.
|
private |
Address of the allocator that created this header.
Definition at line 183 of file ArenaSharedHeapSTLAllocator.h.