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_Constraint_System_defs_hh
00024 #define PPL_Constraint_System_defs_hh 1
00025
00026 #include "Constraint_System.types.hh"
00027 #include "Linear_Expression.types.hh"
00028 #include "Linear_System.defs.hh"
00029 #include "Generator.types.hh"
00030 #include "Polyhedron.types.hh"
00031 #include "Constraint.types.hh"
00032 #include "Congruence_System.types.hh"
00033 #include <iterator>
00034 #include <iosfwd>
00035
00036 namespace Parma_Polyhedra_Library {
00037
00038 namespace IO_Operators {
00039
00041
00046 std::ostream& operator<<(std::ostream& s, const Constraint_System& cs);
00047
00048 }
00049
00050
00052 bool operator==(const Polyhedron& x, const Polyhedron& y);
00053
00054 }
00055
00056
00057 namespace std {
00058
00060
00061 void swap(Parma_Polyhedra_Library::Constraint_System& x,
00062 Parma_Polyhedra_Library::Constraint_System& y);
00063
00064 }
00065
00067
00127 class Parma_Polyhedra_Library::Constraint_System : private Linear_System {
00128 public:
00130 Constraint_System();
00131
00133 explicit Constraint_System(const Constraint& c);
00134
00136 explicit Constraint_System(const Congruence_System& cgs);
00137
00139 Constraint_System(const Constraint_System& cs);
00140
00142 ~Constraint_System();
00143
00145 Constraint_System& operator=(const Constraint_System& y);
00146
00148 static dimension_type max_space_dimension();
00149
00151 dimension_type space_dimension() const;
00152
00157 bool has_strict_inequalities() const;
00158
00163 void clear();
00164
00169 void insert(const Constraint& c);
00170
00172 static void initialize();
00173
00175 static void finalize();
00176
00180 static const Constraint_System& zero_dim_empty();
00181
00183
00197 class const_iterator
00198 : public std::iterator<std::forward_iterator_tag,
00199 Constraint,
00200 ptrdiff_t,
00201 const Constraint*,
00202 const Constraint&> {
00203 public:
00205 const_iterator();
00206
00208 const_iterator(const const_iterator& y);
00209
00211 ~const_iterator();
00212
00214 const_iterator& operator=(const const_iterator& y);
00215
00217 const Constraint& operator*() const;
00218
00220 const Constraint* operator->() const;
00221
00223 const_iterator& operator++();
00224
00226 const_iterator operator++(int);
00227
00232 bool operator==(const const_iterator& y) const;
00233
00238 bool operator!=(const const_iterator& y) const;
00239
00240 private:
00241 friend class Constraint_System;
00242
00244 Linear_System::const_iterator i;
00245
00247 const Linear_System* csp;
00248
00250 const_iterator(const Linear_System::const_iterator& iter,
00251 const Constraint_System& csys);
00252
00254 void skip_forward();
00255 };
00256
00258 bool empty() const;
00259
00265 const_iterator begin() const;
00266
00268 const_iterator end() const;
00269
00271 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00272
00276 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
00277 bool OK() const;
00278
00279 PPL_OUTPUT_DECLARATIONS
00280
00281 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00282
00287 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
00288 bool ascii_load(std::istream& s);
00289
00291 memory_size_type total_memory_in_bytes() const;
00292
00294 memory_size_type external_memory_in_bytes() const;
00295
00297 void swap(Constraint_System& y);
00298
00299 private:
00304 static const Constraint_System* zero_dim_empty_p;
00305
00306 friend class const_iterator;
00307 friend class Parma_Polyhedra_Library::Polyhedron;
00308
00309 friend bool operator==(const Polyhedron& x, const Polyhedron& y);
00310
00312 explicit Constraint_System(Topology topol);
00313
00319 Constraint_System(Topology topol,
00320 dimension_type n_rows, dimension_type n_columns);
00321
00330 bool adjust_topology_and_space_dimension(Topology topol,
00331 dimension_type num_dimensions);
00332
00334 Constraint& operator[](dimension_type k);
00335
00337 const Constraint& operator[](dimension_type k) const;
00338
00340 bool satisfies_all_constraints(const Generator& g) const;
00341
00343
00377 void affine_preimage(dimension_type v,
00378 const Linear_Expression& expr,
00379 Coefficient_traits::const_reference denominator);
00380
00382 dimension_type num_equalities() const;
00383
00385 dimension_type num_inequalities() const;
00386
00393 void simplify();
00394
00400 void insert_pending(const Constraint& c);
00401
00403 void add_low_level_constraints();
00404 };
00405
00406
00407
00408 #endif // !defined(PPL_Constraint_System_defs_hh)