GLM Version 0.9.0

type_gentype.hpp

00001 
00002 // OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
00004 // Created : 2008-10-05
00005 // Updated : 2010-01-26
00006 // Licence : This source is under MIT License
00007 // File    : glm/core/type_gentype.hpp
00009 
00010 #ifndef glm_core_type_gentype
00011 #define glm_core_type_gentype
00012 
00013 #include "type_size.hpp"
00014 
00015 namespace glm
00016 {
00017         enum profile
00018         {
00019                 nice,
00020                 fast,
00021                 simd
00022         };
00023 
00024 namespace detail
00025 {
00026         template
00027         <
00028                 typename VALTYPE, 
00029                 template <typename> class TYPE
00030         >
00031         struct genType
00032         {
00033         public:
00034                 enum ctor{null};
00035 
00036                 typedef VALTYPE value_type;
00037                 typedef VALTYPE & value_reference;
00038                 typedef VALTYPE * value_pointer;
00039                 typedef VALTYPE const * value_const_pointer;
00040                 typedef TYPE<bool> bool_type;
00041 
00042                 typedef sizeType size_type;
00043                 static bool is_vector();
00044                 static bool is_matrix();
00045                 
00046                 typedef TYPE<VALTYPE> type;
00047                 typedef TYPE<VALTYPE> * pointer;
00048                 typedef TYPE<VALTYPE> const * const_pointer;
00049                 typedef TYPE<VALTYPE> const * const const_pointer_const;
00050                 typedef TYPE<VALTYPE> * const pointer_const;
00051                 typedef TYPE<VALTYPE> & reference;
00052                 typedef TYPE<VALTYPE> const & const_reference;
00053                 typedef TYPE<VALTYPE> const & param_type;
00054 
00056                 // Address (Implementation details)
00057 
00058                 value_const_pointer value_address() const{return value_pointer(this);}
00059                 value_pointer value_address(){return value_pointer(this);}
00060 
00061         //protected:
00062         //      enum kind
00063         //      {
00064         //              GEN_TYPE,
00065         //              VEC_TYPE,
00066         //              MAT_TYPE
00067         //      };
00068 
00069         //      typedef typename TYPE::kind kind;
00070         };
00071 
00072         template
00073         <
00074                 typename VALTYPE, 
00075                 template <typename> class TYPE
00076         >
00077         bool genType<VALTYPE, TYPE>::is_vector()
00078         {
00079                 return true;
00080         }
00081 /*
00082         template <typename valTypeT, unsigned int colT, unsigned int rowT, profile proT = nice>
00083         class base
00084         {
00085         public:
00087                 // Traits
00088 
00089                 typedef sizeType                                                        size_type;
00090                 typedef valTypeT                                                        value_type;
00091 
00092                 typedef base<value_type, colT, rowT>            class_type;
00093 
00094                 typedef base<bool, colT, rowT>                          bool_type;
00095                 typedef base<value_type, rowT, 1>                       col_type;
00096                 typedef base<value_type, colT, 1>                       row_type;
00097                 typedef base<value_type, rowT, colT>            transpose_type;
00098 
00099                 static size_type                                                        col_size();
00100                 static size_type                                                        row_size();
00101                 static size_type                                                        value_size();
00102                 static bool                                                                     is_scalar();
00103                 static bool                                                                     is_vector();
00104                 static bool                                                                     is_matrix();
00105 
00106         private:
00107                 // Data 
00108                 col_type value[colT];           
00109 
00110         public:
00112                 // Constructors
00113                 base();
00114                 base(class_type const & m);
00115 
00116                 explicit base(value_type const & x);
00117                 explicit base(value_type const * const x);
00118                 explicit base(col_type const * const x);
00119 
00121                 // Conversions
00122                 template <typename vU, uint cU, uint rU, profile pU>
00123                 explicit base(base<vU, cU, rU, pU> const & m);
00124 
00126                 // Accesses
00127                 col_type& operator[](size_type i);
00128                 col_type const & operator[](size_type i) const;
00129 
00131                 // Unary updatable operators
00132                 class_type& operator=  (class_type const & x);
00133                 class_type& operator+= (value_type const & x);
00134                 class_type& operator+= (class_type const & x);
00135                 class_type& operator-= (value_type const & x);
00136                 class_type& operator-= (class_type const & x);
00137                 class_type& operator*= (value_type const & x);
00138                 class_type& operator*= (class_type const & x);
00139                 class_type& operator/= (value_type const & x);
00140                 class_type& operator/= (class_type const & x);
00141                 class_type& operator++ ();
00142                 class_type& operator-- ();
00143         };
00144 */
00145         }//namespace detail
00146 }//namespace glm
00147 
00148 //#include "type_gentype.inl"
00149 
00150 #endif//glm_core_type_gentype