PPL  1.2
Parma_Polyhedra_Library::DB_Row< T > Class Template Reference

The base class for the single rows of matrices. More...

#include <DB_Row_defs.hh>

Inheritance diagram for Parma_Polyhedra_Library::DB_Row< T >:
Collaboration diagram for Parma_Polyhedra_Library::DB_Row< T >:

Public Types

typedef Implementation::Ptr_Iterator< T * > iterator
 A (non const) random access iterator to access the row's elements. More...
 
typedef Implementation::Ptr_Iterator< const T * > const_iterator
 A const random access iterator to access the row's elements. More...
 

Public Member Functions

 DB_Row ()
 Pre-constructs a row: construction must be completed by construct(). More...
 
 DB_Row (dimension_type sz)
 Tight constructor: resizing will require reallocation. More...
 
 DB_Row (dimension_type sz, dimension_type capacity)
 Sizing constructor with capacity. More...
 
 DB_Row (const DB_Row &y)
 Ordinary copy constructor. More...
 
 DB_Row (const DB_Row &y, dimension_type capacity)
 Copy constructor with specified capacity. More...
 
 DB_Row (const DB_Row &y, dimension_type sz, dimension_type capacity)
 Copy constructor with specified size and capacity. More...
 
 ~DB_Row ()
 Destructor. More...
 
DB_Rowoperator= (const DB_Row &y)
 Assignment operator. More...
 
void m_swap (DB_Row &y)
 Swaps *this with y. More...
 
void assign (DB_Row &y)
 Assigns the implementation of y to *this. More...
 
void allocate (dimension_type capacity)
 Allocates memory for a default constructed DB_Row object, allowing for capacity coefficients at most. More...
 
void expand_within_capacity (dimension_type new_size)
 Expands the row to size new_size. More...
 
void shrink (dimension_type new_size)
 Shrinks the row by erasing elements at the end. More...
 
dimension_type size () const
 Gives the number of coefficients currently in use. More...
 
iterator begin ()
 Returns the const iterator pointing to the first element, if *this is not empty; otherwise, returns the past-the-end const iterator. More...
 
iterator end ()
 Returns the past-the-end iterator. More...
 
const_iterator begin () const
 Returns the const iterator pointing to the first element, if *this is not empty; otherwise, returns the past-the-end const iterator. More...
 
const_iterator end () const
 Returns the past-the-end const iterator. More...
 
memory_size_type total_memory_in_bytes () const
 Returns a lower bound to the total size in bytes of the memory occupied by *this. More...
 
memory_size_type external_memory_in_bytes () const
 Returns a lower bound to the size in bytes of the memory managed by *this. More...
 
memory_size_type total_memory_in_bytes (dimension_type capacity) const
 Returns the total size in bytes of the memory occupied by *this, provided the capacity of *this is given by capacity. More...
 
memory_size_type external_memory_in_bytes (dimension_type capacity) const
 Returns the size in bytes of the memory managed by *this, provided the capacity of *this is given by capacity. More...
 
bool OK (dimension_type row_size, dimension_type row_capacity) const
 Checks if all the invariants are satisfied. More...
 
Post-constructors.
void construct (dimension_type sz)
 Constructs properly a default-constructed element. More...
 
void construct (dimension_type sz, dimension_type capacity)
 Constructs properly a default-constructed element. More...
 
template<typename U >
void construct_upward_approximation (const DB_Row< U > &y, dimension_type capacity)
 Constructs properly a conservative approximation of y. More...
 
Subscript operators.
T & operator[] (dimension_type k)
 Returns a reference to the element of the row indexed by k. More...
 
const T & operator[] (dimension_type k) const
 Returns a constant reference to the element of the row indexed by k. More...
 

Static Public Member Functions

static dimension_type max_size ()
 Returns the size() of the largest possible DB_Row. More...
 

Private Member Functions

void copy_construct_coefficients (const DB_Row &y)
 Exception-safe copy construction mechanism for coefficients. More...
 
- Private Member Functions inherited from Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >
 DB_Row_Impl_Handler ()
 Default constructor. More...
 
 ~DB_Row_Impl_Handler ()
 Destructor. More...
 

Friends

template<typename U >
class Parma_Polyhedra_Library::DB_Row
 

