15 #ifndef BORNAGAIN_CORE_SAMPLEBUILDERENGINE_IREGISTRY_H
16 #define BORNAGAIN_CORE_SAMPLEBUILDERENGINE_IREGISTRY_H
31 const ValueType*
getItem(
const std::string& key)
const
33 auto it =
m_data.find(key);
36 "IRegistry::createItem() -> Error. Not existing item key '" + key +
"'");
37 return it->second.get();
40 std::vector<std::string>
keys()
const
42 std::vector<std::string> result;
44 result.push_back(it->first);
51 void add(
const std::string& key, ValueType* item)
55 "IRegistry::createItem() -> Error. Already existing item with key '" + key +
"'");
56 m_data[key] = std::unique_ptr<ValueType>(item);
60 std::map<std::string, std::unique_ptr<ValueType>>
m_data;
Defines many exception classes in namespace Exceptionss.
Templated object registry.
std::map< std::string, std::unique_ptr< ValueType > > m_data
void add(const std::string &key, ValueType *item)
const ValueType * getItem(const std::string &key) const
std::vector< std::string > keys() const