Changeset 1158 for XIOS/dev/dev_olga/src/attribute_map.cpp
- Timestamp:
- 06/06/17 17:58:16 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/dev_olga/src/attribute_map.cpp
r1009 r1158 16 16 ///-------------------------------------------------------------- 17 17 18 /*! 19 Clear all attributes of an object and reset them to empty state 20 */ 18 21 void CAttributeMap::clearAllAttributes(void) 19 22 { … … 29 32 //--------------------------------------------------------------- 30 33 34 /* 35 Clear an attribute and reset its value 36 \param[in] key id of attribute 37 */ 31 38 void CAttributeMap::clearAttribute(const StdString& key) 32 39 { … … 36 43 //--------------------------------------------------------------- 37 44 45 /*! 46 Set an attribute of certain id with a value 47 \param[in] key id of the attribute 48 \param[in] attr value of attribute 49 */ 38 50 void CAttributeMap::setAttribute(const StdString& key, CAttribute* const attr) 39 51 { … … 50 62 //--------------------------------------------------------------- 51 63 64 /*! 65 Subscript operator. Return attribute with a specific id 66 */ 52 67 CAttribute* CAttributeMap::operator[](const StdString& key) 53 68 { … … 103 118 } 104 119 } 120 121 /*! 122 Compare two attribute maps 123 \param [in] another attribute map to compare 124 \param [in] excludedAttrs attribute to be excluded from comparasion 125 \return true if these two maps have same attributes whose value are identical 126 */ 127 bool CAttributeMap::isEqual(const CAttributeMap& another, const vector<StdString>& excludedAttrs) 128 { 129 SuperClassMap::const_iterator itb = another.begin(), ite = another.end(), it; 130 for (it = itb; it !=ite; ++it) 131 { 132 bool excluded = false; 133 for (int idx = 0; idx < excludedAttrs.size(); ++idx) 134 { 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; 155 } 156 } 157 } 158 159 return true; 160 } 161 105 162 106 163 //--------------------------------------------------------------- … … 129 186 if (apply) 130 187 { 131 if (currentAtt->isEmpty() && !el.second->isEmpty())188 if (currentAtt->isEmpty() && currentAtt->canInherite() && !el.second->isEmpty()) 132 189 { 133 190 this->setAttribute(el.first, el.second); … … 139 196 } 140 197 198 /*! 199 Duplicate attribute map with a specific attribute map. 200 Copy all non-empty attribute of the current attribute map 201 \param [in] srcAttr attribute map which is copied from. 202 */ 141 203 void CAttributeMap::duplicateAttributes(const CAttributeMap* const srcAttr) 142 204 { … … 216 278 } 217 279 */ 280 218 281 void CAttributeMap::generateCInterface(ostream& oss, const string& className) 219 282 {
Note: See TracChangeset
for help on using the changeset viewer.