VISR  0.11.1
Versatile Interactive Scene Renderer
scalar_parameter.hpp
Go to the documentation of this file.
1 /* Copyright Institute of Sound and Vibration Research - All rights reserved */
2 
3 #ifndef VISR_PML_SCALAR_PARAMETER_HPP_INCLUDED
4 #define VISR_PML_SCALAR_PARAMETER_HPP_INCLUDED
5 
7 #include "export_symbols.hpp"
8 
11 
12 #include <complex>
13 
14 namespace visr
15 {
16 namespace pml
17 {
18 
19 namespace // unnamed
20 {
24 template<typename ElementType> struct ScalarParameterType {};
25 
26 template<> struct ScalarParameterType<bool>
27 {
28  static constexpr const ParameterType ptype() { return detail::compileTimeHashFNV1( "Boolean" ); }
29 };
30 
31 template<> struct ScalarParameterType<int>
32 {
33  static constexpr const ParameterType ptype() { return detail::compileTimeHashFNV1( "Integer" ); }
34 };
35 
36 template<> struct ScalarParameterType<unsigned int>
37 {
38  static constexpr const ParameterType ptype() { return detail::compileTimeHashFNV1( "UnsignedInteger" ); }
39 };
40 
41 template<> struct ScalarParameterType<float>
42 { static constexpr const ParameterType ptype() { return detail::compileTimeHashFNV1( "Float" ); } };
43 
44 template<> struct ScalarParameterType<double>
45 { static constexpr const ParameterType ptype() { return detail::compileTimeHashFNV1( "Double" ); } };
46 
47 template<> struct ScalarParameterType<std::complex<float> >
48 { static constexpr const ParameterType ptype() { return detail::compileTimeHashFNV1( "ComplexFloat" ); } };
49 
50 template<> struct ScalarParameterType<std::complex<double> >
51 { static constexpr const ParameterType ptype() { return detail::compileTimeHashFNV1( "ComplexDouble" ); } };
52 } // unnamed namespace
53 
59 template<typename ElementType >
60 class VISR_PML_LIBRARY_SYMBOL ScalarParameter: public TypedParameterBase<ScalarParameter<ElementType>, EmptyParameterConfig, ScalarParameterType<ElementType>::ptype() >
61 {
62 public:
68 
70 
71  explicit ScalarParameter(ParameterConfigBase const & config);
72 
73  explicit ScalarParameter(EmptyParameterConfig const & config);
74 
75  explicit ScalarParameter( ElementType val );
76 
77  virtual ~ScalarParameter() override;
78 
79  ElementType & operator=(ElementType val );
80 
81  ElementType value() const;
82 private:
83  ElementType mValue;
84 };
85 
86 } // namespace pml
87 } // namespace visr
88 
94 DEFINE_PARAMETER_TYPE( visr::pml::ScalarParameter< std::complex<float> >, visr::pml::ScalarParameter< std::complex<float> >::staticType(), visr::pml::EmptyParameterConfig )
95 DEFINE_PARAMETER_TYPE( visr::pml::ScalarParameter< std::complex<double> >, visr::pml::ScalarParameter< std::complex<double> >::staticType(), visr::pml::EmptyParameterConfig )
96 
97 #endif // VISR_PML_SCALAR_PARAMETER_HPP_INCLUDED
uint64_t ParameterType
Definition: parameter_type.hpp:13
constexpr uint64_t compileTimeHashFNV1(const char *s)
Definition: compile_time_hash_fnv1.hpp:25
Definition: options.cpp:10
Definition: parameter_factory.hpp:20
Definition: parameter_config_base.hpp:22
Definition: scalar_parameter.hpp:60
#define DEFINE_PARAMETER_TYPE(ParameterClassType, ParameterId, ParameterConfigType)
Definition: parameter_type.hpp:60
Definition: empty_parameter_config.hpp:21