Parma_Polyhedra_Library::DB_Row< T > Class Template Reference
[C++ Language Interface]

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

#include <DB_Row.defs.hh>

Inheritance diagram for Parma_Polyhedra_Library::DB_Row< T >:

Inheritance graph
[legend]
Collaboration diagram for Parma_Polyhedra_Library::DB_Row< T >:

Collaboration graph
[legend]

List of all members.

Public Types

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

Public Member Functions

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

Static Public Member Functions

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

Private Member Functions

void copy_construct_coefficients (const DB_Row &y)
 Exception-safe copy construction mechanism for coefficients.

Friends

class Parma_Polyhedra_Library::DB_Row

Related Functions

(Note that these are not member functions.)

template<typename T>
void swap (Parma_Polyhedra_Library::DB_Row< T > &x, Parma_Polyhedra_Library::DB_Row< T > &y)
 Specializes std::swap.
template<typename T>
void iter_swap (typename std::vector< Parma_Polyhedra_Library::DB_Row< T > >::iterator x, typename std::vector< Parma_Polyhedra_Library::DB_Row< T > >::iterator y)
 Specializes std::iter_swap.
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)


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 119 of file DB_Row.defs.hh.


Member Typedef Documentation

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

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

Definition at line 243 of file DB_Row.defs.hh.

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 246 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 165 of file DB_Row.inlines.hh.

00166   : DB_Row_Impl_Handler<T>() {
00167 }

template<typename T>
Parma_Polyhedra_Library::DB_Row< T >::DB_Row ( dimension_type  sz  )  [inline]

Tight constructor: resizing will require reallocation.

Definition at line 249 of file DB_Row.inlines.hh.

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

00249                                          {
00250   construct(sz);
00251 }

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 241 of file DB_Row.inlines.hh.

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

00243   : DB_Row_Impl_Handler<T>() {
00244   construct(sz, capacity);
00245 }

template<typename T>
Parma_Polyhedra_Library::DB_Row< T >::DB_Row ( const DB_Row< T > &  y  )  [inline]

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 265 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().

00267   : DB_Row_Impl_Handler<T>() {
00268   assert(y.impl);
00269   assert(y.size() <= capacity && capacity <= max_size());
00270   allocate(capacity);
00271   copy_construct_coefficients(y);
00272 }

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 276 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().

00279   : DB_Row_Impl_Handler<T>() {
00280   assert(y.impl);
00281   assert(y.size() <= sz && sz <= capacity && capacity <= max_size());
00282   allocate(capacity);
00283   copy_construct_coefficients(y);
00284   expand_within_capacity(sz);
00285 }

template<typename T>
Parma_Polyhedra_Library::DB_Row< T >::~DB_Row (  )  [inline]

Destructor.

Definition at line 289 of file DB_Row.inlines.hh.

00289                    {
00290 }


Member Function Documentation

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 235 of file DB_Row.inlines.hh.

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

00235                                             {
00236   construct(sz, sz);
00237 }

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:
sz The size of the row that will be constructed.
capacity The 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 226 of file DB_Row.inlines.hh.

References Parma_Polyhedra_Library::DB_Row< T >::allocate(), Parma_Polyhedra_Library::DB_Row< T >::expand_within_capacity(), and Parma_Polyhedra_Library::DB_Row< T >::max_size().

00227                                                     {
00228   assert(sz <= capacity && capacity <= max_size());
00229   allocate(capacity);
00230   expand_within_capacity(sz);
00231 }

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:
y A row containing the elements whose upward approximations will be used to properly construct *this.
capacity The capacity of the constructed row.
It is assumed that capacity is greater than or equal to the size of y.

Definition at line 215 of file DB_Row.inlines.hh.

References Parma_Polyhedra_Library::DB_Row< T >::allocate(), Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::Impl::construct_upward_approximation(), 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().

00216                                                                          {
00217   DB_Row<T>& x = *this;
00218   assert(y.size() <= capacity && capacity <= max_size());
00219   allocate(capacity);
00220   assert(y.impl);
00221   x.impl->construct_upward_approximation(*(y.impl));
00222 }

template<typename T>
DB_Row< T > & Parma_Polyhedra_Library::DB_Row< T >::operator= ( const DB_Row< T > &  y  )  [inline]

Assignment operator.

Definition at line 322 of file DB_Row.inlines.hh.

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

00322                                     {
00323   // Copy-construct `tmp' from `y'.
00324   DB_Row tmp(y);
00325   // Swap the implementation of `*this' with the one of `tmp'.
00326   swap(tmp);
00327   // Now `tmp' goes out of scope, so the old `*this' will be destroyed.
00328   return *this;
00329 }

template<typename T>
void Parma_Polyhedra_Library::DB_Row< T >::swap ( DB_Row< T > &  y  )  [inline]

Swaps *this with y.

Definition at line 302 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 >::iter_swap(), Parma_Polyhedra_Library::DB_Row< T >::operator=(), and Parma_Polyhedra_Library::DB_Row< T >::swap().

