]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
CCAR: fix a bug in KeepOnlyResourcesWithComponent (erase an item of a vector when...
authorcaremoli <caremoli>
Tue, 7 Sep 2010 13:07:02 +0000 (13:07 +0000)
committercaremoli <caremoli>
Tue, 7 Sep 2010 13:07:02 +0000 (13:07 +0000)
and allow GiveContainer to raise SALOME exceptions to catch them in YACS

idl/SALOME_ContainerManager.idl
src/ResourcesManager/ResourcesManager.cxx

index ed5c9796e4b85f6ec086eef3c14de97ab8247ff0..88385755bc8140ca37dc68bd74f8d65d6f13a88c 100644 (file)
@@ -216,7 +216,7 @@ interface ContainerManager
   //! GiveContainer - use mode parameter of ContainerParameters to configure
   //! how this method works
   //! Currently: get, start, getorstart, findorstart, find
-  Container GiveContainer(in ContainerParameters params);
+  Container GiveContainer(in ContainerParameters params) raises (SALOME::SALOME_Exception);
 
   //!  Shutdown all containers that have been launched by the container manager
   void ShutdownContainers();
index a265e9f251c37929872f3ad996c6ef681c61d145..868ac8cb8d22484ced7e6490350c975ef6c99267 100644 (file)
@@ -455,21 +455,21 @@ void
 ResourcesManager_cpp::KeepOnlyResourcesWithComponent(std::vector<std::string>& resources, 
                                                      const std::vector<std::string>& componentList)
 {
+  std::vector<std::string> kept_resources;
+
   std::vector<std::string>::iterator iter = resources.begin();
   for (; iter != resources.end(); iter++)
   {
-    MapOfParserResourcesType::const_iterator it = _resourcesList.find(*iter);
-    const std::vector<std::string>& mapOfComponentsOfCurrentHost = (*it).second.ComponentsList;
+    const std::vector<std::string>& mapOfComponentsOfCurrentHost = _resourcesList[*iter].ComponentsList;
 
     bool erasedHost = false;
     if( mapOfComponentsOfCurrentHost.size() > 0 )
     {
       for(unsigned int i=0; i<componentList.size(); i++)
       {
-        const char* compoi = componentList[i].c_str();
         std::vector<std::string>::const_iterator itt = find(mapOfComponentsOfCurrentHost.begin(),
-                                                  mapOfComponentsOfCurrentHost.end(),
-                                                  compoi);
+                                                            mapOfComponentsOfCurrentHost.end(),
+                                                            componentList[i]);
         if (itt == mapOfComponentsOfCurrentHost.end())
         {
           erasedHost = true;
@@ -477,9 +477,10 @@ ResourcesManager_cpp::KeepOnlyResourcesWithComponent(std::vector<std::string>& r
         }
       }
     }
-    if(erasedHost)
-      resources.erase(iter);
+    if(!erasedHost)
+      kept_resources.push_back(*iter);
   }
+  resources=kept_resources;
 }