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_Generator_defs_hh
00024 #define PPL_Generator_defs_hh 1
00025
00026 #include "Generator.types.hh"
00027 #include "Scalar_Products.types.hh"
00028 #include "Row.defs.hh"
00029 #include "Variable.defs.hh"
00030 #include "Constraint_System.types.hh"
00031 #include "Generator_System.defs.hh"
00032 #include "Congruence_System.types.hh"
00033 #include "Linear_Expression.defs.hh"
00034 #include "Polyhedron.types.hh"
00035 #include "Grid_Generator.types.hh"
00036 #include "Grid_Generator_System.types.hh"
00037 #include "Checked_Number.defs.hh"
00038 #include "distances.defs.hh"
00039 #include <iosfwd>
00040
00041 namespace Parma_Polyhedra_Library {
00042
00043
00044
00045 namespace IO_Operators {
00046
00048
00049 std::ostream& operator<<(std::ostream& s, const Generator& g);
00050
00051 }
00052
00053 }
00054
00055 namespace std {
00056
00058
00059 void swap(Parma_Polyhedra_Library::Generator& x,
00060 Parma_Polyhedra_Library::Generator& y);
00061
00062 }
00063
00064
00066
00243 class Parma_Polyhedra_Library::Generator : private Linear_Row {
00244 public:
00246
00251 static Generator line(const Linear_Expression& e);
00252
00254
00259 static Generator ray(const Linear_Expression& e);
00260
00262
00269 static Generator point(const Linear_Expression& e
00270 = Linear_Expression::zero(),
00271 Coefficient_traits::const_reference d
00272 = Coefficient_one());
00273
00275
00282 static Generator
00283 closure_point(const Linear_Expression& e = Linear_Expression::zero(),
00284 Coefficient_traits::const_reference d = Coefficient_one());
00285
00287 Generator(const Generator& g);
00288
00290 ~Generator();
00291
00293 Generator& operator=(const Generator& g);
00294
00296 static dimension_type max_space_dimension();
00297
00299 dimension_type space_dimension() const;
00300
00302 enum Type {
00304 LINE,
00306 RAY,
00308 POINT,
00310 CLOSURE_POINT
00311 };
00312
00314 Type type() const;
00315
00317 bool is_line() const;
00318
00320 bool is_ray() const;
00321
00322 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00324 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
00325 bool is_line_or_ray() const;
00326
00328 bool is_point() const;
00329
00331 bool is_closure_point() const;
00332
00334
00339 Coefficient_traits::const_reference coefficient(Variable v) const;
00340
00342
00346 Coefficient_traits::const_reference divisor() const;
00347
00349 static void initialize();
00350
00352 static void finalize();
00353
00355 static const Generator& zero_dim_point();
00356
00361 static const Generator& zero_dim_closure_point();
00362
00367 memory_size_type total_memory_in_bytes() const;
00368
00370 memory_size_type external_memory_in_bytes() const;
00371
00378 bool is_equivalent_to(const Generator& y) const;
00379
00380 PPL_OUTPUT_DECLARATIONS
00381
00382 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00383
00388 #endif
00389 bool ascii_load(std::istream& s);
00390
00392 bool OK() const;
00393
00395 void swap(Generator& y);
00396
00397 private:
00402 static const Generator* zero_dim_point_p;
00403
00408 static const Generator* zero_dim_closure_point_p;
00409
00414 Generator(Linear_Expression& e, Type type, Topology topology);
00415
00420 void
00421 throw_dimension_incompatible(const char* method,
00422 const char* name_var,
00423 Variable v) const;
00424
00429 void
00430 throw_invalid_argument(const char* method, const char* reason) const;
00431
00432 friend class Parma_Polyhedra_Library::Scalar_Products;
00433 friend class Parma_Polyhedra_Library::Topology_Adjusted_Scalar_Product_Sign;
00434 friend class Parma_Polyhedra_Library::Topology_Adjusted_Scalar_Product_Assign;
00435 friend class Parma_Polyhedra_Library::Generator_System;
00436 friend class Parma_Polyhedra_Library::Generator_System::const_iterator;
00437
00438 friend class Parma_Polyhedra_Library::Polyhedron;
00439 friend class Parma_Polyhedra_Library::Grid_Generator;
00440
00441 friend class Parma_Polyhedra_Library::Grid_Generator_System;
00442
00443 friend
00444 Parma_Polyhedra_Library
00445 ::Linear_Expression::Linear_Expression(const Generator& g);
00446
00447 friend std::ostream&
00448 Parma_Polyhedra_Library::IO_Operators::operator<<(std::ostream& s,
00449 const Generator& g);
00450
00452 Generator(const Generator& g, dimension_type dimension);
00453
00455 bool is_ray_or_point() const;
00456
00458 void set_is_line();
00459
00461 void set_is_ray_or_point();
00462
00470 bool is_matching_closure_point(const Generator& p) const;
00471
00473 Generator();
00474 };
00475
00476
00477 namespace Parma_Polyhedra_Library {
00478
00480
00481 Generator line(const Linear_Expression& e);
00482
00484
00485 Generator ray(const Linear_Expression& e);
00486
00493 Generator
00494 point(const Linear_Expression& e = Linear_Expression::zero(),
00495 Coefficient_traits::const_reference d = Coefficient_one());
00496
00503 Generator
00504 closure_point(const Linear_Expression& e = Linear_Expression::zero(),
00505 Coefficient_traits::const_reference d = Coefficient_one());
00506
00508
00509 bool operator==(const Generator& x, const Generator& y);
00510
00512
00513 bool operator!=(const Generator& x, const Generator& y);
00514
00516
00530 template <typename To>
00531 bool rectilinear_distance_assign(Checked_Number<To, Extended_Number_Policy>& r,
00532 const Generator& x,
00533 const Generator& y,
00534 Rounding_Dir dir);
00535
00537
00551 template <typename Temp, typename To>
00552 bool rectilinear_distance_assign(Checked_Number<To, Extended_Number_Policy>& r,
00553 const Generator& x,
00554 const Generator& y,
00555 Rounding_Dir dir);
00556
00558
00572 template <typename Temp, typename To>
00573 bool rectilinear_distance_assign(Checked_Number<To, Extended_Number_Policy>& r,
00574 const Generator& x,
00575 const Generator& y,
00576 Rounding_Dir dir,
00577 Temp& tmp0,
00578 Temp& tmp1,
00579 Temp& tmp2);
00580
00582
00596 template <typename To>
00597 bool euclidean_distance_assign(Checked_Number<To, Extended_Number_Policy>& r,
00598 const Generator& x,
00599 const Generator& y,
00600 Rounding_Dir dir);
00601
00603
00617 template <typename Temp, typename To>
00618 bool rectilinear_distance_assign(Checked_Number<To, Extended_Number_Policy>& r,
00619 const Generator& x,
00620 const Generator& y,
00621 Rounding_Dir dir);
00622
00624
00638 template <typename Temp, typename To>
00639 bool euclidean_distance_assign(Checked_Number<To, Extended_Number_Policy>& r,
00640 const Generator& x,
00641 const Generator& y,
00642 Rounding_Dir dir,
00643 Temp& tmp0,
00644 Temp& tmp1,
00645 Temp& tmp2);
00646
00648
00662 template <typename To>
00663 bool l_infinity_distance_assign(Checked_Number<To, Extended_Number_Policy>& r,
00664 const Generator& x,
00665 const Generator& y,
00666 Rounding_Dir dir);
00667
00669
00683 template <typename Temp, typename To>
00684 bool l_infinity_distance_assign(Checked_Number<To, Extended_Number_Policy>& r,
00685 const Generator& x,
00686 const Generator& y,
00687 Rounding_Dir dir);
00688
00690
00704 template <typename Temp, typename To>
00705 bool l_infinity_distance_assign(Checked_Number<To, Extended_Number_Policy>& r,
00706 const Generator& x,
00707 const Generator& y,
00708 Rounding_Dir dir,
00709 Temp& tmp0,
00710 Temp& tmp1,
00711 Temp& tmp2);
00712
00713 namespace IO_Operators {
00714
00716
00717 std::ostream& operator<<(std::ostream& s, const Generator::Type& t);
00718
00719 }
00720
00721 }
00722
00723 #include "Generator.inlines.hh"
00724
00725 #endif // !defined(PPL_Generator_defs_hh)