type_gentype.hpp
Go to the documentation of this file.
00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 
00028 
00029 #ifndef glm_core_type_gentype
00030 #define glm_core_type_gentype
00031 
00032 #include "type_size.hpp"
00033 
00034 namespace glm
00035 {
00036         enum profile
00037         {
00038                 nice,
00039                 fast,
00040                 simd
00041         };
00042 
00043 namespace detail
00044 {
00045         template
00046         <
00047                 typename VALTYPE, 
00048                 template <typename> class TYPE
00049         >
00050         struct genType
00051         {
00052         public:
00053                 enum ctor{null};
00054 
00055                 typedef VALTYPE value_type;
00056                 typedef VALTYPE & value_reference;
00057                 typedef VALTYPE * value_pointer;
00058                 typedef VALTYPE const * value_const_pointer;
00059                 typedef TYPE<bool> bool_type;
00060 
00061                 typedef sizeType size_type;
00062                 static bool is_vector();
00063                 static bool is_matrix();
00064                 
00065                 typedef TYPE<VALTYPE> type;
00066                 typedef TYPE<VALTYPE> * pointer;
00067                 typedef TYPE<VALTYPE> const * const_pointer;
00068                 typedef TYPE<VALTYPE> const * const const_pointer_const;
00069                 typedef TYPE<VALTYPE> * const pointer_const;
00070                 typedef TYPE<VALTYPE> & reference;
00071                 typedef TYPE<VALTYPE> const & const_reference;
00072                 typedef TYPE<VALTYPE> const & param_type;
00073 
00075                 // Address (Implementation details)
00076 
00077                 value_const_pointer value_address() const{return value_pointer(this);}
00078                 value_pointer value_address(){return value_pointer(this);}
00079 
00080         //protected:
00081         //      enum kind
00082         //      {
00083         //              GEN_TYPE,
00084         //              VEC_TYPE,
00085         //              MAT_TYPE
00086         //      };
00087 
00088         //      typedef typename TYPE::kind kind;
00089         };
00090 
00091         template
00092         <
00093                 typename VALTYPE, 
00094                 template <typename> class TYPE
00095         >
00096         bool genType<VALTYPE, TYPE>::is_vector()
00097         {
00098                 return true;
00099         }
00100 /*
00101         template <typename valTypeT, unsigned int colT, unsigned int rowT, profile proT = nice>
00102         class base
00103         {
00104         public:
00106                 // Traits
00107 
00108                 typedef sizeType                                                        size_type;
00109                 typedef valTypeT                                                        value_type;
00110 
00111                 typedef base<value_type, colT, rowT>            class_type;
00112 
00113                 typedef base<bool, colT, rowT>                          bool_type;
00114                 typedef base<value_type, rowT, 1>                       col_type;
00115                 typedef base<value_type, colT, 1>                       row_type;
00116                 typedef base<value_type, rowT, colT>            transpose_type;
00117 
00118                 static size_type                                                        col_size();
00119                 static size_type                                                        row_size();
00120                 static size_type                                                        value_size();
00121                 static bool                                                                     is_scalar();
00122                 static bool                                                                     is_vector();
00123                 static bool                                                                     is_matrix();
00124 
00125         private:
00126                 // Data 
00127                 col_type value[colT];           
00128 
00129         public:
00131                 // Constructors
00132                 base();
00133                 base(class_type const & m);
00134 
00135                 explicit base(value_type const & x);
00136                 explicit base(value_type const * const x);
00137                 explicit base(col_type const * const x);
00138 
00140                 // Conversions
00141                 template <typename vU, uint cU, uint rU, profile pU>
00142                 explicit base(base<vU, cU, rU, pU> const & m);
00143 
00145                 // Accesses
00146                 col_type& operator[](size_type i);
00147                 col_type const & operator[](size_type i) const;
00148 
00150                 // Unary updatable operators
00151                 class_type& operator=  (class_type const & x);
00152                 class_type& operator+= (value_type const & x);
00153                 class_type& operator+= (class_type const & x);
00154                 class_type& operator-= (value_type const & x);
00155                 class_type& operator-= (class_type const & x);
00156                 class_type& operator*= (value_type const & x);
00157                 class_type& operator*= (class_type const & x);
00158                 class_type& operator/= (value_type const & x);
00159                 class_type& operator/= (class_type const & x);
00160                 class_type& operator++ ();
00161                 class_type& operator-- ();
00162         };
00163 */
00164         }//namespace detail
00165 }//namespace glm
00166 
00167 //#include "type_gentype.inl"
00168 
00169 #endif//glm_core_type_gentype