| The Gaudi Framework v28r2-patches (bc4ad17a)

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

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 <vector>
9 #include <typeinfo>
10
11 #include "GaudiKernel/Timing.h"
12 #include "GaudiKernel/ModuleInfo.h"
13
14 #ifdef __linux
15 # include <pthread.h>
16 #ifndef __APPLE__
17 # include <execinfo.h>
18 #endif
19 #endif
20
29 namespace System {
31 typedef void* ImageHandle;
33 typedef void* ProcessHandle;
35 typedef unsigned long (*EntryPoint)(const unsigned long iid, void** ppvObject);
37 typedef void* (*Creator)();
39 GAUDI_API unsigned long loadDynamicLib(const std::string& name, ImageHandle* handle);
41 GAUDI_API unsigned long unloadDynamicLib(ImageHandle handle);
43 GAUDI_API unsigned long getProcedureByName(ImageHandle handle, const std::string& name, EntryPoint* pFunction);
45 GAUDI_API unsigned long getProcedureByName(ImageHandle handle, const std::string& name, Creator* pFunction);
47 GAUDI_API unsigned long getLastError();
49 GAUDI_API const std::string getLastErrorString();
51 GAUDI_API const std::string getErrorString(unsigned long error);
53 GAUDI_API const std::string typeinfoName( const std::type_info& );
54 GAUDI_API const std::string typeinfoName( const char* );
56 GAUDI_API const std::string& hostName();
58 GAUDI_API const std::string& osName();
60 GAUDI_API const std::string& osVersion();
62 GAUDI_API const std::string& machineType();
64 // 0 = 80386 instruction set
65 // 1 or above = SSE (XMM) supported by CPU (not testing for O.S. support)
66 // 2 or above = SSE2
67 // 3 or above = SSE3
68 // 4 or above = Supplementary SSE3 (SSSE3)
69 // 5 or above = SSE4.1
70 // 6 or above = SSE4.2
71 // 7 or above = AVX supported by CPU and operating system
72 // 8 or above = AVX2
73 // 9 or above = AVX512F
74 GAUDI_API int instructionsetLevel();
76 GAUDI_API const std::string& accountName();
78 GAUDI_API long numCmdLineArgs();
80 GAUDI_API long argc();
82 GAUDI_API const std::vector<std::string> cmdLineArgs();
84 GAUDI_API char** argv();
86 GAUDI_API std::string getEnv(const char* var);
89 GAUDI_API bool getEnv(const char* var, std::string &value);
90 inline bool getEnv(const std::string &var, std::string &value) {
91 return getEnv(var.c_str(), value);
92 }
94 GAUDI_API std::vector<std::string> getEnv();
100 GAUDI_API int setEnv(const std::string &name, const std::string &value, int overwrite = 1);
102 GAUDI_API bool isEnvSet(const char* var);
103 #ifdef __linux
104 typedef pthread_t ThreadHandle;
107 inline ThreadHandle threadSelf() { return pthread_self(); }
108 #else
109 typedef void* ThreadHandle;
112 inline ThreadHandle threadSelf() { return (void*)0; }
113 #endif
114 GAUDI_API int backTrace(void** addresses, const int depth);
115 GAUDI_API bool backTrace(std::string& btrace, const int depth, const int offset = 0);
116 GAUDI_API bool getStackLevel(void* addresses, void*& addr, std::string& fnc, std::string& lib) ;
117
118 #if __GNUC__ >= 4
119 template <typename DESTPTR, typename SRCPTR>
132 inline DESTPTR FuncPtrCast(SRCPTR ptr) {
133 union {
134 SRCPTR src;
135 DESTPTR dst;
136 } p2p;
137 p2p.src = ptr;
138 return p2p.dst;
139 }
140 #endif
141 }
142 #endif // SYSTEM_SYSTEM_H
System::getEnv
GAUDI_API std::string getEnv(const char *var)
get a particular environment variable (returning "UNKNOWN" if not set)
Definition: System.cpp:550
System::argc
GAUDI_API long argc()
Number of arguments passed to the commandline (==numCmdLineArgs()); just to match argv call...
Definition: System.cpp:468
System::argv
GAUDI_API char ** argv()
char** command line arguments including executable name as arg[0]; You may not modify them! ...
Definition: System.cpp:535
Kernel.h
System::getErrorString
GAUDI_API const std::string getErrorString(unsigned long error)
Retrieve error code as string for a given error.
Definition: System.cpp:262
System::setEnv
GAUDI_API int setEnv(const std::string &name, const std::string &value, int overwrite=1)
Set an environment variables.
Definition: System.cpp:678
System::getLastError
GAUDI_API unsigned long getLastError()
Get last system known error.
Definition: System.cpp:246
System::getProcedureByName
GAUDI_API unsigned long getProcedureByName(ImageHandle handle, const std::string &name, EntryPoint *pFunction)
Get a specific function defined in the DLL.
Definition: System.cpp:191
gaudiComponentHelp.name
name
Definition: gaudiComponentHelp.py:28
System::getStackLevel
GAUDI_API bool getStackLevel(void *addresses, void *&addr, std::string &fnc, std::string &lib)
System::typeinfoName
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:299
System::instructionsetLevel
GAUDI_API int instructionsetLevel()
Instruction Set "Level".
Definition: System.cpp:434
System
Note: OS specific details for environment resolution.
Definition: Debugger.h:19
System::ThreadHandle
void * ThreadHandle
A Thread handle.
Definition: System.h:110
System::accountName
GAUDI_API const std::string & accountName()
User login name.
Definition: System.cpp:444
ModuleInfo.h
System::ImageHandle
void * ImageHandle
Definition of an image handle.
Definition: ModuleInfo.h:30
System::backTrace
GAUDI_API int backTrace(void **addresses, const int depth)
System::EntryPoint
unsigned long(* EntryPoint)(const unsigned long iid, void **ppvObject)
Definition of the "generic" DLL entry point function.
Definition: System.h:35
std::type_info
std::string
STL class.
System::numCmdLineArgs
GAUDI_API long numCmdLineArgs()
Number of arguments passed to the commandline.
Definition: System.cpp:463
System::osName
GAUDI_API const std::string & osName()
OS name.
Definition: System.cpp:377
System::unloadDynamicLib
GAUDI_API unsigned long unloadDynamicLib(ImageHandle handle)
unload dynamic link library
Definition: System.cpp:165
System::isEnvSet
GAUDI_API bool isEnvSet(const char *var)
Check if an environment variable is set or not.
Definition: System.cpp:570
Timing.h
ReadAndWriteWhiteBoard.dst
dst
Definition: ReadAndWriteWhiteBoard.py:17
System::hostName
GAUDI_API const std::string & hostName()
Host name.
Definition: System.cpp:371
std::vector< std::string >
System::threadSelf
ThreadHandle threadSelf()
thread handle "accessor"
Definition: System.h:112
std::string::c_str
T c_str(T...args)
System::cmdLineArgs
GAUDI_API const std::vector< std::string > cmdLineArgs()
Command line arguments including executable name as arg[0] as vector of strings.
Definition: System.cpp:473
System::osVersion
GAUDI_API const std::string & osVersion()
OS version.
Definition: System.cpp:394
System::getLastErrorString
GAUDI_API const std::string getLastErrorString()
Get last system error as string.
Definition: System.cpp:256
System::machineType
GAUDI_API const std::string & machineType()
Machine type.
Definition: System.cpp:415
System::Creator
void *(* Creator)()
Definition of the "generic" DLL entry point function.
Definition: System.h:37
GAUDI_API
#define GAUDI_API
Definition: Kernel.h:107
System::ProcessHandle
void * ProcessHandle
Definition of the process handle.
Definition: ModuleInfo.h:32
System::loadDynamicLib
GAUDI_API unsigned long loadDynamicLib(const std::string &name, ImageHandle *handle)
Load dynamic link library.
Definition: System.cpp:126