ATLAS Offline Software
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 
18 #ifndef ATLALLOCATORS_ARENAHEAPALLOCATOR_H
19 #define ATLALLOCATORS_ARENAHEAPALLOCATOR_H
20 
21 
23 #include <cstdlib>
24 
25 
26 namespace SG {
27 
28 
29 class ArenaBlock;
30 
31 
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.
91 
92 
100  initParams (size_t nblock = 1000, const std::string& name = "");
101 
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 
128 
129 
134 
135 
140 
141 
145  void swap (ArenaHeapAllocator& other);
146 
147 
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 
211 
214 };
215 
216 
217 } // namespace SG
218 
219 
220 #include "AthAllocators/ArenaHeapAllocator.icc"
221 
222 
223 #endif // not ATLALLOCATORS_ARENAHEAPALLOCATOR_H
SG::ArenaBlockAllocatorBase::params
const Params & params() const
Return this Allocator's parameters.
Definition: ArenaBlockAllocatorBase.cxx:224
SG::ArenaHeapAllocator::operator=
ArenaHeapAllocator & operator=(const ArenaHeapAllocator &)=delete
SG
Forward declaration.
Definition: CaloCellPacker_400_500.h:32
SG::ArenaHeapAllocator::free
void free(pointer p)
Free an element.
SG::ArenaHeapAllocator::ArenaHeapAllocator
ArenaHeapAllocator(const ArenaHeapAllocator &)=delete
Don't allow copy construction or assignment.
SG::ArenaHeapAllocator
Heap-based allocator.
Definition: ArenaHeapAllocator.h:64
SG::ArenaBlockAllocatorBase::name
virtual const std::string & name() const override
Return the name of this allocator.
Definition: ArenaBlockAllocatorBase.cxx:214
const
bool const RAWDATA *ch2 const
Definition: LArRodBlockPhysicsV0.cxx:560
SG::ArenaHeapAllocator::initParams::initParams
initParams(size_t nblock=1000, const std::string &name="")
Constructor.
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
SG::ArenaHeapAllocator::slowClear
void slowClear()
Call clear() for all allocated elements.
Definition: ArenaHeapAllocator.cxx:164
SG::ArenaHeapAllocator::const_iterator
void const_iterator
Definition: ArenaHeapAllocator.h:190
ArenaBlockAllocatorBase.h
Common functionality for block-oriented allocators.
SG::ArenaHeapAllocator::erase
virtual void erase() override final
Free all allocated elements and release memory back to the system.
Definition: ArenaHeapAllocator.cxx:129
SG::ArenaHeapAllocator::swap
void swap(ArenaHeapAllocator &other)
Swap.
Definition: ArenaHeapAllocator.cxx:78
SG::ArenaHeapAllocator::reset
virtual void reset() override
Free all allocated elements.
Definition: ArenaHeapAllocator.cxx:95
SG::ArenaBlockAllocatorBase
Common functionality for block-oriented allocators.
Definition: ArenaBlockAllocatorBase.h:35
private
#define private
Definition: DetDescrConditionsDict_dict_fixes.cxx:13
SG::ArenaHeapAllocator::initParams::Base
ArenaAllocatorBase::initParams< T, clear, no_ctor, no_dtor > Base
Definition: ArenaHeapAllocator.h:90
SG::ArenaHeapAllocator::m_freeptr
pointer m_freeptr
Pointer to the next free element.
Definition: ArenaHeapAllocator.h:213
SG::ArenaHeapAllocator::iterator
void iterator
Definition: ArenaHeapAllocator.h:189
InDetDD::other
@ other
Definition: InDetDD_Defs.h:16
VKalVrtAthena::varHolder_detail::clear
void clear(T &var)
Definition: NtupleVars.h:48
SG::ArenaHeapAllocator::initParams
Helper to initialize a parameters structure.
Definition: ArenaHeapAllocator.h:88
SG::ArenaAllocatorBase::initParams
Helper to initialize a parameters structure.
Definition: ArenaAllocatorBase.h:316
SG::ArenaAllocatorBase::pointer
char * pointer
Type for pointers to elements.
Definition: ArenaAllocatorBase.h:137
SG::ArenaHeapAllocator::refill
pointer refill()
Add more free elements to the pool, and allocate a new element.
Definition: ArenaHeapAllocator.cxx:139
SG::ArenaHeapAllocator::ArenaHeapAllocator
ArenaHeapAllocator(const Params &params)
Constructor.
Definition: ArenaHeapAllocator.cxx:27
SG::ArenaAllocatorBase::Params
Allocator parameters.
Definition: ArenaAllocatorBase.h:150
SG::ArenaHeapAllocator::link
pointer & link(pointer p) const
Return a reference to the link for an element.
SG::ArenaHeapAllocator::initParams::params
ArenaAllocatorBase::Params params() const
Return an initialized parameters structure.
SG::ArenaHeapAllocator::allocate
pointer allocate()
Allocate a new element.
SG::ArenaHeapAllocator::~ArenaHeapAllocator
virtual ~ArenaHeapAllocator()
Destructor.
Definition: ArenaHeapAllocator.cxx:39