Parma_Polyhedra_Library::Generator_System::const_iterator Class Reference
[C++ Language Interface]

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

#include <Generator_System.defs.hh>

Inheritance diagram for Parma_Polyhedra_Library::Generator_System::const_iterator:

Inheritance graph
[legend]
Collaboration diagram for Parma_Polyhedra_Library::Generator_System::const_iterator:

Collaboration graph
[legend]

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 &gsys)
 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 245 of file Generator_System.defs.hh.


Constructor & Destructor Documentation

Parma_Polyhedra_Library::Generator_System::const_iterator::const_iterator (  )  [inline]

Default constructor.

Reimplemented in Parma_Polyhedra_Library::Grid_Generator_System::const_iterator.

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

00095   : i(), gsp(0) {
00096 }

Parma_Polyhedra_Library::Generator_System::const_iterator::const_iterator ( const const_iterator y  )  [inline]

Ordinary copy-constructor.

Reimplemented in Parma_Polyhedra_Library::Grid_Generator_System::const_iterator.

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

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

Parma_Polyhedra_Library::Generator_System::const_iterator::~const_iterator (  )  [inline]

Destructor.

Reimplemented in Parma_Polyhedra_Library::Grid_Generator_System::const_iterator.

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

00104                                                 {
00105 }

Parma_Polyhedra_Library::Generator_System::const_iterator::const_iterator ( const Linear_System::const_iterator iter,
const Generator_System gsys 
) [inline, private]

Constructor.

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

00154   : i(iter), gsp(&gsys) {
00155 }


Member Function Documentation

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 109 of file Generator_System.inlines.hh.

References gsp, Parma_Polyhedra_Library::Matrix::const_iterator::i, and i.

Referenced by Parma_Polyhedra_Library::Grid_Generator_System::const_iterator::operator=().

00109                                                                  {
00110   i = y.i;
00111   gsp = y.gsp;
00112   return *this;
00113 }

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 116 of file Generator_System.inlines.hh.

Referenced by Parma_Polyhedra_Library::Grid_Generator_System::const_iterator::operator*().

00116                                                 {
00117   return static_cast<const Generator&>(*i);
00118 }

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 121 of file Generator_System.inlines.hh.

References i.

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

00121                                                  {
00122   return static_cast<const Generator*>(i.operator->());
00123 }

Generator_System::const_iterator & Parma_Polyhedra_Library::Generator_System::const_iterator::operator++ (  )  [inline]

Prefix increment operator.

Reimplemented in Parma_Polyhedra_Library::Grid_Generator_System::const_iterator.

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

References gsp, i, Parma_Polyhedra_Library::Linear_System::is_necessarily_closed(), and skip_forward().

Referenced by Parma_Polyhedra_Library::Grid_Generator_System::const_iterator::operator++(), and operator++().

00126                                            {
00127   ++i;
00128   if (!gsp->is_necessarily_closed())
00129     skip_forward();
00130   return *this;
00131 }

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 134 of file Generator_System.inlines.hh.

References operator++().

00134                                               {
00135   const const_iterator tmp = *this;
00136   operator++();
00137   return tmp;
00138 }

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 141 of file Generator_System.inlines.hh.

References Parma_Polyhedra_Library::Matrix::const_iterator::i, and i.

00141                                                                         {
00142   return i == y.i;
00143 }

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 146 of file Generator_System.inlines.hh.

References Parma_Polyhedra_Library::Matrix::const_iterator::i, and i.

00146                                                                         {
00147   return i != y.i;
00148 }

void Parma_Polyhedra_Library::Generator_System::const_iterator::skip_forward (  )  [private]

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

Definition at line 264 of file Generator_System.cc.

References Parma_Polyhedra_Library::Matrix::end(), gsp, i, Parma_Polyhedra_Library::Generator::is_closure_point(), Parma_Polyhedra_Library::Generator::is_matching_closure_point(), and Parma_Polyhedra_Library::Generator::is_point().

Referenced by operator++().

00264                                                 {
00265   const Linear_System::const_iterator gsp_end = gsp->end();
00266   if (i != gsp_end) {
00267     Linear_System::const_iterator i_next = i;
00268     ++i_next;
00269     if (i_next != gsp_end) {
00270       const Generator& cp = static_cast<const Generator&>(*i);
00271       const Generator& p = static_cast<const Generator&>(*i_next);
00272       if (cp.is_closure_point()
00273           && p.is_point()
00274           && cp.is_matching_closure_point(p))
00275         i = i_next;
00276     }
00277   }
00278 }


Friends And Related Function Documentation

friend class Generator_System [friend]

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


Member Data Documentation

The const iterator over the Linear_System.

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

Referenced by operator!=(), operator++(), operator->(), operator=(), operator==(), and skip_forward().

A const pointer to the Linear_System.

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

Referenced by operator++(), operator=(), and skip_forward().


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

Generated on Wed Jul 16 22:55:48 2008 for PPL by  doxygen 1.5.6