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