DbiValidityRec Class Reference

#include <DbiValidityRec.h>

Inheritance diagram for DbiValidityRec:
DbiTableRow

List of all members.

Public Member Functions

 DbiValidityRec (Int_t dbNo=-1, Bool_t isGap=kTRUE)
 DbiValidityRec (const DbiValidityRec &from)
 DbiValidityRec (const VldRange &range, Dbi::Task task, Int_t aggNo, UInt_t seqNo, Int_t dbNo=-1, Bool_t isGap=kFALSE, VldTimeStamp time=VldTimeStamp())
virtual ~DbiValidityRec ()
virtual DbiTableRowCreateTableRow () const
Int_t GetAggregateNo () const
VldTimeStamp GetCreationDate () const
UInt_t GetDbNo () const
VldTimeStamp GetInsertDate () const
Dbi::Task GetTask () const
std::string GetL2CacheName () const
UInt_t GetSeqNo () const
const DbiTableProxyGetTableProxy () const
const VldRangeGetVldRange () const
Bool_t HasExpired (const DbiValidityRec &other) const
Bool_t HasExpired (const VldContext &vc, const Dbi::Task &task) const
Bool_t IsCompatible (const VldContext &vc, const Dbi::Task &task) const
Bool_t IsGap () const
void AndTimeWindow (const VldTimeStamp &start, const VldTimeStamp &end)
void SetAggregateNo (Int_t aggNo)
void SetDbNo (Int_t dbNo)
void SetTableProxy (const DbiTableProxy *tp)
void SetTimeWindow (const VldTimeStamp &start, const VldTimeStamp &end)
void SetVldRange (const VldRange &range)
void Trim (const VldTimeStamp &queryTime, const DbiValidityRec &other)
virtual void Fill (DbiResultSet &rs, const DbiValidityRec *vrec)
virtual void Store (DbiOutRowStream &ors, const DbiValidityRec *vrec) const
void Streamer (DbiBinaryFile &file)

Static Public Member Functions

static std::string GetL2CacheName (UInt_t seqLo, UInt_t seqHi, VldTimeStamp ts)

Private Attributes

Int_t fAggregateNo
VldTimeStamp fCreationDate
 Creation date.
Int_t fDbNo
 Cascade no. of source db =-1 unknown.
VldTimeStamp fInsertDate
 Insertion date.
Bool_t fIsGap
 kTRUE if corresponds to a gap.
Dbi::Task fTask
 Task number.
Int_t fSeqNo
 Sequence number or 0 if compound.
const DbiTableProxyfTableProxy
 DbiTableProxy that filled this (if any).
VldRange fVldRange
 Validity range of record.

Detailed Description

Id
DbiValidityRec.h,v 1.20 2012/06/14 18:23:51 gmieg Exp

Definition at line 42 of file DbiValidityRec.h.


Constructor & Destructor Documentation

DbiValidityRec::DbiValidityRec ( Int_t  dbNo = -1,
Bool_t  isGap = kTRUE 
)

Definition at line 120 of file DbiValidityRec.cxx.

References Msg::kVerbose, LEA_CTOR, and MSG.

00120                                                       :
00121 
00122 fAggregateNo(-2),
00123 fDbNo(dbNo),
00124 fIsGap(isGap),
00125 fTask(0),
00126 fSeqNo(0),
00127 fTableProxy(0)
00128 {
00129 //
00130 //
00131 //  Purpose:  Default constructor
00132 //
00133 //  Arguments:.  
00134 //    dbNo     in    Cascade no. of database holding record.
00135 //    isGap    in    = kTRUE if a gap.
00136 //
00137 //  Return:    n/a
00138 //
00139 //  Contact:   N. West
00140 //
00141 //  Specification:-
00142 //  =============
00143 //
00144 //  o Create ValidityRec.
00145 
00146 
00147 //  Program Notes:-
00148 //  =============
00149 
00150 //  None.
00151 
00152   LEA_CTOR    //Leak Checker
00153 
00154   MSG("Dbi", Msg::kVerbose) << "Creating DbiValidityRec" << endl;
00155 }
//.....................................................................

