Ignore:
Timestamp:
10/16/12 13:04:44 (12 years ago)
Author:
ymipsl
Message:

Major Update

  • redesign Type and attribute manipulation
  • add enumerate type and attribute
  • use blitz class array instead of boost class array

YM

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/trunk/src/attribute_template_impl.hpp

    r352 r369  
    22#define __XMLIO_CAttributeTemplate_impl__ 
    33 
    4 #include "array.hpp" 
    54#include "type.hpp" 
    65#include "buffer_in.hpp" 
     
    2524         this->setValue(value); 
    2625      } 
    27  
     26/* 
    2827      template <class T> 
    2928         CAttributeTemplate<T>::CAttributeTemplate(const CAttribute & attribut) 
     
    3433            ERROR("CAttributeTemplate", << "Invalid instantiation !"); 
    3534      } 
    36  
     35*/ 
    3736      template <class T> 
    3837         CAttributeTemplate<T>::CAttributeTemplate(const StdString & id, 
     
    5251         umap.insert(umap.end(), std::make_pair(id, this)); 
    5352      } 
    54  
    55       template <class T> 
    56          CAttributeTemplate<T>::~CAttributeTemplate(void) 
     53/* 
     54      template <class T> 
     55      CAttributeTemplate<T>::~CAttributeTemplate(void) 
    5756      {  
    58          this->clear(); 
    59       } 
    60  
     57//         this->CType<T>::reset() ; 
     58//         this->clear(); 
     59      } 
     60*/ 
    6161      ///-------------------------------------------------------------- 
    6262 
     
    6464         T CAttributeTemplate<T>::getValue(void) const 
    6565      { 
     66         return CType<T>::get() ; 
     67/* 
    6668         if (SuperClass::isEmpty()) 
    6769         { 
     
    7173          } 
    7274         return (SuperClass::getValue<T>()); 
    73       } 
    74  
     75*/ 
     76      } 
     77 
     78/* 
    7579      template <class T> 
    7680         T* CAttributeTemplate<T>::getRef(void) 
     
    8488         return (SuperClass::getRef<T>()); 
    8589      } 
     90*/ 
    8691 
    8792      template <class T> 
    8893         void CAttributeTemplate<T>::setValue(const T & value) 
    8994      { 
    90          SuperClass::setValue<T>(value); 
    91       } 
    92  
    93       //--------------------------------------------------------------- 
    94  
    95       template <class T> 
    96          T CAttributeTemplate<T>::operator=(const T & value) 
     95         CType<T>::set(value) ; 
     96//         SuperClass::setValue<T>(value); 
     97      } 
     98 
     99    template <class T> 
     100    void CAttributeTemplate<T>::set(const CAttribute& attr) 
     101    { 
     102      this->set(dynamic_cast<const CAttributeTemplate<T>& >(attr)) ; 
     103    }  
     104 
     105   template <class T> 
     106    void CAttributeTemplate<T>::set(const CAttributeTemplate& attr) 
     107    { 
     108      CType<T>::set(attr) ; 
     109    }  
     110 
     111      //--------------------------------------------------------------- 
     112 
     113      template <class T> 
     114         CAttributeTemplate<T>& CAttributeTemplate<T>::operator=(const T & value) 
    97115      { 
    98116         this->setValue(value); 
    99          return (this->getValue()); 
    100       } 
    101  
    102       //--------------------------------------------------------------- 
    103  
    104       template <class T> 
    105          StdString CAttributeTemplate<T>::toString(void) const 
     117//         return (this->getValue()); 
     118         return *this; 
     119      } 
     120 
     121      //--------------------------------------------------------------- 
     122 
     123      template <class T> 
     124         StdString CAttributeTemplate<T>::_toString(void) const 
    106125      { 
    107126         StdOStringStream oss; 
    108          if (!this->isEmpty() && this->hasId()) 
    109             oss << this->getName() << "=\"" << this->getValue() << "\""; 
     127         if (!CType<T>::isEmpty() && this->hasId()) 
     128            oss << this->getName() << "=\"" << CType<T>::toString() << "\""; 
    110129         return (oss.str()); 
    111130      } 
    112131 
    113132      template <class T> 
    114          void CAttributeTemplate<T>::fromString(const StdString & str) 
    115       { 
    116          ERROR("CAttributeTemplate<T>::fromString(const StdString & str)", 
    117                << "[ str = " << str << " ] Not implemented yet !"); 
    118       } 
    119  
    120       //--------------------------------------------------------------- 
    121  
     133         void CAttributeTemplate<T>::_fromString(const StdString & str) 
     134      { 
     135        CType<T>::fromString(str) ; 
     136      } 
     137 
     138      //--------------------------------------------------------------- 
     139/* 
    122140      template <class T> 
    123141         void CAttributeTemplate<T>::toBinary (StdOStream & os) const 
     
    133151         this->setValue(value); 
    134152      } 
    135  
    136       template <class T> 
    137          bool CAttributeTemplate<T>::toBuffer (CBufferOut& buffer) const 
    138       { 
     153*/ 
     154      template <class T> 
     155         bool CAttributeTemplate<T>::_toBuffer (CBufferOut& buffer) const 
     156      { 
     157         return CType<T>::toBuffer(buffer) ; 
     158/*          
    139159         if (isEmpty()) return buffer.put(true) ; 
    140160         else 
     
    146166           return ret ; 
    147167         } 
    148       } 
    149  
    150       template <class T> 
    151       bool CAttributeTemplate<T>::fromBuffer(CBufferIn& buffer) 
    152       { 
     168*/ 
     169      } 
     170 
     171      template <class T> 
     172      bool CAttributeTemplate<T>::_fromBuffer(CBufferIn& buffer) 
     173      { 
     174        return CType<T>::fromBuffer(buffer) ; 
     175/*         
    153176        bool empty ; 
    154177        bool ret=true ; 
     
    170193          return val.fromBuffer(buffer) ; 
    171194        } 
    172       } 
    173  
     195*/ 
     196      } 
     197/* 
    174198      template <class T> 
    175199      size_t CAttributeTemplate<T>::size(void) const 
    176       { 
     200      {  
     201        return CType<T>::size() ;*/ 
     202/*         
    177203        if (isEmpty()) return sizeof(bool) ; 
    178204        else 
     
    181207          return val.size()+sizeof(bool) ; 
    182208        } 
    183       } 
     209*/ 
     210 /*     }*/ 
    184211 
    185212      template <typename T> 
     
    231258      } 
    232259  
    233        
    234       //--------------------------------------------------------------- 
    235  
    236       /** Spécialisations des templates pour la fonction [toString] **/ 
     260/*       
     261      //--------------------------------------------------------------- 
     262 
     263      // Spécialisations des templates pour la fonction [toString]  
    237264 
    238265      template <> 
     
    241268      //--------------------------------------------------------------- 
    242269 
    243       /** Spécialisations des templates pour la fonction [fromString] **/ 
     270      // Spécialisations des templates pour la fonction [fromString]  
    244271 
    245272      template <> // Chaîne de caractÚres. 
     
    260287      //--------------------------------------------------------------- 
    261288 
    262       /** Spécialisations des templates pour la fonction [toBinary] **/ 
     289      // Spécialisations des templates pour la fonction [toBinary] // 
    263290 
    264291      template <> // Chaîne de caractÚres. 
     
    276303      //--------------------------------------------------------------- 
    277304 
    278       /** Spécialisations des templates pour la fonction [fromBinary] **/ 
     305      // Spécialisations des templates pour la fonction [fromBinary] // 
    279306 
    280307      template <> // Chaîne de caractÚres. 
     
    291318 
    292319      ///-------------------------------------------------------------- 
     320*/       
    293321} // namespace xios 
    294322 
Note: See TracChangeset for help on using the changeset viewer.