Salome HOME
Compilation under Windows: add missing header
[modules/kernel.git] / src / ParallelContainer / SALOME_ParallelComponent_i.hxx
index 21886497061249a858d46d3014418801c0c62dcd..13c4593ad5bead07fb6efd464c6d90d884504cf7 100644 (file)
@@ -1,35 +1,37 @@
-//  SALOME_ParallelComponent : implementation of container and engine for Parallel Kernel
+// Copyright (C) 2007-2021  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, 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.
 //
-//  Copyright (C) 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+// 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
+//
+
+//  SALOME_ParallelComponent : implementation of container and engine for Parallel Kernel
 //  File   : SALOME_ParallelComponent_i.hxx
-//  Author : André RIBES, EDF
+//  Author : Andr RIBES, EDF
 //  Author : Paul RASCLE, EDF - MARC TAJCHMAN, CEA
-
+//
 #ifndef _SALOME_PARALLEL_COMPONENT_I_HXX_
 #define _SALOME_PARALLEL_COMPONENT_I_HXX_
 
 #include <iostream>
 #include <signal.h>
 #include <stdlib.h>
-#ifndef WNT
+#ifndef WIN32
 #include <unistd.h>
 #endif
 #include <sys/types.h>
@@ -37,7 +39,7 @@
 #include <map>
 #include <SALOMEconfig.h>
 
-#include "SALOME_ComponentPaCO_Engines_Parallel_Component_server.h"
+#include "SALOME_PACOExtensionPaCO_Engines_Parallel_Component_server.hxx"
 
 #include "NOTIFICATION.hxx"
 #include "RegistryConnexion.hxx"
 
 class Engines_Parallel_Container_i;
 
-#if defined CONTAINER_EXPORTS
-#if defined WIN32
-#define CONTAINER_EXPORT __declspec( dllexport )
+#ifdef WIN32
+# if defined CONTAINER_EXPORTS || defined SalomeParallelContainer_EXPORTS
+#  define CONTAINER_EXPORT __declspec( dllexport )
+# else
+#  define CONTAINER_EXPORT __declspec( dllimport )
+# endif
 #else
-#define CONTAINER_EXPORT
-#endif
-#else
-#if defined WNT
-#define CONTAINER_EXPORT __declspec( dllimport )
-#else
-#define CONTAINER_EXPORT
-#endif
+# define CONTAINER_EXPORT
 #endif
 
 class CONTAINER_EXPORT Engines_Parallel_Component_i: 
@@ -64,13 +62,13 @@ class CONTAINER_EXPORT Engines_Parallel_Component_i:
   public virtual PortableServer::RefCountServantBase
 {
 public:
-  Engines_Parallel_Component_i(CORBA::ORB_ptr orb, char * ior, int rank);
   Engines_Parallel_Component_i(CORBA::ORB_ptr orb, char * ior, int rank,
-                              PortableServer::POA_ptr poa,
-                              PortableServer::ObjectId * contId, 
-                              const char *instanceName, 
-                              const char *interfaceName,
-                              bool notif = false);
+                               PortableServer::POA_ptr poa,
+                               PortableServer::ObjectId * contId, 
+                               const char *instanceName, 
+                               const char *interfaceName,
+                               bool notif = false,
+                               bool regist = true);
 
   virtual ~Engines_Parallel_Component_i();
 
@@ -82,7 +80,6 @@ public:
   void ping();
   void destroy();
 
-  CORBA::Long getStudyId();
   Engines::Container_ptr GetContainerRef();
 
   void setProperties(const Engines::FieldsDict& dico);
@@ -95,33 +92,35 @@ public:
   bool Resume_impl();
   CORBA::Long CpuUsed_impl() ;
 
- virtual Engines::TMPFile* DumpPython(CORBA::Object_ptr theStudy,
-                                     CORBA::Boolean isPublished,
-                                     CORBA::Boolean& isValidScript);
+ virtual Engines::TMPFile* DumpPython(CORBA::Boolean isPublished,
+                                      CORBA::Boolean isMultiFile,
+                                      CORBA::Boolean& isValidScript);
 
  // CORBA operations for Salome_file
  virtual Engines::Salome_file_ptr getInputFileToService(const char* service_name, 
-                                                       const char* Salome_file_name);
+                                                        const char* Salome_file_name);
  virtual Engines::Salome_file_ptr getOutputFileToService(const char* service_name, 
-                                                        const char* Salome_file_name);
+                                                         const char* Salome_file_name);
 
  virtual void checkInputFilesToService(const char* service_name);
  virtual Engines::Salome_file_ptr setInputFileToService(const char* service_name, 
-                                                       const char* Salome_file_name);
+                                                        const char* Salome_file_name);
 
  virtual void checkOutputFilesToService(const char* service_name);
  virtual Engines::Salome_file_ptr setOutputFileToService(const char* service_name, 
-                                                        const char* Salome_file_name);
+                                                         const char* Salome_file_name);
 
  void send_parallel_proxy_object(CORBA::Object_ptr proxy_ref);
 
+  // Object information
+  virtual bool hasObjectInfo() { return false; }
+  virtual char* getObjectInfo(const char* entry) { return ""; }
+
   // --- local C++ methods
 
   PortableServer::ObjectId * getId(); 
   Engines_Parallel_Container_i *GetContainerPtr();
 
-  bool setStudyId(CORBA::Long studyId);
-  static bool isMultiStudy();
   static bool isMultiInstance();
   static std::string GetDynLibraryName(const char *componentName);
 
@@ -133,24 +132,23 @@ public:
   bool Killer( pthread_t ThreadId , int signum );
   void SetCurCpu() ;
   long CpuUsed() ;
+  void CancelThread();
 
   void wait_parallel_object_proxy();
   char * get_parallel_proxy_object();
 
   virtual void configureSalome_file(std::string service_name,
-                                   std::string file_port_name,
-                                   Engines::Parallel_Salome_file_proxy_impl * file);
+                                    std::string file_port_name,
+                                    Engines::Parallel_Salome_file_proxy_impl * file);
 
 protected:
-  int _studyId; // -1: not initialised; 0: multiStudy; >0: study
-  static bool _isMultiStudy;
   static bool _isMultiInstance;
 
   std::string _instanceName ;
   std::string _interfaceName ;
 
-  CORBA::ORB_ptr _orb;
-  PortableServer::POA_ptr _poa;
+  CORBA::ORB_var _orb;
+  PortableServer::POA_var _poa;
   PortableServer::ObjectId * _id;
   PortableServer::ObjectId * _contId;
   Engines_Parallel_Component_i * _thisObj ;
@@ -191,7 +189,7 @@ protected:
   char * _proxy;
 
 private:
-#ifndef WNT
+#ifndef WIN32
   pthread_t _ThreadId ;
 #else
   pthread_t* _ThreadId ;
@@ -199,6 +197,8 @@ private:
   long      _StartUsed ;
   long      _ThreadCpuUsed ;
   bool      _Executed ;
+  bool      _CanceledThread ;
+  bool      _destroyed;
 };
 
 #endif