Salome HOME
PR: mergefrom_PAL_OCC_21Oct04
[modules/kernel.git] / src / Container / SALOME_Component_i.hxx
1 //  SALOME Container : implementation of container and engine for Kernel
2 //
3 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
5 // 
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. 
10 // 
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. 
15 // 
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 
19 // 
20 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
21 //
22 //
23 //
24 //  File   : SALOME_Component_i.hxx
25 //  Author : Paul RASCLE, EDF - MARC TAJCHMAN, CEA
26 //  Module : SALOME
27 //  $Header$
28
29 #ifndef _SALOME_COMPONENT_I_HXX_
30 #define _SALOME_COMPONENT_I_HXX_
31
32 #include <iostream>
33 #include <signal.h>
34 #include <stdlib.h>
35 #include <unistd.h>
36 #include <sys/types.h>
37 #include <string>
38 #include <map>
39 #include <SALOMEconfig.h>
40 #include CORBA_SERVER_HEADER(SALOME_Component)
41 #include "NOTIFICATION.hxx"
42
43 class RegistryConnexion;
44
45 class Engines_Component_i: public virtual POA_Engines::Component,
46                            public virtual PortableServer::RefCountServantBase
47 {
48 public:
49   Engines_Component_i();
50   Engines_Component_i(CORBA::ORB_ptr orb,
51                       PortableServer::POA_ptr poa,
52                       PortableServer::ObjectId * contId, 
53                       const char *instanceName, 
54                       const char *interfaceName,
55                       bool notif = false);
56   // Consructeur pour composant parallele: ne pas faire appel au registry
57   Engines_Component_i(CORBA::ORB_ptr orb,
58                       PortableServer::POA_ptr poa,
59                       PortableServer::ObjectId * contId, 
60                       const char *instanceName, 
61                       const char *interfaceName,
62                       int flag,
63                       bool notif = false);
64
65   virtual ~Engines_Component_i();
66
67   char* instanceName();
68   char* interfaceName();
69
70   void destroy();
71   void ping();
72
73   Engines::Container_ptr GetContainerRef();
74   PortableServer::ObjectId * getId(); 
75
76   void setProperties(const Engines::FieldsDict& dico);
77   Engines::FieldsDict* getProperties();
78
79   void beginService(const char *serviceName);
80   void endService(const char *serviceName);
81   void sendMessage(const char *event_type, const char *message);
82
83   void Names( const char * graphName , const char * nodeName ) ;
84   char * graphName() ;
85   char * nodeName() ;
86   bool Killer( int ThreadId , int signum );
87   bool Kill_impl();
88   bool Stop_impl();
89   bool Suspend_impl();
90   bool Resume_impl();
91   void SetCurCpu() ;
92   long CpuUsed() ;
93   long CpuUsed_impl() ;
94
95 protected:
96   std::string _instanceName ;
97   std::string _interfaceName ;
98   std::string _serviceName ;
99   std::string _graphName ;
100   std::string _nodeName ;
101   CORBA::ORB_ptr _orb;
102   PortableServer::POA_ptr _poa;
103   PortableServer::ObjectId * _id;
104   PortableServer::ObjectId * _contId;
105   Engines_Component_i * _thisObj ;
106   RegistryConnexion *_myConnexionToRegistry;
107   NOTIFICATION_Supplier* _notifSupplier;
108   std::map<std::string,CORBA::Any>_fieldsDict;
109
110 private:
111   pthread_t _ThreadId ;
112   long      _StartUsed ;
113   long      _ThreadCpuUsed ;
114   bool      _Executed ;
115 };
116
117 #endif