Delimits and identifies the allowed "context" values associated with the associated DBI returned information. More...
#include <TVldRange.hxx>
Public Member Functions | |
TVldRange () | |
TVldRange (const Int_t detMask, const Int_t simMask, const TVldTimeStamp &tstart, const TVldTimeStamp &tend, const TString &source) | |
virtual | ~TVldRange () |
const char * | AsString (Option_t *option="") const |
Bool_t | IsCompatible (const TVldContext &vldc) const |
Bool_t | IsCompatible (const TVldContext *vldc) const |
Int_t | GetDetectorMask () const |
Int_t | GetSimMask () const |
TVldTimeStamp | GetTimeStart () const |
TVldTimeStamp | GetTimeEnd () const |
TString | GetDataSource () const |
void | Print (Option_t *option="") const |
Print to stdout. See AsString() for options. | |
void | TrimTo (const TVldRange &vldr) |
void | SetTimeStart (const TVldTimeStamp &tstart) |
void | SetTimeEnd (const TVldTimeStamp &tend) |
Protected Attributes | |
Int_t | fDetectorMask |
Int_t | fSimMask |
or's of DbiDetector::Detector_t | |
TVldTimeStamp | fTimeStart |
or's of data/mc conditions | |
TVldTimeStamp | fTimeEnd |
TString | fDataSource |
Delimits and identifies the allowed "context" values associated with the associated DBI returned information.
Contact: R. Hatcher
Created on: 2000.05.03
Definition at line 37 of file TVldRange.hxx.
TVldRange::TVldRange | ( | ) |
Definition at line 30 of file TVldRange.cxx.
00031 : fDetectorMask(0), fSimMask(0), 00032 fTimeStart(), fTimeEnd(), fDataSource("unknown") 00033 { 00034 // Default constructor 00035 }
TVldRange::TVldRange | ( | const Int_t | detMask, | |
const Int_t | simMask, | |||
const TVldTimeStamp & | tstart, | |||
const TVldTimeStamp & | tend, | |||
const TString & | source | |||
) |
Definition at line 37 of file TVldRange.cxx.
00041 : fDetectorMask(detMask), fSimMask(simMask), 00042 fTimeStart(tstart), fTimeEnd(tend), fDataSource(source) 00043 { 00044 // normal constructor 00045 }
TVldRange::~TVldRange | ( | ) | [virtual] |
Definition at line 48 of file TVldRange.cxx.
const char * TVldRange::AsString | ( | Option_t * | option = "" |
) | const |
Return the TVldRange as a string
Result is a pointer to a statically allocated string. User should copy this into their own buffer before calling this method again.
option "a": give detector/simflag masks as alpha chars option "c": compact (single line) option "s": drop nsec part of times option "1": include only "start time" option "-": don't include "source" info
Definition at line 55 of file TVldRange.cxx.
References TVldTimeStamp::AsString(), fDataSource, fDetectorMask, fSimMask, fTimeEnd, fTimeStart, and DbiDetector::MaskToString().
Referenced by TDbiValidityRec::Fill(), TDbiValidityRec::IsCompatible(), and Print().
00056 { 00057 // Return the TVldRange as a string 00058 // 00059 // Result is a pointer to a statically allocated string. 00060 // User should copy this into their own buffer before calling 00061 // this method again. 00062 // 00063 // option "a": give detector/simflag masks as alpha chars 00064 // option "c": compact (single line) 00065 // option "s": drop nsec part of times 00066 // option "1": include only "start time" 00067 // option "-": don't include "source" info 00068 00069 static char newstring[255] = " "; 00070 00071 TString opt = option; 00072 opt.ToLower(); 00073 00074 Bool_t opt_a = opt.Contains("a"); 00075 Bool_t opt_c = opt.Contains("c"); 00076 00077 TString detbits; 00078 if (opt_a) { 00079 detbits = DbiDetector::MaskToString(fDetectorMask); 00080 } 00081 else { 00082 sprintf(newstring,"det %#4.4x",fDetectorMask); 00083 detbits = newstring; 00084 } 00085 00086 TString simbits; 00087 if (opt_a) { 00088 simbits = DbiSimFlag::MaskToString(fSimMask); 00089 } 00090 else { 00091 sprintf(newstring,"sim %#4.4x",fSimMask); 00092 simbits = newstring; 00093 } 00094 00095 // TVldTimeStamp::AsString returns pointer to statically allocated string 00096 // one needs to copy this before calling it again in same function call 00097 static char timeopt[4] = "c "; 00098 timeopt[0] = (opt.Contains("s")?'s':'c'); 00099 TString start_str = fTimeStart.AsString(timeopt); 00100 TString end_str; 00101 if ( ! opt.Contains("1")) { 00102 end_str = fTimeEnd.AsString(timeopt); 00103 if ( !opt_c ) end_str.Prepend("\n\t "); 00104 else end_str.Prepend(" "); 00105 } 00106 if ( ! opt_c ) start_str.Prepend("\n\t "); 00107 00108 TString source; 00109 if ( ! opt.Contains("-")) { 00110 source += (opt_c) ? " '" : "\n\t from source: "; 00111 source += fDataSource; 00112 source += (opt_c) ? "'" : ""; 00113 } 00114 00115 sprintf(newstring, 00116 "|%s|%s|%s%s%s", 00117 (const char*)detbits, 00118 (const char*)simbits, 00119 (const char*)start_str, 00120 (const char*)end_str, 00121 (const char*)source); 00122 00123 return newstring; 00124 }
TString TVldRange::GetDataSource | ( | ) | const [inline] |
Definition at line 72 of file TVldRange.hxx.
References fDataSource.
Referenced by TDbiBinaryFile::operator<<(), and TDbiValidityRec::SetTimeWindow().
00072 { return fDataSource; }
Int_t TVldRange::GetDetectorMask | ( | ) | const [inline] |
Definition at line 68 of file TVldRange.hxx.
References fDetectorMask.
Referenced by TDbiLogEntry::Fill(), TDbiValidityRec::HasExpired(), TDbiBinaryFile::operator<<(), TDbiValidityRec::SetTimeWindow(), and TDbiValidityRec::Store().
00068 { return fDetectorMask; }
Int_t TVldRange::GetSimMask | ( | ) | const [inline] |
Definition at line 69 of file TVldRange.hxx.
References fSimMask.
Referenced by TDbiLogEntry::Fill(), TDbiValidityRec::HasExpired(), TDbiBinaryFile::operator<<(), TDbiValidityRec::SetTimeWindow(), and TDbiValidityRec::Store().
00069 { return fSimMask; }
TVldTimeStamp TVldRange::GetTimeEnd | ( | ) | const [inline] |
Definition at line 71 of file TVldRange.hxx.
References fTimeEnd.
Referenced by TDbiValidityRec::AndTimeWindow(), ClassImp(), TDbiValidityRec::HasExpired(), TDbiBinaryFile::operator<<(), TDbiValidityRec::Store(), and TDbiValidityRec::Trim().
00071 { return fTimeEnd; }
TVldTimeStamp TVldRange::GetTimeStart | ( | ) | const [inline] |
Definition at line 70 of file TVldRange.hxx.
References fTimeStart.
Referenced by TDbiValidityRec::AndTimeWindow(), ClassImp(), TDbiLogEntry::Fill(), TDbiValidityRec::HasExpired(), TDbiValidityRec::IsHigherPriority(), TDbiBinaryFile::operator<<(), TDbiValidityRec::Store(), and TDbiValidityRec::Trim().
00070 { return fTimeStart; }
Bool_t TVldRange::IsCompatible | ( | const TVldContext * | vldc | ) | const |
Compare TVldContext with this TVldRange to see if the the tagged set is compatible.
Definition at line 153 of file TVldRange.cxx.
References IsCompatible().
00154 { 00155 // compare TVldContext with this TVldRange to see if the 00156 // the tagged set is compatible 00157 00158 return IsCompatible(*vldc); 00159 }
Bool_t TVldRange::IsCompatible | ( | const TVldContext & | vldc | ) | const |
Compare TVldContext with this TVldRange to see if the the tagged set is compatible.
Definition at line 127 of file TVldRange.cxx.
References fDetectorMask, fSimMask, fTimeEnd, fTimeStart, TVldContext::GetDetector(), TVldContext::GetSimFlag(), TVldContext::GetTimeStamp(), DbiSimFlag::kUnknown, and DbiDetector::kUnknown.
Referenced by IsCompatible(), and TDbiValidityRec::IsCompatible().
00128 { 00129 // compare TVldContext with this TVldRange to see if the 00130 // the tagged set is compatible 00131 00132 Int_t detector = (Int_t)vldc.GetDetector(); 00133 Int_t simflag = (Int_t)vldc.GetSimFlag(); 00134 00135 // account for case where both TVldContext and TVldRange 00136 // are using "kUnknown" which has no bits set 00137 if ( ! (detector & fDetectorMask) && 00138 (detector != DbiDetector::kUnknown || 00139 fDetectorMask != DbiDetector::kUnknown ) ) return kFALSE; 00140 if ( ! (simflag & fSimMask) && 00141 (simflag != DbiSimFlag::kUnknown || 00142 fSimMask != DbiSimFlag::kUnknown ) ) return kFALSE; 00143 00144 // the start time is taken as inclusive, but the end time is exclusive 00145 00146 if ( vldc.GetTimeStamp() < fTimeStart ) return kFALSE; 00147 if ( vldc.GetTimeStamp() >= fTimeEnd ) return kFALSE; 00148 00149 return kTRUE; 00150 }
void TVldRange::Print | ( | Option_t * | option = "" |
) | const |
Print to stdout. See AsString() for options.
Definition at line 162 of file TVldRange.cxx.
References AsString().
Referenced by TVldValidate::TestRange().
00163 { 00164 // Print this object 00165 00166 printf("%s\n",AsString(option)); 00167 }
void TVldRange::SetTimeEnd | ( | const TVldTimeStamp & | tend | ) | [inline] |
void TVldRange::SetTimeStart | ( | const TVldTimeStamp & | tstart | ) | [inline] |
void TVldRange::TrimTo | ( | const TVldRange & | vldr | ) |
Trim this range to the intersection (ie. more restricted) limits of it's initial value and that of the argument
Definition at line 170 of file TVldRange.cxx.
References fDataSource, fDetectorMask, fSimMask, fTimeEnd, and fTimeStart.
00171 { 00172 // Trim this range to the intersection (ie. more restricted) 00173 // limits of it's initial value and that of the argument 00174 00175 fDetectorMask &= vldr.fDetectorMask; 00176 fSimMask &= vldr.fSimMask; 00177 if (fTimeStart < vldr.fTimeStart) fTimeStart = vldr.fTimeStart; 00178 if (fTimeEnd > vldr.fTimeEnd ) fTimeEnd = vldr.fTimeEnd; 00179 if (!fDataSource.Contains(vldr.fDataSource)) { 00180 fDataSource += ", "; 00181 fDataSource += vldr.fDataSource; 00182 } 00183 }
TString TVldRange::fDataSource [protected] |
Definition at line 89 of file TVldRange.hxx.
Referenced by AsString(), GetDataSource(), and TrimTo().
Int_t TVldRange::fDetectorMask [protected] |
Definition at line 85 of file TVldRange.hxx.
Referenced by AsString(), GetDetectorMask(), IsCompatible(), and TrimTo().
Int_t TVldRange::fSimMask [protected] |
or's of DbiDetector::Detector_t
Definition at line 86 of file TVldRange.hxx.
Referenced by AsString(), GetSimMask(), IsCompatible(), and TrimTo().
TVldTimeStamp TVldRange::fTimeEnd [protected] |
Definition at line 88 of file TVldRange.hxx.
Referenced by AsString(), GetTimeEnd(), IsCompatible(), SetTimeEnd(), and TrimTo().
TVldTimeStamp TVldRange::fTimeStart [protected] |
or's of data/mc conditions
Definition at line 87 of file TVldRange.hxx.
Referenced by AsString(), GetTimeStart(), IsCompatible(), SetTimeStart(), and TrimTo().