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

BoundsTracker Class Reference

Track a FileGap::BoundsList, say if VldTimeStamp is in a file or not. More...

#include <BoundsTracker.h>

List of all members.

Public Member Functions

 BoundsTracker (const FileGap::BoundList &lst)
int InFile (const VldTimeStamp &vts)
int GetIndex () const
 Return the index of the current iterator.
VldTimeStamp GetItrFirst ()
VldTimeStamp GetItrSecond ()

Private Attributes

FileGap::BoundList fList
FileGap::BoundList::iterator fItr
int fIndex


Detailed Description

Track a FileGap::BoundsList, say if VldTimeStamp is in a file or not.

Author:
(last to touch it)
Author
bv
Version:
Revision
1.1
Date:
Date
2005/11/22 19:33:21
Contact: bv@bnl.gov

Created on: Mon Oct 10 14:11:15 2005

Id
BoundsTracker.h,v 1.1 2005/11/22 19:33:21 bv Exp

Definition at line 32 of file BoundsTracker.h.


Constructor & Destructor Documentation

BoundsTracker::BoundsTracker const FileGap::BoundList lst  ) 
 

Definition at line 8 of file BoundsTracker.cxx.

References done(), fItr, and fList.

00009     : fIndex(0)
00010 {
00011     cerr << "BoundList is " << lst.size() << " elements\n";
00012 
00013     FileGap::BoundList::const_iterator it, done = lst.end();
00014     for (it=lst.begin(); it != done; ++it) {
00015         VldTimeStamp a = it->first;
00016         VldTimeStamp b = it->second;
00017 
00018         fList.push_back(pair<VldTimeStamp,VldTimeStamp>(a,b));
00019     }
00020     fItr = fList.begin();
00021 }


Member Function Documentation

int BoundsTracker::GetIndex  )  const
 

Return the index of the current iterator.

Definition at line 54 of file BoundsTracker.cxx.

Referenced by StndBmsSpin::Scan().

00055 {
00056     return fIndex;
00057 }

VldTimeStamp BoundsTracker::GetItrFirst  ) 
 

Definition at line 58 of file BoundsTracker.cxx.

References fItr.

00059 {
00060     return fItr->first;
00061 }

VldTimeStamp BoundsTracker::GetItrSecond  ) 
 

Definition at line 62 of file BoundsTracker.cxx.

References fItr.

00063 {
00064     return fItr->second;
00065 }

int BoundsTracker::InFile const VldTimeStamp vts  ) 
 

Check if vts is inside a file. May reset current file count

Return 0 if in file indicated by GetIndex() Return -1 if just before this file Return +1 if just after this file Return -2 if just before first file Return +2 if just after last file

Definition at line 22 of file BoundsTracker.cxx.

References fItr, and fList.

Referenced by StndBmsSpin::Scan().

00023 {
00024     //cerr << "infile\n";
00025     size_t siz = fList.size();
00026     if (! siz) return -3;
00027     //cerr << "InFile("<< vts<<"), list size="<<siz<<"\n";
00028 
00029     if (fItr->first <= vts && vts <= fItr->second) return 0;
00030 
00031     if (vts < fItr->first) {
00032         if (fItr == fList.begin()) return -2;
00033         FileGap::BoundList::iterator prev = fItr;
00034         --prev;
00035         if (vts > prev->second) return -1;
00036         fItr = prev;
00037         --fIndex;
00038         return this->InFile(vts);       
00039     }
00040 
00041     if (vts > fItr->second) {
00042         FileGap::BoundList::iterator next = fItr;
00043         ++next;
00044         if (next == fList.end()) return +2;
00045         if (vts < next->first) return +1;
00046         fItr = next;
00047         ++fIndex;
00048         return this->InFile(vts);
00049     }
00050 
00051     return 0;                   // never reach this
00052 }


Member Data Documentation

int BoundsTracker::fIndex [private]
 

Definition at line 35 of file BoundsTracker.h.

FileGap::BoundList::iterator BoundsTracker::fItr [private]
 

Definition at line 34 of file BoundsTracker.h.

Referenced by BoundsTracker(), GetItrFirst(), GetItrSecond(), and InFile().

FileGap::BoundList BoundsTracker::fList [private]
 

Definition at line 33 of file BoundsTracker.h.

Referenced by BoundsTracker(), and InFile().


The documentation for this class was generated from the following files:
Generated on Mon Feb 15 11:08:49 2010 for loon by  doxygen 1.3.9.1