Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00013
00014
00015
00016 #ifndef XRD_CENV_H
00017 #define XRD_CENV_H
00018
00019 #include "XrdOuc/XrdOucEnv.hh"
00020 #include "XrdSys/XrdSysPthread.hh"
00021
00022 #include <string.h>
00023
00024 using namespace std;
00025
00026
00027 #define EnvGetLong(x) XrdClientEnv::Instance()->GetInt(x)
00028 #define EnvGetString(x) XrdClientEnv::Instance()->Get(x)
00029 #define EnvPutString(name, val) XrdClientEnv::Instance()->Put(name, val)
00030 #define EnvPutInt(name, val) XrdClientEnv::Instance()->PutInt(name, val)
00031
00032 class XrdClientEnv {
00033 private:
00034
00035 XrdOucEnv *fOucEnv;
00036 XrdSysRecMutex fMutex;
00037 static XrdClientEnv *fgInstance;
00038
00039 protected:
00040 XrdClientEnv();
00041 ~XrdClientEnv();
00042
00043 public:
00044
00045 const char * Get(const char *varname) {
00046 const char *res;
00047 XrdSysMutexHelper m(fMutex);
00048
00049 res = fOucEnv->Get(varname);
00050 return res;
00051 }
00052
00053 long GetInt(const char *varname) {
00054 long res;
00055 XrdSysMutexHelper m(fMutex);
00056
00057 res = fOucEnv->GetInt(varname);
00058 return res;
00059 }
00060
00061 void Put(const char *varname, const char *value) {
00062 XrdSysMutexHelper m(fMutex);
00063
00064 fOucEnv->Put(varname, value);
00065 }
00066
00067 void PutInt(const char *varname, long value) {
00068 XrdSysMutexHelper m(fMutex);
00069
00070 fOucEnv->PutInt(varname, value);
00071 }
00072
00073 static XrdClientEnv *Instance();
00074
00075 };
00076
00077 #endif