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_Row_defs_hh
00024 #define PPL_Row_defs_hh 1
00025
00026 #include "Row.types.hh"
00027 #include "globals.defs.hh"
00028 #include "Coefficient.defs.hh"
00029 #include <vector>
00030 #include <limits>
00031
00032 #ifndef EXTRA_ROW_DEBUG
00033 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00034
00043 #endif // PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00044 #define EXTRA_ROW_DEBUG 0
00045 #endif
00046
00047 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00049
00053 #endif // PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00054 class Parma_Polyhedra_Library::Row_Impl_Handler {
00055 public:
00057 Row_Impl_Handler();
00058
00060 ~Row_Impl_Handler();
00061
00062 class Impl;
00063
00065 Impl* impl;
00066
00067 #if EXTRA_ROW_DEBUG
00069 dimension_type capacity_;
00070 #endif // EXTRA_ROW_DEBUG
00071
00072 private:
00074 Row_Impl_Handler(const Row_Impl_Handler&);
00075
00077 Row_Impl_Handler& operator=(const Row_Impl_Handler&);
00078 };
00079
00080 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00082
00083 #endif // PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00084 class Parma_Polyhedra_Library::Row : private Row_Impl_Handler {
00085 public:
00086 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00087
00092 #endif // PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00093 class Flags {
00094 public:
00096 Flags();
00097
00099 bool operator==(const Flags& y) const;
00100
00105 bool operator!=(const Flags& y) const;
00106
00107 PPL_OUTPUT_DECLARATIONS;
00108
00110
00115 bool ascii_load(std::istream& s);
00116
00117 protected:
00119 typedef unsigned int base_type;
00120
00122 static const unsigned first_free_bit = 0;
00123
00125 static const unsigned num_bits = std::numeric_limits<base_type>::digits;
00126
00128 explicit Flags(base_type n);
00129
00131 base_type get_bits() const;
00132
00134 void set_bits(base_type mask);
00135
00137 void reset_bits(base_type mask);
00138
00143 bool test_bits(base_type mask) const;
00144
00145 private:
00147 base_type bits;
00148
00149 friend class Row;
00150 };
00151
00153 Row();
00154
00156
00157
00158
00161 void construct(dimension_type sz, Flags f);
00162
00164
00178 void construct(dimension_type sz, dimension_type capacity, Flags f);
00180
00182
00185 Row(dimension_type sz, Flags f);
00186
00188
00202 Row(dimension_type sz, dimension_type capacity, Flags f);
00203
00205 Row(const Row& y);
00206
00208
00212 Row(const Row& y, dimension_type capacity);
00213
00215
00219 Row(const Row& y, dimension_type sz, dimension_type capacity);
00220
00222 ~Row();
00223
00225 Row& operator=(const Row& y);
00226
00228 void swap(Row& y);
00229
00231
00235 void assign(Row& y);
00236
00245 void allocate(dimension_type capacity, Flags f);
00246
00248
00254 void expand_within_capacity(dimension_type new_size);
00255
00257
00262 void shrink(dimension_type new_size);
00263
00265 const Flags& flags() const;
00266
00268 Flags& flags();
00269
00271 static dimension_type max_size();
00272
00274 dimension_type size() const;
00275
00277
00278
00279 Coefficient& operator[](dimension_type k);
00280
00282 Coefficient_traits::const_reference operator[](dimension_type k) const;
00284
00286
00290 void normalize();
00291
00292 PPL_OUTPUT_DECLARATIONS;
00293
00295
00299 bool ascii_load(std::istream& s);
00300
00305 memory_size_type total_memory_in_bytes() const;
00306
00311 memory_size_type external_memory_in_bytes() const;
00312
00317 memory_size_type total_memory_in_bytes(dimension_type capacity) const;
00318
00323 memory_size_type external_memory_in_bytes(dimension_type capacity) const;
00324
00326 bool OK(dimension_type row_size, dimension_type row_capacity) const;
00327
00328 private:
00330 void copy_construct_coefficients(const Row& y);
00331
00332 #if EXTRA_ROW_DEBUG
00334 dimension_type capacity() const;
00335 #endif // EXTRA_ROW_DEBUG
00336 };
00337
00338 namespace Parma_Polyhedra_Library {
00339
00341
00342 bool operator==(const Row& x, const Row& y);
00343
00345
00346 bool operator!=(const Row& x, const Row& y);
00347
00348 }
00349
00350
00351 namespace std {
00352
00353 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00355
00356 #endif // PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00357 void swap(Parma_Polyhedra_Library::Row& x,
00358 Parma_Polyhedra_Library::Row& y);
00359
00360 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00362
00363 #endif // PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00364 void iter_swap(std::vector<Parma_Polyhedra_Library::Row>::iterator x,
00365 std::vector<Parma_Polyhedra_Library::Row>::iterator y);
00366
00367 }
00368
00369
00370 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00372
00377 #endif // PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00378 class Parma_Polyhedra_Library::Row_Impl_Handler::Impl {
00379 public:
00381
00382
00388 static void* operator new(size_t fixed_size, dimension_type capacity);
00389
00391 static void operator delete(void* p);
00392
00397 static void operator delete(void* p, dimension_type capacity);
00399
00401 Impl(Row::Flags f);
00402
00404
00408 ~Impl();
00409
00411
00414 void expand_within_capacity(dimension_type new_size);
00415
00417
00420 void shrink(dimension_type new_size);
00421
00423 void copy_construct_coefficients(const Impl& y);
00424
00426 static dimension_type max_size();
00427
00429
00430
00431 const Row::Flags& flags() const;
00432
00434 Row::Flags& flags();
00436
00438
00439
00440 dimension_type size() const;
00441
00443 void set_size(dimension_type new_size);
00444
00446 void bump_size();
00448
00450
00451
00452 Coefficient& operator[](dimension_type k);
00453
00455 Coefficient_traits::const_reference operator[](dimension_type k) const;
00457
00462 memory_size_type total_memory_in_bytes() const;
00463
00465 memory_size_type total_memory_in_bytes(dimension_type capacity) const;
00466
00468 memory_size_type external_memory_in_bytes() const;
00469
00470 private:
00472 dimension_type size_;
00473
00475 Row::Flags flags_;
00476
00478 Coefficient vec_[
00479 #if !CXX_SUPPORTS_FLEXIBLE_ARRAYS
00480 1
00481 #endif
00482 ];
00483
00485 Impl();
00486
00488 Impl(const Impl& y);
00489
00491 Impl& operator=(const Impl&);
00492 };
00493
00494 #include "Row.inlines.hh"
00495
00496 #endif // !defined(PPL_Row_defs_hh)