Ignore:
Timestamp:
11/15/17 12:14:34 (6 years ago)
Author:
yushan
Message:

dev_omp

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/branch_openmp/src/attribute_enum_impl.hpp

    r1134 r1328  
    1010namespace xios 
    1111{ 
    12   /// ////////////////////// Définitions ////////////////////// /// 
     12  /// ////////////////////// Définitions ////////////////////// /// 
    1313  template <class T> 
    1414  CAttributeEnum<T>::CAttributeEnum(const StdString & id) 
     
    3030     umap.insert(umap.end(), std::make_pair(id, this)); 
    3131  } 
    32   
     32 
    3333  template <class T> 
    3434  CAttributeEnum<T>::CAttributeEnum 
     
    4040     umap.insert(umap.end(), std::make_pair(id, this)); 
    4141  } 
    42   
     42 
    4343  ///-------------------------------------------------------------- 
    4444  template <class T> 
     
    5454     return CEnum<T>::get(); 
    5555  } 
    56   
     56 
    5757  template <class T> 
    5858  string CAttributeEnum<T>::getStringValue(void) const 
    5959  { 
    60     return CEnum<T>::toString(); 
    61   } 
    62  
     60     return CEnum<T>::toString(); 
     61  } 
    6362 
    6463  template <class T> 
     
    7170  void CAttributeEnum<T>::set(const CAttribute& attr) 
    7271  { 
    73      this->set(dynamic_cast<const CAttributeEnum<T>& >(attr)); 
    74   } 
    75     
    76   template <class T> 
     72    this->set(dynamic_cast<const CAttributeEnum<T>& >(attr)); 
     73  } 
     74 
     75 template <class T> 
    7776  void CAttributeEnum<T>::set(const CAttributeEnum& attr) 
    7877  { 
    79      CEnum<T>::set(attr); 
    80   } 
    81   
     78    CEnum<T>::set(attr); 
     79  } 
     80 
    8281  template <class T> 
    8382  void CAttributeEnum<T>::setInheritedValue(const CAttribute& attr) 
    8483  { 
    85      this->setInheritedValue(dynamic_cast<const CAttributeEnum<T>& >(attr)); 
    86   } 
    87    
     84    this->setInheritedValue(dynamic_cast<const CAttributeEnum<T>& >(attr)); 
     85  } 
     86 
    8887  template <class T> 
    8988  void CAttributeEnum<T>::setInheritedValue(const CAttributeEnum& attr) 
    9089  { 
    91      if (this->isEmpty() && _canInherite && attr.hasInheritedValue()) inheritedValue.set(attr.getInheritedValue()); 
    92   } 
    93    
     90    if (this->isEmpty() && _canInherite && attr.hasInheritedValue()) inheritedValue.set(attr.getInheritedValue()); 
     91  } 
     92 
    9493  template <class T> 
    9594  typename T::t_enum CAttributeEnum<T>::getInheritedValue(void) const 
    9695  { 
    97      if (this->isEmpty()) return inheritedValue.get(); 
    98      else return getValue(); 
    99   } 
    100  
    101   template <class T> 
    102       string CAttributeEnum<T>::getInheritedStringValue(void) const 
    103       { 
    104           if (this->isEmpty()) return inheritedValue.toString(); 
    105           else return CEnum<T>::toString();; 
    106       } 
    107  
    108   template <class T> 
    109       bool CAttributeEnum<T>::hasInheritedValue(void) const 
    110       { 
    111           return !this->isEmpty() || !inheritedValue.isEmpty(); 
    112       } 
    113  
    114   template <class T> 
    115       bool CAttributeEnum<T>::isEqual(const CAttribute& attr) 
    116       { 
    117           return (this->isEqual(dynamic_cast<const CAttributeEnum<T>& >(attr))); 
    118       } 
    119  
    120   template <class T> 
    121       bool CAttributeEnum<T>::isEqual(const CAttributeEnum& attr) 
    122       { 
    123           return ((dynamic_cast<const CEnum<T>& >(*this)) == (dynamic_cast<const CEnum<T>& >(attr))); 
    124       } 
     96    if (this->isEmpty()) return inheritedValue.get(); 
     97    else return getValue(); 
     98  } 
     99 
     100  template <class T> 
     101  string CAttributeEnum<T>::getInheritedStringValue(void) const 
     102  { 
     103     if (this->isEmpty()) return inheritedValue.toString(); 
     104     else return CEnum<T>::toString();; 
     105  } 
     106 
     107  template <class T> 
     108  bool CAttributeEnum<T>::hasInheritedValue(void) const 
     109  { 
     110    return !this->isEmpty() || !inheritedValue.isEmpty(); 
     111  } 
     112 
     113  template <class T> 
     114  bool CAttributeEnum<T>::isEqual(const CAttribute& attr) 
     115  { 
     116    return (this->isEqual(dynamic_cast<const CAttributeEnum<T>& >(attr))); 
     117  } 
     118 
     119  template <class T> 
     120  bool CAttributeEnum<T>::isEqual(const CAttributeEnum& attr) 
     121  { 
     122    return ((dynamic_cast<const CEnum<T>& >(*this)) == (dynamic_cast<const CEnum<T>& >(attr))); 
     123  } 
    125124 
    126125  //--------------------------------------------------------------- 
    127126 
    128127  template <class T> 
    129       CAttributeEnum<T>& CAttributeEnum<T>::operator=(const T_enum & value) 
    130       { 
    131           this->setValue(value); 
    132           return *this; 
    133       } 
     128  CAttributeEnum<T>& CAttributeEnum<T>::operator=(const T_enum & value) 
     129  { 
     130     this->setValue(value); 
     131     return *this; 
     132  } 
    134133 
    135134  //--------------------------------------------------------------- 
    136135 
    137136  template <class T> 
    138       StdString CAttributeEnum<T>::_toString(void) const 
    139       { 
    140           StdOStringStream oss; 
    141           if (!CEnum<T>::isEmpty() && this->hasId()) 
    142               oss << this->getName() << "=\"" << CEnum<T>::toString() << "\""; 
    143           return (oss.str()); 
    144       } 
    145  
    146   template <class T> 
    147       void CAttributeEnum<T>::_fromString(const StdString & str) 
    148       { 
    149           CEnum<T>::fromString(str); 
    150       } 
    151  
    152   template <class T> 
    153       bool CAttributeEnum<T>::_toBuffer (CBufferOut& buffer) const 
    154       { 
    155           return CEnum<T>::toBuffer(buffer); 
    156       } 
    157  
    158   template <class T> 
    159       bool CAttributeEnum<T>::_fromBuffer(CBufferIn& buffer) 
    160       { 
    161           return CEnum<T>::fromBuffer(buffer); 
    162       } 
    163  
    164   template <typename T> 
    165       void CAttributeEnum<T>::generateCInterface(ostream& oss,const string& className) 
    166       { 
    167           CInterface::AttributeCInterface<CEnumBase>(oss, className, this->getName()); 
    168       } 
    169  
    170   template <typename T> 
    171       void CAttributeEnum<T>::generateFortran2003Interface(ostream& oss,const string& className) 
    172       { 
    173           CInterface::AttributeFortran2003Interface<string>(oss, className, this->getName()); 
    174       } 
    175  
    176   template <typename T> 
    177       void CAttributeEnum<T>::generateFortranInterfaceDeclaration_(ostream& oss,const string& className) 
    178       { 
    179           CInterface::AttributeFortranInterfaceDeclaration<string>(oss, className, this->getName()+"_"); 
    180       } 
    181  
    182   template <typename T> 
    183       void CAttributeEnum<T>::generateFortranInterfaceBody_(ostream& oss,const string& className) 
    184       { 
    185           CInterface::AttributeFortranInterfaceBody<string>(oss, className, this->getName()); 
    186       } 
    187  
    188   template <typename T> 
    189       void CAttributeEnum<T>::generateFortranInterfaceDeclaration(ostream& oss,const string& className) 
    190       { 
    191           CInterface::AttributeFortranInterfaceDeclaration<string>(oss, className, this->getName()); 
    192       } 
    193  
    194   template <typename T> 
    195       void CAttributeEnum<T>::generateFortranInterfaceGetDeclaration_(ostream& oss,const string& className) 
    196       { 
    197           CInterface::AttributeFortranInterfaceGetDeclaration<string>(oss, className, this->getName()+"_"); 
    198       } 
    199  
    200   template <typename T> 
    201       void CAttributeEnum<T>::generateFortranInterfaceGetBody_(ostream& oss,const string& className) 
    202       { 
    203           CInterface::AttributeFortranInterfaceGetBody<string>(oss, className, this->getName()); 
    204       } 
    205  
    206   template <typename T> 
    207       void CAttributeEnum<T>::generateFortranInterfaceGetDeclaration(ostream& oss,const string& className) 
    208       { 
    209           CInterface::AttributeFortranInterfaceGetDeclaration<string>(oss, className, this->getName()); 
    210       } 
     137  StdString CAttributeEnum<T>::_toString(void) const 
     138  { 
     139     StdOStringStream oss; 
     140     if (!CEnum<T>::isEmpty() && this->hasId()) 
     141        oss << this->getName() << "=\"" << CEnum<T>::toString() << "\""; 
     142     return (oss.str()); 
     143  } 
     144 
     145  template <class T> 
     146  void CAttributeEnum<T>::_fromString(const StdString & str) 
     147  { 
     148    CEnum<T>::fromString(str); 
     149  } 
     150 
     151  template <class T> 
     152  bool CAttributeEnum<T>::_toBuffer (CBufferOut& buffer) const 
     153  { 
     154     return CEnum<T>::toBuffer(buffer); 
     155  } 
     156 
     157  template <class T> 
     158  bool CAttributeEnum<T>::_fromBuffer(CBufferIn& buffer) 
     159  { 
     160    return CEnum<T>::fromBuffer(buffer); 
     161  } 
     162 
     163  template <typename T> 
     164  void CAttributeEnum<T>::generateCInterface(ostream& oss,const string& className) 
     165  { 
     166    CInterface::AttributeCInterface<CEnumBase>(oss, className, this->getName()); 
     167  } 
     168 
     169  template <typename T> 
     170  void CAttributeEnum<T>::generateFortran2003Interface(ostream& oss,const string& className) 
     171  { 
     172    CInterface::AttributeFortran2003Interface<string>(oss, className, this->getName()); 
     173  } 
     174 
     175  template <typename T> 
     176  void CAttributeEnum<T>::generateFortranInterfaceDeclaration_(ostream& oss,const string& className) 
     177  { 
     178    CInterface::AttributeFortranInterfaceDeclaration<string>(oss, className, this->getName()+"_"); 
     179  } 
     180 
     181  template <typename T> 
     182  void CAttributeEnum<T>::generateFortranInterfaceBody_(ostream& oss,const string& className) 
     183  { 
     184    CInterface::AttributeFortranInterfaceBody<string>(oss, className, this->getName()); 
     185  } 
     186 
     187  template <typename T> 
     188  void CAttributeEnum<T>::generateFortranInterfaceDeclaration(ostream& oss,const string& className) 
     189  { 
     190    CInterface::AttributeFortranInterfaceDeclaration<string>(oss, className, this->getName()); 
     191  } 
     192 
     193  template <typename T> 
     194  void CAttributeEnum<T>::generateFortranInterfaceGetDeclaration_(ostream& oss,const string& className) 
     195  { 
     196    CInterface::AttributeFortranInterfaceGetDeclaration<string>(oss, className, this->getName()+"_"); 
     197  } 
     198 
     199  template <typename T> 
     200  void CAttributeEnum<T>::generateFortranInterfaceGetBody_(ostream& oss,const string& className) 
     201  { 
     202    CInterface::AttributeFortranInterfaceGetBody<string>(oss, className, this->getName()); 
     203  } 
     204 
     205  template <typename T> 
     206  void CAttributeEnum<T>::generateFortranInterfaceGetDeclaration(ostream& oss,const string& className) 
     207  { 
     208    CInterface::AttributeFortranInterfaceGetDeclaration<string>(oss, className, this->getName()); 
     209  } 
    211210} // namespace xios 
    212211 
    213212#endif // __XIOS_ATTRIBUTE_ENUM_IMPL_HPP__ 
    214  
Note: See TracChangeset for help on using the changeset viewer.