ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Control
AthAllocators
AthAllocators
ArenaHeapAllocator.h
Go to the documentation of this file.
1
// This file's extension implies that it's C, but it's really -*- C++ -*-.
2
3
/*
4
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
5
*/
6
7
// $Id: ArenaHeapAllocator.h 470529 2011-11-24 23:54:22Z ssnyder $
8
16
17
18
#ifndef ATLALLOCATORS_ARENAHEAPALLOCATOR_H
19
#define ATLALLOCATORS_ARENAHEAPALLOCATOR_H
20
21
22
#include "
AthAllocators/ArenaBlockAllocatorBase.h
"
23
#include <cstdlib>
24
25
26
namespace
SG
{
27
28
29
class
ArenaBlock
;
30
31
62
class
ArenaHeapAllocator
63
:
public
ArenaBlockAllocatorBase
64
{
65
public
:
82
template
<
typename
T
,
83
bool
clear
=
false
,
84
bool
no_ctor =
false
,
85
bool
no_dtor =
false
>
86
struct
initParams
87
:
public
ArenaAllocatorBase::initParams
<T, clear, no_ctor, no_dtor>
88
{
89
// Short name for our base class.
90
typedef
ArenaAllocatorBase::initParams<T, clear, no_ctor, no_dtor>
Base
;
91
92
100
initParams
(
size_t
nblock = 1000,
const
std::string& name =
""
);
101
103
ArenaAllocatorBase::Params
params
()
const
;
104
106
// Note: gcc 3.2.3 doesn't allow defining this out-of-line.
107
operator
ArenaAllocatorBase::Params
()
const
{
return
params
(); }
108
};
109
110
116
ArenaHeapAllocator
(
const
Params& params);
117
118
122
virtual
~ArenaHeapAllocator
();
123
124
126
ArenaHeapAllocator
(
const
ArenaHeapAllocator
&) =
delete
;
127
ArenaHeapAllocator
&
operator=
(
const
ArenaHeapAllocator
&) =
delete
;
128
129
133
ArenaHeapAllocator
(
ArenaHeapAllocator
&& other);
134
135
139
ArenaHeapAllocator
&
operator=
(
ArenaHeapAllocator
&& other);
140
141
145
void
swap
(
ArenaHeapAllocator
& other);
146
147
153
pointer
allocate
();
154
155
163
void
free
(pointer p);
164
165
174
virtual
void
reset
()
override
;
175
176
185
virtual
void
erase
() override final;
186
187
188
// These are just placeholders --- the iterators are not implemented.
189
typedef
void
iterator
;
190
typedef
void
const_iterator
;
191
192
193
private
:
197
void
slowClear
();
198
199
203
pointer
refill
();
204
205
210
pointer&
link
(pointer p)
const
;
211
213
pointer
m_freeptr
;
214
};
215
216
217
}
// namespace SG
218
219
220
#include "AthAllocators/ArenaHeapAllocator.icc"
221
222
223
#endif
// not ATLALLOCATORS_ARENAHEAPALLOCATOR_H
ArenaBlockAllocatorBase.h
Common functionality for block-oriented allocators.
clear
void clear()
Empty the pool.
SG::ArenaBlockAllocatorBase
Common functionality for block-oriented allocators.
Definition
ArenaBlockAllocatorBase.h:35
SG::ArenaBlock
A large memory block that gets carved into smaller uniform elements.
Definition
ArenaBlock.h:43
const
SG
Forward declaration.
Definition
CaloCellPacker_400_500.h:32
SG::operator=
ArenaHeapAllocator & operator=(const ArenaHeapAllocator &)=delete
SG::~ArenaHeapAllocator
virtual ~ArenaHeapAllocator()
Destructor.
Definition
ArenaHeapAllocator.cxx:40
SG::iterator
void iterator
Definition
ArenaHeapAllocator.h:189
SG::m_freeptr
pointer m_freeptr
Pointer to the next free element.
Definition
ArenaHeapAllocator.h:213
SG::allocate
pointer allocate()
Allocate a new element.
SG::slowClear
void slowClear()
Call clear() for all allocated elements.
Definition
ArenaHeapAllocator.cxx:174
SG::free
void free(pointer p)
Free an element.
SG::const_iterator
void const_iterator
Definition
ArenaHeapAllocator.h:190
SG::link
pointer & link(pointer p) const
Return a reference to the link for an element.
SG::refill
pointer refill()
Add more free elements to the pool, and allocate a new element.
SG::erase
virtual void erase() override final
Free all allocated elements and release memory back to the system.
SG::reset
virtual void reset() override
Free all allocated elements.
SG::swap
void swap(ArenaHeapAllocator &other)
Swap.
SG::ArenaHeapAllocator
ArenaHeapAllocator(const Params ¶ms)
Constructor.
Definition
ArenaHeapAllocator.cxx:28
TSU::T
unsigned long long T
Definition
L1TopoDataTypes.h:36
SG::ArenaAllocatorBase::Params
Allocator parameters.
Definition
ArenaAllocatorBase.h:150
SG::ArenaAllocatorBase::initParams
Helper to initialize a parameters structure.
Definition
ArenaAllocatorBase.h:316
SG::initParams::initParams
initParams(size_t nblock=1000, const std::string &name="")
Constructor.
SG::initParams::Base
ArenaAllocatorBase::initParams< T, clear, no_ctor, no_dtor > Base
Definition
ArenaHeapAllocator.h:90
SG::initParams::params
ArenaAllocatorBase::Params params() const
Return an initialized parameters structure.
private
#define private
Definition
testRead.cxx:27
Generated on
for ATLAS Offline Software by
1.17.0