DbiValidityRec::DbiValidityRec ( const DbiValidityRec from  ) 

Definition at line 158 of file DbiValidityRec.cxx.

References Msg::kVerbose, LEA_CTOR, and MSG.

00158                                                          : DbiTableRow(from)
00159 {
00160 //
00161 //
00162 //  Purpose:  Copy constructor
00163 //
00164 //  Arguments:  
00165 //    from    in    Object to be copied from.
00166 //
00167 //  Return:    n/a
00168 //
00169 //  Contact:   N. West
00170 //
00171 //  Specification:-
00172 //  =============
00173 //
00174 //  o Create ValidityRec.
00175 
00176 
00177 //  Program Notes:-
00178 //  =============
00179 
00180 //  Explicit just for leak checking.
00181 
00182   LEA_CTOR    //Leak Checker
00183 
00184   MSG("Dbi", Msg::kVerbose) << "Creating DbiValidityRec" << endl;
00185 
00186   *this = from;
00187 
00188 }

DbiValidityRec::DbiValidityRec ( const VldRange range,
Dbi::Task  task,
Int_t  aggNo,
UInt_t  seqNo,
Int_t  dbNo = -1,
Bool_t  isGap = kFALSE,
VldTimeStamp  time = VldTimeStamp() 
)

Definition at line 191 of file DbiValidityRec.cxx.

References Msg::kVerbose, LEA_CTOR, and MSG.

00197                                                   :
00198 fAggregateNo(aggNo),
00199 fCreationDate(time),
00200 fDbNo(dbNo),
00201 fIsGap(isGap),
00202 fTask(task),
00203 fSeqNo(seqNo),
00204 fTableProxy(0),
00205 fVldRange(range)
00206 {
00207 //
00208 //
00209 //  Purpose:  Constructor from components
00210 //
00211 //  Arguments:  
00212 //    range    in   component range
00213 //    task     in   component task 
00214 //    aggNo    in   component aggregate number
00215 //    seqNo    in   component sequence number
00216 //    dbNo     in    Cascade no. of database holding record.
00217 //    isGap    in    = kTRUE if a gap.
00218 //
00219 //
00220 //
00221 // 
00222 //  Return:    n/a
00223 //
00224 //  Contact:   N. West
00225 //
00226 //  Specification:-
00227 //  =============
00228 //
00229 //  o Create ValidityRec.
00230 
00231 
00232 //  Program Notes:-
00233 //  =============
00234 
00235 //  None.
00236 
00237   LEA_CTOR    //Leak Checker
00238 
00239   MSG("Dbi", Msg::kVerbose) << "Creating DbiValidityRec" << endl;
00240 }

DbiValidityRec::~DbiValidityRec (  )  [virtual]

Definition at line 244 of file DbiValidityRec.cxx.

References Msg::kVerbose, LEA_DTOR, and MSG.

00244                                 {
00245 //
00246 //
00247 //  Purpose: Destructor
00248 //
00249 //  Arguments: 
00250 //    None.
00251 //
00252 //  Return:    n/a
00253 //
00254 //  Contact:   N. West
00255 //
00256 //  Specification:-
00257 //  =============
00258 //
00259 //  o  Destroy ValidityRec.
00260 
00261 
00262 //  Program Notes:-
00263 //  =============
00264 
00265 //  None.
00266 
00267   LEA_DTOR    //Leak Checker
00268 
00269   MSG("Dbi", Msg::kVerbose) << "Destroying DbiValidityRec" << endl;
00270 
00271 }


Member Function Documentation

void DbiValidityRec::AndTimeWindow ( const VldTimeStamp start,
const VldTimeStamp end 
)

Definition at line 86 of file DbiValidityRec.cxx.

References fVldRange, VldRange::GetTimeEnd(), VldRange::GetTimeStart(), and SetTimeWindow().

Referenced by DbiResultAgg::DbiResultAgg().

