forked from KFTrack/KinKal
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTimeRange.cc
More file actions
26 lines (23 loc) · 704 Bytes
/
Copy pathTimeRange.cc
File metadata and controls
26 lines (23 loc) · 704 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include "KinKal/General/TimeRange.hh"
namespace KinKal {
bool TimeRange::restrict(TimeRange const& other ) {
bool retval = overlaps(other);
if(retval){
range_[0] = std::max(begin(),other.begin());
range_[1] = std::min(end(),other.end());
}
return retval;
}
void TimeRange::extend(double time, TimeDir tdir) {
// require the resulting range to be >0
if(tdir == TimeDir::forwards){
if(time > range_[0])range_[1] = time;
} else {
if(time < range_[1])range_[0] = time;
}
}
std::ostream& operator <<(std::ostream& ost, TimeRange const& trange) {
ost << " Range [" << trange.begin() << "," << trange.end() << "]";
return ost;
}
}