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_Expression_defs_hh
00024 #define PPL_Linear_Expression_defs_hh 1
00025
00026 #include "Linear_Expression.types.hh"
00027 #include "Scalar_Products.types.hh"
00028 #include "Constraint.types.hh"
00029 #include "Generator.types.hh"
00030 #include "Congruence.types.hh"
00031 #include "Grid_Generator.types.hh"
00032 #include "Linear_Row.defs.hh"
00033 #include "Coefficient.types.hh"
00034 #include "Variable.defs.hh"
00035 #include "Constraint_System.types.hh"
00036 #include "Generator_System.types.hh"
00037 #include "Congruence_System.types.hh"
00038 #include "Grid_Generator_System.types.hh"
00039 #include "Polyhedron.types.hh"
00040 #include "Grid.types.hh"
00041 #include <cstddef>
00042
00043 namespace Parma_Polyhedra_Library {
00044
00045
00047
00048 Linear_Expression
00049 operator+(const Linear_Expression& e1, const Linear_Expression& e2);
00050
00052
00053 Linear_Expression
00054 operator+(Variable v, Variable w);
00055
00057
00058 Linear_Expression
00059 operator+(Variable v, const Linear_Expression& e);
00060
00062
00063 Linear_Expression
00064 operator+(const Linear_Expression& e, Variable v);
00065
00067
00068 Linear_Expression
00069 operator+(Coefficient_traits::const_reference n, const Linear_Expression& e);
00070
00072
00073 Linear_Expression
00074 operator+(const Linear_Expression& e, Coefficient_traits::const_reference n);
00075
00077
00078 Linear_Expression
00079 operator+(const Linear_Expression& e);
00080
00082
00083 Linear_Expression
00084 operator-(const Linear_Expression& e);
00085
00087
00088 Linear_Expression
00089 operator-(const Linear_Expression& e1, const Linear_Expression& e2);
00090
00092
00093 Linear_Expression
00094 operator-(Variable v, Variable w);
00095
00097
00098 Linear_Expression
00099 operator-(Variable v, const Linear_Expression& e);
00100
00102
00103 Linear_Expression
00104 operator-(const Linear_Expression& e, Variable v);
00105
00107
00108 Linear_Expression
00109 operator-(Coefficient_traits::const_reference n, const Linear_Expression& e);
00110
00112
00113 Linear_Expression
00114 operator-(const Linear_Expression& e, Coefficient_traits::const_reference n);
00115
00117
00118 Linear_Expression
00119 operator*(Coefficient_traits::const_reference n, const Linear_Expression& e);
00120
00122
00123 Linear_Expression
00124 operator*(const Linear_Expression& e, Coefficient_traits::const_reference n);
00125
00127
00128 Linear_Expression&
00129 operator+=(Linear_Expression& e1, const Linear_Expression& e2);
00130
00132
00137 Linear_Expression&
00138 operator+=(Linear_Expression& e, Variable v);
00139
00141
00142 Linear_Expression&
00143 operator+=(Linear_Expression& e, Coefficient_traits::const_reference n);
00144
00146
00147 Linear_Expression&
00148 operator-=(Linear_Expression& e1, const Linear_Expression& e2);
00149
00151
00156 Linear_Expression&
00157 operator-=(Linear_Expression& e, Variable v);
00158
00160
00161 Linear_Expression&
00162 operator-=(Linear_Expression& e, Coefficient_traits::const_reference n);
00163
00165
00166 Linear_Expression&
00167 operator*=(Linear_Expression& e, Coefficient_traits::const_reference n);
00168
00169 namespace IO_Operators {
00170
00172
00173 std::ostream& operator<<(std::ostream& s, const Linear_Expression& e);
00174
00175 }
00176
00177 }
00178
00179
00180 namespace std {
00181
00183
00184 void swap(Parma_Polyhedra_Library::Linear_Expression& x,
00185 Parma_Polyhedra_Library::Linear_Expression& y);
00186
00187 }
00188
00190
00236 class Parma_Polyhedra_Library::Linear_Expression : private Linear_Row {
00237 public:
00239 Linear_Expression();
00240
00242 Linear_Expression(const Linear_Expression& e);
00243
00245 ~Linear_Expression();
00246
00251 explicit Linear_Expression(Coefficient_traits::const_reference n);
00252
00254
00259 Linear_Expression(Variable v);
00260
00262
00271 explicit Linear_Expression(const Constraint& c);
00272
00286 explicit Linear_Expression(const Generator& g);
00287
00297 explicit Linear_Expression(const Grid_Generator& g);
00298
00300
00305 explicit Linear_Expression(const Congruence& cg);
00306
00308 static dimension_type max_space_dimension();
00309
00311 dimension_type space_dimension() const;
00312
00314 Coefficient_traits::const_reference coefficient(Variable v) const;
00315
00317 Coefficient_traits::const_reference inhomogeneous_term() const;
00318
00320 static void initialize();
00321
00323 static void finalize();
00324
00326 static const Linear_Expression& zero();
00327
00332 memory_size_type total_memory_in_bytes() const;
00333
00335 memory_size_type external_memory_in_bytes() const;
00336
00337 PPL_OUTPUT_DECLARATIONS
00338
00339 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00340
00345 #endif
00346 bool ascii_load(std::istream& s);
00347
00349 bool OK() const;
00350
00352 void swap(Linear_Expression& y);
00353
00354 private:
00359 static const Linear_Expression* zero_p;
00360
00361 friend class Parma_Polyhedra_Library::Scalar_Products;
00362 friend class Parma_Polyhedra_Library::Constraint;
00363 friend class Parma_Polyhedra_Library::Generator;
00364
00365 friend class Parma_Polyhedra_Library::Grid_Generator;
00366 friend class Parma_Polyhedra_Library::Congruence;
00367
00368 friend class Parma_Polyhedra_Library::Polyhedron;
00369 friend class Parma_Polyhedra_Library::Grid;
00370
00371
00372
00373 friend class Parma_Polyhedra_Library::Constraint_System;
00374
00375
00376
00377 friend class Parma_Polyhedra_Library::Generator_System;
00378
00379
00380
00381 friend class Parma_Polyhedra_Library::Congruence_System;
00382
00383
00384
00385 friend class Parma_Polyhedra_Library::Grid_Generator_System;
00386
00388 Linear_Expression(const Linear_Expression& e, dimension_type sz);
00389
00391
00395 Linear_Expression(dimension_type sz, bool);
00396
00405 Linear_Expression(Variable v, Variable w);
00406
00407 friend Linear_Expression
00408 operator+(const Linear_Expression& e1, const Linear_Expression& e2);
00409 friend Linear_Expression
00410 operator+(Coefficient_traits::const_reference n, const Linear_Expression& e);
00411 friend Linear_Expression
00412 operator+(const Linear_Expression& e, Coefficient_traits::const_reference n);
00413
00414 friend Linear_Expression
00415 operator-(const Linear_Expression& e);
00416
00417 friend Linear_Expression
00418 operator-(const Linear_Expression& e1, const Linear_Expression& e2);
00419 friend Linear_Expression
00420 operator-(Variable v, Variable w);
00421 friend Linear_Expression
00422 operator-(Coefficient_traits::const_reference n, const Linear_Expression& e);
00423 friend Linear_Expression
00424 operator-(const Linear_Expression& e, Coefficient_traits::const_reference n);
00425
00426 friend Linear_Expression
00427 operator*(Coefficient_traits::const_reference n, const Linear_Expression& e);
00428 friend Linear_Expression
00429 operator*(const Linear_Expression& e, Coefficient_traits::const_reference n);
00430
00431 friend Linear_Expression&
00432 operator+=(Linear_Expression& e1, const Linear_Expression& e2);
00433 friend Linear_Expression&
00434 operator+=(Linear_Expression& e, Variable v);
00435 friend Linear_Expression&
00436 operator+=(Linear_Expression& e, Coefficient_traits::const_reference n);
00437
00438 friend Linear_Expression&
00439 operator-=(Linear_Expression& e1, const Linear_Expression& e2);
00440 friend Linear_Expression&
00441 operator-=(Linear_Expression& e, Variable v);
00442 friend Linear_Expression&
00443 operator-=(Linear_Expression& e, Coefficient_traits::const_reference n);
00444
00445 friend Linear_Expression&
00446 operator*=(Linear_Expression& e, Coefficient_traits::const_reference n);
00447
00448 friend std::ostream&
00449 Parma_Polyhedra_Library::IO_Operators
00450 ::operator<<(std::ostream& s, const Linear_Expression& e);
00451 };
00452
00453 #include "Linear_Expression.inlines.hh"
00454
00455 #endif // !defined(PPL_Linear_Expression_defs_hh)