00087                                                                  {
00088 //
00089 //
00090 //  Purpose:  And in supplied start and end times.
00091 //
00092 //  Arguments: 
00093 //    startOther   in    Start time to be ANDed in.
00094 //    endOther     in    End time to be ANDed in.
00095 //
00096 //  Return:   None. 
00097 //
00098 //  Contact:   N. West
00099 //
00100 //  Specification:-
00101 //  =============
00102 //
00103 //  o Trim time windown on current record to be the overlap (and)
00104 //    with the supplied time window.
00105 
00106 //  Program Notes:-
00107 //  =============
00108 
00109 //  None.
00110 
00111   VldTimeStamp start = fVldRange.GetTimeStart();
00112   VldTimeStamp end   = fVldRange.GetTimeEnd();
00113 
00114   SetTimeWindow( start > startOther ? start : startOther,
00115                  end   < endOther   ? end   : endOther );
00116 }

virtual DbiTableRow* DbiValidityRec::CreateTableRow (  )  const [inline, virtual]

Implements DbiTableRow.

Definition at line 62 of file DbiValidityRec.h.

00062                                               {
00063                                            return new DbiValidityRec; }

void DbiValidityRec::Fill ( DbiResultSet rs,
const DbiValidityRec vrec 
) [virtual]

Definition at line 275 of file DbiValidityRec.cxx.

References VldRange::AsString(), DbiResultSet::CurRowNum(), fAggregateNo, fCreationDate, fDbNo, fInsertDate, fIsGap, fSeqNo, fTableProxy, fTask, fVldRange, DbiResultSet::GetDbNo(), DbiResultSet::GetTableProxy(), Msg::kVerbose, and MSG.

00276                                                             {
00277 //
00278 //
00279 //  Purpose:  Fill oject from Result Set
00280 //
00281 //  Arguments: 
00282 //    rs           in    Result Set used to fill object
00283 //    vrec         in    =0.  If filling other table rows it points
00284 //                       to the associated validity record.
00285 //
00286 //  Return:    
00287 //
00288 //  Contact:   N. West
00289 //
00290 //  Specification:-
00291 //  =============
00292 //
00293 //  o Fill object from current row of Result Set.
00294 
00295 //  Program Notes:-
00296 //  =============
00297 
00298 //  None.
00299 
00300     VldTimeStamp start, end;
00301     Int_t detMask, simMask;
00302 
00303 //  Establish source DbiTableProxy and cascade no.
00304 
00305     fTableProxy = rs.GetTableProxy();
00306     fDbNo       = rs.GetDbNo();
00307 
00308 //  Read data from row.
00309 
00310     rs >> fSeqNo >> start >> end >> detMask >> simMask >> fTask 
00311        >> fAggregateNo    >> fCreationDate  >> fInsertDate;    
00312 
00313     fIsGap = kFALSE;
00314 
00315     VldRange vr(detMask, simMask, start, end, "From Database");
00316     fVldRange = vr;   
00317 
00318     MSG("Dbi", Msg::kVerbose) 
00319          << "DbiValidityRec for row " << rs.CurRowNum()
00320          << ": " << fVldRange.AsString()
00321          << " seq num: " << fSeqNo
00322          << " agg no: "  << fAggregateNo
00323          << " task: " << endl;
00324 }

Int_t DbiValidityRec::GetAggregateNo (  )  const [inline, virtual]
VldTimeStamp DbiValidityRec::GetCreationDate (  )  const [inline]
UInt_t DbiValidityRec::GetDbNo (  )  const [inline]
VldTimeStamp DbiValidityRec::GetInsertDate (  )  const [inline]

Definition at line 67 of file DbiValidityRec.h.

References fInsertDate.

Referenced by main(), PrintTimeCal(), and WriteTableToCSVFile().

00067 { return fInsertDate; }

std::string DbiValidityRec::GetL2CacheName ( UInt_t  seqLo,
UInt_t  seqHi,
VldTimeStamp  ts 
) [static]

Definition at line 345 of file DbiValidityRec.cxx.

References VldTimeStamp::AsString().

