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>
31 bool Contains(
const std::string& paramName)
const;
35 template<
typename ParameterType>
36 void SetParameter(
const std::string& paramName,
const ParameterType& paramValue)
38 parameters[paramName] = &memory.template Emplace<TypedObjectParameter<ParameterType>>(paramValue);
42 template<
typename ParameterType>
45 auto param = GetParameter(paramName);
48 return param->GetValue<ParameterType>();
50 return ParameterType();
54 bool CollectionContains(
const std::string& collectionName,
unsigned int objectIndex)
const;
58 std::set<unsigned int>* GetCollection(
const std::string& name);
59 const std::set<unsigned int>* GetCollection(
const std::string& name)
const;
62 void SerializeForGUI(std::map<std::string, std::string>& nameValues)
const;
63 void SetSerializeForGUIFunction(std::function<
void(
const ParametrizedObject&
object, std::map<std::string, std::string>& nameValues)>
function);
73 std::map<std::string, ObjectParameter*> parameters{};
74 std::map<std::string, std::set<unsigned int>> indexCollections{};
78 const ObjectParameter* GetParameter(
const std::string& paramName)
const;
79 ObjectParameter* GetParameter(
const std::string& paramName);
81 std::function<void(
const ParametrizedObject&
object, std::map<std::string, std::string>&)> serializeGUIFunction =
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:43
std::size_t GetParametersSize() const
Definition: ParametrizedObject.cpp:149
void SetParameter(const std::string ¶mName, const ParameterType ¶mValue)
Definition: ParametrizedObject.h:36
void AddCollection(const std::string &collectionName)
Creates a new id collection under the given name.
Definition: ParametrizedObject.cpp:80
bool Contains(const std::string ¶mName) const
Definition: ParametrizedObject.cpp:65
bool CollectionContains(const std::string &collectionName, unsigned int objectIndex) const
Definition: ParametrizedObject.cpp:70