ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Control
AthAllocators
AthAllocators
ArenaPoolAllocator.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
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
4
*/
12
13
#ifndef ATHALLOCATORS_ARENAPOOLALLOCATOR_H
14
#define ATHALLOCATORS_ARENAPOOLALLOCATOR_H
15
16
17
#include "
AthAllocators/ArenaBlockAllocatorBase.h
"
18
#include "boost/iterator/iterator_adaptor.hpp"
19
#include <cstdlib>
20
21
22
namespace
SG
{
23
24
25
class
ArenaBlock
;
26
27
38
class
ArenaPoolAllocator
39
:
public
ArenaBlockAllocatorBase
40
{
41
public
:
42
// Needed forward declaration.
43
class
const_iterator
;
44
53
class
iterator
54
:
public
boost::iterator_adaptor<
55
iterator,
56
pointer,
57
boost::use_default,
58
boost::forward_traversal_tag>
59
{
60
public
:
64
iterator
();
65
66
72
iterator
(
pointer
p,
ArenaBlock
* block);
73
74
75
// To allow initializing a @c const_iterator from an @c iterator.
76
friend
class
const_iterator
;
77
78
79
private
:
81
ArenaBlock
*
m_block
;
82
83
// Required by @c iterator_adaptor.
84
friend
class
boost::iterator_core_access
;
85
87
void
increment
();
88
};
89
90
99
class
const_iterator
100
:
public
boost::iterator_adaptor<
101
const_iterator,
102
const_pointer,
103
boost::use_default,
104
boost::forward_traversal_tag>
105
{
106
public
:
110
const_iterator
();
111
112
118
const_iterator
(
pointer
p,
const
ArenaBlock
* block);
119
120
125
const_iterator
(
const
iterator
& it);
126
127
128
private
:
130
const
ArenaBlock
*
m_block
;
131
132
// Required by @c iterator_adaptor.
133
friend
class
boost::iterator_core_access
;
134
136
void
increment
();
137
};
138
139
145
ArenaPoolAllocator
(
const
Params
&
params
);
146
147
151
virtual
~ArenaPoolAllocator
();
152
153
155
ArenaPoolAllocator
(
const
ArenaPoolAllocator
&) =
delete
;
156
ArenaPoolAllocator
&
operator=
(
const
ArenaPoolAllocator
&) =
delete
;
157
158
162
ArenaPoolAllocator
(
ArenaPoolAllocator
&& other);
163
164
168
ArenaPoolAllocator
&
operator=
(
ArenaPoolAllocator
&& other);
169
170
174
void
swap
(
ArenaPoolAllocator
& other);
175
176
182
pointer
allocate
();
183
184
193
virtual
void
reset
()
override
;
194
195
204
virtual
void
erase
() override final;
205
206
214
void
resetTo
(
pointer
p);
215
216
223
iterator
begin
();
224
225
232
const_iterator
begin
()
const
;
233
234
238
iterator
end
();
239
240
244
const_iterator
end
()
const
;
245
246
247
private
:
251
void
refill
();
252
253
258
void
clearBlock
();
259
260
262
pointer
m_ptr
;
263
265
pointer
m_end
;
266
};
267
268
269
}
// namespace SG
270
271
272
#include "AthAllocators/ArenaPoolAllocator.icc"
273
274
275
#endif
// not ATHALLOCATORS_ARENAPOOLALLOCATOR_H
ArenaBlockAllocatorBase.h
Common functionality for block-oriented allocators.
SG::ArenaAllocatorBase::pointer
char * pointer
Type for pointers to elements.
Definition
ArenaAllocatorBase.h:137
SG::ArenaBlockAllocatorBase::params
const Params & params() const
Return this Allocator's parameters.
Definition
ArenaBlockAllocatorBase.cxx:235
SG::ArenaBlockAllocatorBase::ArenaBlockAllocatorBase
ArenaBlockAllocatorBase(const Params ¶ms)
Constructor.
Definition
ArenaBlockAllocatorBase.cxx:25
SG::ArenaBlock
A large memory block that gets carved into smaller uniform elements.
Definition
ArenaBlock.h:43
SG::ArenaPoolAllocator::const_iterator
Const iterator for the pool.
Definition
ArenaPoolAllocator.h:105
SG::ArenaPoolAllocator::const_iterator::const_iterator
const_iterator(const iterator &it)
Constructor from iterator.
SG::ArenaPoolAllocator::const_iterator::const_iterator
const_iterator(pointer p, const ArenaBlock *block)
Constructor.
SG::ArenaPoolAllocator::const_iterator::const_iterator
const_iterator()
Default constructor.
SG::ArenaPoolAllocator::const_iterator::iterator_core_access
friend class boost::iterator_core_access
Definition
ArenaPoolAllocator.h:133
SG::ArenaPoolAllocator::const_iterator::m_block
const ArenaBlock * m_block
Block containing the current element.
Definition
ArenaPoolAllocator.h:130
SG::ArenaPoolAllocator::const_iterator::increment
void increment()
Move the iterator forward.
Definition
ArenaPoolAllocator.cxx:84
SG::ArenaPoolAllocator::iterator
Non-const iterator for the pool.
Definition
ArenaPoolAllocator.h:59
SG::ArenaPoolAllocator::iterator::iterator
iterator(pointer p, ArenaBlock *block)
Constructor.
SG::ArenaPoolAllocator::iterator::increment
void increment()
Move the iterator forward.
Definition
ArenaPoolAllocator.cxx:74
SG::ArenaPoolAllocator::iterator::m_block
ArenaBlock * m_block
Block containing the current element.
Definition
ArenaPoolAllocator.h:81
SG::ArenaPoolAllocator::iterator::iterator_core_access
friend class boost::iterator_core_access
Definition
ArenaPoolAllocator.h:84
SG::ArenaPoolAllocator::iterator::const_iterator
friend class const_iterator
Definition
ArenaPoolAllocator.h:76
SG::ArenaPoolAllocator::iterator::iterator
iterator()
Default constructor.
SG::ArenaPoolAllocator::allocate
pointer allocate()
Allocate a new element.
SG::ArenaPoolAllocator::m_end
pointer m_end
One past the last available element in the current block, of null.
Definition
ArenaPoolAllocator.h:265
SG::ArenaPoolAllocator::begin
iterator begin()
Starting pool iterator.
Definition
ArenaPoolAllocator.cxx:271
SG::ArenaPoolAllocator::reset
virtual void reset() override
Free all allocated elements.
Definition
ArenaPoolAllocator.cxx:179
SG::ArenaPoolAllocator::resetTo
void resetTo(pointer p)
Reset pool back to a previous state.
Definition
ArenaPoolAllocator.cxx:218
SG::ArenaPoolAllocator::refill
void refill()
Add more free elements to the pool.
Definition
ArenaPoolAllocator.cxx:314
SG::ArenaPoolAllocator::clearBlock
void clearBlock()
Reset all elements in the topmost block, and move the block to the free list.
Definition
ArenaPoolAllocator.cxx:329
SG::ArenaPoolAllocator::~ArenaPoolAllocator
virtual ~ArenaPoolAllocator()
Destructor.
Definition
ArenaPoolAllocator.cxx:108
SG::ArenaPoolAllocator::operator=
ArenaPoolAllocator & operator=(const ArenaPoolAllocator &)=delete
SG::ArenaPoolAllocator::m_ptr
pointer m_ptr
Pointer to the next free element to allocate, or null.
Definition
ArenaPoolAllocator.h:262
SG::ArenaPoolAllocator::ArenaPoolAllocator
ArenaPoolAllocator(const Params ¶ms)
Constructor.
Definition
ArenaPoolAllocator.cxx:97
SG::ArenaPoolAllocator::swap
void swap(ArenaPoolAllocator &other)
Swap.
Definition
ArenaPoolAllocator.cxx:161
SG::ArenaPoolAllocator::erase
virtual void erase() override final
Free all allocated elements and release memory back to the system.
Definition
ArenaPoolAllocator.cxx:201
SG::ArenaPoolAllocator::end
iterator end()
Ending pool iterator.
Definition
ArenaPoolAllocator.cxx:294
SG::ArenaPoolAllocator::ArenaPoolAllocator
ArenaPoolAllocator(const ArenaPoolAllocator &)=delete
Don't allow copy construction or assignment.
const
SG
Forward declaration.
Definition
CaloCellPacker_400_500.h:32
SG::ArenaAllocatorBase::Params
Allocator parameters.
Definition
ArenaAllocatorBase.h:150
private
#define private
Definition
testRead.cxx:27
Generated on
for ATLAS Offline Software by
1.17.0