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_Linear_Row_defs_hh
00025 #define PPL_Linear_Row_defs_hh 1
00026
00027 #include "Linear_Row.types.hh"
00028 #include "globals.defs.hh"
00029 #include "Row.defs.hh"
00030 #include "Topology.hh"
00031 #include "Linear_Expression.types.hh"
00032 #include "Constraint.types.hh"
00033 #include "Generator.types.hh"
00034
00035 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00036
00037
00123 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
00124
00125 class Parma_Polyhedra_Library::Linear_Row : public Row {
00126 public:
00128 enum Kind {
00129 LINE_OR_EQUALITY = 0,
00130 RAY_OR_POINT_OR_INEQUALITY = 1
00131 };
00132
00133 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00134
00143 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
00144 class Flags : public Row::Flags {
00145 public:
00147 Flags();
00148
00150 explicit Flags(Topology t);
00151
00153 Flags(Topology t, Kind k);
00154
00156
00157 Topology topology() const;
00158 bool is_necessarily_closed() const;
00159 bool is_not_necessarily_closed() const;
00160 bool is_line_or_equality() const;
00161 bool is_ray_or_point_or_inequality() const;
00162
00163 void set_necessarily_closed();
00164 void set_not_necessarily_closed();
00165 void set_is_line_or_equality();
00166 void set_is_ray_or_point_or_inequality();
00168
00170 bool operator==(const Flags& y) const;
00171
00176 bool operator!=(const Flags& y) const;
00177
00178 PPL_OUTPUT_DECLARATIONS
00179
00185 bool ascii_load(std::istream& s);
00186
00187 private:
00189 explicit Flags(base_type mask);
00190
00192
00193
00194 static const unsigned rpi_validity_bit
00195 = Row::Flags::first_free_bit + 0;
00196 static const unsigned rpi_bit
00197 = Row::Flags::first_free_bit + 1;
00198 static const unsigned nnc_validity_bit
00199 = Row::Flags::first_free_bit + 2;
00200 static const unsigned nnc_bit
00201 = Row::Flags::first_free_bit + 3;
00203
00204 protected:
00206 static const unsigned first_free_bit
00207 = Row::Flags::first_free_bit + 4;
00208
00209 friend class Parma_Polyhedra_Library::Linear_Row;
00210 };
00211
00213 Linear_Row();
00214
00216
00217
00218
00221 void construct(dimension_type sz, Flags f);
00222
00224
00238 void construct(dimension_type sz, dimension_type capacity, Flags f);
00240
00242 Linear_Row(dimension_type sz, Flags f);
00243
00245 Linear_Row(dimension_type sz, dimension_type capacity, Flags f);
00246
00248 Linear_Row(const Linear_Row& y);
00249
00251
00254 Linear_Row(const Linear_Row& y, dimension_type capacity);
00255
00257
00261 Linear_Row(const Linear_Row& y, dimension_type sz, dimension_type capacity);
00262
00264 ~Linear_Row();
00265
00267
00268
00269 const Flags& flags() const;
00270
00272 Flags& flags();
00273
00275 Topology topology() const;
00276
00281 bool is_not_necessarily_closed() const;
00282
00287 bool is_necessarily_closed() const;
00288
00293 bool is_line_or_equality() const;
00294
00299 bool is_ray_or_point_or_inequality() const;
00301
00303
00304
00305 void set_necessarily_closed();
00306
00308 void set_not_necessarily_closed();
00309
00311 void set_is_line_or_equality();
00312
00314 void set_is_ray_or_point_or_inequality();
00316
00318 static dimension_type max_space_dimension();
00319
00321 dimension_type space_dimension() const;
00322
00324 Coefficient_traits::const_reference inhomogeneous_term() const;
00325
00327 Coefficient_traits::const_reference coefficient(dimension_type n) const;
00328
00333 void sign_normalize();
00334
00341 void strong_normalize();
00342
00347 bool check_strong_normalized() const;
00348
00350
00361 void linear_combine(const Linear_Row& y, dimension_type k);
00362
00367 bool is_zero() const;
00368
00373 bool all_homogeneous_terms_are_zero() const;
00374
00375 PPL_OUTPUT_DECLARATIONS
00376
00382 bool ascii_load(std::istream& s);
00383
00385 bool OK() const;
00386
00391 bool OK(dimension_type row_size, dimension_type row_capacity) const;
00392
00393 private:
00394 friend class Parma_Polyhedra_Library::Linear_Expression;
00395 friend class Parma_Polyhedra_Library::Constraint;
00396 friend class Parma_Polyhedra_Library::Generator;
00397 };
00398
00399 namespace Parma_Polyhedra_Library {
00400
00402
00403 bool operator==(const Linear_Row& x, const Linear_Row& y);
00404
00406
00407 bool operator!=(const Linear_Row& x, const Linear_Row& y);
00408
00409 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00410
00411
00445 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
00446 int compare(const Linear_Row& x, const Linear_Row& y);
00447
00448 }
00449
00450
00451 namespace std {
00452
00453 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00454
00455
00456 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
00457 void swap(Parma_Polyhedra_Library::Linear_Row& x,
00458 Parma_Polyhedra_Library::Linear_Row& y);
00459
00460 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00461
00462
00463 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
00464 void iter_swap(std::vector<Parma_Polyhedra_Library::Linear_Row>::iterator x,
00465 std::vector<Parma_Polyhedra_Library::Linear_Row>::iterator y);
00466
00467 }
00468
00469 #include "Linear_Row.inlines.hh"
00470
00471 #endif // !defined(PPL_Linear_Row_defs_hh)