ATLAS Offline Software
|
Base class for Handle
classes, containing parts that are independent of how the Allocator gets created.
More...
#include <ArenaHandleBaseT.h>
Classes | |
class | const_iterator |
Const iterator. More... | |
class | iterator |
Non-const iterator. More... | |
Public Types | |
typedef T * | pointer |
A pointer to the element type we're allocating. More... | |
typedef ArenaHandleBaseAllocT< ALLOC > | Base |
Shorthand for our base class. More... | |
typedef ALLOC | alloc_t |
The Allocator we use. More... | |
Public Member Functions | |
ArenaHandleBaseT (ArenaHeader *header, size_t index) | |
Constructor, passing in an index. More... | |
ArenaHandleBaseT (ArenaHeader *header, const EventContext &ctx, size_t index) | |
Constructor, passing in an index, for a specific event slot. More... | |
ArenaHandleBaseT (ArenaBase *arena, size_t index) | |
Constructor, passing in an index, for a specific Arena. More... | |
iterator | begin () |
Starting iterator. More... | |
const_iterator | begin () const |
Starting const iterator. More... | |
iterator | end () |
Ending iterator. More... | |
const_iterator | end () const |
Ending const iterator. More... | |
void | free (pointer p) |
Free an element. More... | |
void | resetTo (pointer p) |
Reset pool back to a previous state. 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 are independent of how the Allocator gets created.
See Arena.h for an overview of the arena-based memory allocators.
Definition at line 37 of file ArenaHandleBaseT.h.
|
inherited |
The Allocator
we use.
Definition at line 57 of file ArenaHandleBaseAllocT.h.
typedef ArenaHandleBaseAllocT<ALLOC> SG::ArenaHandleBaseT< T, ALLOC >::Base |
Shorthand for our base class.
Definition at line 45 of file ArenaHandleBaseT.h.
typedef T* SG::ArenaHandleBaseT< T, ALLOC >::pointer |
A pointer to the element type we're allocating.
Definition at line 42 of file ArenaHandleBaseT.h.
SG::ArenaHandleBaseT< T, ALLOC >::ArenaHandleBaseT | ( | 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::ArenaHandleBaseT< T, ALLOC >::ArenaHandleBaseT | ( | 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::ArenaHandleBaseT< T, ALLOC >::ArenaHandleBaseT | ( | ArenaBase * | arena, |
size_t | index | ||
) |
|
protectedinherited |
Return our current Allocator.
|
protectedinherited |
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.
iterator SG::ArenaHandleBaseT< T, ALLOC >::begin | ( | ) |
Starting iterator.
This will iterate over all allocated elements (in unspecified order). It is at least a forward_iterator
. This may only be instantiated if the underlying Allocator supports iterators.
const_iterator SG::ArenaHandleBaseT< T, ALLOC >::begin | ( | ) | const |
Starting const iterator.
This will iterate over all allocated elements (in unspecified order). It is at least a forward_iterator
. This may only be instantiated if the underlying Allocator supports iterators.
iterator SG::ArenaHandleBaseT< T, ALLOC >::end | ( | ) |
Ending iterator.
This may only be instantiated if the underlying Allocator supports iterators.
const_iterator SG::ArenaHandleBaseT< T, ALLOC >::end | ( | ) | const |
Ending const iterator.
This may only be instantiated if the underlying Allocator supports iterators.
|
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.
void SG::ArenaHandleBaseT< T, ALLOC >::free | ( | pointer | p | ) |
Free an element.
p | The element to be freed. |
clear()
will be called on the element at this point, if it has been defined.
This may only be instantiated if it's supported by the underlying Allocator.
|
staticprotectedinherited |
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.
|
inherited |
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.
void SG::ArenaHandleBaseT< T, ALLOC >::resetTo | ( | pointer | p | ) |
Reset pool back to a previous state.
p | The pointer back to which to reset. |
This will free (a la reset
) the element p
and all elements that have been allocated after it from this allocator.
This may only be instantiated if it's supported by the underlying Allocator.
|
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.