00001 #include "TEpicsParam.h" 00002 00003 #include "TGo4Log.h" 00004 00005 TEpicsParam::TEpicsParam(const char* name) : 00006 TGo4Parameter(name) 00007 { 00008 fAutoFill = kFALSE; 00009 fVerbose = kFALSE; 00010 00011 ResetDisplayVariables(); 00012 00013 // please use set_EpicsPar.C macro to define actual setup 00014 } 00015 00016 void TEpicsParam::ResetDisplayVariables() 00017 { 00018 for (int nl = 0; nl < CBM_EPIX_NUMHIS_LONG; ++nl) 00019 fDisplayLong[nl].Clear(); 00020 00021 for (int dl = 0; dl < CBM_EPIX_NUMHIS_DOUBLE; ++dl) 00022 fDisplayDouble[dl].Clear(); 00023 } 00024 00025 Int_t TEpicsParam::AddDouble(const char* name, Bool_t showwarn) 00026 { 00027 if ((name==0) || (strlen(name)==0) || (strcmp(name, CBM_EPIX_NOTCONFIGURED)==0)) return -1; 00028 00029 int first_empty = -1; 00030 00031 for (int dl = 0; dl < CBM_EPIX_NUMHIS_DOUBLE; ++dl) { 00032 if (fDisplayDouble[dl] == name) return dl; 00033 00034 if ((fDisplayDouble[dl] == CBM_EPIX_NOTCONFIGURED) || 00035 (fDisplayDouble[dl].Length()==0)) { 00036 if (first_empty<0) first_empty = dl; 00037 } 00038 } 00039 00040 if (first_empty>=0) { 00041 fDisplayDouble[first_empty] = name; 00042 return first_empty; 00043 } 00044 00045 if (showwarn) TGo4Log::Warn("No place in TEpicsParam to keep double record %s", name); 00046 return -1; 00047 } 00048 00049 const char* TEpicsParam::DoubleName(Int_t n) 00050 { 00051 if ((n<0) || (n>=CBM_EPIX_NUMHIS_DOUBLE)) return 0; 00052 00053 if ((fDisplayDouble[n] == CBM_EPIX_NOTCONFIGURED) || 00054 (fDisplayDouble[n].Length()==0)) return 0; 00055 00056 return fDisplayDouble[n].Data(); 00057 } 00058 00059 Int_t TEpicsParam::AddLong(const char* name, Bool_t showwarn) 00060 { 00061 if ((name==0) || (strlen(name)==0) || (strcmp(name, CBM_EPIX_NOTCONFIGURED)==0)) return -1; 00062 00063 int first_empty = -1; 00064 00065 for (int nl = 0; nl < CBM_EPIX_NUMHIS_LONG; ++nl) { 00066 if (fDisplayLong[nl] == name) return nl; 00067 00068 if ((fDisplayLong[nl] == CBM_EPIX_NOTCONFIGURED) || 00069 (fDisplayLong[nl].Length() == 0)) { 00070 if (first_empty<0) first_empty = nl; 00071 } 00072 } 00073 00074 if (first_empty>=0) { 00075 fDisplayLong[first_empty] = name; 00076 return first_empty; 00077 } 00078 00079 if (showwarn) TGo4Log::Warn("No place in TEpicsParam to keep long record %s", name); 00080 return -1; 00081 } 00082 00083 const char* TEpicsParam::LongName(Int_t n) 00084 { 00085 if ((n<0) || (n>=CBM_EPIX_NUMHIS_LONG)) return 0; 00086 if ((fDisplayLong[n] == CBM_EPIX_NOTCONFIGURED) || 00087 (fDisplayLong[n].Length() == 0)) return 0; 00088 return fDisplayLong[n].Data(); 00089 } 00090