00302                          {
00303   DB_Row<T>& x = *this;
00304   std::swap(x.impl, y.impl);
00305 #if PPL_DB_ROW_EXTRA_DEBUG
00306   std::swap(x.capacity_, y.capacity_);
00307 #endif
00308 }

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 312 of file DB_Row.inlines.hh.

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

00312                            {
00313   DB_Row<T>& x = *this;
00314   x.impl = y.impl;
00315 #if PPL_DB_ROW_EXTRA_DEBUG
00316   x.capacity_ = y.capacity_;
00317 #endif
00318 }

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 171 of file DB_Row.inlines.hh.

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

Referenced by Parma_Polyhedra_Library::DB_Row< T >::construct(), Parma_Polyhedra_Library::DB_Row< T >::construct_upward_approximation(), and Parma_Polyhedra_Library::DB_Row< T >::DB_Row().

00175                                         {
00176   DB_Row<T>& x = *this;
00177   assert(capacity <= max_size());
00178 #if !PPL_CXX_SUPPORTS_FLEXIBLE_ARRAYS
00179   if (capacity == 0)
00180     ++capacity;
00181 #endif
00182   assert(x.impl == 0);
00183   x.impl = new (capacity) typename DB_Row_Impl_Handler<T>::Impl();
00184 #if PPL_DB_ROW_EXTRA_DEBUG
00185   assert(x.capacity_ == 0);
00186   x.capacity_ = capacity;
00187 #endif
00188 }

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 192 of file DB_Row.inlines.hh.

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

Referenced by Parma_Polyhedra_Library::DB_Row< T >::construct(), and Parma_Polyhedra_Library::DB_Row< T >::DB_Row().

00192                                                                {
00193   DB_Row<T>& x = *this;
00194   assert(x.impl);
00195 #if PPL_DB_ROW_EXTRA_DEBUG
00196   assert(new_size <= x.capacity_);
00197 #endif
00198   x.impl->expand_within_capacity(new_size);
00199 }

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 294 of file DB_Row.inlines.hh.

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

00294                                                {
00295   DB_Row<T>& x = *this;
00296   assert(x.impl);
00297   x.impl->shrink(new_size);
00298 }

template<typename T>
dimension_type Parma_Polyhedra_Library::DB_Row< T >::max_size (  )  [inline, static]

Returns the size() of the largest possible DB_Row.

Definition at line 145 of file DB_Row.inlines.hh.

Referenced by Parma_Polyhedra_Library::DB_Row< T >::allocate(), Parma_Polyhedra_Library::DB_Row< T >::construct(), Parma_Polyhedra_Library::DB_Row< T >::construct_upward_approximation(), and Parma_Polyhedra_Library::DB_Row< T >::DB_Row().

00145                     {
00146   return DB_Row_Impl_Handler<T>::Impl::max_size();
00147 }

template<typename T>
dimension_type Parma_Polyhedra_Library::DB_Row< T >::size (  )  const [inline]

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 333 of file DB_Row.inlines.hh.

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

00333                                             {
00334   DB_Row<T>& x = *this;
00335   return (*x.impl)[k];
00336 }

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 340 of file DB_Row.inlines.hh.

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

00340                                                   {
00341   const DB_Row<T>& x = *this;
00342   return (*x.impl)[k];
00343 }

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 347 of file DB_Row.inlines.hh.

References Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::impl, and Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::Impl::vec_.

00347                  {
00348   DB_Row<T>& x = *this;
00349   return iterator(x.impl->vec_);
00350 }

template<typename T>
DB_Row< T >::iterator Parma_Polyhedra_Library::DB_Row< T >::end (  )  [inline]

Returns the past-the-end iterator.

Definition at line 354 of file DB_Row.inlines.hh.

References Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::impl, Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::Impl::size_, and Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::Impl::vec_.

00354                {
00355   DB_Row<T>& x = *this;
00356   return iterator(x.impl->vec_ + x.impl->size_);
00357 }

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 361 of file DB_Row.inlines.hh.

References Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::impl, and Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::Impl::vec_.

00361                        {
00362   const DB_Row<T>& x = *this;
00363   return const_iterator(x.impl->vec_);
00364 }

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 368 of file DB_Row.inlines.hh.

References Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::impl, Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::Impl::size_, and Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::Impl::vec_.

00368                      {
00369   const DB_Row<T>& x = *this;
00370   return const_iterator(x.impl->vec_ + x.impl->size_);
00371 }

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 399 of file DB_Row.inlines.hh.

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

00399                                        {
00400   return sizeof(*this) + external_memory_in_bytes();
00401 }

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 388 of file DB_Row.inlines.hh.

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

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

00388                                           {
00389   const DB_Row<T>& x = *this;
00390 #if PPL_DB_ROW_EXTRA_DEBUG
00391   return x.impl->total_memory_in_bytes(x.capacity_);
00392 #else
00393   return x.impl->total_memory_in_bytes();
00394 #endif
00395 }

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 382 of file DB_Row.inlines.hh.

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

00382                                                               {
00383   return sizeof(*this) + external_memory_in_bytes(capacity);
00384 }

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 375 of file DB_Row.inlines.hh.

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

