Salome HOME
sources v1.2
[modules/kernel.git] / src / Registry / RegistryService.hxx
1 //  SALOME Registry : Registry server implementation
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   : RegistryService.hxx
25 //  Author : Pascale NOYRET - Antoine YESSAYAN, EDF
26 //  Module : SALOME
27 //  $Header$
28
29 # ifndef __RegistryService_h__
30 # define __RegistryService_h__
31
32 #include <SALOMEconfig.h>
33 #include CORBA_SERVER_HEADER(SALOME_Registry)
34
35 # include <map>
36
37
38 class RegistryService : public POA_Registry::Components  //, public PortableServer::RefCountServantBase
39 {
40
41 public :
42         enum Status { UNDEF=-1 , TERMINATED=0 , RUNNING=1 } ;
43
44         class client_infos
45         {
46         protected :
47                 const char* const       _ior;
48                 const char* const       _name;
49                 const long              _pid ;
50                 const char* const       _machine;
51                 const char* const       _adip;
52                 const long              _uid;
53                 const char* const       _pwname;
54                 const long              _ts_start ;
55                 const long              _difftime;
56                 const char* const       _cdir ;
57                       long              _ts_hello ;
58                       long              _ts_end ;
59                       Status            _status;
60         public :
61                 friend class RegistryService ;
62
63                 client_infos( const Registry::Infos &infos );
64                 ~client_infos();
65         }; 
66
67
68
69 public :
70         RegistryService(void);
71         virtual ~RegistryService(void);
72
73         void ping();
74         virtual CORBA::ULong add (const Registry::Infos & infos);
75         virtual CORBA::ULong size ( void );
76         virtual void remove( const CORBA::ULong id );
77         virtual void hello( const CORBA::ULong id );
78         virtual void end(void);
79
80         virtual Registry::AllInfos *getall(void);
81         virtual Registry::AllInfos *history(void);
82
83         void SessionName( const char *sessionName ) ;
84
85
86 protected :
87
88         const char              *_SessionName ;
89         int                      _Compteur ;
90         map<int,client_infos *>  _reg ;
91         map<int,client_infos *>  _fin ;
92
93         Registry::AllInfos* makeseq(map<int,client_infos *> &mymap );
94
95 } ;
96
97 # endif