00347                                                             {
00348 //
00349 //
00350 //  Purpose:  Return the associated Level 2 Cache Name.
00351 //
00352 //  Specification:-
00353 //  =============
00354 //
00355 //  o For unaggregated queries name format: <Seqno>_<CreationDate>
00356 //
00357 //  o For aggregated queries name format:   <LowSeqno>_<HighSeqNo>_<MaxCreationDate>
00358 
00359 //  Program Notes:-
00360 //  =============
00361 
00362 //  The static routine centralises the definition of cache names both for
00363 //  DbiValidityRec and DbiValidityRecBuilder.
00364 
00365   ostringstream oss;
00366   oss << seqLo << "_";
00367   if ( seqLo != seqHi )  oss << seqHi << "_";
00368   oss << ts.AsString("s");
00369   std::string str(oss.str());
00370   // Convert white space to underscore.
00371   int i = str.size();
00372   while ( i-- ) if ( str[i] == ' ' ) str[i] = '_';
00373   return str;
00374 
00375 }

std::string DbiValidityRec::GetL2CacheName (  )  const

Definition at line 328 of file DbiValidityRec.cxx.

References GetCreationDate(), and GetSeqNo().

Referenced by DbiTableProxy::Query().

00328                                                {
00329 //
00330 //
00331 //  Purpose:  Return the associated Level 2 Cache Name.
00332 //
00333 //  Specification:-
00334 //  =============
00335 //
00336 //  o See GetL2CacheName(UInt_t seqLo, UInt_t seqHi, VldTimeStamp ts);
00337 
00338   return DbiValidityRec::GetL2CacheName(this->GetSeqNo(),
00339                                         this->GetSeqNo(),
00340                                         this->GetCreationDate());
00341 
00342 }

UInt_t DbiValidityRec::GetSeqNo (  )  const [inline]
const DbiTableProxy* DbiValidityRec::GetTableProxy (  )  const [inline]
Dbi::Task DbiValidityRec::GetTask (  )  const [inline]
const VldRange& DbiValidityRec::GetVldRange (  )  const [inline]

Definition at line 72 of file DbiValidityRec.h.

References fVldRange.

Referenced by CountPot::Ana(), BfldCache::BfldCache(), CheckGC::checklin(), CoilTools::CoilCurrentLimits(), DbiWriter< T >::CompleteOpen(), PulserTimePlotter::CreateGraph(), SpillServerMonFinder::DataIsAvailable(), DbiResultAgg::DbiResultAgg(), DbiValidityRecBuilder::DbiValidityRecBuilder(), PhotonStatSummarizer::DoesTableExist(), MuonDriftCalScheme::DoReset(), LIPlexMaps::DriftWithTime(), dump_peds(), CountPot::EndJob(), HvStatusFinder::ExtendedQuery(), DbiLogEntry::Fill(), FabSteelPlate::Fill(), PulserRefDriftPin::Fill(), DbuVaChipSpars::Fill(), FabPlnInstall::Fill(), PlexPixelSpotToStripEnd::Fill(), PulserRawGainPin::Fill(), UgliDbiStripStruct::Fill(), PlexPinDiodeToLed::Fill(), PlexVetoShieldMuxToMdl::Fill(), BfldDbiPlaneMap::Fill(), UgliDbiSteelPln::Fill(), PlexStripEndToLed::Fill(), PlexRawChannelReadoutType::Fill(), PlexRawChannelToPinDiode::Fill(), UgliDbiScintPln::Fill(), DbuRunSummary::Fill(), UgliDbiScintMdlStruct::Fill(), UgliDbiStrip::Fill(), DbuDaqFileSummary::Fill(), PulserDriftPin::Fill(), PulserGainPin::Fill(), UgliDbiScintMdl::Fill(), DbuVaChipPeds::Fill(), PlexPixelToRawChannel::Fill(), UgliDbiScintPlnStruct::Fill(), DbuSubRunSummary::Fill(), PulserRawDriftPin::Fill(), BfieldCoilCurrent::Fill(), CountPot::FillMBPOT(), SpillServerMonFinder::FindClosestEntries(), SpillTimeFinder::FindClosestEntries(), Summarizer::FindNextContext(), CoilTools::GetLast(), HasExpired(), HvStatusFinder::LocalQuery(), CoilTools::LocalQuery(), DbmModule::LogEntry(), main(), PlotAllPeds::Next(), PlotPeds::Next(), FabPlnInstallLookup::NextInstall(), DbiResultPtr< T >::NextQuery(), operator<<(), PlotAllPeds::Prev(), PrintTimeCal(), DbiTableProxy::QueryOverlayCreationDate(), LIPlexMaps::ReadDbGainAverage(), FarTimingFidFinder::RefreshQuery(), SimPmtM64CrosstalkTable::Reset(), PhotonLookupTable::Reset(), RangeLookupTable::Reset(), PulserGainFit::RunNearFarFits(), PulserGainFit::RunPinFits(), MBSpillAccessor::SeekClosest(), BDSpillAccessor::SeekClosest(), DbiResultPtr< T >::SetContext(), BDSwicPedAccessor::SetSpillTime(), Trim(), GeoGeometry::TrimVldRange(), Plexus::TrimVldRange(), UgliGeometry::TrimVldRange(), PlotPeds::Update(), DbiLogEntry::Write(), WriteTableToCSVFile(), and PulserDBModule::WriteTempGC().