00375                                                                  {
00376   const DB_Row<T>& x = *this;
00377   return x.impl->total_memory_in_bytes(capacity);
00378 }

template<typename T>
bool Parma_Polyhedra_Library::DB_Row< T >::OK ( dimension_type  row_size,
dimension_type  row_capacity 
) const [inline]

Checks if all the invariants are satisfied.

Definition at line 123 of file DB_Row.templates.hh.

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

00128                       {
00129 #ifndef NDEBUG
00130   using std::endl;
00131   using std::cerr;
00132 #endif
00133 
00134   const DB_Row<T>& x = *this;
00135   bool is_broken = false;
00136 
00137 #if PPL_DB_ROW_EXTRA_DEBUG
00138 # if !PPL_CXX_SUPPORTS_FLEXIBLE_ARRAYS
00139   if (x.capacity_ == 0) {
00140     cerr << "Illegal row capacity: is 0, should be at least 1"
00141          << endl;
00142     is_broken = true;
00143   }
00144   else if (x.capacity_ == 1 && row_capacity == 0)
00145     // This is fine.
00146     ;
00147   else
00148 # endif // !PPL_CXX_SUPPORTS_FLEXIBLE_ARRAYS
00149   if (x.capacity_ != row_capacity) {
00150     cerr << "DB_Row capacity mismatch: is " << x.capacity_
00151          << ", should be " << row_capacity << "."
00152          << endl;
00153     is_broken = true;
00154   }
00155 #endif // PPL_DB_ROW_EXTRA_DEBUG
00156 
00157   if (x.size() != row_size) {
00158 #ifndef NDEBUG
00159     cerr << "DB_Row size mismatch: is " << x.size()
00160          << ", should be " << row_size << "."
00161          << endl;
00162 #endif
00163     is_broken = true;
00164   }
00165 
00166 #if PPL_DB_ROW_EXTRA_DEBUG
00167   if (x.capacity_ < x.size()) {
00168 #ifndef NDEBUG
00169     cerr << "DB_Row is completely broken: capacity is " << x.capacity_
00170          << ", size is " << x.size() << "."
00171          << endl;
00172 #endif
00173     is_broken = true;
00174   }
00175 #endif // PPL_DB_ROW_EXTRA_DEBUG
00176 
00177   for (dimension_type i = x.size(); i-- > 0; ) {
00178     const T& element = x[i];
00179     // Not OK is bad.
00180     if (!element.OK()) {
00181       is_broken = true;
00182       break;
00183     }
00184     // In addition, nans should never occur.
00185     if (is_not_a_number(element)) {
00186 #ifndef NDEBUG
00187       cerr << "Not-a-number found in DB_Row."
00188            << endl;
00189 #endif
00190       is_broken = true;
00191       break;
00192     }
00193   }
00194 
00195   return !is_broken;
00196 }

template<typename T>
void Parma_Polyhedra_Library::DB_Row< T >::copy_construct_coefficients ( const DB_Row< T > &  y  )  [inline, private]

Exception-safe copy construction mechanism for coefficients.

Definition at line 203 of file DB_Row.inlines.hh.

References Parma_Polyhedra_Library::DB_Row_Impl_Handler< T >::Impl::copy_construct_coefficients(), 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().

00203                                                       {
00204   DB_Row<T>& x = *this;
00205   assert(x.impl && y.impl);
00206 #if PPL_DB_ROW_EXTRA_DEBUG
00207   assert(y.size() <= x.capacity_);
00208 #endif
00209   x.impl->copy_construct_coefficients(*(y.impl));
00210 }


Friends And Related Function Documentation

template<typename T>
friend class Parma_Polyhedra_Library::DB_Row [friend]

Definition at line 296 of file DB_Row.defs.hh.

template<typename T>
bool operator== ( const DB_Row< T > &  x,
const DB_Row< T > &  y 
) [related]

Definition at line 201 of file DB_Row.templates.hh.

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

00201                                                    {
00202   if (x.size() != y.size())
00203     return false;
00204   for (dimension_type i = x.size(); i-- > 0; )
00205     if (x[i] != y[i])
00206       return false;
00207   return true;
00208 }

template<typename T>
bool operator!= ( const DB_Row< T > &  x,
const DB_Row< T > &  y 
) [related]

Definition at line 406 of file DB_Row.inlines.hh.

00406                                                    {
00407   return !(x == y);
00408 }

template<typename T>
void swap ( Parma_Polyhedra_Library::DB_Row< T > &  x,
Parma_Polyhedra_Library::DB_Row< T > &  y 
) [related]

Specializes std::swap.

Definition at line 418 of file DB_Row.inlines.hh.

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

00419                                           {
00420   x.swap(y);
00421 }

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

Specializes std::iter_swap.

Definition at line 426 of file DB_Row.inlines.hh.

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

00429                       {
00430   swap(*x, *y);
00431 }


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

Generated on Sat Oct 11 10:41:15 2008 for PPL by  doxygen 1.5.6