| # Gaudi Framework, version v23r0 |

Home |  | Generated: Mon Jan 30 2012

# System.h

Go to the documentation of this file.

    00001 // $Header: /tmp/svngaudi/tmp.jEpFh25751/Gaudi/GaudiKernel/GaudiKernel/System.h,v 1.17 2008/10/28 10:40:19 marcocle Exp $
    00002 #ifndef GAUDIKERNEL_SYSTEM_H
    00003 #define GAUDIKERNEL_SYSTEM_H
    00004
    00005 // Framework include files
    00006 #include "GaudiKernel/Kernel.h"
    00007 // STL include files
    00008 #include <string>
    00009 #include <vector>
    00010 #include <typeinfo>
    00011
    00012 #include "GaudiKernel/Timing.h"
    00013 #include "GaudiKernel/ModuleInfo.h"
    00014
    00015 #ifdef __linux
    00016 # include <pthread.h>
    00017 #ifndef __APPLE__
    00018 # include <execinfo.h>
    00019 #endif
    00020 #endif
    00021
    00030 namespace System  {
    00032   typedef void* ImageHandle;
    00034   typedef void* ProcessHandle;
    00036   typedef unsigned long (*EntryPoint)(const unsigned long iid, void** ppvObject);
    00038   typedef void* (*Creator)();
    00040   GAUDI_API unsigned long loadDynamicLib(const std::string& name, ImageHandle* handle);
    00042   GAUDI_API unsigned long unloadDynamicLib(ImageHandle handle);
    00044   GAUDI_API unsigned long getProcedureByName(ImageHandle handle, const std::string& name, EntryPoint* pFunction);
    00046   GAUDI_API unsigned long getProcedureByName(ImageHandle handle, const std::string& name, Creator* pFunction);
    00048   GAUDI_API unsigned long getLastError();
    00050   GAUDI_API const std::string getLastErrorString();
    00052   GAUDI_API const std::string getErrorString(unsigned long error);
    00054   GAUDI_API const std::string typeinfoName( const std::type_info& );
    00055   GAUDI_API const std::string typeinfoName( const char* );
    00057   GAUDI_API const std::string& hostName();
    00059   GAUDI_API const std::string& osName();
    00061   GAUDI_API const std::string& osVersion();
    00063   GAUDI_API const std::string& machineType();
    00065   GAUDI_API const std::string& accountName();
    00067   GAUDI_API long numCmdLineArgs();
    00069   GAUDI_API long argc();
    00071   GAUDI_API const std::vector<std::string> cmdLineArgs();
    00073   GAUDI_API char** argv();
    00075   GAUDI_API std::string getEnv(const char* var);
    00078   GAUDI_API bool getEnv(const char* var, std::string &value);
    00079   inline bool getEnv(const std::string &var, std::string &value) {
    00080     return getEnv(var.c_str(), value);
    00081   }
    00083   GAUDI_API std::vector<std::string> getEnv();
    00089   GAUDI_API int setEnv(const std::string &name, const std::string &value, int overwrite = 1);
    00091   GAUDI_API bool isEnvSet(const char* var);
    00092 #ifdef __linux
    00093
    00094   typedef pthread_t ThreadHandle;
    00096   inline ThreadHandle threadSelf() { return pthread_self(); }
    00097 #else
    00098
    00099   typedef void* ThreadHandle;
    00101   inline ThreadHandle threadSelf() { return (void*)0; }
    00102 #endif
    00103   GAUDI_API int  backTrace(void** addresses, const int depth);
    00104   GAUDI_API bool backTrace(std::string& btrace, const int depth, const int offset = 0);
    00105   GAUDI_API bool getStackLevel(void* addresses, void*& addr, std::string& fnc, std::string& lib) ;
    00106
    00107 #if __GNUC__ >= 4
    00108
    00109
    00110
    00111
    00112
    00113
    00114
    00115
    00116
    00117
    00118
    00119
    00120   template <typename DESTPTR, typename SRCPTR>
    00121   inline DESTPTR FuncPtrCast(SRCPTR ptr) {
    00122     union {
    00123       SRCPTR src;
    00124       DESTPTR dst;
    00125     } p2p;
    00126     p2p.src = ptr;
    00127     return p2p.dst;
    00128   }
    00129 #endif
    00130 }
    00131 #endif    // SYSTEM_SYSTEM_H

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines