Changeset 1875 for XIOS/dev/dev_ym/XIOS_COUPLING/src/attribute_template.hpp
- Timestamp:
- 05/12/20 11:52:13 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/dev_ym/XIOS_COUPLING/src/attribute_template.hpp
r1622 r1875 12 12 #include "buffer_out.hpp" 13 13 #include "type.hpp" 14 #include "tv_data_display.h" 15 16 #ifdef __GNUC__ 17 #include <typeinfo> 18 #include <cxxabi.h> 19 #endif 14 20 15 21 namespace xios … … 20 26 The class implements attribute of some basic types 21 27 */ 22 template <class T>28 template <class T> 23 29 class CAttributeTemplate : public CAttribute, public CType<T> 24 30 { … … 91 97 // virtual void generateFortranInterfaceIsDefinedDeclaration(ostream& oss,const string& className) ; 92 98 99 static int show_TV_ttf_display_type ( const CAttributeTemplate<T>* attr) 100 { 101 int status ; 102 if (attr->isEmpty()) 103 { 104 status = TV_ttf_add_row("State", TV_ttf_type_ascii_string,"(empty)") ; 105 if (status != TV_ttf_ec_ok) return TV_ttf_format_raw ; 106 else return TV_ttf_format_ok_elide ; 107 } 108 else 109 { 110 char tname[128] ; 111 char bname[128] = "ValueType" ; 112 #ifdef __GNUC__ 113 size_t size = sizeof(bname) ; 114 abi::__cxa_demangle(typeid(T).name(), bname, &size, &status) ; 115 if (status !=0) return TV_ttf_format_raw ; 116 #endif 117 snprintf (tname, sizeof(tname), "%s", bname); 118 if (typeid(T)==typeid(string)) 119 status = TV_ttf_add_row("values", TV_ttf_type_ascii_string, ((string*)(attr->ptrValue))->c_str() ); 120 else status = TV_ttf_add_row("values", tname, attr->ptrValue) ; 121 if (status != TV_ttf_ec_ok) return TV_ttf_format_raw ; 122 else return TV_ttf_format_ok_elide ; 123 } 124 } 125 126 static int TV_ttf_display_type ( const CAttributeTemplate<T>* attr ) 127 { 128 return show_TV_ttf_display_type (attr) ; 129 } 130 93 131 94 132 protected : … … 107 145 }; // class CAttribute 108 146 147 #define macrotype(_TYPE_)\ 148 template<> int CAttributeTemplate<_TYPE_>::TV_ttf_display_type( const CAttributeTemplate<_TYPE_>* attr ) \ 149 {\ 150 return show_TV_ttf_display_type (attr) ;\ 151 } 152 153 macrotype(double) 154 macrotype(int) 155 macrotype(bool) 156 macrotype(string) 157 //macrotype(CDate) 158 //macrotype(CDuration) 159 #undef macrotype 109 160 110 161 template <class T> void FromBinary(StdIStream & is, T & obj); 162 111 163 112 164 } // namespace xios
Note: See TracChangeset
for help on using the changeset viewer.