#pragma once #include #include #include #include #include "Component.h" class DataComponent : public Component { public: DataComponent() {}; ~DataComponent() {}; template void setEntry(const std::string& key, const T& value) { dataMap.insert_or_assign(key, value); } template std::optional getEntry(std::string key) const { if (!this->dataMap.contains(key)) return std::nullopt; const std::any& value = this->dataMap.at(key); if (value.type() != typeid(T)) { return std::nullopt; } return std::any_cast(value); } private: std::map dataMap; };