Changeset 1875 for XIOS/dev/dev_ym/XIOS_COUPLING/src/attribute_array.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_array.hpp
r1622 r1875 21 21 { 22 22 public : 23 24 using CArray<T_numtype,N_rank>::operator = ; 23 using CArray<T_numtype,N_rank>::operator = ; 25 24 26 25 /// Constructeurs /// … … 65 64 virtual void generateFortranInterfaceGetBody_(ostream& oss,const string& className) ; 66 65 virtual void generateFortranInterfaceGetDeclaration(ostream& oss,const string& className) ; 66 67 static int show_TV_ttf_display_type ( const CAttributeArray<T_numtype,N_rank>* array ) 68 { 69 int status ; 70 if (array->isEmpty()) 71 { 72 status = TV_ttf_add_row("State", TV_ttf_type_ascii_string,"(empty)") ; 73 if (status != TV_ttf_ec_ok) return TV_ttf_format_raw ; 74 else return TV_ttf_format_ok_elide ; 75 } 76 else 77 { 78 char tname[128] ; 79 char bname[128] = "value_type" ; 80 #ifdef __GNUC__ 81 size_t size = sizeof(bname) ; 82 abi::__cxa_demangle(typeid(T_numtype).name(), bname, &size, &status) ; 83 if (status !=0) return TV_ttf_format_raw ; 84 #endif 85 int dim = array->dimensions() ; 86 if (dim==1) snprintf (tname, sizeof(tname), "%s[%d]", bname, array->extent(0)); 87 if (dim==2) snprintf (tname, sizeof(tname), "%s[%d][%d]", bname, array->extent(1), array->extent(0)); 88 if (dim==3) snprintf (tname, sizeof(tname), "%s[%d][%d][%d]", bname, array->extent(2), array->extent(1), array->extent(3)); 89 if (dim==4) snprintf (tname, sizeof(tname), "%s[%d][%d][%d][%d]", bname, array->extent(0), array->extent(1), array->extent(2), array->extent(3)); 90 if (dim==5) snprintf (tname, sizeof(tname), "%s[%d][%d][%d][%d][%d]", bname, array->extent(4), array->extent(3), array->extent(2), array->extent(1) 91 ,array->extent(0)); 92 if (dim==6) snprintf (tname, sizeof(tname), "%s[%d][%d][%d][%d][%d][%d]", bname, array->extent(5), array->extent(4), array->extent(3), array->extent(2) 93 ,array->extent(1),array->extent(0)); 94 if (dim==7) snprintf (tname, sizeof(tname), "%s[%d][%d][%d][%d][%d][%d][%d]", bname, array->extent(6), array->extent(5), array->extent(4), array->extent(3) 95 ,array->extent(2),array->extent(1),array->extent(0)); 96 status = TV_ttf_add_row("array_values", tname, array->dataFirst()) ; 97 if (status != TV_ttf_ec_ok) return TV_ttf_format_raw ; 98 else return TV_ttf_format_ok ; 99 } 100 } 101 102 103 static int TV_ttf_display_type ( const CAttributeArray<T_numtype,N_rank>* array ) 104 { 105 return CAttributeArray<T_numtype,N_rank>::show_TV_ttf_display_type (array) ; 106 } 67 107 68 108 private : … … 75 115 bool _fromBuffer(CBufferIn& buffer) ; 76 116 }; // class CAttributeEnum 117 118 119 #define macrotyperank(_TYPE_,_RANK_)\ 120 template<> int CAttributeArray<_TYPE_,_RANK_>::TV_ttf_display_type(const CAttributeArray<_TYPE_,_RANK_>* array ) \ 121 {\ 122 return CAttributeArray<_TYPE_,_RANK_>::show_TV_ttf_display_type (array) ;\ 123 } 124 125 #define macrotype(_TYPE_)\ 126 macrotyperank(_TYPE_,1)\ 127 macrotyperank(_TYPE_,2)\ 128 macrotyperank(_TYPE_,3)\ 129 macrotyperank(_TYPE_,4)\ 130 macrotyperank(_TYPE_,5)\ 131 macrotyperank(_TYPE_,6)\ 132 macrotyperank(_TYPE_,7) 133 134 macrotype(double) 135 macrotype(int) 136 macrotype(bool) 137 macrotype(size_t) 138 macrotype(float) 139 macrotype(string) 140 141 #undef macrotyperank 142 #undef macrotype 77 143 } // namespace xios 78 144
Note: See TracChangeset
for help on using the changeset viewer.