Changeset 2603


Ignore:
Timestamp:
12/11/23 11:18:00 (5 months ago)
Author:
jderouillat
Message:

Replace the childList (not updated) usage by a childMap usage to get a Context from a string

Location:
XIOS3/trunk/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • XIOS3/trunk/src/group_template.hpp

    r1875 r2603  
    3737         /// Accesseurs /// 
    3838         const xios_map<StdString,Group*>& getGroupMap(void) const; 
    39          const vector<Child*>& getChildList(void) const; 
     39         const xios_map<StdString,Child*>& getChildMap(void) const; 
    4040 
    4141         void getAllChildren(vector<Child*> & allc) const; 
  • XIOS3/trunk/src/group_template_impl.hpp

    r1875 r2603  
    229229 
    230230   template <class U, class V, class W> 
    231       const std::vector<U*>& 
    232          CGroupTemplate<U, V, W>::getChildList(void) const 
    233    {  
    234       return (this->childList);  
     231      const xios_map<StdString, U*>& 
     232         CGroupTemplate<U, V, W>::getChildMap(void) const 
     233   {  
     234      return (this->childMap);  
    235235   } 
    236236 
  • XIOS3/trunk/src/interface/c/iccontext.cpp

    r2121 r2603  
    3838      CTimer::get("XIOS").resume() ; 
    3939 
    40       std::vector<xios::CContext*> def_vector = 
    41             xios::CContext::getRoot()->getChildList(); 
    42  
    43       for (std::size_t i = 0; i < def_vector.size(); i++) 
     40      xios_map<StdString, CContext* > def_map = 
     41            xios::CContext::getRoot()->getChildMap(); 
     42       
     43      if (def_map.count(id)) 
    4444      { 
    45           if (def_vector[i]->getId().compare(id) == 0) 
    46           { 
    47             *_ret = def_vector[i]; 
    48              CTimer::get("XIOS").suspend() ; 
    49             return; 
    50           } 
     45        *_ret = def_map[id]; 
     46        CTimer::get("XIOS").suspend() ; 
     47        return; 
    5148      } 
    5249       CTimer::get("XIOS").suspend() ; 
     
    9390 
    9491      CTimer::get("XIOS").resume(); 
    95       std::vector<xios::CContext*> def_vector = 
    96             xios::CContext::getRoot()->getChildList(); 
     92 
     93      xios_map<StdString, CContext* > def_map = 
     94            xios::CContext::getRoot()->getChildMap(); 
    9795 
    9896      *_ret = false; 
    99       for (std::size_t i = 0; i < def_vector.size(); i++) 
     97      if (def_map.count(id)) 
    10098      { 
    101         if (def_vector[i]->getId().compare(id) == 0) 
    102         { 
    103           *_ret = true; 
    104           break; 
    105         } 
     99        *_ret = true; 
     100        return; 
    106101      } 
    107102      CTimer::get("XIOS").suspend(); 
  • XIOS3/trunk/src/node/context.cpp

    r2595 r2603  
    222222   { 
    223223      StdString currentContextId = CContext::getCurrent() -> getId(); 
    224       std::vector<CContext*> def_vector = 
    225          CContext::getRoot()->getChildList(); 
    226       std::vector<CContext*>::iterator 
    227          it = def_vector.begin(), end = def_vector.end(); 
     224      std::map<StdString,CContext*> def_map = 
     225         CContext::getRoot()->getChildMap(); 
     226      std::map<StdString,CContext*>::iterator 
     227         it = def_map.begin(), end = def_map.end(); 
    228228 
    229229      out << "<? xml version=\"1.0\" ?>" << std::endl; 
     
    232232      for (; it != end; it++) 
    233233      { 
    234          CContext* context = *it; 
     234         CContext* context = it->second; 
    235235         CContext::setCurrent(context->getId()); 
    236236         out << *context << std::endl; 
     
    813813        xios::MPI_Comm_dup(interComm, &interCommServer) ; 
    814814        CContextClient* client = CContextClient::getNew(this, intraCommClient, interCommClient); 
     815               
    815816        CContextServer* server = CContextServer::getNew(this, intraCommServer, interCommServer); 
    816817        client->setAssociatedServer(server) ; 
Note: See TracChangeset for help on using the changeset viewer.