VISR  0.12.0
Versatile Interactive Scene Renderer
vector_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_VECTOR_PARAMETER_HPP_INCLUDED
4 #define VISR_PML_VECTOR_PARAMETER_HPP_INCLUDED
5 
6 #include "export_symbols.hpp"
8 
10 
13 
14 #include <complex>
15 
16 namespace visr
17 {
18 namespace pml
19 {
20 
21 namespace // unnamed
22 {
26 template<typename ElementType> struct VectorParameterType {};
27 
28 template<> struct VectorParameterType<float>
29 { static constexpr const ParameterType ptype() { return detail::compileTimeHashFNV1( "FloatVector" ); } };
30 
31 template<> struct VectorParameterType<double>
32 { static constexpr const ParameterType ptype() { return detail::compileTimeHashFNV1( "DoubleVector" ); } };
33 
34 template<> struct VectorParameterType<std::complex<float> >
35 { static constexpr const ParameterType ptype() { return detail::compileTimeHashFNV1( "ComplexFloatVector" ); } };
36 
37 template<> struct VectorParameterType<std::complex<double> >
38 { static constexpr const ParameterType ptype() { return detail::compileTimeHashFNV1( "ComplexDoubleVector" ); } };
39 } // unnamed namespace
40 
46 template<typename ElementType >
47 class VISR_PML_LIBRARY_SYMBOL VectorParameter: public efl::BasicVector<ElementType>,
48  public TypedParameterBase<VectorParameter<ElementType>, VectorParameterConfig, VectorParameterType<ElementType>::ptype() >
49 {
50 public:
55 
57 
58  explicit VectorParameter(ParameterConfigBase const & config);
59 
60  explicit VectorParameter(VectorParameterConfig const & config);
61 
70  static VectorParameter fromString( std::string const & initString, std::size_t alignment = 0 );
71 
76  static VectorParameter fromStream( std::istream & stream, std::size_t alignment = 0 );
77 
82  static VectorParameter fromAudioFile( std::string const & fileName, std::size_t alignment = 0 );
83 
88  static VectorParameter fromTextFile( std::string const & fileName, std::size_t alignment = 0 );
90 
94  virtual ~VectorParameter() override;
95 };
96 
97 } // namespace pml
98 } // namespace visr
99 
102 DEFINE_PARAMETER_TYPE( visr::pml::VectorParameter< std::complex<float> >, visr::pml::VectorParameter< std::complex<float> >::staticType(), visr::pml::VectorParameterConfig )
103 DEFINE_PARAMETER_TYPE( visr::pml::VectorParameter< std::complex<double> >, visr::pml::VectorParameter< std::complex<double> >::staticType(), visr::pml::VectorParameterConfig )
104 
105 #endif // VISR_PML_VECTOR_PARAMETER_HPP_INCLUDED
uint64_t ParameterType
Definition: parameter_type.hpp:13
Definition: vector_parameter.hpp:47
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
#define DEFINE_PARAMETER_TYPE(ParameterClassType, ParameterId, ParameterConfigType)
Definition: parameter_type.hpp:60
Definition: basic_vector.hpp:28
Definition: vector_parameter_config.hpp:21