ATLAS Offline Software
ArenaHandleBaseAllocT.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: ArenaHandleBaseAllocT.h 470529 2011-11-24 23:54:22Z ssnyder $
8 
19 #ifndef ATLALLOCATORS_ARENAHANDLEBASEALLOCT_H
20 #define ATLALLOCATORS_ARENAHANDLEBASEALLOCT_H
21 
22 
26 #include "GaudiKernel/System.h"
27 #include <string>
28 
29 
30 namespace SG {
31 
32 
51 template <typename ALLOC>
53  : public ArenaHandleBase
54 {
55 public:
57  typedef ALLOC alloc_t;
58 
59 
67 
68 
77  const EventContext& ctx,
78  size_t index);
79 
80 
87 
88 
92  const typename ALLOC::Params& params() const;
93 
94 
95 protected:
99  ALLOC* allocator();
100 
101 
105  const ALLOC* allocator() const;
106 
107 
117  template <class HANDLE, class DEFPARAMS>
118  static
119  size_t makeIndex (const typename ALLOC::Params* params);
120 
121 private:
132  class Creator
133  : public ArenaAllocatorCreator
134  {
135  public:
138  typedef
139  std::unique_ptr<ArenaAllocatorBase> makeFunc_t (const typename ALLOC::Params&);
140 
141 
151  Creator (const std::string& name,
152  makeFunc_t* makeFunc,
153  const typename ALLOC::Params& params);
154 
155 
159  virtual std::unique_ptr<ArenaAllocatorBase> create();
160 
161 
165  const std::string& name() const;
166 
167 
168  protected:
171 
173  typename ALLOC::Params m_params;
174  };
175 };
176 
177 
178 } // namespace SG
179 
180 
182 
183 
184 #endif // not ATLALLOCATORS_ARENAHANDLEBASEALLOCT_H
header
Definition: hcg.cxx:526
SG
Forward declaration.
Definition: CaloCellPacker_400_500.h:32
index
Definition: index.py:1
SG::ArenaHandleBaseAllocT::Creator::Creator
Creator(const std::string &name, makeFunc_t *makeFunc, const typename ALLOC::Params &params)
Constructor.
SG::ArenaHandleBaseAllocT::ArenaHandleBaseAllocT
ArenaHandleBaseAllocT(ArenaHeader *header, const EventContext &ctx, size_t index)
Constructor, passing in an index, for a specific event slot.
SG::ArenaHandleBaseAllocT::ArenaHandleBaseAllocT
ArenaHandleBaseAllocT(ArenaHeader *header, size_t index)
Constructor, passing in an index.
SG::ArenaHandleBaseAllocT::allocator
ALLOC * allocator()
Return our current Allocator.
SG::ArenaHandleBase
Base class for all Handle classes, containing parts that do not depend on the referenced type.
Definition: ArenaHandleBase.h:59
SG::ArenaHandleBaseAllocT::allocator
const ALLOC * allocator() const
Return our current Allocator.
ArenaHandleBase.h
Base class for all Handle classes, containing parts that do not depend on the referenced type....
SG::ArenaHandleBaseAllocT::Creator
Concrete ArenaAllocatorCreator class used to create the Allocator for this handle.
Definition: ArenaHandleBaseAllocT.h:134
ArenaAllocatorCreator.h
Provide an interface for creating an arena Allocator. See Arena.h for an overview of the arena-based ...
SG::ArenaHeader
Proxy for a group of Arenas.
Definition: ArenaHeader.h:54
SG::ArenaHandleBaseAllocT::Creator::makeFunc_t
std::unique_ptr< ArenaAllocatorBase > makeFunc_t(const typename ALLOC::Params &)
Type for m_makeFunc — a function returning a new Allocator from a parameters structure.
Definition: ArenaHandleBaseAllocT.h:139
SG::ArenaAllocatorCreator
Provide an interface for creating an arena Allocator.
Definition: ArenaAllocatorCreator.h:39
SG::ArenaBase
Part of Arena dealing with the list of allocators.
Definition: ArenaBase.h:42
ArenaHandleBaseAllocT.icc
SG::ArenaHandleBaseAllocT::alloc_t
ALLOC alloc_t
The Allocator we use.
Definition: ArenaHandleBaseAllocT.h:57
SG::ArenaHandleBaseAllocT::Creator::m_params
ALLOC::Params m_params
Set of parameters to use to create our allocator.
Definition: ArenaHandleBaseAllocT.h:173
SG::ArenaHandleBaseAllocT::Creator::name
const std::string & name() const
Return the name of the Allocator we create.
SG::ArenaHandleBaseAllocT::Creator::create
virtual std::unique_ptr< ArenaAllocatorBase > create()
Create an allocator instance.
SG::ArenaHandleBaseAllocT
Base class for Handle classes, containing parts that depend only on the Allocator.
Definition: ArenaHandleBaseAllocT.h:54
ArenaAllocatorRegistry.h
Registry of allocator factories. See Arena.h for an overview of the arena-based memory allocators.
SG::ArenaHandleBaseAllocT::Creator::m_makeFunc
makeFunc_t * m_makeFunc
Function that creates an Allocator given a set of parameters.
Definition: ArenaHandleBaseAllocT.h:170
SG::ArenaHandleBaseAllocT::params
const ALLOC::Params & params() const
Return our Allocator's parameters.
SG::ArenaHandleBaseAllocT::ArenaHandleBaseAllocT
ArenaHandleBaseAllocT(ArenaBase *arena, size_t index)
Constructor, passing in an index, for a specific Arena.
SG::ArenaHandleBaseAllocT::makeIndex
static size_t makeIndex(const typename ALLOC::Params *params)
Find the index for creating an allocator.