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 PPL_ROW_EXTRA_DEBUG
00033 #ifdef PPL_ABI_BREAKING_EXTRA_DEBUG
00034 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00035
00044 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
00045 #define PPL_ROW_EXTRA_DEBUG 1
00046 #else // !defined(PPL_ABI_BREAKING_EXTRA_DEBUG)
00047 #define PPL_ROW_EXTRA_DEBUG 0
00048 #endif // !defined(PPL_ABI_BREAKING_EXTRA_DEBUG)
00049 #endif // !defined(PPL_ROW_EXTRA_DEBUG)
00050
00051 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00053
00057 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
00058 class Parma_Polyhedra_Library::Row_Impl_Handler {
00059 public:
00061 Row_Impl_Handler();
00062
00064 ~Row_Impl_Handler();
00065
00066 class Impl;
00067
00069 Impl* impl;
00070
00071 #if PPL_ROW_EXTRA_DEBUG
00073 dimension_type capacity_;
00074 #endif // PPL_ROW_EXTRA_DEBUG
00075
00076 private:
00078 Row_Impl_Handler(const Row_Impl_Handler&);
00079
00081 Row_Impl_Handler& operator=(const Row_Impl_Handler&);
00082 };
00083
00084 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00086
00087 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
00088 class Parma_Polyhedra_Library::Row : private Row_Impl_Handler {
00089 public:
00090 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00091
00096 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
00097 class Flags {
00098 public:
00100 Flags();
00101
00103 bool operator==(const Flags& y) const;
00104
00109 bool operator!=(const Flags& y) const;
00110
00111 PPL_OUTPUT_DECLARATIONS
00112
00114
00119 bool ascii_load(std::istream& s);
00120
00121 protected:
00123 typedef unsigned int base_type;
00124
00126 static const unsigned first_free_bit = 0;
00127
00129 static const unsigned num_bits = std::numeric_limits<base_type>::digits;
00130
00132 explicit Flags(base_type n);
00133
00135 base_type get_bits() const;
00136
00138 void set_bits(base_type mask);
00139
00141 void reset_bits(base_type mask);
00142
00147 bool test_bits(base_type mask) const;
00148
00149 private:
00151 base_type bits;
00152
00153 friend class Row;
00154 };
00155
00157 Row();
00158
00160
00161
00162
00165 void construct(dimension_type sz, Flags f);
00166
00168
00182 void construct(dimension_type sz, dimension_type capacity, Flags f);
00184
00186
00189 Row(dimension_type sz, Flags f);
00190
00192
00206 Row(dimension_type sz, dimension_type capacity, Flags f);
00207
00209 Row(const Row& y);
00210
00212
00216 Row(const Row& y, dimension_type capacity);
00217
00219
00223 Row(const Row& y, dimension_type sz, dimension_type capacity);
00224
00226 ~Row();
00227
00229 Row& operator=(const Row& y);
00230
00232 void swap(Row& y);
00233
00235
00239 void assign(Row& y);
00240
00249 void allocate(dimension_type capacity, Flags f);
00250
00252
00258 void expand_within_capacity(dimension_type new_size);
00259
00261
00266 void shrink(dimension_type new_size);
00267
00269 const Flags& flags() const;
00270
00272 Flags& flags();
00273
00275 static dimension_type max_size();
00276
00278 dimension_type size() const;
00279
00281
00282
00283 Coefficient& operator[](dimension_type k);
00284
00286 Coefficient_traits::const_reference operator[](dimension_type k) const;
00288
00290
00294 void normalize();
00295
00296 PPL_OUTPUT_DECLARATIONS
00297
00303 bool ascii_load(std::istream& s);
00304
00309 memory_size_type total_memory_in_bytes() const;
00310
00315 memory_size_type external_memory_in_bytes() const;
00316
00321 memory_size_type total_memory_in_bytes(dimension_type capacity) const;
00322
00327 memory_size_type external_memory_in_bytes(dimension_type capacity) const;
00328
00330 bool OK() const;
00331
00336 bool OK(dimension_type row_size, dimension_type row_capacity) const;
00337
00338 private:
00340 void copy_construct_coefficients(const Row& y);
00341
00342 #if PPL_ROW_EXTRA_DEBUG
00344 dimension_type capacity() const;
00345 #endif // PPL_ROW_EXTRA_DEBUG
00346 };
00347
00348 namespace Parma_Polyhedra_Library {
00349
00351
00352 bool operator==(const Row& x, const Row& y);
00353
00355
00356 bool operator!=(const Row& x, const Row& y);
00357
00358 }
00359
00360
00361 namespace std {
00362
00363 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00365
00366 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
00367 void swap(Parma_Polyhedra_Library::Row& x,
00368 Parma_Polyhedra_Library::Row& y);
00369
00370 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00372
00373 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
00374 void iter_swap(std::vector<Parma_Polyhedra_Library::Row>::iterator x,
00375 std::vector<Parma_Polyhedra_Library::Row>::iterator y);
00376
00377 }
00378
00379
00380 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00382
00387 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
00388 class Parma_Polyhedra_Library::Row_Impl_Handler::Impl {
00389 public:
00391
00392
00398 static void* operator new(size_t fixed_size, dimension_type capacity);
00399
00401 static void operator delete(void* p);
00402
00407 static void operator delete(void* p, dimension_type capacity);
00409
00411 Impl(Row::Flags f);
00412
00414
00418 ~Impl();
00419
00421
00424 void expand_within_capacity(dimension_type new_size);
00425
00427
00430 void shrink(dimension_type new_size);
00431
00433 void copy_construct_coefficients(const Impl& y);
00434
00436 static dimension_type max_size();
00437
00439
00440
00441 const Row::Flags& flags() const;
00442
00444 Row::Flags& flags();
00446
00448
00449
00450 dimension_type size() const;
00451
00453 void set_size(dimension_type new_size);
00454
00456 void bump_size();
00458
00460
00461
00462 Coefficient& operator[](dimension_type k);
00463
00465 Coefficient_traits::const_reference operator[](dimension_type k) const;
00467
00472 memory_size_type total_memory_in_bytes() const;
00473
00475 memory_size_type total_memory_in_bytes(dimension_type capacity) const;
00476
00478 memory_size_type external_memory_in_bytes() const;
00479
00480 private:
00482 dimension_type size_;
00483
00485 Row::Flags flags_;
00486
00488 Coefficient vec_[
00489 #if !PPL_CXX_SUPPORTS_FLEXIBLE_ARRAYS
00490 1
00491 #endif
00492 ];
00493
00495 Impl();
00496
00498 Impl(const Impl& y);
00499
00501 Impl& operator=(const Impl&);
00502 };
00503
00504 #include "Row.inlines.hh"
00505
00506 #endif // !defined(PPL_Row_defs_hh)