ATLAS Offline Software
ArenaHeader.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-2017 CERN for the benefit of the ATLAS collaboration
5 */
6 
7 // $Id: ArenaHeader.h 470529 2011-11-24 23:54:22Z ssnyder $
8 
18 #ifndef ATLALLOCATORS_ARENAHEADER_H
19 #define ATLALLOCATORS_ARENAHEADER_H
20 
21 
23 #include "GaudiKernel/EventContext.h"
24 #include <vector>
25 #include <cstdlib>
26 #include <string>
27 #include <iosfwd>
28 #include <mutex>
29 #include "boost/thread/tss.hpp"
30 
31 
32 class EventContext;
33 
34 
35 namespace SG {
36 
37 
38 class ArenaAllocatorBase;
39 class ArenaBase;
40 
41 
54 {
55 public:
59  ArenaHeader();
60 
61 
67  ~ArenaHeader();
68 
69 
79 
80 
88  LockedAllocator allocator (const EventContext& ctx, size_t i);
89 
90 
96  ArenaBase* setArena (ArenaBase* arena);
97 
98 
103  void addArena (ArenaBase* a);
104 
105 
111  void setArenaForSlot (int slot, ArenaBase* a);
112 
113 
120  void delArena (ArenaBase* a);
121 
122 
127  void report (std::ostream& os) const;
128 
129 
137  std::string reportStr () const;
138 
139 
148  void reset();
149 
150 
154  static ArenaHeader* defaultHeader();
155 
156 
157 private:
159  boost::thread_specific_ptr<ArenaBase> m_arena;
160 
163 
165  std::vector<ArenaBase*> m_arenas;
166 
168  std::vector<ArenaBase*> m_slots;
169 
172 };
173 
174 
175 } // namespace SG
176 
177 
179 
180 
181 
182 #endif // not ATLALLOCATORS_ARENAHEADER_H
183 
SG::ArenaHeader::~ArenaHeader
~ArenaHeader()
Destructor.
Definition: ArenaHeader.cxx:47
SG::ArenaHeader::m_mutex
std::mutex m_mutex
Mutex to protect access to m_defaultArena, m_arenas, and m_slots.
Definition: ArenaHeader.h:171
SG
Forward declaration.
Definition: CaloCellPacker_400_500.h:32
BeamSpot::mutex
std::mutex mutex
Definition: InDetBeamSpotVertex.cxx:18
SG::ArenaHeader::setArenaForSlot
void setArenaForSlot(int slot, ArenaBase *a)
Record the arena associated with an event slot.
Definition: ArenaHeader.cxx:84
SG::ArenaHeader::allocator
LockedAllocator allocator(const EventContext &ctx, size_t i)
Translate an integer index to an Allocator pointer.
SG::ArenaHeader::allocator
LockedAllocator allocator(size_t i)
Translate an integer index to an Allocator pointer.
SG::ArenaHeader::reportStr
std::string reportStr() const
Generate a report of all Arenas in the group, and return the result as a string.
Definition: ArenaHeader.cxx:137
SG::ArenaHeader::report
void report(std::ostream &os) const
Generate a report of all Arenas in the group.
Definition: ArenaHeader.cxx:115
lumiFormat.i
int i
Definition: lumiFormat.py:85
SG::ArenaHeader
Proxy for a group of Arenas.
Definition: ArenaHeader.h:54
SG::ArenaHeader::reset
void reset()
Call reset on all Allocators in the current Arena.
Definition: ArenaHeader.cxx:153
SG::LockedAllocator
A pointer type that holds a lock on an allocator object.
Definition: LockedAllocator.h:40
SG::ArenaBase
Part of Arena dealing with the list of allocators.
Definition: ArenaBase.h:42
SG::ArenaHeader::m_arena
boost::thread_specific_ptr< ArenaBase > m_arena
Current Arena.
Definition: ArenaHeader.h:159
ReadFromCoolCompare.os
os
Definition: ReadFromCoolCompare.py:231
ArenaHeader.icc
SG::ArenaHeader::ArenaHeader
ArenaHeader()
Constructor.
Definition: ArenaHeader.cxx:34
SG::ArenaHeader::m_slots
std::vector< ArenaBase * > m_slots
Arenas indexed by event slot.
Definition: ArenaHeader.h:168
SG::ArenaHeader::defaultHeader
static ArenaHeader * defaultHeader()
Return the global default Header instance.
Definition: ArenaHeader.cxx:164
ArenaBase.h
Part of Arena dealing with the list of allocators. Broken out from Arena to avoid a dependency loop w...
a
TList * a
Definition: liststreamerinfos.cxx:10
SG::ArenaHeader::m_arenas
std::vector< ArenaBase * > m_arenas
List of all Arenas in our group.
Definition: ArenaHeader.h:165
SG::ArenaHeader::delArena
void delArena(ArenaBase *a)
Remove an Arena from the group.
Definition: ArenaHeader.cxx:101
SG::ArenaHeader::setArena
ArenaBase * setArena(ArenaBase *arena)
Set the current Arena for the current thread.
Definition: ArenaHeader.cxx:59
SG::ArenaHeader::m_defaultArena
ArenaBase m_defaultArena
The default Arena.
Definition: ArenaHeader.h:162
SG::ArenaHeader::addArena
void addArena(ArenaBase *a)
Add a new Arena to the group.
Definition: ArenaHeader.cxx:72