Ignore:
Timestamp:
06/06/17 17:58:16 (7 years ago)
Author:
oabramkina
Message:

Two server levels: merging with trunk r1137.
There are bugs.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/dev_olga/src/attribute_map.cpp

    r1009 r1158  
    1616      ///-------------------------------------------------------------- 
    1717 
     18      /*! 
     19         Clear all attributes of an object and reset them to empty state 
     20      */ 
    1821      void CAttributeMap::clearAllAttributes(void) 
    1922      { 
     
    2932      //--------------------------------------------------------------- 
    3033 
     34      /* 
     35        Clear an attribute and reset its value 
     36        \param[in] key id of attribute 
     37      */ 
    3138      void CAttributeMap::clearAttribute(const StdString& key) 
    3239      { 
     
    3643      //--------------------------------------------------------------- 
    3744 
     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      */ 
    3850      void CAttributeMap::setAttribute(const StdString& key, CAttribute* const attr) 
    3951      { 
     
    5062      //--------------------------------------------------------------- 
    5163 
     64      /*! 
     65        Subscript operator. Return attribute with a specific id 
     66      */ 
    5267      CAttribute* CAttributeMap::operator[](const StdString& key) 
    5368      { 
     
    103118         } 
    104119      } 
     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 
    105162 
    106163      //--------------------------------------------------------------- 
     
    129186               if (apply) 
    130187               { 
    131                  if (currentAtt->isEmpty() && !el.second->isEmpty()) 
     188                 if (currentAtt->isEmpty() && currentAtt->canInherite() && !el.second->isEmpty()) 
    132189                 { 
    133190                    this->setAttribute(el.first, el.second); 
     
    139196      } 
    140197 
     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      */ 
    141203      void CAttributeMap::duplicateAttributes(const CAttributeMap* const srcAttr) 
    142204      { 
     
    216278      } 
    217279 */ 
     280       
    218281      void CAttributeMap::generateCInterface(ostream& oss, const string& className) 
    219282      { 
Note: See TracChangeset for help on using the changeset viewer.