X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FParallelContainer%2FSALOME_ParallelContainer_i.hxx;h=3fdd4f8299c488df71d997e37d4c415821cb233b;hb=d8edd4804d9e6513a17c497c1a30326d4ba0d677;hp=34d980fdb1d343cc7028ff41611cd5849ab59a98;hpb=f14439749926cca959747bb79fda10529520bd0b;p=modules%2Fkernel.git diff --git a/src/ParallelContainer/SALOME_ParallelContainer_i.hxx b/src/ParallelContainer/SALOME_ParallelContainer_i.hxx index 34d980fdb..3fdd4f829 100644 --- a/src/ParallelContainer/SALOME_ParallelContainer_i.hxx +++ b/src/ParallelContainer/SALOME_ParallelContainer_i.hxx @@ -1,39 +1,39 @@ -// SALOME_ParallelContainer : implementation of container and engine for Parallel Kernel +// Copyright (C) 2007-2021 CEA/DEN, EDF R&D, OPEN CASCADE // -// 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 +// 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. +// +// 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_ParallelContainer_i.hxx -// Author : André RIBES, EDF -// Author : Paul RASCLE, EDF - MARC TAJCHMAN, CEA +// Author : Andr� RIBES, EDF #ifndef _SALOME_PARALLEL_CONTAINER_I_HXX_ #define _SALOME_PARALLEL_CONTAINER_I_HXX_ #include -#include "SALOME_ComponentPaCO_Engines_Container_server.h" +#include "SALOME_PACOExtensionPaCO_Engines_PACO_Container_server.hxx" +#include "SALOME_ParallelGlobalProcessVar_i.hxx" #include #include #include -#ifndef WNT +#ifndef WIN32 #include #endif #include @@ -43,54 +43,61 @@ class SALOME_NamingService; - -#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_Container_i: - /* public virtual POA_Engines::Container, */ - public Engines::Container_serv, - public virtual PortableServer::RefCountServantBase + virtual public Engines::PACO_Container_serv, + virtual public ParallelGlobalProcessVar_i, + virtual public PortableServer::RefCountServantBase { public: - Engines_Parallel_Container_i(CORBA::ORB_ptr orb, char * ior, int rank); - Engines_Parallel_Container_i(CORBA::ORB_ptr orb, char * ior, int rank, - PortableServer::POA_ptr poa, - char * containerName , - int argc, char* argv[], - bool activAndRegist = true, - bool isServantAloneInProcess = true); + Engines_Parallel_Container_i(CORBA::ORB_ptr orb, + char * ior, + int rank, + PortableServer::POA_ptr poa, + std::string containerName , + bool isServantAloneInProcess = true); + virtual ~Engines_Parallel_Container_i(); // --- CORBA methods - virtual bool load_component_Library(const char* componentName); + virtual bool load_component_Library(const char* componentName, CORBA::String_out reason); + + virtual Engines::EngineComponent_ptr + create_component_instance( const char* componentName); - virtual Engines::Component_ptr - create_component_instance( const char* componentName, - CORBA::Long studyId); // 0 for multiStudy + virtual Engines::EngineComponent_ptr + create_component_instance_env( const char* componentName, + const Engines::FieldsDict& env, + CORBA::String_out reason); - Engines::Component_ptr - find_component_instance( const char* registeredName, - CORBA::Long studyId); // 0 for multiStudy + virtual char* + create_python_service_instance(const char* CompName, + CORBA::String_out reason); - Engines::Component_ptr + Engines::EngineComponent_ptr + find_component_instance( const char* registeredName); + + Engines::EngineComponent_ptr load_impl(const char* nameToRegister, - const char* componentName); + const char* componentName); + + void + create_paco_component_node_instance(const char* componentName, + const char* proxy_containerName); + void updateInstanceNumber(); - void remove_impl(Engines::Component_ptr component_i); + void remove_impl(Engines::EngineComponent_ptr component_i); void finalize_removal(); virtual void ping(); @@ -102,66 +109,67 @@ public: virtual void Shutdown(); char* getHostName(); CORBA::Long getPID(); + //! Kill current container bool Kill_impl() ; // --- local C++ methods + Engines::EngineComponent_ptr + find_or_create_instance(std::string genericRegisterName); - Engines::Component_ptr - find_or_create_instance( std::string genericRegisterName, - std::string componentLibraryName); + Engines::EngineComponent_ptr + createCPPInstance(std::string genericRegisterName, + void *handle); - Engines::Component_ptr - createInstance(std::string genericRegisterName, - void *handle, - int studyId); - - Engines::Component_ptr - createParallelInstance(std::string genericRegisterName, - void *handle, - int studyId); + Engines::EngineComponent_ptr + createPythonInstance(std::string genericRegisterName); static bool isPythonContainer(const char* ContainerName); static void decInstanceCnt(std::string genericRegisterName); // --- needed for parallel components, Numerical Platon - - int getArgc() { return _argc; } - char **getArgv() { return _argv; } - void set_id(PortableServer::ObjectId * id) { _id = id;} Engines::fileRef_ptr createFileRef(const char* origFileName); Engines::fileTransfer_ptr getFileTransfer(); virtual Engines::Salome_file_ptr createSalome_file(const char* origFileName); + void copyFile(Engines::Container_ptr container, const char* remoteFile, const char* localFile); + Engines::PyNode_ptr createPyNode(const char* nodeName, const char* code); + Engines::PyNode_ptr getDefaultPyNode(const char *nodeName); + Engines::PyScriptNode_ptr createPyScriptNode(const char* nodeName, const char* code); + Engines::PyScriptNode_ptr getDefaultPyScriptNode(const char *nodeName); protected: - static std::map _cntInstances_map; - static std::map _library_map; // library names, loaded - static std::map _toRemove_map;// library names to remove - static omni_mutex _numInstanceMutex ; // lib and instance protection - - bool _isSupervContainer; - - SALOME_NamingService *_NS ; + SALOME_NamingService *_NS; + std::string _hostname; std::string _library_path; std::string _containerName; std::string _logfilename; CORBA::ORB_var _orb; PortableServer::POA_var _poa; - PortableServer::ObjectId * _id ; - int _numInstance ; - std::map _listInstances_map; - std::map _fileRef_map; - std::map _Salome_file_map; + PortableServer::ObjectId * _id; + int _numInstance; + CORBA::Long _pid; + bool _isServantAloneInProcess; Engines::fileTransfer_var _fileTransfer; - int _argc ; - char** _argv ; - long _pid; - bool _isServantAloneInProcess; + typedef std::map _listInstances_map_t; + typedef std::map _fileRef_map_t; + typedef std::map _Salome_file_map_t; + _listInstances_map_t _listInstances_map; + _fileRef_map_t _fileRef_map; + _Salome_file_map_t _Salome_file_map; + + // Cette map contient les references vers les diff�rentes + // instances d'objets parall�les. + std::map _par_obj_inst_map; + + typedef PortableServer::ObjectId * (*FACTORY_FUNCTION) (CORBA::ORB_ptr, char *, int, + PortableServer::POA_ptr, + PortableServer::ObjectId *, + const char *, + const char *); }; #endif -