16 #error no need to expose this header to Swig
20 #ifndef BORNAGAIN_SAMPLE_COMPONENTBUILDER_IREGISTRY_H
21 #define BORNAGAIN_SAMPLE_COMPONENTBUILDER_IREGISTRY_H
32 template <
class ValueType>
35 const ValueType*
getItem(
const std::string& key)
const
37 auto it =
m_data.find(key);
39 return it->second.get();
42 std::vector<std::string>
keys()
const
44 std::vector<std::string> result;
45 for (
const auto& it :
m_data)
46 result.push_back(it.first);
53 void add(
const std::string& key, ValueType* item)
56 m_data[key] = std::unique_ptr<ValueType>(item);
60 std::map<std::string, std::unique_ptr<ValueType>>
m_data;
Defines the macro ASSERT.
#define ASSERT(condition)
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