Ignore:
Timestamp:
10/01/21 10:40:31 (3 years ago)
Author:
jderouillat
Message:

Move context cleaning in xios_finalize (for clients) and when servers have finished their work

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/object_template_impl.hpp

    r2241 r2243  
    6868      return (CObjectTemplate<T>::AllVectObj[contextId]); 
    6969   } 
    70    template <class T> 
    71       std::vector<std::shared_ptr<T> > * 
    72          CObjectTemplate<T>::GetAllVectobjectPtr(const StdString & contextId) 
    73    { 
    74       return &(CObjectTemplate<T>::AllVectObj[contextId]); 
    75    } 
    76  
    77   template <class T> 
    78       xios_map<StdString, xios_map<StdString, std::shared_ptr<T> > >* 
    79          CObjectTemplate<T>::GetAllMapobject() 
    80    { 
    81       return &(CObjectTemplate<T>::AllMapObj); 
     70   
     71   template <class T> 
     72      void CObjectTemplate<T>::cleanStaticDataStructure(void) 
     73   { 
     74     xios_map<StdString, xios_map<StdString, std::shared_ptr<T> > >* allMap = &(CObjectTemplate<T>::AllMapObj); 
     75      for(auto it = allMap->begin(); it != allMap->end(); ++it) 
     76      { 
     77        for(auto it2 = it->second.begin(); it2 != it->second.end(); ++it2) 
     78        { 
     79          std::shared_ptr<T> todel = it2->second; 
     80          todel.reset(); 
     81        } 
     82        it->second.clear(); 
     83 
     84        std::vector<std::shared_ptr<T> >* allVect = &(CObjectTemplate<T>::AllVectObj[it->first]); 
     85        for(auto it = allVect->begin(); it != allVect->end(); ++it) 
     86        { 
     87          it->reset(); 
     88        } 
     89        allVect->clear(); 
     90      } 
     91      allMap->clear(); 
    8292   } 
    8393 
Note: See TracChangeset for help on using the changeset viewer.