VISR  0.11.8
Versatile Interactive Scene Renderer
matrix_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_MATRIX_PARAMETER_HPP_INCLUDED
4 #define VISR_PML_MATRIX_PARAMETER_HPP_INCLUDED
5 
6 #include "export_symbols.hpp"
8 
10 
13 
14 #include <complex>
15 #include <initializer_list>
16 #include <istream>
17 
18 namespace visr
19 {
20 namespace pml
21 {
22 
23 namespace // unnamed
24 {
25 template<typename ElementType> struct MatrixParameterType{};
26 
27 template<> struct MatrixParameterType<float>
28 {
29  static constexpr const ParameterType ptype() { return detail::compileTimeHashFNV1("FloatMatrix"); }
30 };
31 
32 template<> struct MatrixParameterType<double>
33 {
34  static constexpr const ParameterType ptype() { return detail::compileTimeHashFNV1( "DoubleMatrix" ); }
35 };
36 template<> struct MatrixParameterType<std::complex<float> >
37 {
38  static constexpr const ParameterType ptype() { return detail::compileTimeHashFNV1( "ComplexFloatMatrix" ); }
39 };
40 template<> struct MatrixParameterType<std::complex<double> >
41 {
42  static constexpr const ParameterType ptype() { return detail::compileTimeHashFNV1( "ComplexDoubleMatrix" ); }
43 };
44 } // unnamed namespace
45 
51 template<typename ElementType >
52 class VISR_PML_LIBRARY_SYMBOL MatrixParameter: public efl::BasicMatrix<ElementType>,
53  public TypedParameterBase<MatrixParameter<ElementType>, MatrixParameterConfig, MatrixParameterType<ElementType>::ptype() >
54 {
55 public:
56 
61  MatrixParameter( std::size_t alignment = 0 );
62 
63  explicit MatrixParameter( ParameterConfigBase const & config );
64 
65  explicit MatrixParameter( MatrixParameterConfig const & config );
66 
74  explicit MatrixParameter( std::size_t numRows, std::size_t numColumns, std::size_t alignment = 0 );
75 
76  explicit MatrixParameter( std::size_t numRows, std::size_t numColumns,
77  std::initializer_list<std::initializer_list<ElementType> > const & initMtx,
78  std::size_t alignment = 0 );
79 
86 
87  virtual ~MatrixParameter() override;
88 
89  MatrixParameter& operator=( MatrixParameter<ElementType> const & rhs );
90 
91 
98  static MatrixParameter fromString( std::string const & textMatrix, std::size_t alignment = 0 );
99 
100  static MatrixParameter fromStream( std::istream & stream, std::size_t alignment = 0 );
101 
102  static MatrixParameter fromAudioFile( std::string const & fileName, std::size_t alignment = 0 );
103 
104  static MatrixParameter fromTextFile( std::string const & fileName, std::size_t alignment = 0 );
106 
114  void resize( std::size_t numRows, std::size_t numColumns );
115 
116 private:
117 };
118 
119 } // namespace pml
120 } // namespace visr
121 
124 DEFINE_PARAMETER_TYPE( visr::pml::MatrixParameter<std::complex<float> >, visr::pml::MatrixParameter<std::complex<float> >::staticType(), visr::pml::MatrixParameterConfig )
125 DEFINE_PARAMETER_TYPE( visr::pml::MatrixParameter<std::complex<double> >, visr::pml::MatrixParameter<std::complex<double> >::staticType(), visr::pml::MatrixParameterConfig )
126 
127 #endif // VISR_PML_MATRIX_PARAMETER_HPP_INCLUDED
Definition: matrix_parameter.hpp:52
Definition: matrix_parameter_config.hpp:26
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
#define DEFINE_PARAMETER_TYPE(ParameterClassType, ParameterId, ParameterConfigType)
Definition: parameter_type.hpp:60
Definition: init_filter_matrix.hpp:15