PPL  1.2
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:

Public Member Functions

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

Private Member Functions

 Generator_System_const_iterator (const Linear_System< Generator >::const_iterator &iter, const Generator_System &gsys)
 Constructor. More...
 
void skip_forward ()
 *this skips to the next generator, skipping those closure points that are immediately followed by a matching point. More...
 

Private Attributes

Linear_System< Generator >::const_iterator i
 The const iterator over the Linear_System. More...
 
const Linear_System< Generator > * gsp
 A const pointer to the Linear_System. More...
 

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();
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 680 of file Generator_System_defs.hh.

Constructor & Destructor Documentation

Parma_Polyhedra_Library::Generator_System_const_iterator::Generator_System_const_iterator ( )
inline

Default constructor.

Definition at line 291 of file Generator_System_inlines.hh.

292  : i(), gsp(0) {
293 }
const Linear_System< Generator > * gsp
A const pointer to the Linear_System.
Linear_System< Generator >::const_iterator i
The const iterator over the Linear_System.
Parma_Polyhedra_Library::Generator_System_const_iterator::Generator_System_const_iterator ( const Generator_System_const_iterator y)
inline

Ordinary copy constructor.

Definition at line 296 of file Generator_System_inlines.hh.

297  : i(y.i), gsp(y.gsp) {
298 }
const Linear_System< Generator > * gsp
A const pointer to the Linear_System.
Linear_System< Generator >::const_iterator i
The const iterator over the Linear_System.
Parma_Polyhedra_Library::Generator_System_const_iterator::~Generator_System_const_iterator ( )
inline

Destructor.

Definition at line 301 of file Generator_System_inlines.hh.

301  {
302 }
Parma_Polyhedra_Library::Generator_System_const_iterator::Generator_System_const_iterator ( const Linear_System< Generator >::const_iterator &  iter,
const Generator_System gsys 
)
inlineprivate

Constructor.

Definition at line 350 of file Generator_System_inlines.hh.

352  : i(iter), gsp(&gs.sys) {
353 }
const Linear_System< Generator > * gsp
A const pointer to the Linear_System.
Linear_System< Generator >::const_iterator i
The const iterator over the Linear_System.

Member Function Documentation

bool Parma_Polyhedra_Library::Generator_System_const_iterator::operator!= ( const Generator_System_const_iterator y) const
inline

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

Definition at line 344 of file Generator_System_inlines.hh.

References i.

344  {
345  return i != y.i;
346 }
Linear_System< Generator >::const_iterator i
The const iterator over the Linear_System.
const Generator & Parma_Polyhedra_Library::Generator_System_const_iterator::operator* ( ) const
inline

Dereference operator.

Definition at line 313 of file Generator_System_inlines.hh.

References i.

313  {
314  return *i;
315 }
Linear_System< Generator >::const_iterator i
The const iterator over the Linear_System.
Generator_System_const_iterator & Parma_Polyhedra_Library::Generator_System_const_iterator::operator++ ( )
inline

Prefix increment operator.

Definition at line 323 of file Generator_System_inlines.hh.

References gsp, i, and skip_forward().

Referenced by operator++().

323  {
324  ++i;
325  if (!gsp->is_necessarily_closed()) {
326  skip_forward();
327  }
328  return *this;
329 }
void skip_forward()
*this skips to the next generator, skipping those closure points that are immediately followed by a m...
const Linear_System< Generator > * gsp
A const pointer to the Linear_System.
Linear_System< Generator >::const_iterator i
The const iterator over the Linear_System.
Generator_System_const_iterator Parma_Polyhedra_Library::Generator_System_const_iterator::operator++ ( int  )
inline

Postfix increment operator.

Definition at line 332 of file Generator_System_inlines.hh.

References operator++().

332  {
333  const Generator_System_const_iterator tmp = *this;
334  operator++();
335  return tmp;
336 }
Generator_System_const_iterator & operator++()
Prefix increment operator.
const Generator * Parma_Polyhedra_Library::Generator_System_const_iterator::operator-> ( ) const
inline

Indirect member selector.

Definition at line 318 of file Generator_System_inlines.hh.

References i.

318  {
319  return i.operator->();
320 }
Linear_System< Generator >::const_iterator i
The const iterator over the Linear_System.
Generator_System_const_iterator & Parma_Polyhedra_Library::Generator_System_const_iterator::operator= ( const Generator_System_const_iterator y)
inline

Assignment operator.

Definition at line 306 of file Generator_System_inlines.hh.

References gsp, and i.

306  {
307  i = y.i;
308  gsp = y.gsp;
309  return *this;
310 }
const Linear_System< Generator > * gsp
A const pointer to the Linear_System.
Linear_System< Generator >::const_iterator i
The const iterator over the Linear_System.
bool Parma_Polyhedra_Library::Generator_System_const_iterator::operator== ( const Generator_System_const_iterator y) const
inline

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

Definition at line 339 of file Generator_System_inlines.hh.

References i.

339  {
340  return i == y.i;
341 }
Linear_System< Generator >::const_iterator i
The const iterator over the Linear_System.
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 188 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().

Referenced by Parma_Polyhedra_Library::Generator_System::begin(), and operator++().

188  {
189  const Linear_System<Generator>::const_iterator gsp_end = gsp->end();
190  if (i != gsp_end) {
191  Linear_System<Generator>::const_iterator i_next = i;
192  ++i_next;
193  if (i_next != gsp_end) {
194  const Generator& cp = *i;
195  const Generator& p = *i_next;
196  if (cp.is_closure_point()
197  && p.is_point()
198  && cp.is_matching_closure_point(p)) {
199  i = i_next;
200  }
201  }
202  }
203 }
const Linear_System< Generator > * gsp
A const pointer to the Linear_System.
Linear_System< Generator >::const_iterator i
The const iterator over the Linear_System.

Friends And Related Function Documentation

friend class Generator_System
friend

Definition at line 724 of file Generator_System_defs.hh.

Member Data Documentation

const Linear_System<Generator>* Parma_Polyhedra_Library::Generator_System_const_iterator::gsp
private

A const pointer to the Linear_System.

Definition at line 730 of file Generator_System_defs.hh.

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

Linear_System<Generator>::const_iterator Parma_Polyhedra_Library::Generator_System_const_iterator::i
private

The const iterator over the Linear_System.

Definition at line 727 of file Generator_System_defs.hh.

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


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