Salome HOME
CCAR: import_hook.py was too strict in ensure_list (ImportError raised)
[modules/kernel.git] / src / Container / SALOME_FileRef_i.cxx
index 7dfa311b9e857ecbc1e184741a694717db15e24c..93bf63be5f0798e6b2e299546f1b339fdb1a7f97 100644 (file)
@@ -1,35 +1,35 @@
-// Copyright (C) 2006  OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
-// 
-//  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 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 
-// 
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//  Copyright (C) 2007-2010  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
 //
+//  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 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
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
 //  File   : SALOME_FileRef_i.cxx
 //  Author : Paul RASCLE, EDF
 //  Module : SALOME
 //  $Header$
-
+//
 #include "SALOME_FileRef_i.hxx"
 #include "utilities.h"
-#include "OpUtil.hxx"
+#include "Basics_Utils.hxx"
 #include <string>
 
-using namespace std;
-
 //=============================================================================
 /*! 
  *  Default constructor, not for use
@@ -47,14 +47,18 @@ fileRef_i::fileRef_i()
 //=============================================================================
 
 fileRef_i::fileRef_i(Engines::Container_ptr container,
-                    const char* origFileName)
+                     const char* origFileName)
 {
   MESSAGE("fileRef_i::fileRef_i "<< origFileName);
   _container =  Engines::Container::_duplicate(container);
   _origFileName = origFileName;
-  _machine = GetHostname();
+  _machine = Kernel_Utils::GetHostname();
+#if defined(_DEBUG_) || defined(_DEBUG)
   int OK = addRef(_machine.c_str(), _origFileName.c_str());
   SCRUTE(OK);
+#else
+  addRef(_machine.c_str(), _origFileName.c_str());
+#endif
 }
 
 
@@ -121,11 +125,11 @@ Engines::Container_ptr fileRef_i::getContainer()
 //=============================================================================
 
 CORBA::Boolean fileRef_i::addRef(const char* machine,
-                                const char* fileName)
+                                 const char* fileName)
 {
   MESSAGE("fileRef_i::addRef " << machine << " " << fileName);
-  string theMachine = machine;
-  string theFileName = fileName;
+  std::string theMachine = machine;
+  std::string theFileName = fileName;
 
   if (theFileName[0] != '/')
     {
@@ -142,7 +146,7 @@ CORBA::Boolean fileRef_i::addRef(const char* machine,
   if (! _copies[theMachine].empty())
     {
       INFOS("there is already a copy on " << theMachine << " under the path "
-           <<  _copies[theMachine] << " new ref not added! ");
+            <<  _copies[theMachine] << " new ref not added! ");
       return 0;
     }
 
@@ -163,17 +167,17 @@ CORBA::Boolean fileRef_i::addRef(const char* machine,
 char* fileRef_i::getRef(const char* machine)
 {
   MESSAGE("fileRef_i::getRef "<< machine);
-  string theMachine = machine;
-  string theFileName = _copies[theMachine];
+  std::string theMachine = machine;
+  std::string theFileName = _copies[theMachine];
   if (_copies[theMachine].empty())
     {
       MESSAGE("no copy of " << _machine << _origFileName << " available on "
-             << theMachine);
+              << theMachine);
     }
   else
     {
       MESSAGE("a copy of " << _machine << _origFileName << "is available on "
-             << theMachine << _copies[theMachine]);
+              << theMachine << _copies[theMachine]);
     }
   return CORBA::string_dup(_copies[theMachine].c_str());
 }