1 // Copyright (C) 2007-2020 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 // SALOME Container : implementation of container and engine for Kernel
24 // File : SALOME_Component_i.hxx
25 // Author : Paul RASCLE, EDF - MARC TAJCHMAN, CEA
29 #ifndef _SALOME_COMPONENT_I_HXX_
30 #define _SALOME_COMPONENT_I_HXX_
32 #include <SALOMEconfig.h>
34 #include "SALOME_Container.hxx"
42 #include <sys/types.h>
45 #include CORBA_SERVER_HEADER(SALOME_Component)
46 #include "NOTIFICATION.hxx"
47 #include "Salome_file_i.hxx"
49 class RegistryConnexion;
50 class Engines_Container_i;
52 class CONTAINER_EXPORT Engines_Component_i:
53 public virtual POA_Engines::EngineComponent,
54 public virtual PortableServer::ServantBase
57 Engines_Component_i();
58 Engines_Component_i(CORBA::ORB_ptr orb,
59 PortableServer::POA_ptr poa,
60 PortableServer::ObjectId * contId,
61 const char *instanceName,
62 const char *interfaceName,
65 //Constructor for standalone component
66 Engines_Component_i(CORBA::ORB_ptr orb,
67 PortableServer::POA_ptr poa,
68 Engines::Container_ptr container,
69 const char *instanceName,
70 const char *interfaceName,
74 virtual ~Engines_Component_i();
79 char* interfaceName();
84 Engines::Container_ptr GetContainerRef();
86 void setProperties(const Engines::FieldsDict& dico);
87 Engines::FieldsDict* getProperties();
89 virtual void SetOption(const char*, const char*);
90 virtual char* GetOption(const char*);
92 void Names( const char * graphName , const char * nodeName ) ;
97 CORBA::Long CpuUsed_impl() ;
99 virtual Engines::TMPFile* DumpPython(CORBA::Boolean isPublished,
100 CORBA::Boolean isMultiFile,
101 CORBA::Boolean& isValidScript);
103 // CORBA operations for Salome_file
104 virtual Engines::Salome_file_ptr getInputFileToService(const char* service_name,
105 const char* Salome_file_name);
106 virtual Engines::Salome_file_ptr getOutputFileToService(const char* service_name,
107 const char* Salome_file_name);
109 virtual void checkInputFilesToService(const char* service_name);
110 virtual Engines::Salome_file_ptr setInputFileToService(const char* service_name,
111 const char* Salome_file_name);
113 virtual void checkOutputFilesToService(const char* service_name);
114 virtual Engines::Salome_file_ptr setOutputFileToService(const char* service_name,
115 const char* Salome_file_name);
117 // Object information
118 virtual bool hasObjectInfo() { return false; }
119 virtual char* getObjectInfo(const char* entry) { return CORBA::string_dup(""); }
121 // Version information
122 virtual char* getVersion();
124 // --- local C++ methods
126 PortableServer::ObjectId * getId();
127 Engines_Container_i *GetContainerPtr();
128 std::string getContainerName();
129 void setContainerName();
131 static bool isMultiInstance();
132 static std::string GetDynLibraryName(const char *componentName);
134 void beginService(const char *serviceName);
135 void endService(const char *serviceName);
136 void sendMessage(const char *event_type, const char *message);
139 bool Killer( pthread_t ThreadId , int signum );
142 void CancelThread() ;
144 virtual void configureSalome_file(std::string service_name,
145 std::string file_port_name,
146 Salome_file_i * file);
149 static bool _isMultiInstance;
151 std::string _instanceName ;
152 std::string _interfaceName ;
153 std::string _containerName ;
156 PortableServer::POA_var _poa;
157 PortableServer::ObjectId * _id;
158 PortableServer::ObjectId * _contId;
159 Engines::Container_var _container;
160 Engines_Component_i * _thisObj ;
161 RegistryConnexion *_myConnexionToRegistry;
162 NOTIFICATION_Supplier* _notifSupplier;
163 std::map<std::string,CORBA::Any>_fieldsDict;
165 // Map Salome_file_name to Salome_file*
166 typedef std::map<std::string, Salome_file_i*> _t_Salome_file_map;
167 // Map Service_name to _Salome_file_map
168 typedef std::map<std::string, Engines_Component_i::_t_Salome_file_map*> _t_Service_file_map;
170 _t_Service_file_map _Input_Service_file_map;
171 _t_Service_file_map _Output_Service_file_map;
172 _t_Service_file_map::iterator _Service_file_map_it;
173 _t_Salome_file_map::iterator _Salome_file_map_it;
175 std::string _serviceName ;
176 std::string _graphName ;
177 std::string _nodeName ;
181 pthread_t _ThreadId ;
183 pthread_t* _ThreadId ;
186 long _ThreadCpuUsed ;
188 bool _CanceledThread ;