00072 { return fVldRange;}

Bool_t DbiValidityRec::HasExpired ( const VldContext vc,
const Dbi::Task task 
) const

Definition at line 418 of file DbiValidityRec.cxx.

References VldContext::GetDetector(), VldRange::GetDetectorMask(), VldContext::GetSimFlag(), VldRange::GetSimMask(), GetTask(), VldRange::GetTimeEnd(), VldContext::GetTimeStamp(), VldRange::GetTimeStart(), and GetVldRange().

00419                                                              {
00420 //
00421 //
00422 //  Purpose: See if validity record has expired i.e. is compatible with
00423 //           this context query except for date.
00424 //
00425 //  Arguments: 
00426 //    vc           in    Context of query
00427 //    task         in    Task of query
00428 //
00429 //
00430 //  Contact:   N. West
00431 
00432 //  Program Notes:-
00433 //  =============
00434 
00435 //  This method is used by DbiResult to identify when ready for
00436 //  purging.
00437 
00438   VldTimeStamp    ts = vc.GetTimeStamp();
00439   const VldRange& vr = this->GetVldRange();
00440 
00441   return 
00442      (       task             == this->GetTask()  
00443         && ( vc.GetDetector() &  vr.GetDetectorMask() )
00444         && ( vc.GetSimFlag()  &  vr.GetSimMask() )
00445         && (    ts            >= vr.GetTimeEnd()
00446              || ts            <  vr.GetTimeStart() )
00447      );
00448 
00449 }

Bool_t DbiValidityRec::HasExpired ( const DbiValidityRec other  )  const

Definition at line 379 of file DbiValidityRec.cxx.

References fTask, fVldRange, VldRange::GetDetectorMask(), VldRange::GetSimMask(), GetTask(), VldRange::GetTimeEnd(), VldRange::GetTimeStart(), and GetVldRange().

Referenced by DbiResult::Satisfies().

00379                                                                    {
00380 //
00381 //
00382 //  Purpose: See if validity record has expired i.e. is compatible with
00383 //           this one except for date.
00384 //
00385 //  Arguments: 
00386 //    other        in    Other DbiValidityRec to be compared with
00387 //
00388 //  Return:    
00389 //
00390 //  Contact:   N. West
00391 //
00392 //  Specification:-
00393 //  =============
00394 //
00395 //  o See if validity record has expired i.e. is compatible with
00396 //    this one except for date.
00397 
00398 //  Program Notes:-
00399 //  =============
00400 
00401 //  This method is used by DbiCache to select candidates for
00402 //  purging.
00403 
00404   const VldRange& otherVR =other.GetVldRange();
00405  
00406   return 
00407      (       other.GetTask() == fTask  
00408         && ( otherVR.GetDetectorMask() & fVldRange.GetDetectorMask() )
00409         && ( otherVR.GetSimMask()      & fVldRange.GetSimMask() )
00410         && (    otherVR.GetTimeStart() >= fVldRange.GetTimeEnd()
00411              || otherVR.GetTimeEnd()   <= fVldRange.GetTimeStart() )
00412      );
00413 
00414 }

