]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
Adding RemoveResource
authorribes <ribes>
Thu, 21 Jan 2010 17:02:39 +0000 (17:02 +0000)
committerribes <ribes>
Thu, 21 Jan 2010 17:02:39 +0000 (17:02 +0000)
idl/SALOME_ContainerManager.idl
src/ResourcesManager/ResourcesManager.cxx
src/ResourcesManager/SALOME_ResourcesManager.cxx
src/ResourcesManager/SALOME_ResourcesManager.hxx

index 917323813bd697fd1f46d5c9c9591ac7a4a1c808..f586036287d2e0e6e09b07d3a9b763ea8601b0e1 100644 (file)
@@ -250,6 +250,15 @@ interface ResourcesManager
     */
   void AddResource(in ResourceDefinition new_resource, in boolean write, in string xml_file) 
     raises (SALOME::SALOME_Exception);
+
+  //! Remove a new resource to the resource_manager
+  /*!
+      write -> true, resource manager will write a new xml_file
+      xml_file -> could be empty, in this case if write is true, resource manager will write
+      the resource in its first ResourceCatalog file
+    */
+  void RemoveResource(in string resource_name, in boolean write, in string xml_file) 
+    raises (SALOME::SALOME_Exception);
 };
 
 
index 6a100a4c6bf34290a9d7294f855c1493d11a58c7..51669d669397e44c7b63f62d2d4d9fca5db04442 100644 (file)
@@ -277,7 +277,11 @@ ResourcesManager_cpp::AddResourceInCatalog(const ParserResourcesType & new_resou
 
 void ResourcesManager_cpp::DeleteResourceInCatalog(const char * name)
 {
-  _resourcesList.erase(name);
+  MapOfParserResourcesType_it it = _resourcesList.find(name);
+  if (it != _resourcesList.end())
+    _resourcesList.erase(name);
+  else
+    RES_INFOS("You try to delete a resource that does not exist... : " << name);
 }
 
 //=============================================================================
index d39882b960329014ae085dd782572183d21c95b9..8d60271429a5e098b4ba83400fc2742aaf258919 100644 (file)
@@ -369,6 +369,19 @@ SALOME_ResourcesManager::AddResource(const Engines::ResourceDefinition& new_reso
   }
 }
 
+void 
+SALOME_ResourcesManager::RemoveResource(const char * resource_name,
+                                       CORBA::Boolean write,
+                                       const char * xml_file)
+{
+  _rm.DeleteResourceInCatalog(resource_name);
+  if (write)
+  {
+    _rm.WriteInXmlFile(std::string(xml_file));
+    _rm.ParseXmlFiles();
+  }
+}
+
 std::string 
 SALOME_ResourcesManager::getMachineFile(std::string hostname, 
                                         CORBA::Long nb_procs, 
index 7573cdfb10174eaa8c44b6ce804aead4d06c35a0..80927c20738caea72722d1282f9a3d4caa7fff0c 100644 (file)
@@ -72,6 +72,10 @@ class SALOMERESOURCESMANAGER_EXPORT SALOME_ResourcesManager:
                     CORBA::Boolean write,
                     const char * xml_file);
 
+    void RemoveResource(const char * resource_name,
+                       CORBA::Boolean write,
+                       const char * xml_file);
+
     // Cpp Methods
     void Shutdown();
     ResourcesManager_cpp *GetImpl() { return &_rm; }