00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef _SALOME_COMPONENT_I_HXX_
00030 #define _SALOME_COMPONENT_I_HXX_
00031
00032 #include <SALOMEconfig.h>
00033
00034 #include "SALOME_Container.hxx"
00035
00036 #include <iostream>
00037 #include <signal.h>
00038 #include <stdlib.h>
00039 #ifndef WIN32
00040 #include <unistd.h>
00041 #endif
00042 #include <sys/types.h>
00043 #include <string>
00044 #include <map>
00045 #include CORBA_SERVER_HEADER(SALOME_Component)
00046 #include "NOTIFICATION.hxx"
00047 #include "Salome_file_i.hxx"
00048
00049 class RegistryConnexion;
00050 class Engines_Container_i;
00051
00052 class CONTAINER_EXPORT Engines_Component_i:
00053 public virtual POA_Engines::EngineComponent,
00054 public virtual PortableServer::ServantBase
00055 {
00056 public:
00057 Engines_Component_i();
00058 Engines_Component_i(CORBA::ORB_ptr orb,
00059 PortableServer::POA_ptr poa,
00060 PortableServer::ObjectId * contId,
00061 const char *instanceName,
00062 const char *interfaceName,
00063 bool notif = false,
00064 bool regist = true);
00065
00066 Engines_Component_i(CORBA::ORB_ptr orb,
00067 PortableServer::POA_ptr poa,
00068 Engines::Container_ptr container,
00069 const char *instanceName,
00070 const char *interfaceName,
00071 bool notif = false,
00072 bool regist = true);
00073
00074 virtual ~Engines_Component_i();
00075
00076
00077
00078 char* instanceName();
00079 char* interfaceName();
00080
00081 void ping();
00082 void destroy();
00083
00084 CORBA::Long getStudyId();
00085 Engines::Container_ptr GetContainerRef();
00086
00087 void setProperties(const Engines::FieldsDict& dico);
00088 Engines::FieldsDict* getProperties();
00089
00090 void Names( const char * graphName , const char * nodeName ) ;
00091 bool Kill_impl();
00092 bool Stop_impl();
00093 bool Suspend_impl();
00094 bool Resume_impl();
00095 CORBA::Long CpuUsed_impl() ;
00096
00097 virtual Engines::TMPFile* DumpPython(CORBA::Object_ptr theStudy,
00098 CORBA::Boolean isPublished,
00099 CORBA::Boolean isMultiFile,
00100 CORBA::Boolean& isValidScript);
00101
00102
00103 virtual Engines::Salome_file_ptr getInputFileToService(const char* service_name,
00104 const char* Salome_file_name);
00105 virtual Engines::Salome_file_ptr getOutputFileToService(const char* service_name,
00106 const char* Salome_file_name);
00107
00108 virtual void checkInputFilesToService(const char* service_name);
00109 virtual Engines::Salome_file_ptr setInputFileToService(const char* service_name,
00110 const char* Salome_file_name);
00111
00112 virtual void checkOutputFilesToService(const char* service_name);
00113 virtual Engines::Salome_file_ptr setOutputFileToService(const char* service_name,
00114 const char* Salome_file_name);
00115
00116
00117 virtual bool hasObjectInfo() { return false; }
00118 virtual char* getObjectInfo(CORBA::Long studyId, const char* entry) { return CORBA::string_dup(""); }
00119
00120
00121
00122 PortableServer::ObjectId * getId();
00123 Engines_Container_i *GetContainerPtr();
00124 std::string getContainerName();
00125 void setContainerName();
00126
00127 virtual bool setStudyId(CORBA::Long studyId);
00128 static bool isMultiStudy();
00129 static bool isMultiInstance();
00130 static std::string GetDynLibraryName(const char *componentName);
00131
00132 void beginService(const char *serviceName);
00133 void endService(const char *serviceName);
00134 void sendMessage(const char *event_type, const char *message);
00135 char * graphName() ;
00136 char * nodeName() ;
00137 bool Killer( pthread_t ThreadId , int signum );
00138 void SetCurCpu() ;
00139 long CpuUsed() ;
00140 void CancelThread() ;
00141
00142 virtual void configureSalome_file(std::string service_name,
00143 std::string file_port_name,
00144 Salome_file_i * file);
00145
00146
00147 protected:
00148 int _studyId;
00149 static bool _isMultiStudy;
00150 static bool _isMultiInstance;
00151
00152 std::string _instanceName ;
00153 std::string _interfaceName ;
00154 std::string _containerName ;
00155
00156 CORBA::ORB_var _orb;
00157 PortableServer::POA_var _poa;
00158 PortableServer::ObjectId * _id;
00159 PortableServer::ObjectId * _contId;
00160 Engines::Container_var _container;
00161 Engines_Component_i * _thisObj ;
00162 RegistryConnexion *_myConnexionToRegistry;
00163 NOTIFICATION_Supplier* _notifSupplier;
00164 std::map<std::string,CORBA::Any>_fieldsDict;
00165
00166
00167 typedef std::map<std::string, Salome_file_i*> _t_Salome_file_map;
00168
00169 typedef std::map<std::string, Engines_Component_i::_t_Salome_file_map*> _t_Service_file_map;
00170
00171 _t_Service_file_map _Input_Service_file_map;
00172 _t_Service_file_map _Output_Service_file_map;
00173 _t_Service_file_map::iterator _Service_file_map_it;
00174 _t_Salome_file_map::iterator _Salome_file_map_it;
00175
00176 std::string _serviceName ;
00177 std::string _graphName ;
00178 std::string _nodeName ;
00179
00180 private:
00181 #ifndef WIN32
00182 pthread_t _ThreadId ;
00183 #else
00184 pthread_t* _ThreadId ;
00185 #endif
00186 long _StartUsed ;
00187 long _ThreadCpuUsed ;
00188 bool _Executed ;
00189 bool _CanceledThread ;
00190 };
00191
00192 #endif