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_Grid_Generator_defs_hh
00024 #define PPL_Grid_Generator_defs_hh 1
00025
00026 #include "Grid_Generator.types.hh"
00027 #include "Coefficient.defs.hh"
00028 #include "Grid_Generator_System.defs.hh"
00029 #include "Generator.defs.hh"
00030 #include "Grid.types.hh"
00031
00032
00033 #include "Box.types.hh"
00034 #include <iosfwd>
00035
00036 namespace Parma_Polyhedra_Library {
00037
00038
00039
00040 namespace IO_Operators {
00041
00043
00044 std::ostream& operator<<(std::ostream& s, const Grid_Generator& g);
00045
00046 }
00047
00048 }
00049
00050 namespace std {
00051
00053
00054 void swap(Parma_Polyhedra_Library::Grid_Generator& x,
00055 Parma_Polyhedra_Library::Grid_Generator& y);
00056
00057 }
00058
00060
00230 class Parma_Polyhedra_Library::Grid_Generator : private Generator {
00231 public:
00233
00238 static Grid_Generator grid_line(const Linear_Expression& e);
00239
00241
00248 static Grid_Generator parameter(const Linear_Expression& e
00249 = Linear_Expression::zero(),
00250 Coefficient_traits::const_reference d
00251 = Coefficient_one());
00252
00254
00261 static Grid_Generator grid_point(const Linear_Expression& e
00262 = Linear_Expression::zero(),
00263 Coefficient_traits::const_reference d
00264 = Coefficient_one());
00265
00267 Grid_Generator(const Grid_Generator& g);
00268
00270 ~Grid_Generator();
00271
00273 Grid_Generator& operator=(const Grid_Generator& g);
00274
00276 Grid_Generator& operator=(const Generator& g);
00277
00279 static dimension_type max_space_dimension();
00280
00282 dimension_type space_dimension() const;
00283
00285 enum Type {
00287 LINE,
00289 PARAMETER,
00291 POINT
00292 };
00293
00295 Type type() const;
00296
00298 bool is_line() const;
00299
00301 bool is_parameter() const;
00302
00307 bool is_line_or_parameter() const;
00308
00310 bool is_point() const;
00311
00316 bool is_parameter_or_point() const;
00317
00319
00324 Coefficient_traits::const_reference coefficient(Variable v) const;
00325
00327
00331 Coefficient_traits::const_reference divisor() const;
00332
00334 static void initialize();
00335
00337 static void finalize();
00338
00340 static const Grid_Generator& zero_dim_point();
00341
00346 memory_size_type total_memory_in_bytes() const;
00347
00349 memory_size_type external_memory_in_bytes() const;
00350
00357 bool is_equivalent_to(const Grid_Generator& y) const;
00358
00360 bool is_equal_to(const Grid_Generator& y) const;
00361
00366 bool is_equal_at_dimension(dimension_type dim,
00367 const Grid_Generator& gg) const;
00368
00373 bool all_homogeneous_terms_are_zero() const;
00374
00375 PPL_OUTPUT_DECLARATIONS
00376
00377 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00378
00383 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
00384 bool ascii_load(std::istream& s);
00385
00387 bool OK() const;
00388
00390 void swap(Grid_Generator& y);
00391
00400 void coefficient_swap(Grid_Generator& y);
00401
00402 private:
00407 static const Grid_Generator* zero_dim_point_p;
00408
00418 void scale_to_divisor(Coefficient_traits::const_reference d);
00419
00427 explicit Grid_Generator(Generator g);
00428
00430 dimension_type size() const;
00431
00433 void negate(dimension_type start, dimension_type end);
00434
00436
00440 void set_divisor(Coefficient_traits::const_reference d);
00441
00443 void set_is_line();
00444
00446 void set_is_parameter_or_point();
00447
00449 void set_is_parameter();
00450
00460 void strong_normalize();
00461
00463 Coefficient& operator[](dimension_type k);
00464
00466 Coefficient_traits::const_reference operator[](dimension_type k) const;
00467
00472 void
00473 throw_invalid_argument(const char* method, const char* reason) const;
00474
00475 friend std::ostream&
00476 IO_Operators::operator<<(std::ostream& s, const Grid_Generator& g);
00477
00478
00479
00480 friend class Grid;
00481
00482
00483
00484
00485
00486
00487 template <typename Interval> friend class Parma_Polyhedra_Library::Box;
00488
00489 friend class Grid_Generator_System;
00490 friend class Grid_Generator_System::const_iterator;
00491 friend class Congruence_System;
00492 friend class Scalar_Products;
00493 friend class Topology_Adjusted_Scalar_Product_Sign;
00494 friend class Linear_Expression;
00495 };
00496
00497
00498 namespace Parma_Polyhedra_Library {
00499
00505 Grid_Generator grid_line(const Linear_Expression& e);
00506
00513 Grid_Generator
00514 parameter(const Linear_Expression& e = Linear_Expression::zero(),
00515 Coefficient_traits::const_reference d = Coefficient_one());
00516
00523 Grid_Generator
00524 grid_point(const Linear_Expression& e = Linear_Expression::zero(),
00525 Coefficient_traits::const_reference d = Coefficient_one());
00526
00528
00529 bool operator==(const Grid_Generator& x, const Grid_Generator& y);
00530
00532
00533 bool operator!=(const Grid_Generator& x, const Grid_Generator& y);
00534
00535
00536 namespace IO_Operators {
00537
00539
00540 std::ostream& operator<<(std::ostream& s, const Grid_Generator::Type& t);
00541
00542 }
00543
00544 }
00545
00546 #include "Grid_Generator.inlines.hh"
00547
00548 #endif // !defined(PPL_Grid_Generator_defs_hh)