ATLAS Offline Software
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
SG::ArenaAllocatorRegistry Class Reference

Registry of allocator factories. More...

#include <ArenaAllocatorRegistry.h>

Collaboration diagram for SG::ArenaAllocatorRegistry:

Public Member Functions

size_t registerCreator (const std::string &name, std::unique_ptr< ArenaAllocatorCreator > creator)
 Register a new allocator type. More...
 
size_t lookup (const std::string &name)
 Look up the index for an allocator type name. More...
 
std::unique_ptr< ArenaAllocatorBasecreate (size_t i)
 Create a new instance of an allocator. More...
 

Static Public Member Functions

static ArenaAllocatorRegistryinstance ()
 Return a pointer to the global ArenaAllocatorRegistry instance. More...
 

Private Member Functions

 ArenaAllocatorRegistry (const ArenaAllocatorRegistry &)
 
ArenaAllocatorRegistryoperator= (const ArenaAllocatorRegistry &)
 
 ArenaAllocatorRegistry ()
 Constructor. Called only by instance. More...
 
 ~ArenaAllocatorRegistry ()
 Destructor. Called only by instance. More...
 

Private Attributes

std::unique_ptr< ArenaAllocatorRegistryImplm_impl
 The implementation object. More...
 

Friends

class ArenaAllocatorRegistryImpl
 

Detailed Description

Registry of allocator factories.

See Arena.h for an overview of the arena-based memory allocators.

Each Allocator type that the application uses is registered here; we assign to each one a small integer index. We can then create an instance of the Allocator given the index. Allocators have names; we also handle finding the index for an Allocator given the name.

Definition at line 43 of file ArenaAllocatorRegistry.h.

Constructor & Destructor Documentation

◆ ArenaAllocatorRegistry() [1/2]

SG::ArenaAllocatorRegistry::ArenaAllocatorRegistry ( const ArenaAllocatorRegistry )
private

◆ ArenaAllocatorRegistry() [2/2]

SG::ArenaAllocatorRegistry::ArenaAllocatorRegistry ( )
private

Constructor. Called only by instance.

Constructor.

Definition at line 214 of file ArenaAllocatorRegistry.cxx.

215  : m_impl (std::make_unique<ArenaAllocatorRegistryImpl>())
216 {
217 }

◆ ~ArenaAllocatorRegistry()

SG::ArenaAllocatorRegistry::~ArenaAllocatorRegistry ( )
private

Destructor. Called only by instance.

Destructor.

Definition at line 223 of file ArenaAllocatorRegistry.cxx.

224 {
225 }

Member Function Documentation

◆ create()

std::unique_ptr< ArenaAllocatorBase > SG::ArenaAllocatorRegistry::create ( size_t  i)

Create a new instance of an allocator.

Parameters
iThe index of the allocator to create.
Returns
A newly-allocated allocator instance.

Definition at line 195 of file ArenaAllocatorRegistry.cxx.

196 {
197  return m_impl->create (i);
198 }

◆ instance()

ArenaAllocatorRegistry * SG::ArenaAllocatorRegistry::instance ( )
static

Return a pointer to the global ArenaAllocatorRegistry instance.

Definition at line 204 of file ArenaAllocatorRegistry.cxx.

205 {
207  return &tmp;
208 }

◆ lookup()

size_t SG::ArenaAllocatorRegistry::lookup ( const std::string &  name)

Look up the index for an allocator type name.

Parameters
nameThe name of the allocator type to find.
Returns
The index corresponding to the type, or std::string::npos if it hasn't yet been registered.

Definition at line 184 of file ArenaAllocatorRegistry.cxx.

185 {
186  return m_impl->lookup (name);
187 }

◆ operator=()

ArenaAllocatorRegistry& SG::ArenaAllocatorRegistry::operator= ( const ArenaAllocatorRegistry )
private

◆ registerCreator()

size_t SG::ArenaAllocatorRegistry::registerCreator ( const std::string &  name,
std::unique_ptr< ArenaAllocatorCreator creator 
)

Register a new allocator type.

Parameters
nameThe name of the allocator type.
creatorThe factory object to create instances of this type. The registry takes ownership of this pointer.
Returns
The new integer index for this allocator type.

If the allocator type already exists, then the index of the existing one is returned (and the object passed as creator is deleted).

Definition at line 171 of file ArenaAllocatorRegistry.cxx.

173 {
174  return m_impl->registerCreator (name, std::move (creator));
175 }

Friends And Related Function Documentation

◆ ArenaAllocatorRegistryImpl

friend class ArenaAllocatorRegistryImpl
friend

Definition at line 98 of file ArenaAllocatorRegistry.h.

Member Data Documentation

◆ m_impl

std::unique_ptr<ArenaAllocatorRegistryImpl> SG::ArenaAllocatorRegistry::m_impl
private

The implementation object.

Definition at line 85 of file ArenaAllocatorRegistry.h.


The documentation for this class was generated from the following files:
SG::ArenaAllocatorRegistry::m_impl
std::unique_ptr< ArenaAllocatorRegistryImpl > m_impl
The implementation object.
Definition: ArenaAllocatorRegistry.h:85
SG::ArenaAllocatorRegistry::ArenaAllocatorRegistry
ArenaAllocatorRegistry()
Constructor. Called only by instance.
Definition: ArenaAllocatorRegistry.cxx:214
lumiFormat.i
int i
Definition: lumiFormat.py:92
DeMoUpdate.tmp
string tmp
Definition: DeMoUpdate.py:1167
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
ATLAS_THREAD_SAFE
#define ATLAS_THREAD_SAFE
Definition: checker_macros.h:211