9class DataComponent :
public Component
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;