Related Functions

(Note that these are not member functions.)

template<typename T >
void swap (DB_Row< T > &x, DB_Row< T > &y)
 Swaps x with y. More...
 
template<typename T >
void iter_swap (typename std::vector< DB_Row< T > >::iterator x, typename std::vector< DB_Row< T > >::iterator y)
 Swaps objects referred by x and y. More...
 
template<typename T >
bool operator!= (const DB_Row< T > &x, const DB_Row< T > &y)
 
template<typename T >
void swap (DB_Row< T > &x, DB_Row< T > &y)
 
template<typename T >
void iter_swap (typename std::vector< DB_Row< T > >::iterator x, typename std::vector< DB_Row< T > >::iterator y)
 
template<typename T >
bool operator== (const DB_Row< T > &x, const DB_Row< T > &y)
 
Classical comparison operators.
template<typename T >
bool operator== (const DB_Row< T > &x, const DB_Row< T > &y)
 
template<typename T >
bool operator!= (const DB_Row< T > &x, const DB_Row< T > &y)
 

Additional Inherited Members

- Private Attributes inherited from Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >
Implimpl
 A pointer to the actual implementation. More...
 

Detailed Description

template<typename T>
class Parma_Polyhedra_Library::DB_Row< T >

The base class for the single rows of matrices.

The class template DB_Row<T> allows for the efficient representation of the single rows of a DB_Matrix. It contains elements of type T stored as a vector. The class T is a family of extended numbers that must provide representation for $ -\infty $, $0$, $ +\infty $ (and, consequently for nan, not a number, since this arises as the ``result'' of undefined sums like $ +\infty + (-\infty) $).

The class T must provide the following methods:

T()

is the default constructor: no assumption is made on the particular object constructed, provided T().OK() gives true (see below).

~T()

is the destructor.

bool is_nan() const

returns true if and only *this represents the not a number value.

bool OK() const

returns true if and only if *this satisfies all its invariants.

Definition at line 120 of file DB_Row_defs.hh.

Member Typedef Documentation

template<typename T>
typedef Implementation::Ptr_Iterator<const T*> Parma_Polyhedra_Library::DB_Row< T >::const_iterator

A const random access iterator to access the row's elements.

Definition at line 247 of file DB_Row_defs.hh.

A (non const) random access iterator to access the row's elements.

Definition at line 244 of file DB_Row_defs.hh.

Constructor & Destructor Documentation

template<typename T >
Parma_Polyhedra_Library::DB_Row< T >::DB_Row ( )
inline

Pre-constructs a row: construction must be completed by construct().

Definition at line 168 of file DB_Row_inlines.hh.

169  : DB_Row_Impl_Handler<T>() {
170 }
template<typename T >
Parma_Polyhedra_Library::DB_Row< T >::DB_Row ( dimension_type  sz)
inline

Tight constructor: resizing will require reallocation.

Definition at line 253 of file DB_Row_inlines.hh.

References Parma_Polyhedra_Library::construct().

253  {
254  construct(sz);
255 }
void construct(dimension_type sz)
Constructs properly a default-constructed element.
template<typename T >
Parma_Polyhedra_Library::DB_Row< T >::DB_Row ( dimension_type  sz,
dimension_type  capacity 
)
inline

Sizing constructor with capacity.

Definition at line 245 of file DB_Row_inlines.hh.

References Parma_Polyhedra_Library::DB_Row< T >::construct().

247  : DB_Row_Impl_Handler<T>() {
248  construct(sz, capacity);
249 }
void construct(dimension_type sz)
Constructs properly a default-constructed element.
template<typename T >
Parma_Polyhedra_Library::DB_Row< T >::DB_Row ( const DB_Row< T > &  y)
inline

Ordinary copy constructor.

Definition at line 259 of file DB_Row_inlines.hh.

References Parma_Polyhedra_Library::DB_Row< T >::allocate(), Parma_Polyhedra_Library::compute_capacity(), Parma_Polyhedra_Library::DB_Row< T >::copy_construct_coefficients(), Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::impl, Parma_Polyhedra_Library::DB_Row< T >::max_size(), and Parma_Polyhedra_Library::DB_Row< T >::size().

