00001 00002 // simpleinterval.h 00003 // 00004 // Purpose: SimpleTimeInterval has two SimpleTime 00005 // objects, startPoint being before endPoint. 00006 // distance in time. Various comparison and 00007 // conversion functions are supported. 00008 // 00009 // Author: Erik Zeitler Date: 2000-09-06 00010 // 00012 00013 #ifndef SIMPLE_INTERVAL_H 00014 #define SIMPLE_INTERVAL_H 00015 #include "SimpleTime.h" 00016 00017 class SimpleTimeDuration; 00018 00019 00030 class SimpleTimeInterval { 00031 public: 00032 // Construction/Destruction 00033 SimpleTimeInterval() {}; 00034 SimpleTimeInterval(const SimpleTimeInterval &i); 00035 SimpleTimeInterval(const SimpleTime & start, 00036 const SimpleTime & end); 00037 ~SimpleTimeInterval() {}; 00038 00039 // Operators 00040 void operator = (const SimpleTimeInterval &); 00041 00042 // Comparison 00043 // Other comparison operators not listed here, 00044 // like startsBefore and endsAfter, can be implemented on demand 00045 bool contains(const SimpleTimeInterval&) const; 00046 bool contains(const SimpleTime&) const; 00047 bool overlapsWith(const SimpleTimeInterval&) const; 00048 bool endsBefore(const SimpleTimeInterval&) const; 00049 bool startsAfter(const SimpleTimeInterval&) const; 00050 00051 // Aux. methods 00052 SimpleTime start() const; 00053 SimpleTime end() const; 00054 void setStart(const SimpleTime &); 00055 void setEnd(const SimpleTime &); 00056 void setInterval(const SimpleTimeInterval &); 00057 void setInterval(const SimpleTime &, const SimpleTime &); 00058 SimpleTimeDuration duration() const; 00059 00060 private: 00061 SimpleTime startPoint; 00062 SimpleTime endPoint; 00063 }; 00064 #endif