3 #ifndef GRAIL_OBJECT_PARAMETER_H
4 #define GRAIL_OBJECT_PARAMETER_H
6 #include "../../../GrailCore/consts.h"
7 #include "../../../GrailLogger/LoggerManager.hh"
23 template <
typename ParameterType>
24 const ParameterType& GetValue()
const
26 if(type != std::type_index{
typeid(ParameterType)})
28 GRAIL_LOG(consts::DEFAULT_GRAIL_LOG_GROUP,
29 logger::Severity::CRITICAL,
30 "Getting value with inappriopriate type\n");
33 return *(
static_cast<const ParameterType*
>(GetUncastValue()));
36 template <
typename ParameterType>
37 void SetValue(
const ParameterType& value)
39 if(type != std::type_index{
typeid(ParameterType)})
41 GRAIL_LOG(consts::DEFAULT_GRAIL_LOG_GROUP,
42 logger::Severity::CRITICAL,
43 "Setting value with inappriopriate type\n");
46 ParameterType* val =
static_cast<ParameterType*
>(GetUncastValue());
66 virtual const void* GetUncastValue()
const = 0;
67 virtual void* GetUncastValue() = 0;
75 #endif //GRAIL_OBJECT_PARAMETER_H