KrisLibrary  1.0.0
IntervalSet.h
1 #ifndef MATH_INTERVAL_SET_H
2 #define MATH_INTERVAL_SET_H
3 
4 #include "Interval.h"
5 #include <vector>
6 
7 namespace Math {
8 
9 struct OpenIntervalSet : public std::vector<OpenInterval>
10 {
11  typedef std::vector<OpenInterval> BaseT;
12  typedef std::vector<ClosedInterval> ClosedBaseT;
13 
14  inline void SetFull() { resize(1); (*this)[0].setFull(); }
15  inline void SetEmpty() { clear(); }
16  void Union(const BaseT&);
17  void Intersect(const BaseT&);
18  void Subtract(const ClosedBaseT&);
19  void Union(const OpenInterval&);
20  void Intersect(const OpenInterval&);
21  void Subtract(const ClosedInterval&);
22 };
23 
24 struct ClosedIntervalSet : public std::vector<ClosedInterval>
25 {
26  typedef std::vector<ClosedInterval> BaseT;
27  typedef std::vector<OpenInterval> OpenBaseT;
28 
29  inline void SetFull() { resize(1); (*this)[0].setFull(); }
30  inline void SetEmpty() { clear(); }
31  void Union(const BaseT&);
32  void Intersect(const BaseT&);
33  void Subtract(const OpenBaseT&);
34  void Union(const ClosedInterval&);
35  void Intersect(const ClosedInterval&);
36  void Subtract(const OpenInterval&);
37 };
38 
39 } //namespace Math
40 
41 #endif
An open interval (a,b)
Definition: Interval.h:31
A closed interval [a,b].
Definition: Interval.h:49
Definition: IntervalSet.h:9
Definition: IntervalSet.h:24
Contains all definitions in the Math package.
Definition: WorkspaceBound.h:12