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