CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
IntersectingIOVRecordIntervalFinder.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: Framework
4 // Class : IntersectingIOVRecordIntervalFinder
5 //
6 // Implementation:
7 // <Notes on implementation>
8 //
9 // Original Author: Chris Jones
10 // Created: Tue Aug 19 13:20:41 EDT 2008
11 // $Id: IntersectingIOVRecordIntervalFinder.cc,v 1.2 2008/09/03 13:41:51 chrjones Exp $
12 //
13 
14 // system include files
15 
16 // user include files
18 namespace edm {
19  namespace eventsetup {
20 
21 //
22 // constants, enums and typedefs
23 //
24 
25 //
26 // static data member definitions
27 //
28 
29 //
30 // constructors and destructor
31 //
33 {
35 }
36 
37 // IntersectingIOVRecordIntervalFinder::IntersectingIOVRecordIntervalFinder(const IntersectingIOVRecordIntervalFinder& rhs)
38 // {
39 // // do actual copying here;
40 // }
41 
43 {
44 }
45 
46 //
47 // assignment operators
48 //
49 // const IntersectingIOVRecordIntervalFinder& IntersectingIOVRecordIntervalFinder::operator=(const IntersectingIOVRecordIntervalFinder& rhs)
50 // {
51 // //An exception safe implementation is
52 // IntersectingIOVRecordIntervalFinder temp(rhs);
53 // swap(rhs);
54 //
55 // return *this;
56 // }
57 
58 //
59 // member functions
60 //
61 void
62 IntersectingIOVRecordIntervalFinder::swapFinders(std::vector<boost::shared_ptr<EventSetupRecordIntervalFinder> >& iFinders)
63 {
64  finders_.swap(iFinders);
65 }
66 
67 void
69  const IOVSyncValue& iTime,
70  ValidityInterval& oInterval)
71 {
72  if(finders_.empty()) {
74  return;
75  }
76 
77  bool haveAValidRecord = false;
78  bool haveUnknownEnding = false;
80 
81  for(std::vector<boost::shared_ptr<EventSetupRecordIntervalFinder> >::iterator it = finders_.begin(),
82  itEnd = finders_.end(); it != itEnd; ++it) {
83  ValidityInterval test = (*it)->findIntervalFor(iKey, iTime);
84  if ( test != ValidityInterval::invalidInterval() ) {
85  haveAValidRecord =true;
86  if(newInterval.first() < test.first()) {
87  newInterval.setFirst(test.first());
88  }
89  if(newInterval.last() > test.last()) {
90  newInterval.setLast(test.last());
91  }
92  if(test.last() == IOVSyncValue::invalidIOVSyncValue()) {
93  haveUnknownEnding=true;
94  }
95  } else {
96  //if it is invalid then we must check on each new IOVSyncValue so that
97  // we can find the time when it is valid
98  haveUnknownEnding=true;
99  }
100  }
101 
102  if(!haveAValidRecord) {
103  //If no Finder has a valid time, then this record is also invalid for this time
104  newInterval = ValidityInterval::invalidInterval();
105  } else if(haveUnknownEnding) {
107  }
108  oInterval = newInterval;
109 }
110 
111 //
112 // const member functions
113 //
114 
115 //
116 // static member functions
117 //
118  }
119 }
void setFirst(const IOVSyncValue &iTime)
static const IOVSyncValue & endOfTime()
Definition: IOVSyncValue.cc:97
const IOVSyncValue & last() const
void swapFinders(std::vector< boost::shared_ptr< EventSetupRecordIntervalFinder > > &)
virtual void setIntervalFor(const EventSetupRecordKey &, const IOVSyncValue &, ValidityInterval &)
static const IOVSyncValue & beginOfTime()
std::vector< boost::shared_ptr< EventSetupRecordIntervalFinder > > finders_
void setLast(const IOVSyncValue &iTime)
static const ValidityInterval & invalidInterval()
const IOVSyncValue & first() const
void findingRecordWithKey(const eventsetup::EventSetupRecordKey &)
static const IOVSyncValue & invalidIOVSyncValue()
Definition: IOVSyncValue.cc:92