Back to index

salome-kernel  6.5.0
RegistryService.hxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License.
00010 //
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 
00023 //  SALOME Registry : Registry server implementation
00024 //  File   : RegistryService.hxx
00025 //  Author : Pascale NOYRET - Antoine YESSAYAN, EDF
00026 //  Module : SALOME
00027 //  $Header: /home/server/cvs/KERNEL/KERNEL_SRC/src/Registry/RegistryService.hxx,v 1.9.2.1.10.2.12.1 2012-04-12 14:05:19 vsr Exp $
00028 //
00029 # ifndef __RegistryService_h__
00030 # define __RegistryService_h__
00031 
00032 #include "SALOME_Registry.hxx"
00033 
00034 #include <SALOMEconfig.h>
00035 #include CORBA_SERVER_HEADER(SALOME_Registry)
00036 
00037 # include <map>
00038 
00039 #ifdef WNT
00040 #pragma warning(disable:4275) // Disable warning interface non dll
00041 #pragma warning(disable:4251) // Warning DLL Interface ...
00042 #endif
00043 
00044 class REGISTRY_EXPORT RegistryService : public POA_Registry::Components  //, public PortableServer::RefCountServantBase
00045 {
00046 
00047 public :
00048         enum Status { UNDEF=-1 , TERMINATED=0 , RUNNING=1 } ;
00049 
00050         class client_infos
00051         {
00052         protected :
00053                 const char* const       _ior;
00054                 const char* const       _name;
00055                 const long              _pid ;
00056                 const char* const       _machine;
00057                 const char* const       _adip;
00058                 const long              _uid;
00059                 const char* const       _pwname;
00060                 const long              _ts_start ;
00061                 const long              _difftime;
00062                 const char* const       _cdir ;
00063                       long              _ts_hello ;
00064                       long              _ts_end ;
00065                       Status            _status;
00066         public :
00067                 friend class RegistryService ;
00068 
00069                 client_infos( const Registry::Infos &infos );
00070                 ~client_infos();
00071         }; 
00072 
00073 
00074 
00075 public :
00076         RegistryService(void);
00077         virtual ~RegistryService(void);
00078 
00079         void ping();
00080         CORBA::Long getPID();
00081         virtual CORBA::ULong add (const Registry::Infos & infos);
00082         virtual CORBA::ULong size ( void );
00083 #ifndef WIN32
00084         virtual void remove( const CORBA::ULong id );
00085         virtual void hello( const CORBA::ULong id );
00086 #else
00087         virtual void remove( CORBA::ULong id );
00088         virtual void hello( CORBA::ULong id );
00089 #endif
00090         virtual void end(void);
00091 
00092         virtual Registry::AllInfos *getall(void);
00093         virtual Registry::AllInfos *history(void);
00094 
00095         void SessionName( const char *sessionName ) ;
00096 
00097         void SetOrb( CORBA::ORB_ptr orb ) { _orb = CORBA::ORB::_duplicate(orb); return; }
00098 
00099         void Shutdown() { if(!CORBA::is_nil(_orb)) _orb->shutdown(0); }
00100 
00101 protected :
00102 
00103         CORBA::ORB_var _orb;
00104         const char              *_SessionName ;
00105         int                      _Compteur ;
00106         std::map<int,client_infos *>     _reg ;
00107         std::map<int,client_infos *>     _fin ;
00108 
00109         Registry::AllInfos* makeseq(std::map<int,client_infos *> &mymap );
00110 
00111 } ;
00112 
00113 # endif