The real implementation of a DB_Row object. More...
#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. | |
| memory_size_type | total_memory_in_bytes () const |
Returns a lower bound to the total size in bytes of the memory occupied by *this. | |
| memory_size_type | total_memory_in_bytes (dimension_type capacity) const |
Returns the total size in bytes of the memory occupied by *this. | |
| memory_size_type | external_memory_in_bytes () const |
Returns the size in bytes of the memory managed by *this. | |
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. | |
Friends | |
| class | DB_Row< T > |
The real implementation of a DB_Row object.
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 337 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 113 of file DB_Row.inlines.hh.
References Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::Impl::shrink().
00113 { 00114 shrink(0); 00115 }
| 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::bump_size | ( | ) | [inline] |
Increments the size of *this by 1.
Definition at line 101 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().
00101 { 00102 ++size_; 00103 }
| 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 34 of file DB_Row.templates.hh.
References Parma_Polyhedra_Library::assign_r(), Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::Impl::bump_size(), Parma_Polyhedra_Library::construct(), and Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::Impl::vec_.
Referenced by Parma_Polyhedra_Library::DB_Row< T >::construct_upward_approximation().
00034 { 00035 const dimension_type y_size = y.size(); 00036 #if PPL_CXX_SUPPORTS_FLEXIBLE_ARRAYS 00037 // Construct in direct order: will destroy in reverse order. 00038 for (dimension_type i = 0; i < y_size; ++i) { 00039 construct(vec_[i], y[i], ROUND_UP); 00040 bump_size(); 00041 } 00042 #else // PPL_CXX_SUPPORTS_FLEXIBLE_ARRAYS 00043 if (y_size > 0) { 00044 assign_r(vec_[0], y[0], ROUND_UP); 00045 bump_size(); 00046 // Construct in direct order: will destroy in reverse order. 00047 for (dimension_type i = 1; i < y_size; ++i) { 00048 construct(vec_[i], y[i], ROUND_UP); 00049 bump_size(); 00050 } 00051 } 00052 #endif // PPL_CXX_SUPPORTS_FLEXIBLE_ARRAYS 00053 }
| void Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::Impl::copy_construct | ( | const Impl & | y | ) | [private] |
Exception-safe copy construction mechanism.
| 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 94 of file DB_Row.templates.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().
00094 { 00095 const dimension_type y_size = y.size(); 00096 #if PPL_CXX_SUPPORTS_FLEXIBLE_ARRAYS 00097 // Construct in direct order: will destroy in reverse order. 00098 for (dimension_type i = 0; i < y_size; ++i) { 00099 new (&vec_[i]) T(y.vec_[i]); 00100 bump_size(); 00101 } 00102 #else // PPL_CXX_SUPPORTS_FLEXIBLE_ARRAYS 00103 if (y_size > 0) { 00104 vec_[0] = y.vec_[0]; 00105 bump_size(); 00106 // Construct in direct order: will destroy in reverse order. 00107 for (dimension_type i = 1; i < y_size; ++i) { 00108 new (&vec_[i]) T(y.vec_[i]); 00109 bump_size(); 00110 } 00111 } 00112 #endif // PPL_CXX_SUPPORTS_FLEXIBLE_ARRAYS 00113 }
| 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 58 of file DB_Row.templates.hh.
References Parma_Polyhedra_Library::assign_r(), 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().
00058 { 00059 PPL_ASSERT(size() <= new_size && new_size <= max_size()); 00060 #if !PPL_CXX_SUPPORTS_FLEXIBLE_ARRAYS 00061 if (size() == 0 && new_size > 0) { 00062 // vec_[0] is already constructed: we just need to assign +infinity. 00063 assign_r(vec_[0], PLUS_INFINITY, ROUND_NOT_NEEDED); 00064 bump_size(); 00065 } 00066 #endif 00067 // Construct in direct order: will destroy in reverse order. 00068 for (dimension_type i = size(); i < new_size; ++i) { 00069 new (&vec_[i]) T(PLUS_INFINITY, ROUND_NOT_NEEDED); 00070 bump_size(); 00071 } 00072 }
| memory_size_type Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::Impl::external_memory_in_bytes | ( | ) | const [inline] |
Returns the size in bytes of the memory managed by *this.
Definition at line 117 of file DB_Row.templates.hh.
References Parma_Polyhedra_Library::external_memory_in_bytes(), 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_Impl_Handler< T >::Impl::total_memory_in_bytes().
00117 { 00118 memory_size_type n = 0; 00119 for (dimension_type i = size(); i-- > 0; ) 00120 n += Parma_Polyhedra_Library::external_memory_in_bytes(vec_[i]); 00121 return n; 00122 }
| 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 83 of file DB_Row.inlines.hh.
Referenced by Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::Impl::expand_within_capacity().
| 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 56 of file DB_Row.inlines.hh.
| 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 50 of file DB_Row.inlines.hh.
| 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 38 of file DB_Row.inlines.hh.
00039 { 00040 #if PPL_CXX_SUPPORTS_FLEXIBLE_ARRAYS 00041 return ::operator new(fixed_size + capacity*sizeof(T)); 00042 #else 00043 PPL_ASSERT(capacity >= 1); 00044 return ::operator new(fixed_size + (capacity-1)*sizeof(T)); 00045 #endif 00046 }
| Impl& Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::Impl::operator= | ( | const Impl & | ) | [private] |
Private and unimplemented: assignment is not allowed.
| 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 141 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_.
| 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 134 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_.
| 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 95 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().
00095 { 00096 size_ = new_sz; 00097 }
| 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 76 of file DB_Row.templates.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().
00076 { 00077 const dimension_type old_size = size(); 00078 PPL_ASSERT(new_size <= old_size); 00079 // Since ~T() does not throw exceptions, nothing here does. 00080 set_size(new_size); 00081 #if !PPL_CXX_SUPPORTS_FLEXIBLE_ARRAYS 00082 // Make sure we do not try to destroy vec_[0]. 00083 if (new_size == 0) 00084 ++new_size; 00085 #endif 00086 // We assume construction was done "forward". 00087 // We thus perform destruction "backward". 00088 for (dimension_type i = old_size; i-- > new_size; ) 00089 vec_[i].~T(); 00090 }
| dimension_type Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::Impl::size | ( | ) | const [inline] |
Returns the actual size of this.
Definition at line 89 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::external_memory_in_bytes(), 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().
00089 { 00090 return size_; 00091 }
| memory_size_type Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::Impl::total_memory_in_bytes | ( | dimension_type | capacity | ) | const [inline] |
Returns the total size in bytes of the memory occupied by *this.
Definition at line 63 of file DB_Row.inlines.hh.
References Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::Impl::external_memory_in_bytes().
00063 { 00064 return 00065 sizeof(*this) 00066 + capacity*sizeof(T) 00067 #if !PPL_CXX_SUPPORTS_FLEXIBLE_ARRAYS 00068 - 1*sizeof(T) 00069 #endif 00070 + external_memory_in_bytes(); 00071 }
| memory_size_type Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::Impl::total_memory_in_bytes | ( | ) | const [inline] |
Returns a lower bound to the total size in bytes of the memory occupied by *this.
Definition at line 75 of file DB_Row.inlines.hh.
References Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::Impl::size_.
Referenced by Parma_Polyhedra_Library::DB_Row< T >::external_memory_in_bytes().
00075 { 00076 // In general, this is a lower bound, as the capacity of *this 00077 // may be strictly greater than `size_' 00078 return total_memory_in_bytes(size_); 00079 }
friend class DB_Row< T > [friend] |
Definition at line 428 of file DB_Row.defs.hh.
dimension_type Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::Impl::size_ [private] |
The number of coefficients in the row.
Definition at line 431 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(), Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::Impl::size(), and Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::Impl::total_memory_in_bytes().
T Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::Impl::vec_[1] [private] |
The vector of coefficients.
Definition at line 438 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::external_memory_in_bytes(), Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::Impl::operator[](), and Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::Impl::shrink().
1.6.3