Bool_t DbiValidityRec::IsCompatible ( const VldContext vc,
const Dbi::Task task 
) const

Definition at line 454 of file DbiValidityRec.cxx.

References VldContext::AsString(), VldRange::AsString(), fTask, fVldRange, VldRange::IsCompatible(), Msg::kDebug, and MSG.

Referenced by DbiResult::Satisfies().

00455                                                                {
00456 //
00457 //
00458 //  Purpose: See if result is compatible with query. 
00459 //
00460 //  Arguments: 
00461 //    vc           in    Context of new query
00462 //    task         in    Task of new query
00463 //
00464 //  Return:    
00465 //
00466 //  Contact:   N. West
00467 //
00468 //  Specification:-
00469 //  =============
00470 //
00471 //  o See if result is compatible with query.
00472 
00473 //  Program Notes:-
00474 //  =============
00475 
00476 //  None.
00477 
00478    MSG("Dbi",Msg::kDebug) 
00479      << " DbiValidityRec::IsCompatible : tasks:"
00480      << task << "," << fTask
00481      << " is compat: " << fVldRange.IsCompatible(vc) << endl
00482      << "   range " << fVldRange.AsString() << endl
00483      << "   context " << vc.AsString() << endl;
00484 
00485   return task == fTask  && fVldRange.IsCompatible(vc);
00486 
00487 }

Bool_t DbiValidityRec::IsGap (  )  const [inline]
void DbiValidityRec::SetAggregateNo ( Int_t  aggNo  )  [inline]

Definition at line 85 of file DbiValidityRec.h.

References fAggregateNo.

Referenced by DbiResultAgg::DbiResultAgg(), and DbiConfigStream::Write().

00085 { fAggregateNo = aggNo; }

void DbiValidityRec::SetDbNo ( Int_t  dbNo  )  [inline]

Definition at line 86 of file DbiValidityRec.h.

References fDbNo.

Referenced by DbiValidityRecBuilder::DbiValidityRecBuilder().

00086 { fDbNo = dbNo; }

void DbiValidityRec::SetTableProxy ( const DbiTableProxy tp  )  [inline]

Definition at line 87 of file DbiValidityRec.h.

References fTableProxy.

00087 { fTableProxy = tp; }

void DbiValidityRec::SetTimeWindow ( const VldTimeStamp start,
const VldTimeStamp end 
)

Definition at line 489 of file DbiValidityRec.cxx.

References fVldRange, VldRange::GetDataSource(), VldRange::GetDetectorMask(), and VldRange::GetSimMask().

Referenced by AndTimeWindow(), and Trim().

00490                                                             {
00491 //
00492 //
00493 //  Purpose:  Set supplied start and end times.
00494 //
00495 //  Arguments: 
00496 //    start        in    Start time to be set,
00497 //    end          in    End time to be set.
00498 //
00499 //  Return:   None. 
00500 //
00501 //  Contact:   N. West
00502 //
00503 //  Specification:-
00504 //  =============
00505 //
00506 //  o Set time windown on current record.
00507 
00508 //  Program Notes:-
00509 //  =============
00510 
00511 //  The method here is rather clumsy, but I don't know of anything
00512 //  better!
00513 
00514   VldRange  range(fVldRange.GetDetectorMask(),
00515                   fVldRange.GetSimMask(),
00516                   start,
00517                   end,
00518                   fVldRange.GetDataSource() );
00519   fVldRange = range;
00520 
00521 }

void DbiValidityRec::SetVldRange ( const VldRange range  )  [inline]

Definition at line 90 of file DbiValidityRec.h.

References fVldRange.

