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_); }
111 if (!newRange.isValid())
113 newRange.lower_ *= scale;
114 newRange.upper_ *= scale;
127 template<
class TimeType>
135 template<
class TimeType>
143 template<
class TimeType>
144 std::ostream& operator<<( std::ostream& out, const TimeRange<TimeType>& range );
150 template<
class TimeType>
152 const TimeType &time );
161 template<
class TimeType>
171 template<
class TimeType>
181 template<
class TimeType>
191 template<
class TimeType>
194 template<
class TimeType>
195 class TimeRange_cc :
virtual public TimeRange<TimeType>
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>
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>
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>
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< TimeType > invalidTimeRange()
Nonmember constructor.
bool isInRange_co(const TimeRange< TimeType > &tr, const TimeType &p)
Nonmember isInRange function [closed, open).
bool isInRange_oc(const TimeRange< TimeType > &tr, const TimeType &p)
Nonmember isInRange function (open, closed].
TimeRange(const TimeType &my_lower, const TimeType &my_upper)
Construct a valid range.
TimeRange()
Construct an invalid range.
TimeRange< TimeType > copyAndScale(const TimeType &scale) const
bool isInRange_cc(const TimeRange< TimeType > &tr, const TimeType &p)
Nonmember isInRange function [closed, closed].
bool isInRange_oo(const TimeRange< TimeType > &tr, const TimeType &p)
Nonmember isInRange function (open, open).
virtual bool isInRange(const TimeType &t) const
TimeRange< TimeType > timeRange(const TimeType my_lower, const TimeType my_upper)
Nonmember constructor.
int compareTimeValues(const TimeType &t1, const TimeType &t2)
Compare two times taking into account floating point errors.
TimeRange(const TimeRange< TimeType > &tr)
Copy constructor.