260  : DB_Row_Impl_Handler<T>() {
261  if (y.impl != 0) {
262  allocate(compute_capacity(y.size(), max_size()));
264  }
265 }
void allocate(dimension_type capacity)
Allocates memory for a default constructed DB_Row object, allowing for capacity coefficients at most...
dimension_type compute_capacity(dimension_type requested_size, dimension_type maximum_size)
Speculative allocation function.
static dimension_type max_size()
Returns the size() of the largest possible DB_Row.
void copy_construct_coefficients(const DB_Row &y)
Exception-safe copy construction mechanism for coefficients.
template<typename T >
Parma_Polyhedra_Library::DB_Row< T >::DB_Row ( const DB_Row< T > &  y,
dimension_type  capacity 
)
inline

Copy constructor with specified capacity.

It is assumed that capacity is greater than or equal to y size.

Definition at line 269 of file DB_Row_inlines.hh.

References Parma_Polyhedra_Library::DB_Row< T >::allocate(), Parma_Polyhedra_Library::DB_Row< T >::copy_construct_coefficients(), Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::impl, Parma_Polyhedra_Library::DB_Row< T >::max_size(), and Parma_Polyhedra_Library::DB_Row< T >::size().

271  : DB_Row_Impl_Handler<T>() {
272  PPL_ASSERT(y.impl);
273  PPL_ASSERT(y.size() <= capacity && capacity <= max_size());
274  allocate(capacity);
276 }
void allocate(dimension_type capacity)
Allocates memory for a default constructed DB_Row object, allowing for capacity coefficients at most...
static dimension_type max_size()
Returns the size() of the largest possible DB_Row.
void copy_construct_coefficients(const DB_Row &y)
Exception-safe copy construction mechanism for coefficients.
template<typename T >
Parma_Polyhedra_Library::DB_Row< T >::DB_Row ( const DB_Row< T > &  y,
dimension_type  sz,
dimension_type  capacity 
)
inline

Copy constructor with specified size and capacity.

It is assumed that sz is greater than or equal to the size of y and, of course, that sz is less than or equal to capacity. Any new position is initialized to $+\infty$.

Definition at line 280 of file DB_Row_inlines.hh.

References Parma_Polyhedra_Library::DB_Row< T >::allocate(), Parma_Polyhedra_Library::DB_Row< T >::copy_construct_coefficients(), Parma_Polyhedra_Library::DB_Row< T >::expand_within_capacity(), Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::impl, Parma_Polyhedra_Library::DB_Row< T >::max_size(), and Parma_Polyhedra_Library::DB_Row< T >::size().

283  : DB_Row_Impl_Handler<T>() {
284  PPL_ASSERT(y.impl);
285  PPL_ASSERT(y.size() <= sz && sz <= capacity && capacity <= max_size());
286  allocate(capacity);
289 }
void expand_within_capacity(dimension_type new_size)
Expands the row to size new_size.
void allocate(dimension_type capacity)
Allocates memory for a default constructed DB_Row object, allowing for capacity coefficients at most...
static dimension_type max_size()
Returns the size() of the largest possible DB_Row.
void copy_construct_coefficients(const DB_Row &y)
Exception-safe copy construction mechanism for coefficients.
template<typename T >
Parma_Polyhedra_Library::DB_Row< T >::~DB_Row ( )
inline

Destructor.

Definition at line 293 of file DB_Row_inlines.hh.

293  {
294 }

Member Function Documentation

template<typename T >
void Parma_Polyhedra_Library::DB_Row< T >::allocate ( dimension_type  capacity)
inline

Allocates memory for a default constructed DB_Row object, allowing for capacity coefficients at most.

It is assumed that no allocation has been performed before (otherwise, a memory leak will occur). After execution, the size of the DB_Row object is zero.

Definition at line 174 of file DB_Row_inlines.hh.

References Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::impl.

Referenced by Parma_Polyhedra_Library::DB_Row< T >::DB_Row().

