18#ifndef TRINITY_OBJECTREGISTRY_H
19#define TRINITY_OBJECTREGISTRY_H
27template<
class T,
class Key = std::
string>
45 return itr->second.get();
49 bool InsertItem(T* obj, Key
const& key,
bool force =
false)
59 _registeredObjects.emplace(std::piecewise_construct, std::forward_as_tuple(key), std::forward_as_tuple(obj));
ObjectRegistry & operator=(ObjectRegistry const &)=delete
bool HasItem(Key const &key) const
Returns true if registry contains an item.
ObjectRegistry(ObjectRegistry const &)=delete
T const * GetRegistryItem(Key const &key) const
Returns a registry item.
bool InsertItem(T *obj, Key const &key, bool force=false)
Inserts a registry item.
RegistryMapType _registeredObjects
static ObjectRegistry< T, Key > * instance()
std::map< Key, std::unique_ptr< T > > RegistryMapType
RegistryMapType const & GetRegisteredItems() const
Return the map of registered items.