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_DB_Row_defs_hh
00024 #define PPL_DB_Row_defs_hh 1
00025
00026 #include "DB_Row.types.hh"
00027 #include "globals.types.hh"
00028 #include "Ptr_Iterator.defs.hh"
00029 #include <cstddef>
00030 #include <vector>
00031
00032 #ifndef EXTRA_ROW_DEBUG
00033 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00034
00040 #endif // PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00041 #define EXTRA_ROW_DEBUG 0
00042 #endif
00043
00044
00045 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00047
00051 #endif // PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00052 template <typename T>
00053 class Parma_Polyhedra_Library::DB_Row_Impl_Handler {
00054 public:
00056 DB_Row_Impl_Handler();
00057
00059 ~DB_Row_Impl_Handler();
00060
00061 class Impl;
00062
00064 Impl* impl;
00065
00066 #if EXTRA_ROW_DEBUG
00068 dimension_type capacity_;
00069 #endif // EXTRA_ROW_DEBUG
00070
00071 private:
00073 DB_Row_Impl_Handler(const DB_Row_Impl_Handler&);
00074
00076 DB_Row_Impl_Handler& operator=(const DB_Row_Impl_Handler&);
00077 };
00078
00079 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00081
00113 #endif // PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00114 template <typename T>
00115 class Parma_Polyhedra_Library::DB_Row : private DB_Row_Impl_Handler<T> {
00116 public:
00118 DB_Row();
00119
00121
00122
00123
00126 void construct(dimension_type sz);
00127
00129
00140 void construct(dimension_type sz, dimension_type capacity);
00141
00143
00154 template <typename U>
00155 void construct_upward_approximation(const DB_Row<U>& y,
00156 dimension_type capacity);
00157
00159
00161 DB_Row(dimension_type sz);
00162
00164 DB_Row(dimension_type sz, dimension_type capacity);
00165
00167 DB_Row(const DB_Row& y);
00168
00170
00173 DB_Row(const DB_Row& y, dimension_type capacity);
00174
00176
00181 DB_Row(const DB_Row& y, dimension_type sz, dimension_type capacity);
00182
00184 ~DB_Row();
00185
00187 DB_Row& operator=(const DB_Row& y);
00188
00190 void swap(DB_Row& y);
00191
00193 void assign(DB_Row& y);
00194
00203 void allocate(dimension_type capacity);
00204
00206
00213 void expand_within_capacity(dimension_type new_size);
00214
00216
00221 void shrink(dimension_type new_size);
00222
00224 static dimension_type max_size();
00225
00227 dimension_type size() const;
00228
00230
00231
00232 T& operator[](dimension_type k);
00233
00235 const T& operator[](dimension_type k) const;
00237
00239 typedef Implementation::Ptr_Iterator<T*> iterator;
00240
00242 typedef Implementation::Ptr_Iterator<const T*> const_iterator;
00243
00249 iterator begin();
00250
00252 iterator end();
00253
00259 const_iterator begin() const;
00260
00262 const_iterator end() const;
00263
00265 bool OK(dimension_type row_size, dimension_type row_capacity) const;
00266
00267 private:
00268 template <typename U> friend class Parma_Polyhedra_Library::DB_Row;
00269
00271 void copy_construct_coefficients(const DB_Row& y);
00272
00273 #if EXTRA_ROW_DEBUG
00275 dimension_type capacity() const;
00276 #endif // defined(EXTRA_ROW_DEBUG)
00277 };
00278
00279 namespace Parma_Polyhedra_Library {
00280
00281 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00283
00284 #endif // PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00285
00286 template <typename T>
00287 bool operator==(const DB_Row<T>& x, const DB_Row<T>& y);
00288
00290 template <typename T>
00291 bool operator!=(const DB_Row<T>& x, const DB_Row<T>& y);
00292 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00293
00294 #endif // PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00295
00296 }
00297
00298
00299 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00301
00306 #endif // PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00307 template <typename T>
00308 class Parma_Polyhedra_Library::DB_Row_Impl_Handler<T>::Impl {
00309 public:
00311
00312
00318 static void* operator new(size_t fixed_size, dimension_type capacity);
00319
00321 static void operator delete(void* p);
00322
00327 static void operator delete(void* p, dimension_type capacity);
00329
00331 Impl();
00332
00334
00338 ~Impl();
00339
00341
00344 void expand_within_capacity(dimension_type new_size);
00345
00347
00350 void shrink(dimension_type new_size);
00351
00353 void copy_construct_coefficients(const Impl& y);
00354
00359 template <typename U>
00360 void construct_upward_approximation(const U& y);
00361
00363 static dimension_type max_size();
00364
00366
00367
00368 dimension_type size() const;
00369
00371 void set_size(dimension_type new_sz);
00372
00374 void bump_size();
00376
00378
00379
00380 T& operator[](dimension_type k);
00381
00383 const T& operator[](dimension_type k) const;
00385
00386 private:
00388 dimension_type size_;
00389
00391 T vec_[
00392 #if !CXX_SUPPORTS_FLEXIBLE_ARRAYS
00393 1
00394 #endif
00395 ];
00396
00398 Impl(const Impl& y);
00399
00401 Impl& operator=(const Impl&);
00402
00404 void copy_construct(const Impl& y);
00405 };
00406
00407 namespace std {
00408
00409 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00411
00412 #endif // PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00413 template <typename T>
00414 void swap(Parma_Polyhedra_Library::DB_Row<T>& x,
00415 Parma_Polyhedra_Library::DB_Row<T>& y);
00416
00417 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00419
00420 #endif // PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00421 template <typename T>
00422 void iter_swap(typename std::vector<Parma_Polyhedra_Library::DB_Row<T> >
00423 ::iterator x,
00424 typename std::vector<Parma_Polyhedra_Library::DB_Row<T> >
00425 ::iterator y);
00426
00427 }
00428
00429 #include "DB_Row.inlines.hh"
00430
00431 #endif // !defined(PPL_DB_Row_defs_hh)