ATLAS Offline Software
Loading...
Searching...
No Matches
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
16
17
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
32class EventContext;
33
34
35namespace SG {
36
37
39class ArenaBase;
40
41
54{
55public:
60
61
68
69
79
80
88 LockedAllocator allocator (const EventContext& ctx, size_t i);
89
90
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
157private:
159 boost::thread_specific_ptr<ArenaBase> m_arena;
160
163
165 std::vector<ArenaBase*> m_arenas;
166
168 std::vector<ArenaBase*> m_slots;
169
171 mutable std::mutex m_mutex;
172};
173
174
175} // namespace SG
176
177
179
180
181
182#endif // not ATLALLOCATORS_ARENAHEADER_H
183
Part of Arena dealing with the list of allocators. Broken out from Arena to avoid a dependency loop w...
static Double_t a
Common base class for arena allocator classes.
Part of Arena dealing with the list of allocators.
Definition ArenaBase.h:42
ArenaBase * setArena(ArenaBase *arena)
Set the current Arena for the current thread.
LockedAllocator allocator(size_t i)
Translate an integer index to an Allocator pointer.
void addArena(ArenaBase *a)
Add a new Arena to the group.
std::string reportStr() const
Generate a report of all Arenas in the group, and return the result as a string.
void delArena(ArenaBase *a)
Remove an Arena from the group.
std::vector< ArenaBase * > m_arenas
List of all Arenas in our group.
void reset()
Call reset on all Allocators in the current Arena.
boost::thread_specific_ptr< ArenaBase > m_arena
Current Arena.
void report(std::ostream &os) const
Generate a report of all Arenas in the group.
~ArenaHeader()
Destructor.
std::vector< ArenaBase * > m_slots
Arenas indexed by event slot.
ArenaHeader()
Constructor.
static ArenaHeader * defaultHeader()
Return the global default Header instance.
ArenaBase m_defaultArena
The default Arena.
void setArenaForSlot(int slot, ArenaBase *a)
Record the arena associated with an event slot.
LockedAllocator allocator(const EventContext &ctx, size_t i)
Translate an integer index to an Allocator pointer.
std::mutex m_mutex
Mutex to protect access to m_defaultArena, m_arenas, and m_slots.
A pointer type that holds a lock on an allocator object.
Forward declaration.