00001 // ***************************************************************************** 00002 // ***************************************************************************** 00003 // oaCommonProcInfo.h 00004 // 00005 // This file contains the definitions of the ProcInfo class. 00006 // 00007 // ProcInfo 00008 // A utility class captures the process information and other functions 00009 // like retrieve the current process information. 00010 // 00011 // ***************************************************************************** 00012 // Except as specified in the OpenAccess terms of use of Cadence or Silicon 00013 // Integration Initiative, this material may not be copied, modified, 00014 // re-published, uploaded, executed, or distributed in any way, in any medium, 00015 // in whole or in part, without prior written permission from Cadence. 00016 // 00017 // Copyright 2002-2005 Cadence Design Systems, Inc. 00018 // All Rights Reserved. 00019 // 00020 // $Author: icftcm $ 00021 // $Revision: #1 $ 00022 // $Date: 2010/08/09 $ 00023 // $State: Exp $ 00024 // ***************************************************************************** 00025 // ***************************************************************************** 00026 00027 00028 00029 #if !defined(oaCommonProcInfo_P) 00030 #define oaCommonProcInfo_P 00031 00032 00033 00034 // ***************************************************************************** 00035 // Nested includes 00036 // ***************************************************************************** 00037 #include "oaCommonTypes.h" 00038 #include <string> 00039 #include <limits.h> 00040 00041 00042 00043 // ***************************************************************************** 00044 // Declare and define types in the oaCommon namespace 00045 // ***************************************************************************** 00046 BEGIN_OA_COMMON_NAMESPACE 00047 00048 00049 00050 #if defined(OA_WINDOWS) 00051 #define oacMaxProcHostNameLen _MAX_PATH 00052 #else 00053 #define oacMaxProcHostNameLen PATH_MAX 00054 #endif 00055 00056 #define oacSmallBufferSize 512 00057 00058 00059 // ***************************************************************************** 00060 // ProcInfo 00061 // ***************************************************************************** 00062 class OA_COMMON_DLL_API ProcInfo { 00063 public: 00064 ProcInfo(); 00065 ProcInfo(const ProcInfo &obj); 00066 00067 const char *getHostName() const; 00068 bool isHostNameEmpty() const; 00069 unsigned long getId() const; 00070 time_t getTime() const; 00071 00072 00073 void getHostNamePIDString(std::string &str, 00074 const char *seperator) const; 00075 00076 void setThisProcess(); 00077 00078 void setHostName(const char *value); 00079 void setId(unsigned long value); 00080 void setTime(time_t value); 00081 00082 void set(const std::string &hostNameIn, 00083 unsigned long idIn); 00084 void set(const std::string &str, 00085 const char *seperator); 00086 00087 bool operator==(const ProcInfo &obj) const; 00088 00089 private: 00090 char hostName[oacMaxProcHostNameLen]; 00091 unsigned long id; 00092 time_t procTime; 00093 }; 00094 00095 00096 00097 END_OA_COMMON_NAMESPACE 00098 00099 #endif
Copyright © 2002 - 2010 Cadence Design Systems, Inc.
All Rights Reserved.