00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef PPL_Grid_Generator_defs_hh
00025 #define PPL_Grid_Generator_defs_hh 1
00026
00027 #include "Grid_Generator.types.hh"
00028 #include "Coefficient.defs.hh"
00029 #include "Grid_Generator_System.defs.hh"
00030 #include "Generator.defs.hh"
00031 #include "Grid.types.hh"
00032 #include <iosfwd>
00033
00034 namespace Parma_Polyhedra_Library {
00035
00036
00037
00038 namespace IO_Operators {
00039
00041
00042 std::ostream& operator<<(std::ostream& s, const Grid_Generator& g);
00043
00044 }
00045
00046 }
00047
00048 namespace std {
00049
00051
00052 void swap(Parma_Polyhedra_Library::Grid_Generator& x,
00053 Parma_Polyhedra_Library::Grid_Generator& y);
00054
00055 }
00056
00058
00228 class Parma_Polyhedra_Library::Grid_Generator : private Generator {
00229 public:
00231
00236 static Grid_Generator grid_line(const Linear_Expression& e);
00237
00239
00246 static Grid_Generator parameter(const Linear_Expression& e
00247 = Linear_Expression::zero(),
00248 Coefficient_traits::const_reference d
00249 = Coefficient_one());
00250
00252
00259 static Grid_Generator grid_point(const Linear_Expression& e
00260 = Linear_Expression::zero(),
00261 Coefficient_traits::const_reference d
00262 = Coefficient_one());
00263
00265 Grid_Generator(const Grid_Generator& g);
00266
00268 ~Grid_Generator();
00269
00271 Grid_Generator& operator=(const Grid_Generator& g);
00272
00274 Grid_Generator& operator=(const Generator& g);
00275
00277 static dimension_type max_space_dimension();
00278
00280 dimension_type space_dimension() const;
00281
00283 enum Type {
00285 LINE,
00287 PARAMETER,
00289 POINT
00290 };
00291
00293 Type type() const;
00294
00296 bool is_line() const;
00297
00299 bool is_parameter() const;
00300
00305 bool is_line_or_parameter() const;
00306
00308 bool is_point() const;
00309
00314 bool is_parameter_or_point() const;
00315
00317
00322 Coefficient_traits::const_reference coefficient(Variable v) const;
00323
00325
00329 Coefficient_traits::const_reference divisor() const;
00330
00332 static void initialize();
00333
00335 static void finalize();
00336
00338 static const Grid_Generator& zero_dim_point();
00339
00344 memory_size_type total_memory_in_bytes() const;
00345
00347 memory_size_type external_memory_in_bytes() const;
00348
00355 bool is_equivalent_to(const Grid_Generator& y) const;
00356
00358 bool is_equal_to(const Grid_Generator& y) const;
00359
00364 bool is_equal_at_dimension(dimension_type dim,
00365 const Grid_Generator& gg) const;
00366
00371 bool all_homogeneous_terms_are_zero() const;
00372
00373 PPL_OUTPUT_DECLARATIONS
00374
00380 bool ascii_load(std::istream& s);
00381
00383 bool OK() const;
00384
00386 void swap(Grid_Generator& y);
00387
00396 void coefficient_swap(Grid_Generator& y);
00397
00398 private:
00403 static const Grid_Generator* zero_dim_point_p;
00404
00414 void scale_to_divisor(Coefficient_traits::const_reference d);
00415
00423 explicit Grid_Generator(Generator g);
00424
00426 dimension_type size() const;
00427
00429 void negate(dimension_type start, dimension_type end);
00430
00432
00436 void set_divisor(Coefficient_traits::const_reference d);
00437
00439 void set_is_line();
00440
00442 void set_is_parameter_or_point();
00443
00445 void set_is_parameter();
00446
00456 void strong_normalize();
00457
00459 Coefficient& operator[](dimension_type k);
00460
00462 Coefficient_traits::const_reference operator[](dimension_type k) const;
00463
00468 void
00469 throw_invalid_argument(const char* method, const char* reason) const;
00470
00471 friend std::ostream&
00472 IO_Operators::operator<<(std::ostream& s, const Grid_Generator& g);
00473
00474
00475
00476 friend class Grid;
00477 friend class Grid_Generator_System;
00478 friend class Grid_Generator_System::const_iterator;
00479 friend class Congruence_System;
00480 friend class Scalar_Products;
00481 friend class Topology_Adjusted_Scalar_Product_Sign;
00482 friend class Linear_Expression;
00483 };
00484
00485
00486 namespace Parma_Polyhedra_Library {
00487
00493 Grid_Generator grid_line(const Linear_Expression& e);
00494
00501 Grid_Generator
00502 parameter(const Linear_Expression& e = Linear_Expression::zero(),
00503 Coefficient_traits::const_reference d = Coefficient_one());
00504
00511 Grid_Generator
00512 grid_point(const Linear_Expression& e = Linear_Expression::zero(),
00513 Coefficient_traits::const_reference d = Coefficient_one());
00514
00516
00517 bool operator==(const Grid_Generator& x, const Grid_Generator& y);
00518
00520
00521 bool operator!=(const Grid_Generator& x, const Grid_Generator& y);
00522
00523
00524 namespace IO_Operators {
00525
00527
00528 std::ostream& operator<<(std::ostream& s, const Grid_Generator::Type& t);
00529
00530 }
00531
00532 }
00533
00534 #include "Grid_Generator.inlines.hh"
00535
00536 #endif // !defined(PPL_Grid_Generator_defs_hh)