rvm 1.08
|
00001 #include "config.h" 00002 00003 #include "types.h" 00004 00005 /** \file types.cc Basic types implementation. */ 00006 00007 // ---------------------------------------------------------------------------- 00008 00009 /** Return false for any variable that is not a char */ 00010 // template<typename T> 00011 // static bool is_signed_char(const T& a_arg) 00012 // { return(false); } 00013 00014 /** Return true for any variable that is a char */ 00015 // template<> 00016 bool is_signed_char(const char& a_arg) 00017 { return(true); } 00018 00019 /** Return false for any variable that is not an unsigned char */ 00020 // template<typename T> 00021 // static bool is_unsigned_char(const T& a_arg) 00022 // { return(false); } 00023 00024 /** Return true for any variable that is an unsigned char */ 00025 // template<> 00026 bool is_unsigned_char(const unsigned char& a_arg) 00027 { return(true); } 00028 00029 /** Return true for any variable that is either a signed or unsigned char */ 00030 // template<typename T> 00031 // static bool is_char(const T& a_arg) 00032 // { return(is_signed_char(a_arg) || is_unsigned_char(a_arg)); } 00033 00034 // ----- 00035 00036 /** Return false for any variable that is not a short */ 00037 // template<typename T> 00038 // static bool is_signed_short(const T& a_arg) 00039 // { return(false); } 00040 00041 /** Return true for any variable that is a short */ 00042 // template<> 00043 bool is_signed_short(const short& a_arg) 00044 { return(true); } 00045 00046 /** Return false for any variable that is not an unsigned short */ 00047 // template<typename T> 00048 // static bool is_unsigned_short(const T& a_arg) 00049 // { return(false); } 00050 00051 /** Return true for any variable that is an unsigned short */ 00052 // template<> 00053 bool is_unsigned_short(const unsigned short& a_arg) 00054 { return(true); } 00055 00056 /** Return true for any variable that is either a signed or unsigned short */ 00057 // template<typename T> 00058 // static bool is_short(const T& a_arg) 00059 // { return(is_signed_short(a_arg) || is_unsigned_short(a_arg)); } 00060 00061 // ----- 00062 00063 /** Return false for any variable that is not a int */ 00064 // template<typename T> 00065 // static bool is_signed_int(const T& a_arg) 00066 // { return(false); } 00067 00068 /** Return true for any variable that is a int */ 00069 // template<> 00070 bool is_signed_int(const int& a_arg) 00071 { return(true); } 00072 00073 /** Return false for any variable that is not an unsigned int */ 00074 // template<typename T> 00075 // static bool is_unsigned_int(const T& a_arg) 00076 // { return(false); } 00077 00078 /** Return true for any variable that is an unsigned int */ 00079 // template<> 00080 bool is_unsigned_int(const unsigned int& a_arg) 00081 { return(true); } 00082 00083 /** Return true for any variable that is either a signed or unsigned int */ 00084 // template<typename T> 00085 // static bool is_int(const T& a_arg) 00086 // { return(is_signed_int(a_arg) || is_unsigned_int(a_arg)); } 00087 00088 // ----- 00089 00090 /** Return false for any variable that is not a long */ 00091 // template<typename T> 00092 // static bool is_signed_long(const T& a_arg) 00093 // { return(false); } 00094 00095 /** Return true for any variable that is a long */ 00096 // template<> 00097 bool is_signed_long(const long& a_arg) 00098 { return(true); } 00099 00100 /** Return false for any variable that is not an unsigned long */ 00101 // template<typename T> 00102 // static bool is_unsigned_long(const T& a_arg) 00103 // { return(false); } 00104 00105 /** Return true for any variable that is an unsigned long */ 00106 // template<> 00107 bool is_unsigned_long(const unsigned long& a_arg) 00108 { return(true); } 00109 00110 /** Return true for any variable that is either a signed or unsigned long */ 00111 // template<typename T> 00112 // static bool is_long(const T& a_arg) 00113 // { return(is_signed_long(a_arg) || is_unsigned_long(a_arg)); } 00114 00115 // ----- 00116 00117 /** Return false for any variable that is not a long long */ 00118 // template<typename T> 00119 // static bool is_signed_long_long(const T& a_arg) 00120 // { return(false); } 00121 00122 /** Return true for any variable that is a long long */ 00123 // template<> 00124 bool is_signed_long_long(const long long& a_arg) 00125 { return(true); } 00126 00127 /** Return false for any variable that is not an unsigned long long */ 00128 // template<typename T> 00129 // static bool is_unsigned_long_long(const T& a_arg) 00130 // { return(false); } 00131 00132 /** Return true for any variable that is an unsigned long long */ 00133 // template<> 00134 bool is_unsigned_long_long(const unsigned long long& a_arg) 00135 { return(true); } 00136 00137 /** Return true for any variable that is either a signed or unsigned long long */ 00138 // template<typename T> 00139 // static bool is_long_long(const T& a_arg) 00140 // { return(is_signed_long_long(a_arg) || is_unsigned_long_long(a_arg)); } 00141 00142 // ----- 00143 00144 /** Return false for any variable that is not a float */ 00145 // template<typename T> 00146 // static bool is_float(const T& a_arg) 00147 // { return(false); } 00148 00149 /** Return true for any variable that is a float */ 00150 // template<> 00151 bool is_float(const float& a_arg) 00152 { return(true); } 00153 00154 // ----- 00155 00156 /** Return false for any variable that is not a double */ 00157 // template<typename T> 00158 // static bool is_double(const T& a_arg) 00159 // { return(false); } 00160 00161 /** Return true for any variable that is a double */ 00162 // template<> 00163 bool is_double(const double& a_arg) 00164 { return(true); } 00165 00166 // ----- 00167 00168 /** Return false for any variable that is not a bool */ 00169 // template<typename T> 00170 // static bool is_bool(const T& a_arg) 00171 // { return(false); } 00172 00173 /** Return true for any variable that is a bool */ 00174 // template<> 00175 bool is_bool(const bool& a_arg) 00176 { return(true); } 00177 00178 // ----- 00179 00180 /** Return true for any variable that is a signed type */ 00181 // template<typename T> 00182 // static bool is_signed(const T& a_arg) 00183 // { 00184 // return( 00185 // is_signed_char(a_arg) 00186 // || is_signed_short(a_arg) 00187 // || is_signed_int(a_arg) 00188 // || is_signed_long(a_arg) 00189 // || is_signed_long_long(a_arg) 00190 // || is_float(a_arg) 00191 // || is_double(a_arg) 00192 // ); 00193 // } 00194 00195 /** Return true for any variable that is an unsigned type */ 00196 // template<typename T> 00197 // static bool is_unsigned(const T& a_arg) 00198 // { 00199 // return( 00200 // is_unsigned_char(a_arg) 00201 // || is_unsigned_short(a_arg) 00202 // || is_unsigned_int(a_arg) 00203 // || is_unsigned_long(a_arg) 00204 // || is_unsigned_long_long(a_arg) 00205 // ); 00206 // } 00207 00208 // ---------------------------------------------------------------------------- 00209 00210 // template<typename T> 00211 // static const char * type_name(const T & a_arg) 00212 // { return("unknown"); } 00213 00214 // template<> 00215 const char * type_name(const unsigned char & a_arg) 00216 { return("unsigned char"); } 00217 00218 // template<> 00219 const char * type_name(const char & a_arg) 00220 { return("char"); } 00221 00222 // template<> 00223 const char * type_name(const unsigned short & a_arg) 00224 { return("unsigned short"); } 00225 00226 // template<> 00227 const char * type_name(const short & a_arg) 00228 { return("short"); } 00229 00230 // template<> 00231 const char * type_name(const unsigned int & a_arg) 00232 { return("unsigned int"); } 00233 00234 // template<> 00235 const char * type_name(const int & a_arg) 00236 { return("int"); } 00237 00238 // template<> 00239 const char * type_name(const unsigned long & a_arg) 00240 { return("unsigned long"); } 00241 00242 // template<> 00243 const char * type_name(const long & a_arg) 00244 { return("long"); } 00245 00246 // template<> 00247 const char * type_name(const unsigned long long & a_arg) 00248 { return("unsigned long long"); } 00249 00250 // template<> 00251 const char * type_name(const long long & a_arg) 00252 { return("long long"); } 00253 00254 // template<> 00255 const char * type_name(const float & a_arg) 00256 { return("float"); } 00257 00258 // template<> 00259 const char * type_name(const double & a_arg) 00260 { return("double"); } 00261 00262 // template<> 00263 const char * type_name(const bool & a_arg) 00264 { return("bool"); } 00265 00266 // ---------------------------------------------------------------------------- 00267