GLM: type_gentype.hpp Source File

GLM 0.9.5

- Main Page
- Related Pages
- Modules
- Namespaces
- Files

- File List

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