Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

BDSpillAccessor.h

Go to the documentation of this file.
00001 
00028 #ifndef BDSPILLACCESSOR_H
00029 #define BDSPILLACCESSOR_H
00030 
00031 #include <DatabaseInterface/DbiResultPtr.h>
00032 #include <DatabaseInterface/DbiResultKey.h>
00033 #include <Validity/VldTimeStamp.h>
00034 
00035 #include <BeamDataUtil/BeamMonSpill.h>
00036 
00037 class BDSpillAccessor {
00038 
00039   static BDSpillAccessor* fInstance;
00040   
00041 public:
00042      BDSpillAccessor();
00043     static BDSpillAccessor& Get();
00044 
00045     ~BDSpillAccessor();
00046 
00056     const BeamMonSpill* LoadSpill(VldTimeStamp vts, int which = 0);
00057 
00058 private:
00059 
00060     // Return rows closest to context.
00061     void SeekClosest(const VldTimeStamp &vts,
00062                      const BeamMonSpill* &before,
00063                      const BeamMonSpill* &after); 
00064 
00065     // Searches current table with binary search.
00066     void TableSearch(DbiResultPtr<BeamMonSpill> &table,
00067                      const VldTimeStamp& vts, 
00068                      const BeamMonSpill* &before,
00069                      const BeamMonSpill* &after); 
00070 
00071     // Apply calibrations and corrections to the BeamMonSpill object
00072     // This belongs naturally to the BeamMonSpill class, but it has
00073     // been put here to avoid applying corrections more than once.
00074     // This guarantees that the corrections are applied when trying to
00075     // read the db and are applied only once.
00076     void CalibrateSpill(const BeamMonSpill* spill);
00077 
00078     DbiResultPtr<BeamMonSpill> *fPrevPtr, *fCenterPtr, *fNextPtr;
00079     DbiResultKey fResKey;
00080     bool fNeedNext, fNeedPrev;
00081 };
00082 
00083 
00084 #endif  // BDSPILLACCESSOR_H

Generated on Mon Feb 15 11:06:24 2010 for loon by  doxygen 1.3.9.1