SALOME documentation central

src/Utils/Utils_Identity.hxx

00001 //  Copyright (C) 2007-2008  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 //  SALOME Utils : general SALOME's definitions and tools
00023 //  File   : Utils_Identity.hxx
00024 //  Author : Pascale NOYRET, EDF
00025 //  Module : SALOME
00026 //  $Header$
00027 //
00028 # if !defined(  __IDENTITE_H__ )
00029 # define __IDENTITE_H__
00030 
00031 #include "SALOME_Utils.hxx"
00032 
00033 extern "C"
00034 {
00035 # include <stdlib.h>
00036 # include <time.h>
00037 #ifndef WIN32
00038 # include <unistd.h>
00039 # include <sys/utsname.h>
00040 #else
00041 # include <windows.h>
00042 #endif
00043 }
00044 
00045 class UTILS_EXPORT Identity
00046 {
00047 
00048 protected :
00049      const char* const   _name ;
00050      const char* const   _adip; // Internet address
00051 
00052 #ifndef WIN32
00053         const struct utsname    _hostid;        
00054      const pid_t         _pid ;
00055      const uid_t         _uid ;
00056 #else
00057      const char* const       _hostid;
00058      const DWORD         _pid ;
00059      const PSID          _uid ;
00060 #endif    
00061         const char* const     _pwname ;
00062      const char* const   _dir ;
00063      const time_t        _start;
00064      const char* const   _cstart ;
00065 
00066 private :
00067      Identity( void );
00068      Identity( const Identity &monid );
00069 
00070 public :
00071      Identity(const char *name);
00072      ~Identity();
00073      friend std::ostream & operator<< ( std::ostream& os , const Identity& monid );
00074 
00075 #ifndef WIN32
00076      const pid_t&           pid(void) const;
00077         const struct utsname& hostid(void) const;
00078      const uid_t&        uid(void) const;
00079 #else
00080      const DWORD&           pid(void) const;
00081         const char* const       hostid(void) const;
00082      const PSID&         uid(void) const;
00083 #endif
00084 
00085      const char* const   name( void ) const;
00086      const char* const   adip(void) const;
00087      const char* const   pwname(void) const;
00088      const time_t&       start(void) const;
00089      const char* const   rep (void) const;
00090 
00091      const char*         host_char(void ) const;
00092      const char*         start_char(void) const;
00093 
00094 } ;
00095 # endif        /* # if !defined(  __IDENTITE_H__ ) */