Ignore:
Timestamp:
04/25/17 10:57:48 (7 years ago)
Author:
mhnguyen
Message:

Adding comparison operator between objects of XIOS.
Two objects of a same type are considered equal if they have same non-empty
attributes which have same values

+) Add operator== to class CArray
+) Add comparison operator to some basic attribute classes
+) Add operator== to date and duration (It seems that they don't serve much)

Test
+) On Curie
+) No Unit tests but test with transformation work (the next commit)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/trunk/src/type/enum_ref_impl.hpp

    r680 r1105  
    263263  } 
    264264                      
    265  
     265  template <typename T>  
     266  bool operator== (const CEnum_ref<T>& lhs, const typename T::t_enum& rhs) 
     267  { 
     268     if (lhs.isEmpty()) return false; 
     269     return (lhs.get() == rhs); 
     270  } 
     271 
     272  template <typename T>  
     273  bool operator== (const typename T::t_enum& lhs, const CEnum_ref<T>& rhs) 
     274  { 
     275    return rhs == lhs; 
     276  } 
     277 
     278  template <typename T>  
     279  bool operator== (const CEnum_ref<T>& lhs, const CEnum_ref<T>& rhs) 
     280  { 
     281    if ((lhs.isEmpty() && !rhs.isEmpty()) || (!lhs.isEmpty() && rhs.isEmpty())) return false; 
     282    if (lhs.isEmpty() && rhs.isEmpty()) return true; 
     283    return (lhs.get() == rhs.get()); 
     284  } 
    266285   
    267286  template <typename T> 
Note: See TracChangeset for help on using the changeset viewer.