PPL  0.12.1
Parma_Polyhedra_Library::Constraint_System::const_iterator Class Reference

An iterator over a system of constraints. More...

#include <Constraint_System.defs.hh>

Collaboration diagram for Parma_Polyhedra_Library::Constraint_System::const_iterator:

List of all members.

Public Member Functions

 const_iterator ()
 Default constructor.
 const_iterator (const const_iterator &y)
 Ordinary copy constructor.
 ~const_iterator ()
 Destructor.
const_iteratoroperator= (const const_iterator &y)
 Assignment operator.
const Constraintoperator* () const
 Dereference operator.
const Constraintoperator-> () const
 Indirect member selector.
const_iteratoroperator++ ()
 Prefix increment operator.
const_iterator operator++ (int)
 Postfix increment operator.
bool operator== (const const_iterator &y) const
 Returns true if and only if *this and y are identical.
bool operator!= (const const_iterator &y) const
 Returns true if and only if *this and y are different.

Private Member Functions

 const_iterator (const Linear_System::const_iterator &iter, const Constraint_System &cs)
 Constructor.
void skip_forward ()
 *this skips to the next non-trivial constraint.

Private Attributes

Linear_System::const_iterator i
 The const iterator over the matrix of constraints.
const Linear_Systemcsp
 A const pointer to the matrix of constraints.

Friends

class Constraint_System

Detailed Description

An iterator over a system of constraints.

A const_iterator is used to provide read-only access to each constraint contained in a Constraint_System object.

Example
The following code prints the system of constraints defining the polyhedron ph:
  const Constraint_System& cs = ph.constraints();
  for (Constraint_System::const_iterator i = cs.begin(),
         cs_end = cs.end(); i != cs_end; ++i)
    cout << *i << endl;

Definition at line 198 of file Constraint_System.defs.hh.


Constructor & Destructor Documentation

Default constructor.

Definition at line 101 of file Constraint_System.inlines.hh.

  : i(), csp(0) {
}

Ordinary copy constructor.

Definition at line 106 of file Constraint_System.inlines.hh.

  : i(y.i), csp(y.csp) {
}

Constructor.

Definition at line 157 of file Constraint_System.inlines.hh.

  : i(iter), csp(&cs) {
}

Member Function Documentation

bool Parma_Polyhedra_Library::Constraint_System::const_iterator::operator!= ( const const_iterator y) const
inline

Returns true if and only if *this and y are different.

Definition at line 151 of file Constraint_System.inlines.hh.

References i.

                                                                         {
  return i != y.i;
}
const Constraint & Parma_Polyhedra_Library::Constraint_System::const_iterator::operator* ( ) const
inline

Dereference operator.

Definition at line 122 of file Constraint_System.inlines.hh.

                                                 {
  return static_cast<const Constraint&>(*i);
}
Constraint_System::const_iterator & Parma_Polyhedra_Library::Constraint_System::const_iterator::operator++ ( )
inline

Prefix increment operator.

Definition at line 132 of file Constraint_System.inlines.hh.

                                            {
  ++i;
  skip_forward();
  return *this;
}
Constraint_System::const_iterator Parma_Polyhedra_Library::Constraint_System::const_iterator::operator++ ( int  )
inline

Postfix increment operator.

Definition at line 139 of file Constraint_System.inlines.hh.

                                               {
  const const_iterator tmp = *this;
  operator++();
  return tmp;
}
const Constraint * Parma_Polyhedra_Library::Constraint_System::const_iterator::operator-> ( ) const
inline

Indirect member selector.

Definition at line 127 of file Constraint_System.inlines.hh.

                                                  {
  return static_cast<const Constraint*>(i.operator->());
}
Constraint_System::const_iterator & Parma_Polyhedra_Library::Constraint_System::const_iterator::operator= ( const const_iterator y)
inline

Assignment operator.

Definition at line 115 of file Constraint_System.inlines.hh.

References csp, and i.

                                                                  {
  i = y.i;
  csp = y.csp;
  return *this;
}
bool Parma_Polyhedra_Library::Constraint_System::const_iterator::operator== ( const const_iterator y) const
inline

Returns true if and only if *this and y are identical.

Definition at line 146 of file Constraint_System.inlines.hh.

References i.

                                                                         {
  return i == y.i;
}

*this skips to the next non-trivial constraint.

Definition at line 325 of file Constraint_System.cc.

Referenced by Parma_Polyhedra_Library::Constraint_System::begin().

                                                 {
  const Linear_System::const_iterator csp_end = csp->end();
  while (i != csp_end && (*this)->is_tautological())
    ++i;
}

Friends And Related Function Documentation

friend class Constraint_System
friend

Definition at line 242 of file Constraint_System.defs.hh.


Member Data Documentation

A const pointer to the matrix of constraints.

Definition at line 248 of file Constraint_System.defs.hh.

Referenced by operator=().

The const iterator over the matrix of constraints.

Definition at line 245 of file Constraint_System.defs.hh.

Referenced by operator!=(), operator=(), and operator==().


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