Salome HOME
Revert "Synchronize adm files"
[modules/kernel.git] / src / ParallelContainer / Parallel_Salome_file_i.cxx
index c6969d61d316cce5d193f3c044952615d203f1e7..c85827096b76641c0b4eca050f08cab16836cad4 100644 (file)
@@ -1,24 +1,25 @@
-//  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2014  CEA/DEN, EDF R&D, OPEN CASCADE
 //
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
 //
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
 //
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
 //
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
+
 //  File   : Parallel_Salome_file_i.cxx
 //  Author : AndrĂ© RIBES, EDF
 //  Module : SALOME
 #include "utilities.h"
 
 Parallel_Salome_file_i::Parallel_Salome_file_i(CORBA::ORB_ptr orb, 
-                                              const char * ior,
-                                              int rank) :
+                                               const char * ior,
+                                               int rank) :
   InterfaceParallel_impl(orb,ior,rank), 
   Engines::Salome_file_serv(orb,ior,rank),
+  Engines::Salome_file_base_serv(orb,ior,rank),
   Engines::fileTransfer_serv(orb,ior,rank),
-  Engines::Parallel_Salome_file_serv(orb,ior,rank)
+  Engines::Parallel_Salome_file_serv(orb,ior,rank),
+  Engines::fileTransfer_base_serv(orb,ior,rank),
+  SALOME::GenericObj_serv(orb,ior,rank),
+  SALOME::GenericObj_base_serv(orb,ior,rank),
+  Engines::Parallel_Salome_file_base_serv(orb,ior,rank)
 {
   CORBA::Object_ptr obj = _orb->string_to_object(ior);
   proxy = Engines::Parallel_Salome_file::_narrow(obj);
@@ -82,7 +88,7 @@ Parallel_Salome_file_i::connect(Engines::Salome_file_ptr source_Salome_file) {
     std::string file_name = begin->first;
     if (_fileManaged[file_name].node > 0 && getMyRank() == 0) {
       if (parallel_file == NULL)
-       parallel_file = Engines::PaCO_Parallel_Salome_file::PaCO_narrow(proxy, _orb);
+        parallel_file = Engines::PaCO_Parallel_Salome_file::PaCO_narrow(proxy, _orb);
       parallel_file->connect(source_Salome_file, _fileManaged[file_name].node);
     }
   }
@@ -90,7 +96,7 @@ Parallel_Salome_file_i::connect(Engines::Salome_file_ptr source_Salome_file) {
 
 void 
 Parallel_Salome_file_i::connectDistributedFile(const char * file_name,
-                                              Engines::Salome_file_ptr source_Salome_file) {
+                                               Engines::Salome_file_ptr source_Salome_file) {
   Salome_file_i::connectDistributedFile(file_name, source_Salome_file);
 
   // Test if the file is managed in an another node
@@ -105,7 +111,7 @@ Parallel_Salome_file_i::connectDistributedFile(const char * file_name,
 
 void 
 Parallel_Salome_file_i::setDistributedSourceFile(const char* file_name,
-                                                const char * source_file_name) {
+                                                 const char * source_file_name) {
   Salome_file_i::setDistributedSourceFile(file_name, source_file_name);
   // Test if the file is managed in an another node
   // If yes, node is updated
@@ -162,29 +168,29 @@ Parallel_Salome_file_i::recvFiles_node() {
       // Test if the file is local or distributed
       if (std::string(file_infos.type.in()) == "local")
       {
-       if (std::string(file_infos.status.in()) == "not_ok")
-         result = checkLocalFile(file_infos.file_name.in());
+        if (std::string(file_infos.status.in()) == "not_ok")
+          result = checkLocalFile(file_infos.file_name.in());
       }
       else
       {
-       if (std::string(file_infos.status.in()) == "not_ok") {
-         // 2 cases :
-         // Source file is a Salome_file
-         // Source file is a Parallel_Salome_file
-         PaCO::InterfaceManager_var interface_manager = 
-           PaCO::InterfaceManager::_narrow(_fileDistributedSource[file_infos.file_name.in()]);
-         if (CORBA::is_nil(interface_manager))
-           result = getDistributedFile(file_infos.file_name.in());
-         else
-           result = getParallelDistributedFile(file_infos.file_name.in());
-       }
+        if (std::string(file_infos.status.in()) == "not_ok") {
+          // 2 cases :
+          // Source file is a Salome_file
+          // Source file is a Parallel_Salome_file
+          PaCO::InterfaceManager_var interface_manager = 
+            PaCO::InterfaceManager::_narrow(_fileDistributedSource[file_infos.file_name.in()]);
+          if (CORBA::is_nil(interface_manager))
+            result = getDistributedFile(file_infos.file_name.in());
+          else
+            result = getParallelDistributedFile(file_infos.file_name.in());
+        }
       }
       // if the result is false
       // we add this file to files_not_ok
       if (!result) 
       {
-       files_not_ok.append(" ");
-       files_not_ok.append(file_infos.file_name.in());
+        files_not_ok.append(" ");
+        files_not_ok.append(file_infos.file_name.in());
       }
     }
   }
@@ -304,8 +310,8 @@ Parallel_Salome_file_i::setFileNode(const char* file_name, CORBA::Long node) {
 
     Engines::Container_ptr cont = parallel_file->updateFile(_fileManaged[fname], node);
     parallel_file->connectDistributedFile(fname.c_str(),
-                                         _fileDistributedSource[fname],
-                                         node);
+                                          _fileDistributedSource[fname],
+                                          node);
 
     // Update file infos with the new reference of the container
     _fileManaged[fname].container = Engines::Container::_duplicate(cont);