1 #ifndef GRAIL_PARAMETRIZED_OBJECT_H
2 #define GRAIL_PARAMETRIZED_OBJECT_H
4 #include "TypedObjectParameter.h"
5 #include "../../MemoryPool.hh"
12 #include <unordered_map>
13 #include <unordered_set>
32 bool Contains(
const std::string& paramName)
const;
36 template <
typename ParameterType>
37 void SetParameter(
const std::string& paramName,
const ParameterType& paramValue)
39 parameters[paramName] = &memory->template Emplace<TypedObjectParameter<ParameterType>>(paramValue);
43 template <
typename ParameterType>
46 auto param = GetParameter(paramName);
49 return param->GetValue<ParameterType>();
51 return ParameterType();
55 bool CollectionContains(
const std::string& collectionName,
unsigned int objectIndex)
const;
59 std::set<unsigned int>* GetCollection(
const std::string& name);
60 const std::set<unsigned int>* GetCollection(
const std::string& name)
const;
63 void SerializeSnapshot(std::map<std::string, std::string>& nameValues)
const;
64 void SetSerializeSnapshotFunction(
66 std::map<std::string, std::string>& nameValues)>
function);
76 std::map<std::string, ObjectParameter*> parameters{};
77 std::map<std::string, std::set<unsigned int>> indexCollections{};
81 const ObjectParameter* GetParameter(
const std::string& paramName)
const;
82 ObjectParameter* GetParameter(
const std::string& paramName);
83 std::function<void(
const ParametrizedObject&
object, std::map<std::string, std::string>&)>
84 serializeSnapshotFunction =
nullptr;
88 #endif //GRAIL_PARAMETRIZED_OBJECT_H