Salome HOME
PR : merge branch V1_2c dans branche principale pour V1_3_0_b1
[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 <SALOMEconfig.h>
39 #include CORBA_SERVER_HEADER(SALOME_Component)
40 #include "NOTIFICATION.hxx"
41
42 class RegistryConnexion;
43
44 class Engines_Component_i: public virtual POA_Engines::Component,
45                            public virtual PortableServer::RefCountServantBase
46 {
47 public:
48   Engines_Component_i();
49   Engines_Component_i(CORBA::ORB_ptr orb,
50                       PortableServer::POA_ptr poa,
51                       PortableServer::ObjectId * contId, 
52                       const char *instanceName, 
53                       const char *interfaceName,
54                       bool notif = false);
55   // Consructeur pour composant parallele: ne pas faire appel au registry
56   Engines_Component_i(CORBA::ORB_ptr orb,
57                       PortableServer::POA_ptr poa,
58                       PortableServer::ObjectId * contId, 
59                       const char *instanceName, 
60                       const char *interfaceName,
61                       int flag,
62                       bool notif = false);
63
64   virtual ~Engines_Component_i();
65
66   char* instanceName();
67   char* interfaceName();
68
69   void destroy();
70   void ping();
71
72   Engines::Container_ptr GetContainerRef();
73   PortableServer::ObjectId * getId(); 
74
75   void beginService(const char *serviceName);
76   void endService(const char *serviceName);
77   void sendMessage(const char *event_type, const char *message);
78
79   void Names( const char * graphName , const char * nodeName ) ;
80   char * graphName() ;
81   char * nodeName() ;
82   bool Killer( int ThreadId , int signum );
83   bool Kill_impl();
84   bool Stop_impl();
85   bool Suspend_impl();
86   bool Resume_impl();
87   void SetCurCpu() ;
88   long CpuUsed() ;
89   long CpuUsed_impl() ;
90
91 protected:
92   string _instanceName ;
93   string _interfaceName ;
94   string _serviceName ;
95   string _graphName ;
96   string _nodeName ;
97   CORBA::ORB_ptr _orb;
98   PortableServer::POA_ptr _poa;
99   PortableServer::ObjectId * _id;
100   PortableServer::ObjectId * _contId;
101   Engines_Component_i * _thisObj ;
102   RegistryConnexion *_myConnexionToRegistry;
103   NOTIFICATION_Supplier* _notifSupplier;
104
105 private:
106   pthread_t _ThreadId ;
107   long      _StartUsed ;
108   long      _ThreadCpuUsed ;
109   bool      _Executed ;
110 };
111
112 #endif