Changeset 1112


Ignore:
Timestamp:
05/03/17 14:59:25 (7 years ago)
Author:
ymipsl
Message:

For xml : if attribute get the string value of "_reset_", attribute will be empty and the attribute will remain empty after inheritance.

YM

Location:
XIOS/trunk/src
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • XIOS/trunk/src/attribute.cpp

    r1107 r1112  
    66namespace xios 
    77{ 
     8 
     9      const StdString CAttribute::resetInheritanceStr("_reset_") ; 
     10 
    811      /// ////////////////////// Définitions ////////////////////// /// 
    912      CAttribute::CAttribute(const StdString & id) 
    10          : CObject(id), CBaseType() 
     13         : CObject(id), CBaseType(), _canInherite(true) 
    1114//         , value() 
    1215      { /* Ne rien faire de plus */ } 
  • XIOS/trunk/src/attribute.hpp

    r1105 r1112  
    6565            virtual void setInheritedValue(const CAttribute& ) = 0 ; 
    6666            virtual bool hasInheritedValue(void) const = 0; 
    67              
     67 
     68            bool canInherite(void) {return _canInherite ;} 
    6869         protected :  
     70            bool _canInherite ; 
     71            static const StdString resetInheritanceStr ;  
    6972 
    7073      }; // class CAttribute 
  • XIOS/trunk/src/attribute_array.hpp

    r1107 r1112  
    5353            /// Autre /// 
    5454            virtual string toString(void) const { return _toString();} 
    55             virtual void fromString(const StdString & str) { _fromString(str);} 
     55            virtual void fromString(const StdString & str) { if (str==resetInheritanceStr) { reset(); _canInherite=false ;}  else _fromString(str);} 
    5656            virtual bool toBuffer  (CBufferOut& buffer) const { return _toBuffer(buffer);} 
    5757            virtual bool fromBuffer(CBufferIn& buffer) { return _fromBuffer(buffer); } 
  • XIOS/trunk/src/attribute_array_impl.hpp

    r1105 r1112  
    8383    void CAttributeArray<T_numtype,N_rank>::setInheritedValue(const CAttributeArray& attr) 
    8484    { 
    85       if (this->isEmpty() && attr.hasInheritedValue()) 
     85      if (this->isEmpty() && _canInherite && attr.hasInheritedValue()) 
    8686      { 
    8787        inheritedValue.resize(attr.shape()) ; 
  • XIOS/trunk/src/attribute_enum.hpp

    r1107 r1112  
    6262            /// Autre /// 
    6363            virtual StdString toString(void) const { return _toString();} 
    64             virtual void fromString(const StdString & str) { _fromString(str);} 
     64            virtual void fromString(const StdString & str) { if (str==resetInheritanceStr) { reset(); _canInherite=false ;}  else _fromString(str);} 
    6565 
    6666            virtual bool toBuffer  (CBufferOut& buffer) const { return _toBuffer(buffer);}  
  • XIOS/trunk/src/attribute_enum_impl.hpp

    r1105 r1112  
    8888  void CAttributeEnum<T>::setInheritedValue(const CAttributeEnum& attr) 
    8989  { 
    90     if (this->isEmpty() && attr.hasInheritedValue()) inheritedValue.set(attr.getInheritedValue()); 
     90    if (this->isEmpty() && _canInherite && attr.hasInheritedValue()) inheritedValue.set(attr.getInheritedValue()); 
    9191  } 
    9292 
  • XIOS/trunk/src/attribute_map.cpp

    r1105 r1112  
    170170               if (apply) 
    171171               { 
    172                  if (currentAtt->isEmpty() && !el.second->isEmpty()) 
     172                 if (currentAtt->isEmpty() && currentAtt->canInherite() && !el.second->isEmpty()) 
    173173                 { 
    174174                    this->setAttribute(el.first, el.second); 
  • XIOS/trunk/src/attribute_template.hpp

    r1105 r1112  
    6565            /// Autre /// 
    6666            virtual StdString toString(void) const { return _toString();} 
    67             virtual void fromString(const StdString & str) { _fromString(str);} 
     67            virtual void fromString(const StdString & str) { if (str==resetInheritanceStr) { reset(); _canInherite=false ;}  else _fromString(str);} 
    6868//            virtual CAttributeTemplate* clone() const {} 
    6969//            virtual void toBinary  (StdOStream & os) const; 
  • XIOS/trunk/src/attribute_template_impl.hpp

    r1105 r1112  
    125125    void CAttributeTemplate<T>::setInheritedValue(const CAttributeTemplate& attr) 
    126126    { 
    127       if (this->isEmpty() && attr.hasInheritedValue()) inheritedValue.set(attr.getInheritedValue()) ; 
     127      if (this->isEmpty() && _canInherite && attr.hasInheritedValue()) inheritedValue.set(attr.getInheritedValue()) ; 
    128128    } 
    129129 
Note: See TracChangeset for help on using the changeset viewer.