178  {
179  DB_Row<T>& x = *this;
180  PPL_ASSERT(capacity <= max_size());
181 #if !PPL_CXX_SUPPORTS_ZERO_LENGTH_ARRAYS
182  if (capacity == 0) {
183  ++capacity;
184  }
185 #endif
186  PPL_ASSERT(x.impl == 0);
187  x.impl = new(capacity) typename DB_Row_Impl_Handler<T>::Impl();
188 #if PPL_DB_ROW_EXTRA_DEBUG
189  PPL_ASSERT(x.capacity_ == 0);
190  x.capacity_ = capacity;
191 #endif
192 }
static dimension_type max_size()
Returns the size() of the largest possible DB_Row.
template<typename T >
void Parma_Polyhedra_Library::DB_Row< T >::assign ( DB_Row< T > &  y)
inline

Assigns the implementation of y to *this.

Definition at line 317 of file DB_Row_inlines.hh.

References Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::impl.

317  {
318  DB_Row<T>& x = *this;
319  x.impl = y.impl;
320 #if PPL_DB_ROW_EXTRA_DEBUG
321  x.capacity_ = y.capacity_;
322 #endif
323 }
template<typename T >
DB_Row< T >::iterator Parma_Polyhedra_Library::DB_Row< T >::begin ( )
inline

Returns the const iterator pointing to the first element, if *this is not empty; otherwise, returns the past-the-end const iterator.

Definition at line 349 of file DB_Row_inlines.hh.

References Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::impl.

349  {
350  DB_Row<T>& x = *this;
351  return iterator(x.impl->vec_);
352 }
Implementation::Ptr_Iterator< T * > iterator
A (non const) random access iterator to access the row's elements.
Definition: DB_Row_defs.hh:244
template<typename T >
DB_Row< T >::const_iterator Parma_Polyhedra_Library::DB_Row< T >::begin ( ) const
inline

Returns the const iterator pointing to the first element, if *this is not empty; otherwise, returns the past-the-end const iterator.

Definition at line 363 of file DB_Row_inlines.hh.

References Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::impl.

363  {
364  const DB_Row<T>& x = *this;
365  return const_iterator(x.impl->vec_);
366 }
Implementation::Ptr_Iterator< const T * > const_iterator
A const random access iterator to access the row's elements.
Definition: DB_Row_defs.hh:247
template<typename T >
void Parma_Polyhedra_Library::DB_Row< T >::construct ( dimension_type  sz)
inline

Constructs properly a default-constructed element.

Builds a row with size sz and minimum capacity.

Definition at line 239 of file DB_Row_inlines.hh.

References Parma_Polyhedra_Library::construct().

Referenced by Parma_Polyhedra_Library::DB_Row< T >::DB_Row().

239  {
240  construct(sz, sz);
241 }
void construct(dimension_type sz)
Constructs properly a default-constructed element.
template<typename T >
void Parma_Polyhedra_Library::DB_Row< T >::construct ( dimension_type  sz,
dimension_type  capacity 
)
inline

Constructs properly a default-constructed element.

Parameters
szThe size of the row that will be constructed.
capacityThe minimum capacity of the row that will be constructed.

The row that we are constructing has a minimum capacity of (i.e., it can contain at least) elements, sz of which will be constructed now.

Definition at line 230 of file DB_Row_inlines.hh.

231  {
232  PPL_ASSERT(sz <= capacity && capacity <= max_size());
233  allocate(capacity);
235 }
void expand_within_capacity(dimension_type new_size)
Expands the row to size new_size.
void allocate(dimension_type capacity)
Allocates memory for a default constructed DB_Row object, allowing for capacity coefficients at most...
static dimension_type max_size()
Returns the size() of the largest possible DB_Row.
template<typename T >
template<typename U >
void Parma_Polyhedra_Library::DB_Row< T >::construct_upward_approximation ( const DB_Row< U > &  y,
dimension_type  capacity 
)
inline

Constructs properly a conservative approximation of y.

Parameters
yA row containing the elements whose upward approximations will be used to properly construct *this.
capacityThe capacity of the constructed row.

It is assumed that capacity is greater than or equal to the size of y.

Definition at line 219 of file DB_Row_inlines.hh.

References Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::impl, and Parma_Polyhedra_Library::DB_Row< T >::size().

