1 #ifndef GRAIL_PARAMETRIZED_OBJECT_H
2 #define GRAIL_PARAMETRIZED_OBJECT_H
4 #include "TypedObjectParameter.h"
5 #include "../../MemoryPool.hh"
8 #include <unordered_map>
9 #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(std::function<
void(
const ParametrizedObject&
object, std::map<std::string, std::string>& nameValues)>
function);
75 std::map<std::string, ObjectParameter*> parameters{};
76 std::map<std::string, std::set<unsigned int>> indexCollections{};
80 const ObjectParameter* GetParameter(
const std::string& paramName)
const;
81 ObjectParameter* GetParameter(
const std::string& paramName);
82 std::function<void(
const ParametrizedObject&
object, std::map<std::string, std::string>&)> serializeSnapshotFunction =
nullptr;
The MemoryPool class - preallocated memory container for optimization issues.
Definition: MemoryPool.hh:74
Definition: ParametrizedObject.h:21
ParameterType GetParameterValue(const std::string ¶mName) const
Definition: ParametrizedObject.h:44
std::size_t GetParametersSize() const
Definition: ParametrizedObject.cpp:148
void SetParameter(const std::string ¶mName, const ParameterType ¶mValue)
Definition: ParametrizedObject.h:37
void AddCollection(const std::string &collectionName)
Creates a new id collection under the given name.
Definition: ParametrizedObject.cpp:79
bool Contains(const std::string ¶mName) const
Definition: ParametrizedObject.cpp:64
bool CollectionContains(const std::string &collectionName, unsigned int objectIndex) const
Definition: ParametrizedObject.cpp:69