29#ifndef RYTHMOS_TIME_RANGE_DECL_H
30#define RYTHMOS_TIME_RANGE_DECL_H
32#include "Rythmos_ConfigDefs.h"
61template<
class TimeType>
71template<
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;
127template<
class TimeType>
135template<
class TimeType>
143template<
class TimeType>
150template<
class TimeType>
152 const TimeType &time );
161template<
class TimeType>
171template<
class TimeType>
181template<
class TimeType>
191template<
class TimeType>
194template<
class TimeType>
195class 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) );
212template<
class TimeType>
213class 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) );
230template<
class TimeType>
231class 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) );
248template<
class TimeType>
249class 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) );
TimeRange(const TimeRange< TimeType > &tr)
Copy constructor.
std::ostream & operator<<(std::ostream &out, const TimeRange< TimeType > &range)
Output operator.
int compareTimeValues(const TimeType &t1, const TimeType &t2)
Compare two times taking into account floating point errors.
TimeRange< TimeType > invalidTimeRange()
Nonmember constructor.
bool isInRange_oo(const TimeRange< TimeType > &tr, const TimeType &p)
Nonmember isInRange function (open, open).
TimeRange< TimeType > copyAndScale(const TimeType &scale) const
bool isInRange_co(const TimeRange< TimeType > &tr, const TimeType &p)
Nonmember isInRange function [closed, open).
virtual bool isInRange(const TimeType &t) const
TimeRange(const TimeType &my_lower, const TimeType &my_upper)
Construct a valid range.
bool isInRange_cc(const TimeRange< TimeType > &tr, const TimeType &p)
Nonmember isInRange function [closed, closed].
bool isInRange_oc(const TimeRange< TimeType > &tr, const TimeType &p)
Nonmember isInRange function (open, closed].
TimeRange()
Construct an invalid range.
TimeRange< TimeType > timeRange(const TimeType my_lower, const TimeType my_upper)
Nonmember constructor.