Changeset 1117
- Timestamp:
- 05/04/17 15:14:37 (8 years ago)
- Location:
- XIOS/trunk/src
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/trunk/src/attribute_map.cpp
r1112 r1117 122 122 Compare two attribute maps 123 123 \param [in] another attribute map to compare 124 \param [in] excludedAttrs attribute to be excluded from comparasion 124 125 \return true if these two maps have same attributes whose value are identical 125 126 */ 126 bool CAttributeMap::isEqual(const CAttributeMap& another )127 bool CAttributeMap::isEqual(const CAttributeMap& another, const vector<StdString>& excludedAttrs) 127 128 { 128 129 SuperClassMap::const_iterator itb = another.begin(), ite = another.end(), it; 129 130 for (it = itb; it !=ite; ++it) 130 131 { 131 if ((*it).first.compare(StdString("id")) != 0 && (*it).first.compare(StdString("src")) != 0) 132 bool excluded = false; 133 for (int idx = 0; idx < excludedAttrs.size(); ++idx) 132 134 { 133 if (this->hasAttribute(it->first)) 134 { 135 if (!((*it).second->isEqual(*(*this)[it->first]))) 136 return false; 135 if (0 == (*it).first.compare(excludedAttrs[idx])) 136 { 137 excluded = true; 138 break; 139 } 140 } 141 142 if (!excluded) 143 { 144 if ((*it).first.compare(StdString("id")) != 0 && (*it).first.compare(StdString("src")) != 0) 145 { 146 if (this->hasAttribute(it->first)) 147 { 148 if (!((*it).second->isEqual(*(*this)[it->first]))) 149 { 150 return false; 151 } 152 } 153 else 154 return false; 137 155 } 138 else139 return false;140 156 } 141 157 } -
XIOS/trunk/src/attribute_map.hpp
r1105 r1117 15 15 \class CAttributeMap 16 16 This class represents the set of attributes which an object can have. 17 Each attribute in the set is represented by an unique id. 17 18 */ 18 19 … … 39 40 40 41 void clearAttribute(const StdString& key); 41 bool isEqual(const CAttributeMap& another );42 bool isEqual(const CAttributeMap& another, const vector<StdString>& excludedAttrs); 42 43 43 44 /// Destructeur /// -
XIOS/trunk/src/attribute_template.hpp
r1112 r1117 16 16 { 17 17 /// ////////////////////// Déclarations ////////////////////// /// 18 /*! 19 \class CAttributeTemplate 20 The class implements attribute of some basic types 21 */ 18 22 template <class T> 19 23 class CAttributeTemplate : public CAttribute, public CType<T> … … 54 58 bool hasInheritedValue(void) const; 55 59 56 bool isEqual (const CAttributeTemplate& attr );60 bool isEqual_(const CAttributeTemplate& attr ); 57 61 bool isEqual(const CAttribute& attr ); 58 62 59 63 /// Destructeur /// 60 64 virtual ~CAttributeTemplate(void) { } -
XIOS/trunk/src/attribute_template_impl.hpp
r1112 r1117 145 145 { 146 146 const CAttributeTemplate<T>& tmp = dynamic_cast<const CAttributeTemplate<T>& >(attr); 147 this->isEqual(tmp); 148 149 } 150 151 template <class T> 152 bool CAttributeTemplate<T>::isEqual(const CAttributeTemplate& attr) 147 return this->isEqual_(tmp); 148 } 149 150 template <class T> 151 bool CAttributeTemplate<T>::isEqual_(const CAttributeTemplate& attr) 153 152 { 154 153 if ((!this->hasInheritedValue() && !attr.hasInheritedValue())) -
XIOS/trunk/src/node/axis.cpp
r1106 r1117 986 986 bool CAxis::isEqual(CAxis* obj) 987 987 { 988 bool objEqual = SuperClass::isEqual(obj); 988 vector<StdString> excludedAttr; 989 excludedAttr.push_back("axis_ref"); 990 991 bool objEqual = SuperClass::isEqual(obj, excludedAttr); 989 992 if (!objEqual) return objEqual; 990 993 -
XIOS/trunk/src/node/domain.cpp
r1106 r1117 2247 2247 bool CDomain::isEqual(CDomain* obj) 2248 2248 { 2249 bool objEqual = SuperClass::isEqual(obj); 2249 vector<StdString> excludedAttr; 2250 excludedAttr.push_back("domain_ref"); 2251 bool objEqual = SuperClass::isEqual(obj, excludedAttr); 2250 2252 if (!objEqual) return objEqual; 2251 2253 -
XIOS/trunk/src/node/scalar.cpp
r1106 r1117 74 74 bool CScalar::isEqual(CScalar* obj) 75 75 { 76 bool objEqual = SuperClass::isEqual(obj); 76 vector<StdString> excludedAttr; 77 excludedAttr.push_back("scalar_ref"); 78 bool objEqual = SuperClass::isEqual(obj, excludedAttr); 77 79 if (!objEqual) return objEqual; 78 80 -
XIOS/trunk/src/object_template.hpp
r1105 r1117 61 61 static bool dispatchEvent(CEventServer& event) ; 62 62 63 bool isEqual(const string& id );64 bool isEqual(T* obj );63 bool isEqual(const string& id, const vector<StdString>& excludedAttrs); 64 bool isEqual(T* obj, const vector<StdString>& excludedAttrs); 65 65 66 66 /// Accesseur statique /// -
XIOS/trunk/src/object_template_impl.hpp
r1105 r1117 140 140 */ 141 141 template <class T> 142 bool CObjectTemplate<T>::isEqual(const string& id )142 bool CObjectTemplate<T>::isEqual(const string& id, const vector<StdString>& excludedAttrs) 143 143 { 144 144 T* obj = CObjectTemplate<T>::get(id); 145 return this->isEqual(obj );146 } 147 148 template <class T> 149 bool CObjectTemplate<T>::isEqual(T* obj )145 return this->isEqual(obj, excludedAttrs); 146 } 147 148 template <class T> 149 bool CObjectTemplate<T>::isEqual(T* obj, const vector<StdString>& excludedAttrs) 150 150 { 151 151 152 152 CAttributeMap& attrMapThis = *this; 153 153 CAttributeMap& attrMapObj = *obj; 154 return (attrMapThis.isEqual(attrMapObj ));154 return (attrMapThis.isEqual(attrMapObj, excludedAttrs)); 155 155 } 156 156
Note: See TracChangeset
for help on using the changeset viewer.