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