# GLM: type_gentype.hpp Source File

- Main Page
- Namespaces
- Files

- File List

# type_gentype.hpp

    00001
    00002 // OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net)
    00004 // Created : 2008-10-05
    00005 // Updated : 2008-10-05
    00006 // Licence : This source is under MIT License
    00007 // File    : glm/core/type_gentype.h
    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 <typename valTypeT, uint colT, uint rowT, profile proT = nice>
    00027 class genType
    00028 {
    00029 public:
    00031         // Traits
    00032
    00033         typedef sizeType                                                        size_type;
    00034         typedef valTypeT                                                        value_type;
    00035
    00036         typedef genType<value_type, colT, rowT>         class_type;
    00037
    00038         typedef genType<bool, colT, rowT>                       bool_type;
    00039         typedef genType<value_type, rowT, 1>            col_type;
    00040         typedef genType<value_type, colT, 1>            row_type;
    00041         typedef genType<value_type, rowT, colT>         transpose_type;
    00042
    00043         static size_type                                                        col_size();
    00044         static size_type                                                        row_size();
    00045         static size_type                                                        value_size();
    00046         static bool                                                                     is_scalar();
    00047         static bool                                                                     is_vector();
    00048         static bool                                                                     is_matrix();
    00049
    00050 private:
    00051         // Data
    00052         col_type value[colT];
    00053
    00054 public:
    00056         // Constructors
    00057         genType();
    00058         genType(class_type const & m);
    00059
    00060         explicit genType(value_type const & x);
    00061         explicit genType(value_type const * const x);
    00062         explicit genType(col_type const * const x);
    00063
    00065         // Conversions
    00066         template <typename vU, uint cU, uint rU, profile pU>
    00067         explicit genType(genType<vU, cU, rU, pU> const & m);
    00068
    00070         // Accesses
    00071         col_type& operator[](size_type i);
    00072         col_type const & operator[](size_type i) const;
    00073
    00075         // Unary updatable operators
    00076         class_type& operator=  (class_type const & x);
    00077         class_type& operator+= (value_type const & x);
    00078         class_type& operator+= (class_type const & x);
    00079         class_type& operator-= (value_type const & x);
    00080         class_type& operator-= (class_type const & x);
    00081         class_type& operator*= (value_type const & x);
    00082         class_type& operator*= (class_type const & x);
    00083         class_type& operator/= (value_type const & x);
    00084         class_type& operator/= (class_type const & x);
    00085         class_type& operator++ ();
    00086         class_type& operator-- ();
    00087 };
    00088
    00089 }//namespace detail
    00090 }//namespace glm
    00091
    00092 #include "type_gentype.inl"
    00093
    00094 #endif//glm_core_type_gentype