0.9.7
type_gentype.hpp
Go to the documentation of this file.
1 
33 #pragma once
34 
35 namespace glm
36 {
37  enum profile
38  {
39  nice,
40  fast,
41  simd
42  };
43 
44  typedef std::size_t sizeType;
45 
46 namespace detail
47 {
48  template
49  <
50  typename VALTYPE,
51  template <typename> class TYPE
52  >
53  struct genType
54  {
55  public:
56  enum ctor{null};
57 
58  typedef VALTYPE value_type;
59  typedef VALTYPE & value_reference;
60  typedef VALTYPE * value_pointer;
61  typedef VALTYPE const * value_const_pointer;
62  typedef TYPE<bool> bool_type;
63 
64  typedef sizeType size_type;
65  static bool is_vector();
66  static bool is_matrix();
67 
68  typedef TYPE<VALTYPE> type;
69  typedef TYPE<VALTYPE> * pointer;
70  typedef TYPE<VALTYPE> const * const_pointer;
71  typedef TYPE<VALTYPE> const * const const_pointer_const;
72  typedef TYPE<VALTYPE> * const pointer_const;
73  typedef TYPE<VALTYPE> & reference;
74  typedef TYPE<VALTYPE> const & const_reference;
75  typedef TYPE<VALTYPE> const & param_type;
76 
78  // Address (Implementation details)
79 
80  value_const_pointer value_address() const{return value_pointer(this);}
81  value_pointer value_address(){return value_pointer(this);}
82 
83  //protected:
84  // enum kind
85  // {
86  // GEN_TYPE,
87  // VEC_TYPE,
88  // MAT_TYPE
89  // };
90 
91  // typedef typename TYPE::kind kind;
92  };
93 
94  template
95  <
96  typename VALTYPE,
97  template <typename> class TYPE
98  >
99  bool genType<VALTYPE, TYPE>::is_vector()
100  {
101  return true;
102  }
103 /*
104  template <typename valTypeT, unsigned int colT, unsigned int rowT, profile proT = nice>
105  class base
106  {
107  public:
109  // Traits
110 
111  typedef sizeType size_type;
112  typedef valTypeT value_type;
113 
114  typedef base<value_type, colT, rowT> class_type;
115 
116  typedef base<bool, colT, rowT> bool_type;
117  typedef base<value_type, rowT, 1> col_type;
118  typedef base<value_type, colT, 1> row_type;
119  typedef base<value_type, rowT, colT> transpose_type;
120 
121  static size_type col_size();
122  static size_type row_size();
123  static size_type value_size();
124  static bool is_scalar();
125  static bool is_vector();
126  static bool is_matrix();
127 
128  private:
129  // Data
130  col_type value[colT];
131 
132  public:
134  // Constructors
135  base();
136  base(class_type const & m);
137 
138  explicit base(T const & x);
139  explicit base(value_type const * const x);
140  explicit base(col_type const * const x);
141 
143  // Conversions
144  template <typename vU, uint cU, uint rU, profile pU>
145  explicit base(base<vU, cU, rU, pU> const & m);
146 
148  // Accesses
149  col_type& operator[](size_type i);
150  col_type const & operator[](size_type i) const;
151 
153  // Unary updatable operators
154  class_type& operator= (class_type const & x);
155  class_type& operator+= (T const & x);
156  class_type& operator+= (class_type const & x);
157  class_type& operator-= (T const & x);
158  class_type& operator-= (class_type const & x);
159  class_type& operator*= (T const & x);
160  class_type& operator*= (class_type const & x);
161  class_type& operator/= (T const & x);
162  class_type& operator/= (class_type const & x);
163  class_type& operator++ ();
164  class_type& operator-- ();
165  };
166 */
167 
168  //template <typename T>
169  //struct traits
170  //{
171  // static const bool is_signed = false;
172  // static const bool is_float = false;
173  // static const bool is_vector = false;
174  // static const bool is_matrix = false;
175  // static const bool is_genType = false;
176  // static const bool is_genIType = false;
177  // static const bool is_genUType = false;
178  //};
179 
180  //template <>
181  //struct traits<half>
182  //{
183  // static const bool is_float = true;
184  // static const bool is_genType = true;
185  //};
186 
187  //template <>
188  //struct traits<float>
189  //{
190  // static const bool is_float = true;
191  // static const bool is_genType = true;
192  //};
193 
194  //template <>
195  //struct traits<double>
196  //{
197  // static const bool is_float = true;
198  // static const bool is_genType = true;
199  //};
200 
201  //template <typename genType>
202  //struct desc
203  //{
204  // typedef genType type;
205  // typedef genType * pointer;
206  // typedef genType const* const_pointer;
207  // typedef genType const *const const_pointer_const;
208  // typedef genType *const pointer_const;
209  // typedef genType & reference;
210  // typedef genType const& const_reference;
211  // typedef genType const& param_type;
212 
213  // typedef typename genType::value_type value_type;
214  // typedef typename genType::size_type size_type;
215  // static const typename size_type value_size;
216  //};
217 
218  //template <typename genType>
219  //const typename desc<genType>::size_type desc<genType>::value_size = genType::value_size();
220 
221 }//namespace detail
222 }//namespace glm
223 
224 //#include "type_gentype.inl"
Definition: _noise.hpp:40