Changeset 3208 in Sophya for trunk/SophyaLib/BaseTools/datatype.cc
- Timestamp:
- Apr 10, 2007, 5:57:02 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaLib/BaseTools/datatype.cc
r2884 r3208 14 14 { 15 15 } 16 #if defined(__SGICC__) || defined(__IBMCPP__) 17 template <class T> 18 string DataTypeInfo<T>::getTypeName() 19 { 20 if (typeid(T) == typeid(uint_1)) return("uint_1"); 21 else if (typeid(T) == typeid(uint_2)) return("uint_2"); 22 else if (typeid(T) == typeid(int_2)) return("int_2"); 23 else if (typeid(T) == typeid(int_4)) return("int_4"); 24 else if (typeid(T) == typeid(int_8)) return("int_8"); 25 else if (typeid(T) == typeid(uint_4)) return("uint_4"); 26 else if (typeid(T) == typeid(uint_8)) return("uint_8"); 27 else if (typeid(T) == typeid(r_4)) return("r_4"); 28 else if (typeid(T) == typeid(r_8)) return("r_8"); 29 else if (typeid(T) == typeid(complex<r_4>)) return(" complex<r_4> "); 30 else if (typeid(T) == typeid(complex<r_8>)) return(" complex<r_8> "); 31 else return("???unknowntype???"); 32 } 33 #else 16 //! Return the type name of T, as a string, (Example: T=uint_8 --> "uint_8") 34 17 template <class T> 35 18 string DataTypeInfo<T>::getTypeName() { return("???unknowntype???"); } … … 37 20 string DataTypeInfo<uint_1>::getTypeName() { return("uint_1"); } 38 21 DECL_TEMP_SPEC 22 string DataTypeInfo<int_1>::getTypeName() { return("int_1"); } 23 DECL_TEMP_SPEC 39 24 string DataTypeInfo<uint_2>::getTypeName() { return("uint_2"); } 40 25 DECL_TEMP_SPEC 41 26 string DataTypeInfo<int_2>::getTypeName() { return("int_2"); } 42 27 DECL_TEMP_SPEC 28 string DataTypeInfo<uint_4>::getTypeName() { return("uint_4"); } 29 DECL_TEMP_SPEC 43 30 string DataTypeInfo<int_4>::getTypeName() { return("int_4"); } 44 31 DECL_TEMP_SPEC 32 string DataTypeInfo<uint_8>::getTypeName() { return("uint_8"); } 33 DECL_TEMP_SPEC 45 34 string DataTypeInfo<int_8>::getTypeName() { return("int_8"); } 46 DECL_TEMP_SPEC47 string DataTypeInfo<uint_4>::getTypeName() { return("uint_4"); }48 DECL_TEMP_SPEC49 string DataTypeInfo<uint_8>::getTypeName() { return("uint_8"); }50 35 DECL_TEMP_SPEC 51 36 string DataTypeInfo<r_4>::getTypeName() { return("r_4"); } … … 56 41 DECL_TEMP_SPEC 57 42 string DataTypeInfo< complex<r_8> >::getTypeName() { return(" complex<r_8> "); } 58 #endif 43 44 /*! 45 \ brief Return an identifier associated to T 46 uint_1 -> 1 , int_1 -> 2 47 uint_2 -> 3 , int_2 -> 4 48 uint_4 -> 5 , int_4 -> 6 49 uint_8 -> 7 , int_8 -> 8 50 r_4 -> 9 , r_8 -> 10 51 complex<r_4> -> 11 , complex<r_8> -> 12 52 */ 53 template <class T> 54 int DataTypeInfo<T>::getTypeId() { return(0); } 55 DECL_TEMP_SPEC 56 int DataTypeInfo<uint_1>::getTypeId() { return(1); } 57 DECL_TEMP_SPEC 58 int DataTypeInfo<int_1>::getTypeId() { return(2); } 59 DECL_TEMP_SPEC 60 int DataTypeInfo<uint_2>::getTypeId() { return(3); } 61 DECL_TEMP_SPEC 62 int DataTypeInfo<int_2>::getTypeId() { return(4); } 63 DECL_TEMP_SPEC 64 int DataTypeInfo<uint_4>::getTypeId() { return(5); } 65 DECL_TEMP_SPEC 66 int DataTypeInfo<int_4>::getTypeId() { return(6); } 67 DECL_TEMP_SPEC 68 int DataTypeInfo<uint_8>::getTypeId() { return(7); } 69 DECL_TEMP_SPEC 70 int DataTypeInfo<int_8>::getTypeId() { return(8); } 71 DECL_TEMP_SPEC 72 int DataTypeInfo<r_4>::getTypeId() { return(9); } 73 DECL_TEMP_SPEC 74 int DataTypeInfo<r_8>::getTypeId() { return(10); } 75 DECL_TEMP_SPEC 76 int DataTypeInfo< complex<r_4> >::getTypeId() { return(11); } 77 DECL_TEMP_SPEC 78 int DataTypeInfo< complex<r_8> >::getTypeId() { return(12); } 79 59 80 60 81 … … 115 136 #ifdef __CXX_PRAGMA_TEMPLATES__ 116 137 #pragma define_template DataTypeInfo<uint_1> 138 #pragma define_template DataTypeInfo<int_1> 117 139 #pragma define_template DataTypeInfo<uint_2> 118 140 #pragma define_template DataTypeInfo<int_2> … … 130 152 namespace SOPHYA { 131 153 template class DataTypeInfo<uint_1>; 154 template class DataTypeInfo<int_1>; 132 155 template class DataTypeInfo<uint_2>; 133 156 template class DataTypeInfo<int_2>;
Note:
See TracChangeset
for help on using the changeset viewer.