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_Generator_defs_hh
00025 #define PPL_Generator_defs_hh 1
00026
00027 #include "Generator.types.hh"
00028 #include "Scalar_Products.types.hh"
00029 #include "Row.defs.hh"
00030 #include "Variable.defs.hh"
00031 #include "Constraint_System.types.hh"
00032 #include "Generator_System.defs.hh"
00033 #include "Congruence_System.types.hh"
00034 #include "Linear_Expression.defs.hh"
00035 #include "Polyhedron.types.hh"
00036 #include "Grid_Generator.types.hh"
00037 #include "Grid_Generator_System.types.hh"
00038 #include "Checked_Number.defs.hh"
00039 #include "distances.defs.hh"
00040 #include <iosfwd>
00041
00042 namespace Parma_Polyhedra_Library {
00043
00044
00045
00046 namespace IO_Operators {
00047
00049
00050 std::ostream& operator<<(std::ostream& s, const Generator& g);
00051
00052 }
00053
00054 }
00055
00056 namespace std {
00057
00059
00060 void swap(Parma_Polyhedra_Library::Generator& x,
00061 Parma_Polyhedra_Library::Generator& y);
00062
00063 }
00064
00065
00067
00244 class Parma_Polyhedra_Library::Generator : private Linear_Row {
00245 public:
00247
00252 static Generator line(const Linear_Expression& e);
00253
00255
00260 static Generator ray(const Linear_Expression& e);
00261
00263
00270 static Generator point(const Linear_Expression& e
00271 = Linear_Expression::zero(),
00272 Coefficient_traits::const_reference d
00273 = Coefficient_one());
00274
00276
00283 static Generator
00284 closure_point(const Linear_Expression& e = Linear_Expression::zero(),
00285 Coefficient_traits::const_reference d = Coefficient_one());
00286
00288 Generator(const Generator& g);
00289
00291 ~Generator();
00292
00294 Generator& operator=(const Generator& g);
00295
00297 static dimension_type max_space_dimension();
00298
00300 dimension_type space_dimension() const;
00301
00303 enum Type {
00305 LINE,
00307 RAY,
00309 POINT,
00311 CLOSURE_POINT
00312 };
00313
00315 Type type() const;
00316
00318 bool is_line() const;
00319
00321 bool is_ray() const;
00322
00323 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00324
00325 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
00326 bool is_line_or_ray() const;
00327
00329 bool is_point() const;
00330
00332 bool is_closure_point() const;
00333
00335
00340 Coefficient_traits::const_reference coefficient(Variable v) const;
00341
00343
00347 Coefficient_traits::const_reference divisor() const;
00348
00350 static void initialize();
00351
00353 static void finalize();
00354
00356 static const Generator& zero_dim_point();
00357
00362 static const Generator& zero_dim_closure_point();
00363
00368 memory_size_type total_memory_in_bytes() const;
00369
00371 memory_size_type external_memory_in_bytes() const;
00372
00379 bool is_equivalent_to(const Generator& y) const;
00380
00381 PPL_OUTPUT_DECLARATIONS
00382
00388 bool ascii_load(std::istream& s);
00389
00391 bool OK() const;
00392
00394 void swap(Generator& y);
00395
00396 private:
00401 static const Generator* zero_dim_point_p;
00402
00407 static const Generator* zero_dim_closure_point_p;
00408
00413 Generator(Linear_Expression& e, Type type, Topology topology);
00414
00419 void
00420 throw_dimension_incompatible(const char* method,
00421 const char* name_var,
00422 Variable v) const;
00423
00428 void
00429 throw_invalid_argument(const char* method, const char* reason) const;
00430
00431 friend class Parma_Polyhedra_Library::Scalar_Products;
00432 friend class Parma_Polyhedra_Library::Topology_Adjusted_Scalar_Product_Sign;
00433 friend class Parma_Polyhedra_Library::Topology_Adjusted_Scalar_Product_Assign;
00434 friend class Parma_Polyhedra_Library::Generator_System;
00435 friend class Parma_Polyhedra_Library::Generator_System::const_iterator;
00436
00437 friend class Parma_Polyhedra_Library::Polyhedron;
00438 friend class Parma_Polyhedra_Library::Grid_Generator;
00439
00440 friend class Parma_Polyhedra_Library::Grid_Generator_System;
00441
00442 friend
00443 Parma_Polyhedra_Library
00444 ::Linear_Expression::Linear_Expression(const Generator& g);
00445
00446 friend std::ostream&
00447 Parma_Polyhedra_Library::IO_Operators::operator<<(std::ostream& s,
00448 const Generator& g);
00449
00451 Generator(const Generator& g, dimension_type dimension);
00452
00454 bool is_ray_or_point() const;
00455
00457 void set_is_line();
00458
00460 void set_is_ray_or_point();
00461
00469 bool is_matching_closure_point(const Generator& p) const;
00470
00472 Generator();
00473 };
00474
00475
00476 namespace Parma_Polyhedra_Library {
00477
00479
00480 Generator line(const Linear_Expression& e);
00481
00483
00484 Generator ray(const Linear_Expression& e);
00485
00492 Generator
00493 point(const Linear_Expression& e = Linear_Expression::zero(),
00494 Coefficient_traits::const_reference d = Coefficient_one());
00495
00502 Generator
00503 closure_point(const Linear_Expression& e = Linear_Expression::zero(),
00504 Coefficient_traits::const_reference d = Coefficient_one());
00505
00507
00508 bool operator==(const Generator& x, const Generator& y);
00509
00511
00512 bool operator!=(const Generator& x, const Generator& y);
00513
00515
00529 template <typename To>
00530 bool rectilinear_distance_assign(Checked_Number<To, Extended_Number_Policy>& r,
00531 const Generator& x,
00532 const Generator& y,
00533 Rounding_Dir dir);
00534
00536
00550 template <typename Temp, typename To>
00551 bool rectilinear_distance_assign(Checked_Number<To, Extended_Number_Policy>& r,
00552 const Generator& x,
00553 const Generator& y,
00554 Rounding_Dir dir);
00555
00557
00571 template <typename Temp, typename To>
00572 bool rectilinear_distance_assign(Checked_Number<To, Extended_Number_Policy>& r,
00573 const Generator& x,
00574 const Generator& y,
00575 Rounding_Dir dir,
00576 Temp& tmp0,
00577 Temp& tmp1,
00578 Temp& tmp2);
00579
00581
00595 template <typename To>
00596 bool euclidean_distance_assign(Checked_Number<To, Extended_Number_Policy>& r,
00597 const Generator& x,
00598 const Generator& y,
00599 Rounding_Dir dir);
00600
00602
00616 template <typename Temp, typename To>
00617 bool rectilinear_distance_assign(Checked_Number<To, Extended_Number_Policy>& r,
00618 const Generator& x,
00619 const Generator& y,
00620 Rounding_Dir dir);
00621
00623
00637 template <typename Temp, typename To>
00638 bool euclidean_distance_assign(Checked_Number<To, Extended_Number_Policy>& r,
00639 const Generator& x,
00640 const Generator& y,
00641 Rounding_Dir dir,
00642 Temp& tmp0,
00643 Temp& tmp1,
00644 Temp& tmp2);
00645
00647
00661 template <typename To>
00662 bool l_infinity_distance_assign(Checked_Number<To, Extended_Number_Policy>& r,
00663 const Generator& x,
00664 const Generator& y,
00665 Rounding_Dir dir);
00666
00668
00682 template <typename Temp, typename To>
00683 bool l_infinity_distance_assign(Checked_Number<To, Extended_Number_Policy>& r,
00684 const Generator& x,
00685 const Generator& y,
00686 Rounding_Dir dir);
00687
00689
00703 template <typename Temp, typename To>
00704 bool l_infinity_distance_assign(Checked_Number<To, Extended_Number_Policy>& r,
00705 const Generator& x,
00706 const Generator& y,
00707 Rounding_Dir dir,
00708 Temp& tmp0,
00709 Temp& tmp1,
00710 Temp& tmp2);
00711
00712 namespace IO_Operators {
00713
00715
00716 std::ostream& operator<<(std::ostream& s, const Generator::Type& t);
00717
00718 }
00719
00720 }
00721
00722 #include "Generator.inlines.hh"
00723
00724 #endif // !defined(PPL_Generator_defs_hh)