Back to index

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