#include <DB_Row.defs.hh>
Public Member Functions | |
Impl () | |
Default constructor. | |
~Impl () | |
Destructor. | |
void | expand_within_capacity (dimension_type new_size) |
Expands the row to size new_size . | |
void | shrink (dimension_type new_size) |
Shrinks the row by erasing elements at the end. | |
void | copy_construct_coefficients (const Impl &y) |
Exception-safe copy construction mechanism for coefficients. | |
template<typename U> | |
void | construct_upward_approximation (const U &y) |
Exception-safe upward approximation construction mechanism for coefficients. | |
Size accessors. | |
dimension_type | size () const |
Returns the actual size of this . | |
void | set_size (dimension_type new_sz) |
Sets to new_sz the actual size of *this . | |
void | bump_size () |
Increments the size of *this by 1. | |
Subscript operators. | |
T & | operator[] (dimension_type k) |
Returns a reference to the element of *this indexed by k . | |
const T & | operator[] (dimension_type k) const |
Returns a constant reference to the element of *this indexed by k . | |
Static Public Member Functions | |
static dimension_type | max_size () |
Returns the size() of the largest possible Impl. | |
Custom allocator and deallocator. | |
static void * | operator new (size_t fixed_size, dimension_type capacity) |
Allocates a chunk of memory able to contain capacity T objects beyond the specified fixed_size and returns a pointer to the new allocated memory. | |
static void | operator delete (void *p) |
Uses the standard delete operator to free the memory p points to. | |
static void | operator delete (void *p, dimension_type capacity) |
Placement version: uses the standard operator delete to free the memory p points to. | |
Private Member Functions | |
Impl (const Impl &y) | |
Private and unimplemented: copy construction is not allowed. | |
Impl & | operator= (const Impl &) |
Private and unimplemented: assignment is not allowed. | |
void | copy_construct (const Impl &y) |
Exception-safe copy construction mechanism. | |
Private Attributes | |
dimension_type | size_ |
The number of coefficients in the row. | |
T | vec_ [1] |
The vector of coefficients. |
The class DB_Row_Impl_Handler::Impl provides the implementation of DB_Row objects and, in particular, of the corresponding memory allocation functions.
Definition at line 308 of file DB_Row.defs.hh.
Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::Impl::Impl | ( | ) | [inline] |
Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::Impl::~Impl | ( | ) | [inline] |
Destructor.
Uses shrink()
method with argument to delete all the row elements.
Definition at line 89 of file DB_Row.inlines.hh.
References Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::Impl::shrink().
00089 { 00090 shrink(0); 00091 }
Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::Impl::Impl | ( | const Impl & | y | ) | [private] |
Private and unimplemented: copy construction is not allowed.
void * Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::Impl::operator new | ( | size_t | fixed_size, | |
dimension_type | capacity | |||
) | [inline, static] |
Allocates a chunk of memory able to contain capacity
T objects beyond the specified fixed_size
and returns a pointer to the new allocated memory.
Definition at line 35 of file DB_Row.inlines.hh.
00036 { 00037 #if CXX_SUPPORTS_FLEXIBLE_ARRAYS 00038 return ::operator new(fixed_size + capacity*sizeof(T)); 00039 #else 00040 assert(capacity >= 1); 00041 return ::operator new(fixed_size + (capacity-1)*sizeof(T)); 00042 #endif 00043 }
void Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::Impl::operator delete | ( | void * | p | ) | [inline, static] |
Uses the standard delete operator to free the memory p
points to.
Definition at line 47 of file DB_Row.inlines.hh.
void Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::Impl::operator delete | ( | void * | p, | |
dimension_type | capacity | |||
) | [inline, static] |
Placement version: uses the standard operator delete to free the memory p
points to.
Definition at line 53 of file DB_Row.inlines.hh.
void Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::Impl::expand_within_capacity | ( | dimension_type | new_size | ) | [inline] |
Expands the row to size new_size
.
It is assumed that new_size
is between the current size and capacity.
Definition at line 352 of file DB_Row.inlines.hh.
References Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::Impl::bump_size(), Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::Impl::max_size(), Parma_Polyhedra_Library::PLUS_INFINITY, Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::Impl::size(), and Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::Impl::vec_.
Referenced by Parma_Polyhedra_Library::DB_Row< T >::expand_within_capacity().
00352 { 00353 assert(size() <= new_size && new_size <= max_size()); 00354 #if !CXX_SUPPORTS_FLEXIBLE_ARRAYS 00355 // vec_[0] is already constructed. 00356 if (size() == 0 && new_size > 0) 00357 bump_size(); 00358 #endif 00359 // Construct in direct order: will destroy in reverse order. 00360 for (dimension_type i = size(); i < new_size; ++i) { 00361 new (&vec_[i]) T(PLUS_INFINITY); 00362 bump_size(); 00363 } 00364 }
void Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::Impl::shrink | ( | dimension_type | new_size | ) | [inline] |
Shrinks the row by erasing elements at the end.
It is assumed that new_size
is not greater than the current size.
Definition at line 368 of file DB_Row.inlines.hh.
References Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::Impl::set_size(), Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::Impl::size(), and Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::Impl::vec_.
Referenced by Parma_Polyhedra_Library::DB_Row< T >::shrink(), and Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::Impl::~Impl().
00368 { 00369 const dimension_type old_size = size(); 00370 assert(new_size <= old_size); 00371 // Since ~T() does not throw exceptions, nothing here does. 00372 set_size(new_size); 00373 #if !CXX_SUPPORTS_FLEXIBLE_ARRAYS 00374 // Make sure we do not try to destroy vec_[0]. 00375 if (new_size == 0) 00376 ++new_size; 00377 #endif 00378 // We assume construction was done "forward". 00379 // We thus perform destruction "backward". 00380 for (dimension_type i = old_size; i-- > new_size; ) 00381 vec_[i].~T(); 00382 }
void Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::Impl::copy_construct_coefficients | ( | const Impl & | y | ) | [inline] |
Exception-safe copy construction mechanism for coefficients.
Definition at line 386 of file DB_Row.inlines.hh.
References Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::Impl::bump_size(), Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::Impl::size(), and Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::Impl::vec_.
Referenced by Parma_Polyhedra_Library::DB_Row< T >::copy_construct_coefficients().
00386 { 00387 const dimension_type y_size = y.size(); 00388 #if CXX_SUPPORTS_FLEXIBLE_ARRAYS 00389 // Construct in direct order: will destroy in reverse order. 00390 for (dimension_type i = 0; i < y_size; ++i) { 00391 new (&vec_[i]) T(y.vec_[i]); 00392 bump_size(); 00393 } 00394 #else 00395 assert(y_size > 0); 00396 if (y_size > 0) { 00397 vec_[0] = y.vec_[0]; 00398 bump_size(); 00399 // Construct in direct order: will destroy in reverse order. 00400 for (dimension_type i = 1; i < y_size; ++i) { 00401 new (&vec_[i]) T(y.vec_[i]); 00402 bump_size(); 00403 } 00404 } 00405 #endif 00406 }
void Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::Impl::construct_upward_approximation | ( | const U & | y | ) | [inline] |
Exception-safe upward approximation construction mechanism for coefficients.
Definition at line 105 of file DB_Row.inlines.hh.
References Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::Impl::bump_size(), and Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::Impl::vec_.
Referenced by Parma_Polyhedra_Library::DB_Row< T >::construct_upward_approximation().
00105 { 00106 const dimension_type y_size = y.size(); 00107 #if CXX_SUPPORTS_FLEXIBLE_ARRAYS 00108 // Construct in direct order: will destroy in reverse order. 00109 for (dimension_type i = 0; i < y_size; ++i) { 00110 construct(vec_[i], y[i], ROUND_UP); 00111 bump_size(); 00112 } 00113 #else 00114 assert(y_size > 0); 00115 if (y_size > 0) { 00116 vec_[0] = y[0]; 00117 bump_size(); 00118 // Construct in direct order: will destroy in reverse order. 00119 for (dimension_type i = 1; i < y_size; ++i) { 00120 construct(vec_[i], y[i], ROUND_UP); 00121 bump_size(); 00122 } 00123 } 00124 #endif 00125 }
dimension_type Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::Impl::max_size | ( | ) | [inline, static] |
Returns the size() of the largest possible Impl.
Definition at line 59 of file DB_Row.inlines.hh.
Referenced by Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::Impl::expand_within_capacity().
dimension_type Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::Impl::size | ( | ) | const [inline] |
Returns the actual size of this
.
Definition at line 65 of file DB_Row.inlines.hh.
References Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::Impl::size_.
Referenced by Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::Impl::copy_construct_coefficients(), Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::Impl::expand_within_capacity(), Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::Impl::operator[](), Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::Impl::shrink(), and Parma_Polyhedra_Library::DB_Row< T >::size().
00065 { 00066 return size_; 00067 }
void Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::Impl::set_size | ( | dimension_type | new_sz | ) | [inline] |
Sets to new_sz
the actual size of *this
.
Definition at line 71 of file DB_Row.inlines.hh.
References Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::Impl::size_.
Referenced by Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::Impl::shrink().
00071 { 00072 size_ = new_sz; 00073 }
void Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::Impl::bump_size | ( | ) | [inline] |
Increments the size of *this
by 1.
Definition at line 77 of file DB_Row.inlines.hh.
References Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::Impl::size_.
Referenced by Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::Impl::construct_upward_approximation(), Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::Impl::copy_construct_coefficients(), and Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::Impl::expand_within_capacity().
00077 { 00078 ++size_; 00079 }
T & Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::Impl::operator[] | ( | dimension_type | k | ) | [inline] |
Returns a reference to the element of *this
indexed by k
.
Definition at line 135 of file DB_Row.inlines.hh.
References Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::Impl::size(), and Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::Impl::vec_.
const T & Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::Impl::operator[] | ( | dimension_type | k | ) | const [inline] |
Returns a constant reference to the element of *this
indexed by k
.
Definition at line 142 of file DB_Row.inlines.hh.
References Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::Impl::size(), and Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::Impl::vec_.
Impl& Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::Impl::operator= | ( | const Impl & | ) | [private] |
Private and unimplemented: assignment is not allowed.
void Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::Impl::copy_construct | ( | const Impl & | y | ) | [private] |
Exception-safe copy construction mechanism.
dimension_type Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::Impl::size_ [private] |
The number of coefficients in the row.
Definition at line 388 of file DB_Row.defs.hh.
Referenced by Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::Impl::bump_size(), Parma_Polyhedra_Library::DB_Row< T >::end(), Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::Impl::set_size(), and Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::Impl::size().
T Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::Impl::vec_[1] [private] |
The vector of coefficients.
Definition at line 395 of file DB_Row.defs.hh.
Referenced by Parma_Polyhedra_Library::DB_Row< T >::begin(), Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::Impl::construct_upward_approximation(), Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::Impl::copy_construct_coefficients(), Parma_Polyhedra_Library::DB_Row< T >::end(), Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::Impl::expand_within_capacity(), Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::Impl::operator[](), and Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::Impl::shrink().