48 std::unique_ptr<ArenaAllocatorCreator> creator);
57 size_t lookup (
const std::string& name);
65 std::unique_ptr<ArenaAllocatorBase>
create (
size_t i);
70 typedef std::map<std::string, size_t>
map_t;
74 std::vector<std::unique_ptr<ArenaAllocatorCreator> >
m_creators;
79 typedef std::lock_guard<std::mutex>
lock_t;
103 std::unique_ptr<ArenaAllocatorCreator> creator)
111 map_t::iterator it =
m_map.find (name);
112 if (it !=
m_map.end()) {
136 map_t::iterator it =
m_map.find (name);
137 if (it ==
m_map.end()) {
138 return std::string::npos;
149std::unique_ptr<ArenaAllocatorBase>
172 std::unique_ptr<ArenaAllocatorCreator> creator)
174 return m_impl->registerCreator (name, std::move (creator));
186 return m_impl->lookup (name);
197 return m_impl->create (i);
Common base class for arena allocator classes. See Arena.h for an overview of the arena-based memory ...
Provide an interface for creating an arena Allocator. See Arena.h for an overview of the arena-based ...
Registry of allocator factories. See Arena.h for an overview of the arena-based memory allocators.
Define macros for attributes used to control the static checker.
#define ATLAS_THREAD_SAFE
ArenaAllocatorRegistry implementation class.
~ArenaAllocatorRegistryImpl()
Destructor.
std::unique_ptr< ArenaAllocatorBase > create(size_t i)
Create a new instance of an allocator.
std::map< std::string, size_t > map_t
Map from names to indices.
size_t lookup(const std::string &name)
Look up the index for an allocator type name.
size_t registerCreator(const std::string &name, std::unique_ptr< ArenaAllocatorCreator > creator)
Register a new allocator type.
std::vector< std::unique_ptr< ArenaAllocatorCreator > > m_creators
Vector of factory instances.
std::lock_guard< std::mutex > lock_t
std::mutex m_mutex
Mutex to protect the contents.
std::unique_ptr< ArenaAllocatorBase > create(size_t i)
Create a new instance of an allocator.
size_t registerCreator(const std::string &name, std::unique_ptr< ArenaAllocatorCreator > creator)
Register a new allocator type.
ArenaAllocatorRegistry()
Constructor. Called only by instance.
ArenaAllocatorRegistry(const ArenaAllocatorRegistry &)
size_t lookup(const std::string &name)
Look up the index for an allocator type name.
~ArenaAllocatorRegistry()
Destructor. Called only by instance.
friend class ArenaAllocatorRegistryImpl
std::unique_ptr< ArenaAllocatorRegistryImpl > m_impl
The implementation object.
static ArenaAllocatorRegistry * instance()
Return a pointer to the global ArenaAllocatorRegistry instance.