ATLAS Offline Software
ArenaBlockAllocatorBase.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-2021 CERN for the benefit of the ATLAS collaboration
4 */
13 #ifndef ATHALLOCATORS_ARENABLOCKALLOCATORBASE_H
14 #define ATHALLOCATORS_ARENABLOCKALLOCATORBASE_H
15 
16 
18 
19 
20 namespace SG {
21 
22 
23 class ArenaBlock;
24 
25 
34  : public ArenaAllocatorBase
35 {
36 public:
43 
44 
48  virtual ~ArenaBlockAllocatorBase();
49 
50 
54 
55 
60 
61 
66 
67 
72 
73 
74 
92  virtual void reserve (size_t size) override;
93 
94 
103  virtual void erase() override;
104 
105 
109  virtual Stats stats() const override;
110 
111 
115  virtual const std::string& name() const override;
116 
117 
121  const Params& params() const;
122 
123 
130  void protect();
131 
132 
139  void unprotect();
140 
141 
142 protected:
147  ArenaBlock* getBlock();
148 
151 
154 
157 
160 
163 };
164 
165 
166 } // namespace SG
167 
168 
169 #endif // not ATHALLOCATORS_ARENABLOCKALLOCATORBASE_H
SG::ArenaBlockAllocatorBase::params
const Params & params() const
Return this Allocator's parameters.
Definition: ArenaBlockAllocatorBase.cxx:224
SG::ArenaBlockAllocatorBase::reserve
virtual void reserve(size_t size) override
Set the total number of elements cached by the allocator.
Definition: ArenaBlockAllocatorBase.cxx:120
SG::ArenaBlockAllocatorBase::m_blocks
ArenaBlock * m_blocks
The list of blocks currently in use.
Definition: ArenaBlockAllocatorBase.h:153
SG::ArenaBlockAllocatorBase::~ArenaBlockAllocatorBase
virtual ~ArenaBlockAllocatorBase()
Destructor.
Definition: ArenaBlockAllocatorBase.cxx:38
SG::ArenaBlockAllocatorBase::getBlock
ArenaBlock * getBlock()
Return an empty block, either newly-allocated or from the free list.
Definition: ArenaBlockAllocatorBase.cxx:234
SG
Forward declaration.
Definition: CaloCellPacker_400_500.h:32
SG::ArenaBlockAllocatorBase::m_params
Params m_params
The parameters for this allocator.
Definition: ArenaBlockAllocatorBase.h:150
SG::ArenaBlockAllocatorBase::erase
virtual void erase() override
Free all allocated elements and release memory back to the system.
Definition: ArenaBlockAllocatorBase.cxx:172
SG::ArenaBlockAllocatorBase::name
virtual const std::string & name() const override
Return the name of this allocator.
Definition: ArenaBlockAllocatorBase.cxx:214
SG::ArenaBlockAllocatorBase::m_protected
bool m_protected
Flag whether the arena has been protected.
Definition: ArenaBlockAllocatorBase.h:162
SG::ArenaBlockAllocatorBase::ArenaBlockAllocatorBase
ArenaBlockAllocatorBase(const ArenaBlockAllocatorBase &)=delete
Don't allow copy construction or assignment.
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
SG::ArenaBlockAllocatorBase::ArenaBlockAllocatorBase
ArenaBlockAllocatorBase(const Params &params)
Constructor.
Definition: ArenaBlockAllocatorBase.cxx:25
SG::ArenaAllocatorBase::Stats
Statistics for an allocator.
Definition: ArenaAllocatorBase.h:188
SG::ArenaBlockAllocatorBase::stats
virtual Stats stats() const override
Return the statistics block for this allocator.
Definition: ArenaBlockAllocatorBase.cxx:196
ArenaAllocatorBase.h
Common base class for arena allocator classes. See Arena.h for an overview of the arena-based memory ...
SG::ArenaAllocatorBase
Common base class for arena allocator classes.
Definition: ArenaAllocatorBase.h:134
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
SG::ArenaBlockAllocatorBase::operator=
ArenaBlockAllocatorBase & operator=(const ArenaBlockAllocatorBase &)=delete
InDetDD::other
@ other
Definition: InDetDD_Defs.h:16
SG::ArenaBlockAllocatorBase::m_stats
ArenaAllocatorBase::Stats m_stats
The statistics structure.
Definition: ArenaBlockAllocatorBase.h:159
SG::ArenaBlockAllocatorBase::unprotect
void unprotect()
Write-enable the memory managed by this allocator.
Definition: ArenaBlockAllocatorBase.cxx:283
SG::ArenaBlockAllocatorBase::swap
void swap(ArenaBlockAllocatorBase &other)
Swap.
Definition: ArenaBlockAllocatorBase.cxx:91
SG::ArenaBlockAllocatorBase::m_freeblocks
ArenaBlock * m_freeblocks
The list of free blocks.
Definition: ArenaBlockAllocatorBase.h:156
SG::ArenaBlockAllocatorBase::protect
void protect()
Write-protect the memory managed by this allocator.
Definition: ArenaBlockAllocatorBase.cxx:270
SG::ArenaAllocatorBase::Params
Allocator parameters.
Definition: ArenaAllocatorBase.h:150