#include <Row.defs.hh>
Public Member Functions | |
Impl (Row::Flags f) | |
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. | |
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 . | |
Flags accessors | |
const Row::Flags & | flags () const |
Returns a const reference to the flags of *this . | |
Row::Flags & | flags () |
Returns a non-const reference to the flags of *this . | |
Size accessors | |
dimension_type | size () const |
Returns the actual size of this . | |
void | set_size (dimension_type new_size) |
Sets to new_size the actual size of *this . | |
void | bump_size () |
Increment the size of *this by 1. | |
Subscript operators | |
Coefficient & | operator[] (dimension_type k) |
Returns a reference to the element of *this indexed by k . | |
Coefficient_traits::const_reference | 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 Coefficient 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 () | |
Private and unimplemented: default construction is not allowed. | |
Impl (const Impl &y) | |
Private and unimplemented: copy construction is not allowed. | |
Impl & | operator= (const Impl &) |
Private and unimplemented: assignment is not allowed. | |
Private Attributes | |
dimension_type | size_ |
The number of coefficients in the row. | |
Row::Flags | flags_ |
The flags of this row. | |
Coefficient | vec_ [1] |
The vector of coefficients. |
The class Row_Impl_Handler::Impl provides the implementation of Row objects and, in particular, of the corresponding memory allocation functions.
Definition at line 378 of file Row.defs.hh.
Parma_Polyhedra_Library::Row_Impl_Handler::Impl::Impl | ( | Row::Flags | f | ) | [inline] |
Parma_Polyhedra_Library::Row_Impl_Handler::Impl::~Impl | ( | ) | [inline] |
Destructor.
Uses shrink()
method with argument to delete all the row elements.
Definition at line 120 of file Row.inlines.hh.
References shrink().
00120 { 00121 shrink(0); 00122 }
Parma_Polyhedra_Library::Row_Impl_Handler::Impl::Impl | ( | ) | [private] |
Private and unimplemented: default construction is not allowed.
Parma_Polyhedra_Library::Row_Impl_Handler::Impl::Impl | ( | const Impl & | y | ) | [private] |
Private and unimplemented: copy construction is not allowed.
void * Parma_Polyhedra_Library::Row_Impl_Handler::Impl::operator new | ( | size_t | fixed_size, | |
dimension_type | capacity | |||
) | [inline, static] |
Allocates a chunk of memory able to contain capacity
Coefficient objects beyond the specified fixed_size
and returns a pointer to the new allocated memory.
Definition at line 74 of file Row.inlines.hh.
00075 { 00076 #if CXX_SUPPORTS_FLEXIBLE_ARRAYS 00077 return ::operator new(fixed_size + capacity*sizeof(Coefficient)); 00078 #else 00079 assert(capacity >= 1); 00080 return ::operator new(fixed_size + (capacity-1)*sizeof(Coefficient)); 00081 #endif 00082 }
void Parma_Polyhedra_Library::Row_Impl_Handler::Impl::operator delete | ( | void * | p | ) | [inline, static] |
Uses the standard delete operator to free the memory p
points to.
Definition at line 85 of file Row.inlines.hh.
void Parma_Polyhedra_Library::Row_Impl_Handler::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 90 of file Row.inlines.hh.
void Parma_Polyhedra_Library::Row_Impl_Handler::Impl::expand_within_capacity | ( | dimension_type | new_size | ) |
Expands the row to size new_size
.
It is assumed that new_size
is between the current size and capacity.
Definition at line 35 of file Row.cc.
Referenced by Parma_Polyhedra_Library::Row::expand_within_capacity().
00035 { 00036 assert(size() <= new_size && new_size <= max_size()); 00037 #if !CXX_SUPPORTS_FLEXIBLE_ARRAYS 00038 // vec_[0] is already constructed. 00039 if (size() == 0 && new_size > 0) 00040 bump_size(); 00041 #endif 00042 for (dimension_type i = size(); i < new_size; ++i) { 00043 new (&vec_[i]) Coefficient(); 00044 bump_size(); 00045 } 00046 }
void Parma_Polyhedra_Library::Row_Impl_Handler::Impl::shrink | ( | dimension_type | new_size | ) |
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 49 of file Row.cc.
References set_size(), size(), and vec_.
Referenced by Parma_Polyhedra_Library::Row::shrink(), and ~Impl().
00049 { 00050 const dimension_type old_size = size(); 00051 assert(new_size <= old_size); 00052 // Since ~Coefficient() does not throw exceptions, nothing here does. 00053 set_size(new_size); 00054 #if !CXX_SUPPORTS_FLEXIBLE_ARRAYS 00055 // Make sure we do not try to destroy vec_[0]. 00056 if (new_size == 0) 00057 ++new_size; 00058 #endif 00059 // We assume construction was done "forward". 00060 // We thus perform destruction "backward". 00061 for (dimension_type i = old_size; i-- > new_size; ) 00062 vec_[i].~Coefficient(); 00063 }
void Parma_Polyhedra_Library::Row_Impl_Handler::Impl::copy_construct_coefficients | ( | const Impl & | y | ) |
Exception-safe copy construction mechanism for coefficients.
Definition at line 66 of file Row.cc.
References bump_size(), size(), and vec_.
Referenced by Parma_Polyhedra_Library::Row::copy_construct_coefficients().
00066 { 00067 const dimension_type y_size = y.size(); 00068 #if CXX_SUPPORTS_FLEXIBLE_ARRAYS 00069 for (dimension_type i = 0; i < y_size; ++i) { 00070 new (&vec_[i]) Coefficient(y.vec_[i]); 00071 bump_size(); 00072 } 00073 #else 00074 assert(y_size > 0); 00075 if (y_size > 0) { 00076 vec_[0] = y.vec_[0]; 00077 bump_size(); 00078 for (dimension_type i = 1; i < y_size; ++i) { 00079 new (&vec_[i]) Coefficient(y.vec_[i]); 00080 bump_size(); 00081 } 00082 } 00083 #endif 00084 }
dimension_type Parma_Polyhedra_Library::Row_Impl_Handler::Impl::max_size | ( | ) | [inline, static] |
Returns the size() of the largest possible Impl.
Definition at line 95 of file Row.inlines.hh.
Referenced by Parma_Polyhedra_Library::Row::max_size().
00095 { 00096 return size_t(-1)/sizeof(Coefficient); 00097 }
const Row::Flags & Parma_Polyhedra_Library::Row_Impl_Handler::Impl::flags | ( | ) | const [inline] |
Returns a const reference to the flags of *this
.
Definition at line 125 of file Row.inlines.hh.
References flags_.
Referenced by Parma_Polyhedra_Library::Row::flags().
00125 { 00126 return flags_; 00127 }
Row::Flags & Parma_Polyhedra_Library::Row_Impl_Handler::Impl::flags | ( | ) | [inline] |
Returns a non-const reference to the flags of *this
.
Definition at line 130 of file Row.inlines.hh.
References flags_.
00130 { 00131 return flags_; 00132 }
dimension_type Parma_Polyhedra_Library::Row_Impl_Handler::Impl::size | ( | ) | const [inline] |
Returns the actual size of this
.
Definition at line 100 of file Row.inlines.hh.
References size_.
Referenced by copy_construct_coefficients(), external_memory_in_bytes(), operator[](), shrink(), and Parma_Polyhedra_Library::Row::size().
00100 { 00101 return size_; 00102 }
void Parma_Polyhedra_Library::Row_Impl_Handler::Impl::set_size | ( | dimension_type | new_size | ) | [inline] |
Sets to new_size
the actual size of *this
.
Definition at line 105 of file Row.inlines.hh.
References size_.
Referenced by shrink().
00105 { 00106 size_ = new_size; 00107 }
void Parma_Polyhedra_Library::Row_Impl_Handler::Impl::bump_size | ( | ) | [inline] |
Increment the size of *this
by 1.
Definition at line 110 of file Row.inlines.hh.
References size_.
Referenced by copy_construct_coefficients().
00110 { 00111 ++size_; 00112 }
Coefficient & Parma_Polyhedra_Library::Row_Impl_Handler::Impl::operator[] | ( | dimension_type | k | ) | [inline] |
Coefficient_traits::const_reference Parma_Polyhedra_Library::Row_Impl_Handler::Impl::operator[] | ( | dimension_type | k | ) | const [inline] |
memory_size_type Parma_Polyhedra_Library::Row_Impl_Handler::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 158 of file Row.inlines.hh.
References size_.
Referenced by Parma_Polyhedra_Library::Row::external_memory_in_bytes().
00158 { 00159 // In general, this is a lower bound, as the capacity of *this 00160 // may be strictly greater than `size_' 00161 return total_memory_in_bytes(size_); 00162 }
memory_size_type Parma_Polyhedra_Library::Row_Impl_Handler::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 147 of file Row.inlines.hh.
References external_memory_in_bytes().
00147 { 00148 return 00149 sizeof(*this) 00150 + capacity*sizeof(Coefficient) 00151 #if !CXX_SUPPORTS_FLEXIBLE_ARRAYS 00152 - 1*sizeof(Coefficient) 00153 #endif 00154 + external_memory_in_bytes(); 00155 }
PPL::memory_size_type Parma_Polyhedra_Library::Row_Impl_Handler::Impl::external_memory_in_bytes | ( | ) | const |
Returns the size in bytes of the memory managed by *this
.
Definition at line 188 of file Row.cc.
References Parma_Polyhedra_Library::Checked::external_memory_in_bytes(), size(), and vec_.
Referenced by total_memory_in_bytes().
00188 { 00189 memory_size_type n = 0; 00190 for (dimension_type i = size(); i-- > 0; ) 00191 n += PPL::external_memory_in_bytes(vec_[i]); 00192 return n; 00193 }
Private and unimplemented: assignment is not allowed.
The number of coefficients in the row.
Definition at line 472 of file Row.defs.hh.
Referenced by bump_size(), set_size(), size(), and total_memory_in_bytes().
The vector of coefficients.
Definition at line 482 of file Row.defs.hh.
Referenced by copy_construct_coefficients(), external_memory_in_bytes(), operator[](), and shrink().