Skip to content
Snippets Groups Projects

ArMem: Revice get/find interface

Merged Rainer Kartmann requested to merge armem/get-find-interface into armem/dev
7 files
+ 84
52
Compare changes
  • Side-by-side
  • Inline
Files
7
@@ -108,6 +108,15 @@ namespace armarx::armem::base::detail
return _container;
}
DerivedT& _derived()
{
return static_cast<DerivedT&>(*this);
}
const DerivedT& _derived() const
{
return static_cast<DerivedT&>(*this);
}
/**
* @throw `armem::error::ContainerNameMismatch` if `gottenName` does not match `actualName`.
@@ -123,6 +132,19 @@ namespace armarx::armem::base::detail
}
template <class ChildT, class KeyT, class ...ChildArgs>
ChildT& _addChild(const KeyT& key, ChildArgs... childArgs)
{
auto [it, inserted] = this->_container.try_emplace(key, childArgs...);
if (not inserted)
{
throw armem::error::ContainerEntryAlreadyExists(
ChildT::getLevelName(), key, DerivedT::getLevelName(), this->_derived().name());
}
return it->second;
}
protected:
mutable ContainerT _container;
Loading