220  {
221  DB_Row<T>& x = *this;
222  PPL_ASSERT(y.size() <= capacity && capacity <= max_size());
223  allocate(capacity);
224  PPL_ASSERT(y.impl);
225  x.impl->construct_upward_approximation(*(y.impl));
226 }
void allocate(dimension_type capacity)
Allocates memory for a default constructed DB_Row object, allowing for capacity coefficients at most...
static dimension_type max_size()
Returns the size() of the largest possible DB_Row.
template<typename T >
void Parma_Polyhedra_Library::DB_Row< T >::copy_construct_coefficients ( const DB_Row< T > &  y)
inlineprivate

Exception-safe copy construction mechanism for coefficients.

Definition at line 207 of file DB_Row_inlines.hh.

References Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::impl, and Parma_Polyhedra_Library::DB_Row< T >::size().

Referenced by Parma_Polyhedra_Library::DB_Row< T >::DB_Row().

207  {
208  DB_Row<T>& x = *this;
209  PPL_ASSERT(x.impl && y.impl);
210 #if PPL_DB_ROW_EXTRA_DEBUG
211  PPL_ASSERT(y.size() <= x.capacity_);
212 #endif
213  x.impl->copy_construct_coefficients(*(y.impl));
214 }
template<typename T >
DB_Row< T >::iterator Parma_Polyhedra_Library::DB_Row< T >::end ( )
inline

Returns the past-the-end iterator.

Definition at line 356 of file DB_Row_inlines.hh.

References Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::impl.

356  {
357  DB_Row<T>& x = *this;
358  return iterator(x.impl->vec_ + x.impl->size_);
359 }
Implementation::Ptr_Iterator< T * > iterator
A (non const) random access iterator to access the row's elements.
Definition: DB_Row_defs.hh:244
template<typename T >
DB_Row< T >::const_iterator Parma_Polyhedra_Library::DB_Row< T >::end ( ) const
inline

Returns the past-the-end const iterator.

Definition at line 370 of file DB_Row_inlines.hh.

References Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::impl.

370  {
371  const DB_Row<T>& x = *this;
372  return const_iterator(x.impl->vec_ + x.impl->size_);
373 }
Implementation::Ptr_Iterator< const T * > const_iterator
A const random access iterator to access the row's elements.
Definition: DB_Row_defs.hh:247
template<typename T >
void Parma_Polyhedra_Library::DB_Row< T >::expand_within_capacity ( dimension_type  new_size)
inline

Expands the row to size new_size.

Adds new positions to the implementation of the row obtaining a new row with size new_size. It is assumed that new_size is between the current size and capacity of the row. The new positions are initialized to $+\infty$.

Definition at line 196 of file DB_Row_inlines.hh.

References Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::impl.

Referenced by Parma_Polyhedra_Library::DB_Row< T >::DB_Row().

196  {
197  DB_Row<T>& x = *this;
198  PPL_ASSERT(x.impl);
199 #if PPL_DB_ROW_EXTRA_DEBUG
200  PPL_ASSERT(new_size <= x.capacity_);
201 #endif
202  x.impl->expand_within_capacity(new_size);
203 }
template<typename T >
memory_size_type Parma_Polyhedra_Library::DB_Row< T >::external_memory_in_bytes ( ) const
inline

Returns a lower bound to the size in bytes of the memory managed by *this.

Definition at line 390 of file DB_Row_inlines.hh.

References Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::impl.

390  {
391  const DB_Row<T>& x = *this;
392 #if PPL_DB_ROW_EXTRA_DEBUG
393  return x.impl->total_memory_in_bytes(x.capacity_);
394 #else
395  return x.impl->total_memory_in_bytes();
396 #endif
397 }
template<typename T >
memory_size_type Parma_Polyhedra_Library::DB_Row< T >::external_memory_in_bytes ( dimension_type  capacity) const
inline

Returns the size in bytes of the memory managed by *this, provided the capacity of *this is given by capacity.

Definition at line 377 of file DB_Row_inlines.hh.

References Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::impl.

377  {
378  const DB_Row<T>& x = *this;
379  return x.impl->total_memory_in_bytes(capacity);
380 }
template<typename T >
void Parma_Polyhedra_Library::DB_Row< T >::m_swap ( DB_Row< T > &  y)
inline

Swaps *this with y.

Definition at line 306 of file DB_Row_inlines.hh.

References Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::impl, and Parma_Polyhedra_Library::swap().

