21 void setEntry(
const std::string& key,
const T& value) { dataMap.insert_or_assign(key, value); }
30 std::optional<T>
getEntry(std::string key)
const {
31 if (!this->dataMap.contains(key))
return std::nullopt;
32 const std::any& value = this->dataMap.at(key);
33 if (value.type() !=
typeid(T)) {
return std::nullopt; }
34 return std::any_cast<T>(value);
37 std::map<std::string, std::any> dataMap;
void setEntry(const std::string &key, const T &value)
Set a key-value pair of any type in the data map.
Definition DataComponent.h:21
std::optional< T > getEntry(std::string key) const
Get a value of type T from the data map.
Definition DataComponent.h:30