PPL  0.12.1
Parma_Polyhedra_Library::Generator_System::const_iterator Class Reference

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

#include <Generator_System.defs.hh>

Inheritance diagram for Parma_Polyhedra_Library::Generator_System::const_iterator:
Collaboration diagram for Parma_Polyhedra_Library::Generator_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 Generatoroperator* () const
 Dereference operator.
const Generatoroperator-> () 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 Generator_System &gs)
 Constructor.
void skip_forward ()
 *this skips to the next generator, skipping those closure points that are immediately followed by a matching point.

Private Attributes

Linear_System::const_iterator i
 The const iterator over the Linear_System.
const Linear_Systemgsp
 A const pointer to the Linear_System.

Friends

class Generator_System

Detailed Description

An iterator over a system of generators.

A const_iterator is used to provide read-only access to each generator contained in an object of Generator_System.

Example
The following code prints the system of generators of the polyhedron ph:
  const Generator_System& gs = ph.generators();
  for (Generator_System::const_iterator i = gs.begin(),
         gs_end = gs.end(); i != gs_end; ++i)
    cout << *i << endl;
The same effect can be obtained more concisely by using more features of the STL:
  const Generator_System& gs = ph.generators();
  copy(gs.begin(), gs.end(), ostream_iterator<Generator>(cout, "\n"));

Definition at line 244 of file Generator_System.defs.hh.


Constructor & Destructor Documentation

Ordinary copy constructor.

Reimplemented in Parma_Polyhedra_Library::Grid_Generator_System::const_iterator.

Definition at line 100 of file Generator_System.inlines.hh.

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

Constructor.

Definition at line 153 of file Generator_System.inlines.hh.

  : i(iter), gsp(&gs) {
}

Member Function Documentation

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

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

Reimplemented in Parma_Polyhedra_Library::Grid_Generator_System::const_iterator.

Definition at line 147 of file Generator_System.inlines.hh.

References Parma_Polyhedra_Library::Dense_Matrix::const_iterator::i.

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

Dereference operator.

Reimplemented in Parma_Polyhedra_Library::Grid_Generator_System::const_iterator.

Definition at line 117 of file Generator_System.inlines.hh.

                                                {
  return static_cast<const Generator&>(*i);
}
Generator_System::const_iterator & Parma_Polyhedra_Library::Generator_System::const_iterator::operator++ ( )
inline
Generator_System::const_iterator Parma_Polyhedra_Library::Generator_System::const_iterator::operator++ ( int  )
inline

Postfix increment operator.

Reimplemented in Parma_Polyhedra_Library::Grid_Generator_System::const_iterator.

Definition at line 135 of file Generator_System.inlines.hh.

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

Indirect member selector.

Reimplemented in Parma_Polyhedra_Library::Grid_Generator_System::const_iterator.

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

Referenced by Parma_Polyhedra_Library::Grid_Generator_System::const_iterator::operator->().

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

Assignment operator.

Reimplemented in Parma_Polyhedra_Library::Grid_Generator_System::const_iterator.

Definition at line 110 of file Generator_System.inlines.hh.

References Parma_Polyhedra_Library::Dense_Matrix::const_iterator::i.

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

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

Reimplemented in Parma_Polyhedra_Library::Grid_Generator_System::const_iterator.

Definition at line 142 of file Generator_System.inlines.hh.

References Parma_Polyhedra_Library::Dense_Matrix::const_iterator::i.

                                                                        {
  return i == y.i;
}

*this skips to the next generator, skipping those closure points that are immediately followed by a matching point.

Definition at line 267 of file Generator_System.cc.

References Parma_Polyhedra_Library::Generator::is_closure_point(), Parma_Polyhedra_Library::Generator::is_matching_closure_point(), and Parma_Polyhedra_Library::Generator::is_point().

                                                {
  const Linear_System::const_iterator gsp_end = gsp->end();
  if (i != gsp_end) {
    Linear_System::const_iterator i_next = i;
    ++i_next;
    if (i_next != gsp_end) {
      const Generator& cp = static_cast<const Generator&>(*i);
      const Generator& p = static_cast<const Generator&>(*i_next);
      if (cp.is_closure_point()
          && p.is_point()
          && cp.is_matching_closure_point(p))
        i = i_next;
    }
  }
}

Friends And Related Function Documentation

friend class Generator_System
friend

Definition at line 288 of file Generator_System.defs.hh.


Member Data Documentation


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