ATLAS Offline Software
|
Base class for Handle
classes, containing parts that depend only on the Allocator.
More...
#include <ArenaHandleBaseAllocT.h>
Classes | |
class | Creator |
Concrete ArenaAllocatorCreator class used to create the Allocator for this handle. More... | |
Public Types | |
typedef ALLOC | alloc_t |
The Allocator we use. More... | |
Public Member Functions | |
ArenaHandleBaseAllocT (ArenaHeader *header, size_t index) | |
Constructor, passing in an index. More... | |
ArenaHandleBaseAllocT (ArenaHeader *header, const EventContext &ctx, size_t index) | |
Constructor, passing in an index, for a specific event slot. More... | |
ArenaHandleBaseAllocT (ArenaBase *arena, size_t index) | |
Constructor, passing in an index, for a specific Arena. More... | |
const ALLOC::Params & | params () const |
Return our Allocator's parameters. More... | |
void | reset () |
Free all allocated elements (of this type in the current Arena). More... | |
void | erase () |
Free all allocated elements and release memory back to the system (of this type in the current Arena). More... | |
void | reserve (size_t size) |
Set the total number of elements cached by the allocator (in the current Arena). More... | |
ArenaAllocatorBase::Stats | stats () const |
Return the statistics block for this allocator, for the current Arena. More... | |
Protected Member Functions | |
ALLOC * | allocator () |
Return our current Allocator. More... | |
const ALLOC * | allocator () const |
Return our current Allocator. More... | |
ArenaAllocatorBase * | baseAllocator () |
Return the current Allocator which we are referencing. More... | |
const ArenaAllocatorBase * | baseAllocator () const |
Return the current Allocator which we are referencing. More... | |
Static Protected Member Functions | |
template<class HANDLE , class DEFPARAMS > | |
static size_t | makeIndex (const typename ALLOC::Params *params) |
Find the index for creating an allocator. More... | |
Private Attributes | |
LockedAllocator | m_allocator |
The associated allocator object. More... | |
Base class for Handle
classes, containing parts that depend only on the Allocator.
See Arena.h for an overview of the arena-based memory allocators.
This is the part of Handle
that depends only on the Allocator class (on which it is templated). This implementation here is responsible for registering the Allocator and handling its possible creation.
A Handle
uses an index to identify the particular Allocator class which it uses; the ArenaAllocatorRegistry
class maps between these indices and instances of ArenaAllocatorCreator
, which are capable of creating new Allocator
instances. An ArenaHandleBaseAllocT
may be created by either passing in the index directly or by passing in a concrete instance of ArenaAllocatorCreator
. In the latter case, we will look up the index, registering the creator if needed.
Definition at line 52 of file ArenaHandleBaseAllocT.h.
typedef ALLOC SG::ArenaHandleBaseAllocT< ALLOC >::alloc_t |
The Allocator
we use.
Definition at line 57 of file ArenaHandleBaseAllocT.h.
SG::ArenaHandleBaseAllocT< ALLOC >::ArenaHandleBaseAllocT | ( | ArenaHeader * | header, |
size_t | index | ||
) |
Constructor, passing in an index.
header | The group of Arenas which this Handle may reference. May be null to select the global default. |
index | The index of this Handle's Allocator type. |
SG::ArenaHandleBaseAllocT< ALLOC >::ArenaHandleBaseAllocT | ( | ArenaHeader * | header, |
const EventContext & | ctx, | ||
size_t | index | ||
) |
Constructor, passing in an index, for a specific event slot.
header | The group of Arenas which this Handle may reference. May be null to select the global default. |
ctx | Event context identifying the event slot. |
index | The index of this Handle's Allocator type. |
SG::ArenaHandleBaseAllocT< ALLOC >::ArenaHandleBaseAllocT | ( | ArenaBase * | arena, |
size_t | index | ||
) |
|
protected |
Return our current Allocator.
|
protected |
Return our current Allocator.
|
protectedinherited |
Return the current Allocator which we are referencing.
This may cause a new Allocator to be created.
|
protectedinherited |
Return the current Allocator which we are referencing.
This may cause a new Allocator to be created.
|
inherited |
Free all allocated elements and release memory back to the system (of this type in the current Arena).
All elements allocated in the current Arena by our associated Allocator are freed, and all allocated blocks of memory are released back to the system. destructor
should be called on them if it was provided (preceded by clear
if provided and mustClear
was set).
Definition at line 87 of file ArenaHandleBase.cxx.
|
staticprotected |
Find the index for creating an allocator.
params | Pointer to the supplied parameters. If null, use the result of DEFPARAMS(). |
We look up in the registry the Allocator name we get from params
(if this is blank, a name is derived from ALLOC
). If not found, then we register Allocator and return the new index.
const ALLOC::Params& SG::ArenaHandleBaseAllocT< ALLOC >::params | ( | ) | const |
Return our Allocator's parameters.
|
inherited |
Set the total number of elements cached by the allocator (in the current Arena).
size | The desired pool size. |
This allows changing the number of elements that are currently free but cached. Any allocated elements are not affected by this call.
If size
is greater than the total number of elements currently cached, then more will be allocated. This will preferably done with a single block, but that is not guaranteed; in addition, the allocator may allocate more elements than is requested.
If size
is smaller than the total number of elements currently cached, as many blocks as possible will be released back to the system. It may not be possible to release the number of elements requested; this should be implemented on a best-effort basis.
Definition at line 111 of file ArenaHandleBase.cxx.
|
inherited |
Free all allocated elements (of this type in the current Arena).
All elements allocated in the current Arena by our associated Allocator are returned to the free state. clear
should be called on them if it was provided. The elements may continue to be cached internally, without returning to the system.
Definition at line 71 of file ArenaHandleBase.cxx.
|
inherited |
Return the statistics block for this allocator, for the current Arena.
Definition at line 121 of file ArenaHandleBase.cxx.
|
privateinherited |
The associated allocator object.
Definition at line 160 of file ArenaHandleBase.h.