Ignore:
Timestamp:
05/12/20 11:52:13 (4 years ago)
Author:
ymipsl
Message:

XIOS coupling branch
Some updates.

First coupling test is beginning to work...

YM

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/attribute_template.hpp

    r1622 r1875  
    1212#include "buffer_out.hpp" 
    1313#include "type.hpp" 
     14#include "tv_data_display.h" 
     15 
     16#ifdef __GNUC__ 
     17#include <typeinfo> 
     18#include <cxxabi.h> 
     19#endif 
    1420 
    1521namespace xios 
     
    2026    The class implements attribute of some basic types 
    2127  */ 
    22       template <class T> 
     28       template <class T> 
    2329         class CAttributeTemplate : public CAttribute, public CType<T> 
    2430      { 
     
    9197//            virtual void generateFortranInterfaceIsDefinedDeclaration(ostream& oss,const string& className) ; 
    9298 
     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 
    93131 
    94132         protected : 
     
    107145      }; // class CAttribute 
    108146 
     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 
     153macrotype(double) 
     154macrotype(int) 
     155macrotype(bool) 
     156macrotype(string) 
     157//macrotype(CDate) 
     158//macrotype(CDuration) 
     159#undef macrotype 
    109160 
    110161   template <class T>  void FromBinary(StdIStream & is, T & obj); 
     162 
    111163 
    112164} // namespace xios 
Note: See TracChangeset for help on using the changeset viewer.