29 #ifndef RYTHMOS_TIME_RANGE_DECL_H
30 #define RYTHMOS_TIME_RANGE_DECL_H
32 #include "Rythmos_ConfigDefs.h"
61 template<
class TimeType>
62 int compareTimeValues(
const TimeType &t1,
const TimeType &t2 );
71 template<
class TimeType>
77 : lower_(0.0), upper_(-1.0)
80 TimeRange(
const TimeType &my_lower,
const TimeType &my_upper )
81 : lower_(my_lower), upper_(my_upper)
92 bool isValid()
const {
return (lower_ <= upper_); }
94 TimeType
lower()
const {
return lower_; }
96 TimeType
upper()
const {
return upper_; }
98 TimeType
length()
const {
return (upper_ - lower_); }
113 newRange.lower_ *= scale;
114 newRange.upper_ *= scale;
127 template<
class TimeType>
128 TimeRange<TimeType> timeRange(
const TimeType my_lower,
const TimeType my_upper);
135 template<
class TimeType>
136 TimeRange<TimeType> invalidTimeRange();
143 template<
class TimeType>
144 std::ostream& operator<<( std::ostream& out, const TimeRange<TimeType>& range );
150 template<
class TimeType>
151 void asssertInTimeRange(
const TimeRange<TimeType> &timeRange,
152 const TimeType &time );
161 template<
class TimeType>
162 bool isInRange_cc(
const TimeRange<TimeType> &tr,
const TimeType &p);
171 template<
class TimeType>
172 bool isInRange_oc(
const TimeRange<TimeType> &tr,
const TimeType &p);
181 template<
class TimeType>
182 bool isInRange_co(
const TimeRange<TimeType> &tr,
const TimeType &p);
191 template<
class TimeType>
192 bool isInRange_oo(
const TimeRange<TimeType> &tr,
const TimeType &p);
194 template<
class TimeType>
195 class TimeRange_cc :
virtual public TimeRange<TimeType>
198 TimeRange_cc(
const TimeRange<TimeType>& tr)
199 :TimeRange<TimeType>(tr)
202 TimeRange_cc(
const TimeType &my_lower,
const TimeType &my_upper )
206 bool isInRange (
const TimeType &t )
const
208 return ( isInRange_cc<TimeType>(*
this,t) );
212 template<
class TimeType>
213 class TimeRange_co :
virtual public TimeRange<TimeType>
216 TimeRange_co(
const TimeRange<TimeType>& tr)
220 TimeRange_co(
const TimeType &my_lower,
const TimeType &my_upper )
224 bool isInRange (
const TimeType &t )
const
226 return ( isInRange_co<TimeType>(*
this,t) );
230 template<
class TimeType>
231 class TimeRange_oo :
virtual public TimeRange<TimeType>
234 TimeRange_oo(
const TimeRange<TimeType>& tr)
238 TimeRange_oo(
const TimeType &my_lower,
const TimeType &my_upper )
242 bool isInRange (
const TimeType &t )
const
244 return ( isInRange_oo<TimeType>(*
this,t) );
248 template<
class TimeType>
249 class TimeRange_oc :
virtual public TimeRange<TimeType>
252 TimeRange_oc(
const TimeRange<TimeType>& tr)
256 TimeRange_oc(
const TimeType &my_lower,
const TimeType &my_upper )
260 bool isInRange (
const TimeType &t )
const
262 return ( isInRange_oc<TimeType>(*
this,t) );
270 #endif //RYTHMOS_TIME_RANGE_DECL_H
TimeRange(const TimeType &my_lower, const TimeType &my_upper)
Construct a valid range.
virtual bool isInRange(const TimeType &t) const
TimeRange()
Construct an invalid range.
int compareTimeValues(const TimeType &t1, const TimeType &t2)
Compare two times taking into account floating point errors.
TimeRange(const TimeRange< TimeType > &tr)
Copy constructor.
TimeRange< TimeType > copyAndScale(const TimeType &scale) const