Referenced by DbiValidityRecBuilder::DbiValidityRecBuilder().

00090 { fVldRange=range;}

void DbiValidityRec::Store ( DbiOutRowStream ors,
const DbiValidityRec vrec 
) const [virtual]

Definition at line 525 of file DbiValidityRec.cxx.

References fAggregateNo, fCreationDate, fInsertDate, fSeqNo, fTask, fVldRange, VldRange::GetDetectorMask(), VldRange::GetSimMask(), VldRange::GetTimeEnd(), and VldRange::GetTimeStart().

Referenced by DbiSqlValPacket::Recreate().

00526                                                                    {
00527 //
00528 //
00529 //  Purpose:  Stream object to output row stream
00530 //
00531 //  Arguments: 
00532 //    ors          in    Output row stream.
00533 //    vrec         in    =0.  If filling other table rows it points
00534 //                       to the associated validity record.
00535 //
00536 //  Return:    
00537 //
00538 //  Contact:   N. West
00539 //
00540 //  Specification:-
00541 //  =============
00542 //
00543 //  o  Stream object to output row stream.
00544 
00545 //  Program Notes:-
00546 //  =============
00547 
00548 //  None.
00549 
00550 //  Write data to row.
00551 
00552     ors << fSeqNo 
00553         << fVldRange.GetTimeStart() 
00554         << fVldRange.GetTimeEnd() 
00555         << fVldRange.GetDetectorMask()
00556         << fVldRange.GetSimMask() 
00557         << fTask 
00558         << fAggregateNo    
00559         << fCreationDate  
00560         << fInsertDate;       
00561 }

void DbiValidityRec::Streamer ( DbiBinaryFile file  ) 

Definition at line 564 of file DbiValidityRec.cxx.

References fAggregateNo, fCreationDate, fDbNo, fInsertDate, fIsGap, fSeqNo, fTableProxy, fTask, fVldRange, DbiBinaryFile::IsReading(), and DbiBinaryFile::IsWriting().

Referenced by DbiResult::Streamer().

00564                                                  {
00565 //
00566 //
00567 //  Purpose:  I/O to binary file
00568 //
00569 //  Program Notes:-
00570 //  =============
00571 
00572 //  Don't store the pointer fTableProxy (don't want to get into storing
00573 //  pointers!); the DbiCache will fix it up on input
00574 
00575   if ( file.IsReading() ) {
00576     file >> fAggregateNo
00577          >> fCreationDate
00578          >> fDbNo
00579          >> fInsertDate
00580          >> fIsGap
00581          >> fTask
00582          >> fSeqNo
00583          >> fVldRange;
00584     fTableProxy = 0;
00585   }
00586   else if ( file.IsWriting() ) {
00587     file << fAggregateNo
00588          << fCreationDate
00589          << fDbNo
00590          << fInsertDate
00591          << fIsGap
00592          << fTask
00593          << fSeqNo
00594          << fVldRange;
00595   }
00596 }

void DbiValidityRec::Trim ( const VldTimeStamp queryTime,
const DbiValidityRec other 
)

Definition at line 600 of file DbiValidityRec.cxx.

References fAggregateNo, fVldRange, VldRange::GetTimeEnd(), VldRange::GetTimeStart(), GetVldRange(), IsGap(), and SetTimeWindow().

Referenced by DbiValidityRecBuilder::DbiValidityRecBuilder().