Referenced by Parma_Polyhedra_Library::DB_Row< T >::swap().

306  {
307  using std::swap;
308  DB_Row<T>& x = *this;
309  swap(x.impl, y.impl);
310 #if PPL_DB_ROW_EXTRA_DEBUG
311  swap(x.capacity_, y.capacity_);
312 #endif
313 }
void swap(CO_Tree &x, CO_Tree &y)
void swap(DB_Row< T > &x, DB_Row< T > &y)
Swaps x with y.
template<typename T >
dimension_type Parma_Polyhedra_Library::DB_Row< T >::max_size ( )
inlinestatic
template<typename T >
bool Parma_Polyhedra_Library::DB_Row< T >::OK ( dimension_type  row_size,
dimension_type  row_capacity 
) const

Checks if all the invariants are satisfied.

Definition at line 129 of file DB_Row_templates.hh.

References Parma_Polyhedra_Library::is_not_a_number(), and Parma_Polyhedra_Library::DB_Row< T >::size().

134  {
135 #ifndef NDEBUG
136  using std::endl;
137  using std::cerr;
138 #endif
139 
140  const DB_Row<T>& x = *this;
141  bool is_broken = false;
142 
143 #if PPL_DB_ROW_EXTRA_DEBUG
144 # if !PPL_CXX_SUPPORTS_ZERO_LENGTH_ARRAYS
145  if (x.capacity_ == 0) {
146  cerr << "Illegal row capacity: is 0, should be at least 1"
147  << endl;
148  is_broken = true;
149  }
150  else if (x.capacity_ == 1 && row_capacity == 0)
151  // This is fine.
152  ;
153  else
154 # endif // !PPL_CXX_SUPPORTS_ZERO_LENGTH_ARRAYS
155  if (x.capacity_ != row_capacity) {
156  cerr << "DB_Row capacity mismatch: is " << x.capacity_
157  << ", should be " << row_capacity << "."
158  << endl;
159  is_broken = true;
160  }
161 #endif // PPL_DB_ROW_EXTRA_DEBUG
162 
163  if (x.size() != row_size) {
164 #ifndef NDEBUG
165  cerr << "DB_Row size mismatch: is " << x.size()
166  << ", should be " << row_size << "."
167  << endl;
168 #endif
169  is_broken = true;
170  }
171 
172 #if PPL_DB_ROW_EXTRA_DEBUG
173  if (x.capacity_ < x.size()) {
174 #ifndef NDEBUG
175  cerr << "DB_Row is completely broken: capacity is " << x.capacity_
176  << ", size is " << x.size() << "."
177  << endl;
178 #endif
179  is_broken = true;
180  }
181 #endif // PPL_DB_ROW_EXTRA_DEBUG
182 
183  for (dimension_type i = x.size(); i-- > 0; ) {
184  const T& element = x[i];
185  // Not OK is bad.
186  if (!element.OK()) {
187  is_broken = true;
188  break;
189  }
190  // In addition, nans should never occur.
191  if (is_not_a_number(element)) {
192 #ifndef NDEBUG
193  cerr << "Not-a-number found in DB_Row."
194  << endl;
195 #endif
196  is_broken = true;
197  break;
198  }
199  }
200 
201  return !is_broken;
202 }
size_t dimension_type
An unsigned integral type for representing space dimensions.
Enable_If< Is_Native_Or_Checked< T >::value, bool >::type is_not_a_number(const T &x)
template<typename T >
DB_Row< T > & Parma_Polyhedra_Library::DB_Row< T >::operator= ( const DB_Row< T > &  y)
inline

Assignment operator.

Definition at line 327 of file DB_Row_inlines.hh.

327  {
328  DB_Row tmp(y);
329  m_swap(tmp);
330  return *this;
331 }
void m_swap(DB_Row &y)
Swaps *this with y.
DB_Row()
Pre-constructs a row: construction must be completed by construct().
template<typename T >
T & Parma_Polyhedra_Library::DB_Row< T >::operator[] ( dimension_type  k)
inline

Returns a reference to the element of the row indexed by k.

Definition at line 335 of file DB_Row_inlines.hh.

References Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::impl.

