Salome HOME
Merge branch 'eap/23514'
[modules/kernel.git] / src / ParallelContainer / SALOME_ParallelContainer_i.cxx
index e90641db1adc290587818ad94b3757dc4a64ff8b..e4f1c1254cdc6b09863fb622a4d301742e9e269b 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2014  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2016  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
@@ -66,7 +66,7 @@ extern "C" {void SigIntHandler( int ) ; }
 
 //=============================================================================
 /*! 
- *  Construtor
+ *  Constructor
  */
 //=============================================================================
 
@@ -282,7 +282,7 @@ void Engines_Parallel_Container_i::Shutdown()
  *  \param componentName like COMPONENT
  *                          try to make a Python import of COMPONENT,
  *                          then a lib open of libCOMPONENTEngine.so
- *  \return true if dlopen successfull or already done, false otherwise
+ *  \return true if dlopen successful or already done, false otherwise
  */
 //=============================================================================
 
@@ -295,7 +295,11 @@ Engines_Parallel_Container_i::load_component_Library(const char* componentName,
   bool ret = false;
   std::string aCompName = componentName;
 #ifndef WIN32
+#ifdef __APPLE__
+  std::string impl_name = string ("lib") + aCompName + string("Engine.dylib");
+#else
   std::string impl_name = string ("lib") + aCompName + string("Engine.so");
+#endif
 #else
   std::string impl_name = aCompName + string("Engine.dll");
 #endif
@@ -321,7 +325,7 @@ Engines_Parallel_Container_i::load_component_Library(const char* componentName,
     MESSAGE("Try to load C++ component");
     void* handle;
 #ifndef WIN32
-    handle = dlopen( impl_name.c_str() , RTLD_LAZY ) ;
+    handle = dlopen( impl_name.c_str() , RTLD_LAZY | RTLD_GLOBAL ) ;
 #else
     handle = dlopen( impl_name.c_str() , 0 ) ;
 #endif
@@ -423,7 +427,11 @@ Engines_Parallel_Container_i::create_component_instance_env(const char*genericRe
 
   std::string aCompName = genericRegisterName;
 #ifndef WIN32
+#ifdef __APPLE__
+  std::string impl_name = string ("lib") + aCompName + string("Engine.dylib");
+#else
   std::string impl_name = string ("lib") + aCompName +string("Engine.so");
+#endif
 #else
   std::string impl_name = aCompName +string("Engine.dll");
 #endif
@@ -436,7 +444,7 @@ Engines_Parallel_Container_i::create_component_instance_env(const char*genericRe
   void* handle = _library_map[impl_name];
   if (handle)
     type_of_lib = "cpp";
-  if (_library_map.count(aCompName) != 0 and !handle)
+  if (_library_map.count(aCompName) != 0 && !handle)
     type_of_lib = "python";
   
   if (type_of_lib == "Not Loaded")
@@ -490,6 +498,14 @@ Engines::EngineComponent_ptr Engines_Parallel_Container_i::find_component_instan
   return anEngine._retn();  
 }
 
+char* Engines_Parallel_Container_i::create_python_service_instance(const char* CompName,
+                                                                  CORBA::String_out reason)
+{
+  // not implemented
+  reason=CORBA::string_dup("");
+  return CORBA::string_dup("");
+}
+
 //=============================================================================
 //! Find or create a new component instance
 /*! 
@@ -619,7 +635,7 @@ Engines_Parallel_Container_i::createFileRef(const char* origFileName)
 
   if (origName[0] != '/')
   {
-    INFOS("path of file to copy must be an absolute path begining with '/'");
+    INFOS("path of file to copy must be an absolute path beginning with '/'");
     return Engines::fileRef::_nil();
   }
 
@@ -741,7 +757,7 @@ Engines_Parallel_Container_i::find_or_create_instance(std::string genericRegiste
   }
   catch (...)
   {
-    INFOS( "Container_i::load_impl catched" ) ;
+    INFOS( "Container_i::load_impl caught" ) ;
   }
   return iobject._retn();
 }
@@ -875,7 +891,7 @@ Engines_Parallel_Container_i::createCPPInstance(std::string genericRegisterName,
     std::string component_registerName =
       _containerName + "/" + instanceName;
 
-    // --- Instanciate required CORBA object
+    // --- Instantiate required CORBA object
 
     PortableServer::ObjectId *id; //not owner, do not delete (nore use var)
     id = (Component_factory) ( _orb, _poa, _id, instanceName.c_str(),
@@ -910,7 +926,7 @@ Engines_Parallel_Container_i::createCPPInstance(std::string genericRegisterName,
   }
   catch (...)
   {
-    INFOS( "Container_i::createInstance exception catched" );
+    INFOS( "Container_i::createInstance exception caught" );
   }
   return iobject._retn();
 }
@@ -927,7 +943,11 @@ Engines_Parallel_Container_i::create_paco_component_node_instance(const char* co
   std::string _proxy_containerName = proxy_containerName;
 
 #ifndef WIN32
+#ifdef __APPLE__
+  string impl_name = string ("lib") + aCompName + string("Engine.dylib");
+#else
   string impl_name = string ("lib") + aCompName +string("Engine.so");
+#endif
 #else
   string impl_name = aCompName +string("Engine.dll");
 #endif
@@ -978,7 +998,7 @@ Engines_Parallel_Container_i::create_paco_component_node_instance(const char* co
     std::string instanceName = aCompName + "_inst_" + aNumI + "_work_node_" + aNumI2;
     std::string component_registerName = _containerName + "/" + instanceName;
 
-    // --- Instanciate work node
+    // --- Instantiate work node
     PortableServer::ObjectId *id ; //not owner, do not delete (nore use var)
     id = (Component_factory) (_orb, proxy_ior, getMyRank(), _poa, _id, instanceName.c_str(), componentName);
     CORBA::string_free(proxy_ior);
@@ -1001,10 +1021,10 @@ Engines_Parallel_Container_i::create_paco_component_node_instance(const char* co
   }
   catch (...)
   {
-    INFOS("Container_i::create_paco_component_node_instance exception catched");
+    INFOS("Container_i::create_paco_component_node_instance exception caught");
     SALOME::ExceptionStruct es;
     es.type = SALOME::INTERNAL_ERROR;
-    es.text = "Container_i::create_paco_component_node_instance exception catched";
+    es.text = "Container_i::create_paco_component_node_instance exception caught";
     throw SALOME::SALOME_Exception(es);
   }
 }
@@ -1127,7 +1147,7 @@ Engines_Parallel_Container_i::createPyNode(const char* nodeName, const char* cod
   return node._retn();
 }
 
-Engines::PyNode_ptr Engines_Parallel_Container_i::getDefaultPyNode()
+Engines::PyNode_ptr Engines_Parallel_Container_i::getDefaultPyNode(const char *nodeName)
 {
   INFOS("Python component not yet implemented");
   return Engines::PyNode::_nil();
@@ -1141,7 +1161,7 @@ Engines_Parallel_Container_i::createPyScriptNode(const char* nodeName, const cha
   return node._retn();
 }
 
-Engines::PyScriptNode_ptr Engines_Parallel_Container_i::getDefaultPyScriptNode()
+Engines::PyScriptNode_ptr Engines_Parallel_Container_i::getDefaultPyScriptNode(const char *nodeName)
 {
   INFOS("Python script node not yet implemented");
   return Engines::PyScriptNode::_nil();