Ignore:
Timestamp:
06/19/13 10:09:36 (11 years ago)
Author:
ymipsl
Message:

Add possibility to make inheritance of attributes and reference before closing the context definition.
New fortran fonction : xios_solve inheritance()
After this call, the value of attribute have the inherited value of their parent.

YM

File:
1 edited

Legend:

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

    r380 r445  
    7575    }  
    7676 
     77     
     78    template <class T> 
     79    void CAttributeEnum<T>::setInheritedValue(const CAttribute& attr) 
     80    { 
     81      this->setInheritedValue(dynamic_cast<const CAttributeEnum<T>& >(attr)) ; 
     82    }  
     83 
     84    template <class T> 
     85    void CAttributeEnum<T>::setInheritedValue(const CAttributeEnum& attr) 
     86    { 
     87      if (this->isEmpty() && attr.hasInheritedValue()) inheritedValue.set(attr.getInheritedValue()) ; 
     88    }  
     89 
     90    template <class T> 
     91    typename T::t_enum CAttributeEnum<T>::getInheritedValue(void) const 
     92    { 
     93      if (this->isEmpty()) return inheritedValue.get() ; 
     94      else return getValue() ; 
     95    }  
     96     
     97    template <class T> 
     98    string CAttributeEnum<T>::getInheritedStringValue(void) const 
     99    { 
     100       return CEnum<T>::toString() ; 
     101       if (this->isEmpty()) return inheritedValue.toString() ; 
     102       else return CEnum<T>::toString() ; ; 
     103    } 
     104     
     105    template <class T> 
     106    bool CAttributeEnum<T>::hasInheritedValue(void) const 
     107    { 
     108      return !this->isEmpty() || !inheritedValue.isEmpty() ; 
     109    }  
     110     
    77111      //--------------------------------------------------------------- 
    78112 
Note: See TracChangeset for help on using the changeset viewer.