3 #ifndef GRAIL_OBJECT_PARAMETER_H
4 #define GRAIL_OBJECT_PARAMETER_H
6 #include "../../../GrailCore/consts.h"
7 #include "../../../GrailLogger/LoggerManager.hh"
27 template <
typename ParameterType>
28 const ParameterType& GetValue()
const
30 if(type != std::type_index{
typeid(ParameterType)})
32 GRAIL_LOG(consts::DEFAULT_GRAIL_LOG_GROUP,
33 logger::Severity::CRITICAL,
34 "Getting value with inappropriate type\n");
37 return *(
static_cast<const ParameterType*
>(GetUncastValue()));
40 template <
typename ParameterType>
41 void SetValue(
const ParameterType& value)
43 if(type != std::type_index{
typeid(ParameterType)})
45 GRAIL_LOG(consts::DEFAULT_GRAIL_LOG_GROUP,
46 logger::Severity::CRITICAL,
47 "Setting value with inappropriate type\n");
50 ParameterType* val =
static_cast<ParameterType*
>(GetUncastValue());
70 virtual const void* GetUncastValue()
const = 0;
71 virtual void* GetUncastValue() = 0;
79 #endif //GRAIL_OBJECT_PARAMETER_H