Version: 9.15.0
RegistryService.hxx
Go to the documentation of this file.
1 // Copyright (C) 2007-2025 CEA, EDF, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007 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, or (at your option) any later version.
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.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 
23 // SALOME Registry : Registry server implementation
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 "SALOME_Registry.hxx"
33 
34 #include <SALOMEconfig.h>
35 #include CORBA_SERVER_HEADER(SALOME_Registry)
36 
37 # include <map>
38 
39 #ifdef WIN32
40 #pragma warning(disable:4275) // Disable warning interface non dll
41 #pragma warning(disable:4251) // Warning DLL Interface ...
42 #endif
43 
44 class REGISTRY_EXPORT RegistryService : public POA_Registry::Components //, public PortableServer::RefCountServantBase
45 {
46 
47 public :
48  enum Status { UNDEF=-1 , TERMINATED=0 , RUNNING=1 } ;
49 
51  {
52  protected :
53  const char* const _ior;
54  const char* const _name;
55  const long _pid ;
56  const char* const _machine;
57  const char* const _adip;
58  const long _uid;
59  const char* const _pwname;
60  const long _ts_start ;
61  const long _difftime;
62  const char* const _cdir ;
63  long _ts_hello ;
64  long _ts_end ;
66  public :
67  friend class RegistryService ;
68 
69  client_infos( const Registry::Infos &infos );
70  ~client_infos();
71  };
72 
73 
74 
75 public :
76  RegistryService(void);
77  virtual ~RegistryService(void);
78 
79  void ping();
80  CORBA::Long getPID();
81  virtual CORBA::ULong add (const Registry::Infos & infos);
82  virtual CORBA::ULong size ( void );
83 #ifndef WIN32
84  virtual void remove( const CORBA::ULong id );
85  virtual void hello( const CORBA::ULong id );
86 #else
87  virtual void remove( CORBA::ULong id );
88  virtual void hello( CORBA::ULong id );
89 #endif
90  virtual void end(void);
91 
92  virtual Registry::AllInfos *getall(void);
93  virtual Registry::AllInfos *history(void);
94 
95  void SessionName( const char *sessionName ) ;
96 
97  void SetOrb( CORBA::ORB_ptr orb ) { _orb = CORBA::ORB::_duplicate(orb); return; }
98 
99  void Shutdown() { if(!CORBA::is_nil(_orb)) _orb->shutdown(0); }
100 
101 protected :
102 
103  CORBA::ORB_var _orb;
104  const char *_SessionName ;
105  int _Compteur ;
106  std::map<int,client_infos *> _reg ;
107  std::map<int,client_infos *> _fin ;
108 
109  Registry::AllInfos* makeseq(std::map<int,client_infos *> &mymap );
110 
111 } ;
112 
113 # endif
#define REGISTRY_EXPORT
Definition: SALOME_Registry.hxx:37
Definition: RegistryService.hxx:51
const char *const _pwname
Definition: RegistryService.hxx:59
long _ts_end
Definition: RegistryService.hxx:64
long _ts_hello
Definition: RegistryService.hxx:63
const long _pid
Definition: RegistryService.hxx:55
const char *const _name
Definition: RegistryService.hxx:54
const long _difftime
Definition: RegistryService.hxx:61
const long _ts_start
Definition: RegistryService.hxx:60
const char *const _ior
Definition: RegistryService.hxx:53
const char *const _adip
Definition: RegistryService.hxx:57
const char *const _cdir
Definition: RegistryService.hxx:62
Status _status
Definition: RegistryService.hxx:65
const long _uid
Definition: RegistryService.hxx:58
const char *const _machine
Definition: RegistryService.hxx:56
Definition: RegistryService.hxx:45
const char * _SessionName
Definition: RegistryService.hxx:104
void Shutdown()
Definition: RegistryService.hxx:99
virtual CORBA::ULong size(void)
Definition: RegistryService.cxx:82
std::map< int, client_infos * > _fin
Definition: RegistryService.hxx:107
virtual CORBA::ULong add(const Registry::Infos &infos)
Definition: RegistryService.cxx:89
virtual ~RegistryService(void)
Definition: RegistryService.cxx:55
virtual Registry::AllInfos * history(void)
Definition: RegistryService.cxx:156
Registry::AllInfos * makeseq(std::map< int, client_infos * > &mymap)
Definition: RegistryService.cxx:163
void SetOrb(CORBA::ORB_ptr orb)
Definition: RegistryService.hxx:97
Status
Definition: RegistryService.hxx:48
RegistryService(void)
Definition: RegistryService.cxx:49
virtual void hello(const CORBA::ULong id)
Definition: RegistryService.cxx:127
virtual void end(void)
Definition: RegistryService.cxx:141
virtual Registry::AllInfos * getall(void)
Definition: RegistryService.cxx:149
CORBA::Long getPID()
Definition: RegistryService.cxx:245
int _Compteur
Definition: RegistryService.hxx:105
std::map< int, client_infos * > _reg
Definition: RegistryService.hxx:106
CORBA::ORB_var _orb
Definition: RegistryService.hxx:103
void SessionName(const char *sessionName)
Definition: RegistryService.cxx:229
void ping()
Definition: RegistryService.cxx:236
sequence< Infos > AllInfos
a list of information
Definition: SALOME_Registry.idl:54
def remove(path)
Definition: pythonpath_reduction.py:25
orb
Definition: salome.py:122
a struct to collect information about servers (processes)
Definition: SALOME_Registry.idl:37