3 #ifndef GRAIL_PARAMETRIZED_OBJECT_H
4 #define GRAIL_PARAMETRIZED_OBJECT_H
6 #include "TypedObjectParameter.hh"
7 #include "../../MemoryPool.hh"
14 #include <unordered_map>
15 #include <unordered_set>
34 bool Contains(
const std::string& paramName)
const;
38 template <
typename ParameterType>
39 void SetParameter(
const std::string& paramName,
const ParameterType& paramValue)
41 parameters[paramName] = &memory->template Emplace<TypedObjectParameter<ParameterType>>(paramValue);
45 template <
typename ParameterType>
48 auto param = GetParameter(paramName);
51 return param->GetValue<ParameterType>();
53 return ParameterType();
57 bool CollectionContains(
const std::string& collectionName,
unsigned int objectIndex)
const;
61 std::set<unsigned int>* GetCollection(
const std::string& name);
62 const std::set<unsigned int>* GetCollection(
const std::string& name)
const;
65 void SerializeSnapshot(std::map<std::string, std::string>& nameValues)
const;
66 void SetSerializeSnapshotFunction(
68 std::map<std::string, std::string>& nameValues)>
function);
78 std::map<std::string, ObjectParameter*> parameters{};
79 std::map<std::string, std::set<unsigned int>> indexCollections{};
83 const ObjectParameter* GetParameter(
const std::string& paramName)
const;
84 ObjectParameter* GetParameter(
const std::string& paramName);
85 std::function<void(
const ParametrizedObject&
object, std::map<std::string, std::string>&)>
86 serializeSnapshotFunction =
nullptr;
91 #endif //GRAIL_PARAMETRIZED_OBJECT_H