335  {
336  DB_Row<T>& x = *this;
337  return (*x.impl)[k];
338 }
template<typename T >
const T & Parma_Polyhedra_Library::DB_Row< T >::operator[] ( dimension_type  k) const
inline

Returns a constant reference to the element of the row indexed by k.

Definition at line 342 of file DB_Row_inlines.hh.

References Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::impl.

342  {
343  const DB_Row<T>& x = *this;
344  return (*x.impl)[k];
345 }
template<typename T >
void Parma_Polyhedra_Library::DB_Row< T >::shrink ( dimension_type  new_size)
inline

Shrinks the row by erasing elements at the end.

Destroys elements of the row implementation from position new_size to the end. It is assumed that new_size is not greater than the current size.

Definition at line 298 of file DB_Row_inlines.hh.

References Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::impl.

298  {
299  DB_Row<T>& x = *this;
300  PPL_ASSERT(x.impl);
301  x.impl->shrink(new_size);
302 }
template<typename T >
memory_size_type Parma_Polyhedra_Library::DB_Row< T >::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 401 of file DB_Row_inlines.hh.

References Parma_Polyhedra_Library::external_memory_in_bytes().

401  {
402  return sizeof(*this) + external_memory_in_bytes();
403 }
memory_size_type external_memory_in_bytes() const
Returns a lower bound to the size in bytes of the memory managed by *this.
template<typename T >
memory_size_type Parma_Polyhedra_Library::DB_Row< T >::total_memory_in_bytes ( dimension_type  capacity) const
inline

Returns the total size in bytes of the memory occupied by *this, provided the capacity of *this is given by capacity.

Definition at line 384 of file DB_Row_inlines.hh.

References Parma_Polyhedra_Library::external_memory_in_bytes().

384  {
385  return sizeof(*this) + external_memory_in_bytes(capacity);
386 }
memory_size_type external_memory_in_bytes() const
Returns a lower bound to the size in bytes of the memory managed by *this.

Friends And Related Function Documentation

template<typename T >
void iter_swap ( typename std::vector< DB_Row< T > >::iterator  x,
typename std::vector< DB_Row< T > >::iterator  y 
)
related

Swaps objects referred by x and y.

template<typename T >
void iter_swap ( typename std::vector< DB_Row< T > >::iterator  x,
typename std::vector< DB_Row< T > >::iterator  y 
)
related

Definition at line 422 of file DB_Row_inlines.hh.

References Parma_Polyhedra_Library::swap().

423  {
424  swap(*x, *y);
425 }
void swap(DB_Row< T > &x, DB_Row< T > &y)
Swaps x with y.
template<typename T >
bool operator!= ( const DB_Row< T > &  x,
const DB_Row< T > &  y 
)
related
template<typename T >
bool operator!= ( const DB_Row< T > &  x,
const DB_Row< T > &  y 
)
related

Definition at line 408 of file DB_Row_inlines.hh.

408  {
409  return !(x == y);
410 }
template<typename T >
bool operator== ( const DB_Row< T > &  x,
const DB_Row< T > &  y 
)
related

Definition at line 207 of file DB_Row_templates.hh.

References Parma_Polyhedra_Library::DB_Row< T >::size().

207  {
208  if (x.size() != y.size()) {
209  return false;
210  }
211  for (dimension_type i = x.size(); i-- > 0; ) {
212  if (x[i] != y[i]) {
213  return false;
214  }
215  }
216  return true;
217 }
size_t dimension_type
An unsigned integral type for representing space dimensions.
template<typename T >
bool operator== ( const DB_Row< T > &  x,
const DB_Row< T > &  y 
)
related
template<typename T>
template<typename U >
friend class Parma_Polyhedra_Library::DB_Row
friend

Definition at line 297 of file DB_Row_defs.hh.

template<typename T >
void swap ( DB_Row< T > &  x,
DB_Row< T > &  y 
)
related

Swaps x with y.

template<typename T >
void swap ( DB_Row< T > &  x,
DB_Row< T > &  y 
)
related

Definition at line 415 of file DB_Row_inlines.hh.

References Parma_Polyhedra_Library::DB_Row< T >::m_swap().

415  {
416  x.m_swap(y);
417 }

The documentation for this class was generated from the following files: