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_Linear_Row_defs_hh
00024 #define PPL_Linear_Row_defs_hh 1
00025
00026 #include "Linear_Row.types.hh"
00027 #include "globals.defs.hh"
00028 #include "Row.defs.hh"
00029 #include "Topology.hh"
00030 #include "Linear_Expression.types.hh"
00031 #include "Constraint.types.hh"
00032 #include "Generator.types.hh"
00033
00034 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00036
00122 #endif // PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00123
00124 class Parma_Polyhedra_Library::Linear_Row : public Row {
00125 public:
00127 enum Kind {
00128 LINE_OR_EQUALITY = 0,
00129 RAY_OR_POINT_OR_INEQUALITY = 1
00130 };
00131
00132 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00133
00142 #endif // PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00143 class Flags : public Row::Flags {
00144 public:
00146 Flags();
00147
00149 explicit Flags(Topology t);
00150
00152 Flags(Topology t, Kind k);
00153
00155
00156 Topology topology() const;
00157 bool is_necessarily_closed() const;
00158 bool is_not_necessarily_closed() const;
00159 bool is_line_or_equality() const;
00160 bool is_ray_or_point_or_inequality() const;
00161
00162 void set_necessarily_closed();
00163 void set_not_necessarily_closed();
00164 void set_is_line_or_equality();
00165 void set_is_ray_or_point_or_inequality();
00167
00169 bool operator==(const Flags& y) const;
00170
00175 bool operator!=(const Flags& y) const;
00176
00177 PPL_OUTPUT_DECLARATIONS;
00178
00180
00184 bool ascii_load(std::istream& s);
00185
00186 private:
00188 explicit Flags(base_type mask);
00189
00191
00192
00193 static const unsigned rpi_validity_bit
00194 = Row::Flags::first_free_bit + 0;
00195 static const unsigned rpi_bit
00196 = Row::Flags::first_free_bit + 1;
00197 static const unsigned nnc_validity_bit
00198 = Row::Flags::first_free_bit + 2;
00199 static const unsigned nnc_bit
00200 = Row::Flags::first_free_bit + 3;
00202
00203 protected:
00205 static const unsigned first_free_bit
00206 = Row::Flags::first_free_bit + 4;
00207
00208 friend class Parma_Polyhedra_Library::Linear_Row;
00209 };
00210
00212 Linear_Row();
00213
00215
00216
00217
00220 void construct(dimension_type sz, Flags f);
00221
00223
00237 void construct(dimension_type sz, dimension_type capacity, Flags f);
00239
00241 Linear_Row(dimension_type sz, Flags f);
00242
00244 Linear_Row(dimension_type sz, dimension_type capacity, Flags f);
00245
00247 Linear_Row(const Linear_Row& y);
00248
00250
00253 Linear_Row(const Linear_Row& y, dimension_type capacity);
00254
00256
00260 Linear_Row(const Linear_Row& y, dimension_type sz, dimension_type capacity);
00261
00263 ~Linear_Row();
00264
00266
00267
00268 const Flags& flags() const;
00269
00271 Flags& flags();
00272
00274 Topology topology() const;
00275
00280 bool is_not_necessarily_closed() const;
00281
00286 bool is_necessarily_closed() const;
00287
00292 bool is_line_or_equality() const;
00293
00298 bool is_ray_or_point_or_inequality() const;
00300
00302
00303
00304 void set_necessarily_closed();
00305
00307 void set_not_necessarily_closed();
00308
00310 void set_is_line_or_equality();
00311
00313 void set_is_ray_or_point_or_inequality();
00315
00317 static dimension_type max_space_dimension();
00318
00320 dimension_type space_dimension() const;
00321
00323 Coefficient_traits::const_reference inhomogeneous_term() const;
00324
00326 Coefficient_traits::const_reference coefficient(dimension_type n) const;
00327
00332 void sign_normalize();
00333
00340 void strong_normalize();
00341
00346 bool check_strong_normalized() const;
00347
00349
00360 void linear_combine(const Linear_Row& y, dimension_type k);
00361
00366 bool all_homogeneous_terms_are_zero() const;
00367
00368 PPL_OUTPUT_DECLARATIONS;
00369
00371
00375 bool ascii_load(std::istream& s);
00376
00378 bool OK(dimension_type row_size, dimension_type row_capacity) const;
00379
00380 private:
00381 friend class Parma_Polyhedra_Library::Linear_Expression;
00382 friend class Parma_Polyhedra_Library::Constraint;
00383 friend class Parma_Polyhedra_Library::Generator;
00384 };
00385
00386 namespace Parma_Polyhedra_Library {
00387
00389
00390 bool operator==(const Linear_Row& x, const Linear_Row& y);
00391
00393
00394 bool operator!=(const Linear_Row& x, const Linear_Row& y);
00395
00396 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00398
00432 #endif // PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00433 int compare(const Linear_Row& x, const Linear_Row& y);
00434
00435 }
00436
00437
00438 namespace std {
00439
00440 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00442
00443 #endif // PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00444 void swap(Parma_Polyhedra_Library::Linear_Row& x,
00445 Parma_Polyhedra_Library::Linear_Row& y);
00446
00447 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00449
00450 #endif // PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00451 void iter_swap(std::vector<Parma_Polyhedra_Library::Linear_Row>::iterator x,
00452 std::vector<Parma_Polyhedra_Library::Linear_Row>::iterator y);
00453
00454 }
00455
00456 #include "Linear_Row.inlines.hh"
00457
00458 #endif // !defined(PPL_Linear_Row_defs_hh)