The Gaudi Framework  v30r3 (a5ef0a68)
System.h
Go to the documentation of this file.
1 #ifndef GAUDIKERNEL_SYSTEM_H
2 #define GAUDIKERNEL_SYSTEM_H
3 
4 // Framework include files
5 #include "GaudiKernel/Kernel.h"
6 // STL include files
7 #include <string>
8 #include <typeinfo>
9 #include <vector>
10 
11 #include "GaudiKernel/ModuleInfo.h"
12 #include "GaudiKernel/Timing.h"
13 
14 #ifdef __linux
15 #include <pthread.h>
16 #ifndef __APPLE__
17 #include <execinfo.h>
18 #endif
19 #endif
20 
29 namespace System
30 {
32  typedef void* ImageHandle;
34  typedef void* ProcessHandle;
36  typedef unsigned long ( *EntryPoint )( const unsigned long iid, void** ppvObject );
38  typedef void* ( *Creator )();
40  GAUDI_API unsigned long loadDynamicLib( const std::string& name, ImageHandle* handle );
42  GAUDI_API unsigned long unloadDynamicLib( ImageHandle handle );
44  GAUDI_API unsigned long getProcedureByName( ImageHandle handle, const std::string& name, EntryPoint* pFunction );
46  GAUDI_API unsigned long getProcedureByName( ImageHandle handle, const std::string& name, Creator* pFunction );
48  GAUDI_API unsigned long getLastError();
52  GAUDI_API const std::string getErrorString( unsigned long error );
55  GAUDI_API const std::string typeinfoName( const char* );
59  GAUDI_API const std::string& osName();
65  // 0 = 80386 instruction set
66  // 1 or above = SSE (XMM) supported by CPU (not testing for O.S. support)
67  // 2 or above = SSE2
68  // 3 or above = SSE3
69  // 4 or above = Supplementary SSE3 (SSSE3)
70  // 5 or above = SSE4.1
71  // 6 or above = SSE4.2
72  // 7 or above = AVX supported by CPU and operating system
73  // 8 or above = AVX2
74  // 9 or above = AVX512F
81  GAUDI_API long argc();
85  GAUDI_API char** argv();
87  GAUDI_API std::string getEnv( const char* var );
90  GAUDI_API bool getEnv( const char* var, std::string& value );
91  inline bool getEnv( const std::string& var, std::string& value ) { return getEnv( var.c_str(), value ); }
99  GAUDI_API int setEnv( const std::string& name, const std::string& value, int overwrite = 1 );
101  GAUDI_API bool isEnvSet( const char* var );
102 #ifdef __linux
103  typedef pthread_t ThreadHandle;
106  inline ThreadHandle threadSelf() { return pthread_self(); }
107 #else
108  typedef void* ThreadHandle;
111  inline ThreadHandle threadSelf() { return (void*)0; }
112 #endif
113  GAUDI_API int backTrace( void** addresses, const int depth );
114  GAUDI_API bool backTrace( std::string& btrace, const int depth, const int offset = 0 );
115  GAUDI_API bool getStackLevel( void* addresses, void*& addr, std::string& fnc, std::string& lib );
116 }
117 #endif // SYSTEM_SYSTEM_H
GAUDI_API std::string getEnv(const char *var)
get a particular environment variable (returning "UNKNOWN" if not set)
Definition: System.cpp:411
GAUDI_API long argc()
Number of arguments passed to the commandline (==numCmdLineArgs()); just to match argv call...
Definition: System.cpp:381
GAUDI_API char ** argv()
char** command line arguments including executable name as arg[0]; You may not modify them! ...
Definition: System.cpp:391
GAUDI_API const std::string getErrorString(unsigned long error)
Retrieve error code as string for a given error.
Definition: System.cpp:301
GAUDI_API int setEnv(const std::string &name, const std::string &value, int overwrite=1)
Set an environment variables.
Definition: System.cpp:534
GAUDI_API unsigned long getLastError()
Get last system known error.
Definition: System.cpp:283
GAUDI_API unsigned long getProcedureByName(ImageHandle handle, const std::string &name, EntryPoint *pFunction)
Get a specific function defined in the DLL.
Definition: System.cpp:230
GAUDI_API bool getStackLevel(void *addresses, void *&addr, std::string &fnc, std::string &lib)
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:332
GAUDI_API int instructionsetLevel()
Instruction Set "Level".
Definition: System.cpp:364
Note: OS specific details for environment resolution.
Definition: Debugger.h:19
void * ThreadHandle
A Thread handle.
Definition: System.h:109
GAUDI_API const std::string & accountName()
User login name.
Definition: System.cpp:371
void * ImageHandle
Definition of an image handle.
Definition: ModuleInfo.h:31
GAUDI_API int backTrace(void **addresses, const int depth)
STL class.
GAUDI_API long numCmdLineArgs()
Number of arguments passed to the commandline.
Definition: System.cpp:378
GAUDI_API const std::string & osName()
OS name.
Definition: System.cpp:344
GAUDI_API unsigned long unloadDynamicLib(ImageHandle handle)
unload dynamic link library
Definition: System.cpp:204
GAUDI_API bool isEnvSet(const char *var)
Check if an environment variable is set or not.
Definition: System.cpp:433
GAUDI_API const std::string & hostName()
Host name.
Definition: System.cpp:337
void *(* Creator)()
Definition of the "generic" DLL entry point function.
Definition: System.h:38
ThreadHandle threadSelf()
thread handle "accessor"
Definition: System.h:111
T c_str(T...args)
GAUDI_API const std::vector< std::string > cmdLineArgs()
Command line arguments including executable name as arg[0] as vector of strings.
Definition: System.cpp:384
GAUDI_API const std::string & osVersion()
OS version.
Definition: System.cpp:351
GAUDI_API const std::string getLastErrorString()
Get last system error as string.
Definition: System.cpp:294
GAUDI_API const std::string & machineType()
Machine type.
Definition: System.cpp:358
#define GAUDI_API
Definition: Kernel.h:104
void * ProcessHandle
Definition of the process handle.
Definition: ModuleInfo.h:33
GAUDI_API unsigned long loadDynamicLib(const std::string &name, ImageHandle *handle)
Load dynamic link library.
Definition: System.cpp:154
unsigned long(* EntryPoint)(const unsigned long iid, void **ppvObject)
Definition of the "generic" DLL entry point function.
Definition: System.h:36