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 PPL_DB_ROW_EXTRA_DEBUG
00033 #ifdef PPL_ABI_BREAKING_EXTRA_DEBUG
00034 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00035
00041 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
00042 #define PPL_DB_ROW_EXTRA_DEBUG 1
00043 #else // !defined(PPL_ABI_BREAKING_EXTRA_DEBUG)
00044 #define PPL_DB_ROW_EXTRA_DEBUG 0
00045 #endif // !defined(PPL_ABI_BREAKING_EXTRA_DEBUG)
00046 #endif // !defined(PPL_DB_ROW_EXTRA_DEBUG)
00047
00048
00049 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00051
00055 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
00056 template <typename T>
00057 class Parma_Polyhedra_Library::DB_Row_Impl_Handler {
00058 public:
00060 DB_Row_Impl_Handler();
00061
00063 ~DB_Row_Impl_Handler();
00064
00065 class Impl;
00066
00068 Impl* impl;
00069
00070 #if PPL_DB_ROW_EXTRA_DEBUG
00072 dimension_type capacity_;
00073 #endif // PPL_DB_ROW_EXTRA_DEBUG
00074
00075 private:
00077 DB_Row_Impl_Handler(const DB_Row_Impl_Handler&);
00078
00080 DB_Row_Impl_Handler& operator=(const DB_Row_Impl_Handler&);
00081 };
00082
00083 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00085
00117 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
00118 template <typename T>
00119 class Parma_Polyhedra_Library::DB_Row : private DB_Row_Impl_Handler<T> {
00120 public:
00122 DB_Row();
00123
00125
00126
00127
00130 void construct(dimension_type sz);
00131
00133
00144 void construct(dimension_type sz, dimension_type capacity);
00145
00147
00158 template <typename U>
00159 void construct_upward_approximation(const DB_Row<U>& y,
00160 dimension_type capacity);
00161
00163
00165 DB_Row(dimension_type sz);
00166
00168 DB_Row(dimension_type sz, dimension_type capacity);
00169
00171 DB_Row(const DB_Row& y);
00172
00174
00177 DB_Row(const DB_Row& y, dimension_type capacity);
00178
00180
00185 DB_Row(const DB_Row& y, dimension_type sz, dimension_type capacity);
00186
00188 ~DB_Row();
00189
00191 DB_Row& operator=(const DB_Row& y);
00192
00194 void swap(DB_Row& y);
00195
00197 void assign(DB_Row& y);
00198
00207 void allocate(dimension_type capacity);
00208
00210
00217 void expand_within_capacity(dimension_type new_size);
00218
00220
00225 void shrink(dimension_type new_size);
00226
00228 static dimension_type max_size();
00229
00231 dimension_type size() const;
00232
00234
00235
00236 T& operator[](dimension_type k);
00237
00239 const T& operator[](dimension_type k) const;
00241
00243 typedef Implementation::Ptr_Iterator<T*> iterator;
00244
00246 typedef Implementation::Ptr_Iterator<const T*> const_iterator;
00247
00253 iterator begin();
00254
00256 iterator end();
00257
00263 const_iterator begin() const;
00264
00266 const_iterator end() const;
00267
00272 memory_size_type total_memory_in_bytes() const;
00273
00278 memory_size_type external_memory_in_bytes() const;
00279
00284 memory_size_type total_memory_in_bytes(dimension_type capacity) const;
00285
00290 memory_size_type external_memory_in_bytes(dimension_type capacity) const;
00291
00293 bool OK(dimension_type row_size, dimension_type row_capacity) const;
00294
00295 private:
00296 template <typename U> friend class Parma_Polyhedra_Library::DB_Row;
00297
00299 void copy_construct_coefficients(const DB_Row& y);
00300
00301 #if PPL_DB_ROW_EXTRA_DEBUG
00303 dimension_type capacity() const;
00304 #endif // PPL_DB_ROW_EXTRA_DEBUG
00305 };
00306
00307 namespace Parma_Polyhedra_Library {
00308
00309 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00311
00312 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
00313
00314 template <typename T>
00315 bool operator==(const DB_Row<T>& x, const DB_Row<T>& y);
00316
00318 template <typename T>
00319 bool operator!=(const DB_Row<T>& x, const DB_Row<T>& y);
00320 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00321
00322 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
00323
00324 }
00325
00326
00327 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00329
00334 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
00335 template <typename T>
00336 class Parma_Polyhedra_Library::DB_Row_Impl_Handler<T>::Impl {
00337 public:
00339
00340
00346 static void* operator new(size_t fixed_size, dimension_type capacity);
00347
00349 static void operator delete(void* p);
00350
00355 static void operator delete(void* p, dimension_type capacity);
00357
00359 Impl();
00360
00362
00366 ~Impl();
00367
00369
00372 void expand_within_capacity(dimension_type new_size);
00373
00375
00378 void shrink(dimension_type new_size);
00379
00381 void copy_construct_coefficients(const Impl& y);
00382
00387 template <typename U>
00388 void construct_upward_approximation(const U& y);
00389
00391 static dimension_type max_size();
00392
00394
00395
00396 dimension_type size() const;
00397
00399 void set_size(dimension_type new_sz);
00400
00402 void bump_size();
00404
00406
00407
00408 T& operator[](dimension_type k);
00409
00411 const T& operator[](dimension_type k) const;
00413
00418 memory_size_type total_memory_in_bytes() const;
00419
00421 memory_size_type total_memory_in_bytes(dimension_type capacity) const;
00422
00424 memory_size_type external_memory_in_bytes() const;
00425
00426 private:
00427 friend class DB_Row<T>;
00428
00430 dimension_type size_;
00431
00433 T vec_[
00434 #if !PPL_CXX_SUPPORTS_FLEXIBLE_ARRAYS
00435 1
00436 #endif
00437 ];
00438
00440 Impl(const Impl& y);
00441
00443 Impl& operator=(const Impl&);
00444
00446 void copy_construct(const Impl& y);
00447 };
00448
00449 namespace std {
00450
00451 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00453
00454 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
00455 template <typename T>
00456 void swap(Parma_Polyhedra_Library::DB_Row<T>& x,
00457 Parma_Polyhedra_Library::DB_Row<T>& y);
00458
00459 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00461
00462 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
00463 template <typename T>
00464 void iter_swap(typename std::vector<Parma_Polyhedra_Library::DB_Row<T> >
00465 ::iterator x,
00466 typename std::vector<Parma_Polyhedra_Library::DB_Row<T> >
00467 ::iterator y);
00468
00469 }
00470
00471 #include "DB_Row.inlines.hh"
00472 #include "DB_Row.templates.hh"
00473
00474 #endif // !defined(PPL_DB_Row_defs_hh)