00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef PPL_Interval_defs_hh
00024 #define PPL_Interval_defs_hh 1
00025
00026 #include "Interval.types.hh"
00027 #include "Coefficient.defs.hh"
00028 #include "Checked_Number.defs.hh"
00029 #include <gmpxx.h>
00030 #include <iosfwd>
00031
00032 namespace Parma_Polyhedra_Library {
00033
00034 typedef Checked_Number<mpq_class, Extended_Number_Policy> ERational;
00035
00036 }
00037
00038 namespace Parma_Polyhedra_Library {
00039
00040 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00042
00043 #endif // PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00044 bool operator<(const Boundary& x, const Boundary& y);
00045
00046 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00048
00049 #endif // PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00050 bool operator>(const Boundary& x, const Boundary& y);
00051
00052 }
00053
00054
00055 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00057
00061 #endif // PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00062 class Parma_Polyhedra_Library::Boundary {
00063 protected:
00065 enum Flag {
00067 NEG = -1,
00069 ZERO = 0,
00071 POS = 1
00072 };
00073
00075 ERational value;
00077 Flag flag;
00078
00080 Boundary(const ERational& v, Flag f);
00081
00082 friend bool
00083 Parma_Polyhedra_Library::operator<(const Boundary& x, const Boundary& y);
00084 friend bool
00085 Parma_Polyhedra_Library::operator>(const Boundary& x, const Boundary& y);
00086
00087 public:
00089 bool is_closed() const;
00090
00092 const ERational& bound() const;
00093
00095 ERational& bound();
00096 };
00097
00098
00099 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00101
00102 #endif // PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00103 class Parma_Polyhedra_Library::LBoundary : public Boundary {
00104 public:
00106 enum Open_Closed {
00108 OPEN = Boundary::POS,
00110 CLOSED = Boundary::ZERO
00111 };
00112
00114 LBoundary(const ERational& v, Open_Closed f);
00115
00117 bool OK() const;
00118 };
00119
00120 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00122
00123 #endif // PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00124 class Parma_Polyhedra_Library::UBoundary : public Boundary {
00125 public:
00127 enum Open_Closed {
00129 OPEN = Boundary::NEG,
00131 CLOSED = Boundary::ZERO
00132 };
00133
00135 UBoundary(const ERational& v, Open_Closed f);
00136
00138 bool OK() const;
00139 };
00140
00141 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00143
00154 #endif // PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00155
00156 class Parma_Polyhedra_Library::Interval {
00157 public:
00159 Interval();
00160
00162 bool is_empty() const;
00163
00165 const LBoundary& lower_bound() const;
00166
00168 LBoundary& lower_bound();
00169
00171 const UBoundary& upper_bound() const;
00172
00174 UBoundary& upper_bound();
00175
00180 void raise_lower_bound(LBoundary new_lower);
00181
00186 void lower_upper_bound(UBoundary new_upper);
00187
00189 void set_empty();
00190
00192 bool OK() const;
00193
00194 private:
00196 LBoundary lower;
00197
00199 UBoundary upper;
00200 };
00201
00202 #include "Interval.inlines.hh"
00203
00204 #endif // !defined(PPL_Interval_defs_hh)