| # Gaudi Framework, version v21r11 |

Home |  | Generated: 30 Sep 2010

# 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 const std::string getEnv(const char* var);
    00077   GAUDI_API const std::vector<std::string> getEnv();
    00083   GAUDI_API int setEnv(const std::string &name, const std::string &value, int overwrite = 1);
    00084 #ifdef __linux
    00086   typedef pthread_t ThreadHandle;
    00088   inline ThreadHandle threadSelf() { return pthread_self(); }
    00089 #else
    00091   typedef void* ThreadHandle;
    00093   inline ThreadHandle threadSelf() { return (void*)0; }
    00094 #endif
    00095   GAUDI_API int  backTrace(void** addresses, const int depth);
    00096   GAUDI_API bool backTrace(std::string& btrace, const int depth, const int offset = 0);
    00097   GAUDI_API bool getStackLevel(void* addresses, void*& addr, std::string& fnc, std::string& lib) ;
    00098
    00099 #if __GNUC__ >= 4
    00112   template <typename DESTPTR, typename SRCPTR>
    00113   inline DESTPTR FuncPtrCast(SRCPTR ptr) {
    00114     union {
    00115       SRCPTR src;
    00116       DESTPTR dst;
    00117     } p2p;
    00118     p2p.src = ptr;
    00119     return p2p.dst;
    00120   }
    00121 #endif
    00122 }
    00123 #endif    // SYSTEM_SYSTEM_H