00601                                                        {
00602 //
00603 //
00604 //  Purpose:  Trim this validity record so that represents 
00605 //            best validity record for query.
00606 //
00607 //  Arguments: 
00608 //    queryTime    in    Time of query
00609 //    other        in    DbiValidity record satisfying query
00610 //
00611 //  Return:    None.
00612 //
00613 //  Contact:   N. West
00614 //
00615 //  Specification:-
00616 //  =============
00617 //
00618 //  o Update this validity record so that it remains the best
00619 //    validity record taking into account the supplied record.
00620 
00621 
00622 //  Program Notes:-
00623 //  =============
00624 
00625 //  This is the function that deal with validity management.
00626 //  It takes into account that several validity records may
00627 //  overlap and that the best one is the one with the latest
00628 //  creation date that brackets the query date.  Other entries
00629 //  with later creation dates may trim start or end times.
00630 
00631 //  Assumptions:-
00632 //  ===========
00633 //
00634 //  That entries are submitted in strict descending priority i.e.:-
00635 //
00636 //  1)  Entries for a higher priority database precede those from a
00637 //      lower priority one.
00638 //
00639 //  2)  Within a database entries are in descending creation date order.
00640 
00641 
00642 //  Ignore other records that are either gaps or have wrong
00643 //  aggregate number.
00644 
00645   if ( fAggregateNo != other.fAggregateNo || other.IsGap() ) return;
00646   
00647 //  If this record is not a gap then the other record can be ignore
00648 //  as it is of lower priority.
00649 
00650   if ( ! IsGap() ) return;
00651 
00652   VldTimeStamp start      = fVldRange.GetTimeStart();
00653   VldTimeStamp end        = fVldRange.GetTimeEnd();
00654   VldTimeStamp startOther = other.GetVldRange().GetTimeStart();
00655   VldTimeStamp endOther   = other.GetVldRange().GetTimeEnd();
00656   
00657 // If entry brackets query date, then use it but with a validity that
00658 // is trimmed by the current record.
00659 
00660   if ( startOther <= queryTime && endOther > queryTime ) {
00661     if ( start < startOther ) start = startOther;
00662     if ( end   > endOther   ) end   = endOther;
00663     *this = other;
00664     SetTimeWindow(start,end);
00665   }
00666 
00667 // It doesn't bracket, so use it to trim the window
00668 
00669   else {
00670 
00671     if ( endOther <= queryTime ) {
00672       if ( start < endOther   ) SetTimeWindow(endOther,end);
00673     }
00674     else if ( startOther > queryTime ) {
00675       if ( end   > startOther ) SetTimeWindow(start, startOther);
00676     }
00677   }
00678 
00679 }


Member Data Documentation

Aggregate number or:- -1 Non-aggregated data or multiple aggregates -2 undefined aggregates

Definition at line 109 of file DbiValidityRec.h.

Referenced by Fill(), GetAggregateNo(), SetAggregateNo(), Store(), Streamer(), and Trim().

Creation date.

Definition at line 112 of file DbiValidityRec.h.

Referenced by Fill(), GetCreationDate(), Store(), and Streamer().

Int_t DbiValidityRec::fDbNo [private]

Cascade no. of source db =-1 unknown.

Definition at line 115 of file DbiValidityRec.h.

Referenced by Fill(), GetDbNo(), SetDbNo(), and Streamer().

Insertion date.

Definition at line 118 of file DbiValidityRec.h.

Referenced by Fill(), GetInsertDate(), Store(), and Streamer().

Bool_t DbiValidityRec::fIsGap [private]

kTRUE if corresponds to a gap.

Definition at line 121 of file DbiValidityRec.h.

Referenced by Fill(), IsGap(), and Streamer().

Int_t DbiValidityRec::fSeqNo [private]

Sequence number or 0 if compound.

Definition at line 127 of file DbiValidityRec.h.

Referenced by Fill(), GetSeqNo(), Store(), and Streamer().

DbiTableProxy that filled this (if any).

Definition at line 130 of file DbiValidityRec.h.

Referenced by Fill(), GetTableProxy(), SetTableProxy(), and Streamer().

Task number.

Definition at line 124 of file DbiValidityRec.h.

Referenced by Fill(), GetTask(), HasExpired(), IsCompatible(), Store(), and Streamer().

Validity range of record.

Definition at line 133 of file DbiValidityRec.h.

Referenced by AndTimeWindow(), Fill(), GetVldRange(), HasExpired(), IsCompatible(), SetTimeWindow(), SetVldRange(), Store(), Streamer(), and Trim().


The documentation for this class was generated from the following files:

Generated on 21 Oct 2017 for loon by  doxygen 1.6.1