Ignore:
Timestamp:
07/26/22 15:26:52 (23 months ago)
Author:
jderouillat
Message:

Set the code structure to compute the hash value of an element based on its attributs, use for now before writing an element in a file

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS3/trunk/src/attribute_map.cpp

    r2146 r2386  
    269269      } 
    270270 
     271      /*! 
     272        Compute the hash value of current attribute map excluding some attributs. 
     273        \param [in] excludedAttrs attribute to be excluded from hash computation 
     274      */ 
     275      int CAttributeMap::computeGlobalAttributesHash(const vector<StdString>& excludedAttrs) 
     276      { 
     277         int attrs_hash( 0 ); 
     278         typedef std::pair<StdString, CAttribute*> StdStrAttPair; 
     279 
     280         SuperClassMap::const_iterator it = this->begin(), end = this->end(); 
     281         for (; it != end; it++) 
     282         { 
     283            const StdStrAttPair& el = *it; 
     284            if ( std::find( excludedAttrs.begin(), excludedAttrs.end(), el.first ) == excludedAttrs.end() ) 
     285            { 
     286              if (this->hasAttribute(el.first)) 
     287              { 
     288                if (!el.second->isEmpty()) 
     289                { 
     290                  attrs_hash += el.second->computeHash(); 
     291                } 
     292              } 
     293            } 
     294         } 
     295         return attrs_hash; 
     296      } 
     297   
    271298      //--------------------------------------------------------------- 
    272299/* 
Note: See TracChangeset for help on using the changeset viewer.