Loading...
Searching...
No Matches
fac_iterfor.h
Go to the documentation of this file.
/* emacs edit mode for this file is -*- C++ -*- */
#ifndef INCL_FAC_ITERFOR_H
#define INCL_FAC_ITERFOR_H
// #include "config.h"
#ifndef NOSTREAMIO
#ifdef HAVE_IOSTREAM
#include <iostream>
#define OSTREAM std::ostream
#elif defined(HAVE_IOSTREAM_H)
#include <iostream.h>
#define OSTREAM ostream
#endif
#endif /* NOSTREAMIO */
class IteratedFor
{
private:
int MAX;
int FROM;
int TO;
int N;
bool last;
int * index;
int * imax;
void fill ( int from, int n );
public:
IteratedFor( int from, int to, int max );
IteratedFor( const IteratedFor & );
~IteratedFor();
IteratedFor& operator= ( const IteratedFor & );
int from() const { return FROM; }
int to() const { return TO; }
int n() const { return N; };
int max() const { return MAX; }
void nextiteration();
void operator++ () { nextiteration(); }
void operator++ ( int ) { nextiteration(); }
bool iterations_left() const { return ! last; }
int operator[] ( int ) const;
};
#ifndef NOSTREAMIO
OSTREAM& operator<< ( OSTREAM &, const IteratedFor & );
#endif /* NOSTREAMIO */
#endif /* ! INCL_FAC_ITERFOR_H */
OSTREAM
#define OSTREAM
Definition canonicalform.h:16
IteratedFor
Definition fac_iterfor.h:19
IteratedFor::operator[]
int operator[](int) const
IteratedFor::imax
int * imax
Definition fac_iterfor.h:27
IteratedFor::FROM
int FROM
Definition fac_iterfor.h:22
IteratedFor::TO
int TO
Definition fac_iterfor.h:23
IteratedFor::IteratedFor
IteratedFor(int from, int to, int max)
IteratedFor::nextiteration
void nextiteration()
IteratedFor::max
int max() const
Definition fac_iterfor.h:37
IteratedFor::~IteratedFor
~IteratedFor()
IteratedFor::from
int from() const
Definition fac_iterfor.h:34
IteratedFor::iterations_left
bool iterations_left() const
Definition fac_iterfor.h:41
IteratedFor::to
int to() const
Definition fac_iterfor.h:35
IteratedFor::MAX
int MAX
Definition fac_iterfor.h:21
IteratedFor::last
bool last
Definition fac_iterfor.h:25
IteratedFor::operator++
void operator++()
Definition fac_iterfor.h:39
IteratedFor::N
int N
Definition fac_iterfor.h:24
IteratedFor::fill
void fill(int from, int n)
IteratedFor::IteratedFor
IteratedFor(const IteratedFor &)
IteratedFor::operator=
IteratedFor & operator=(const IteratedFor &)
IteratedFor::n
int n() const
Definition fac_iterfor.h:36
IteratedFor::index
int * index
Definition fac_iterfor.h:26
operator<<
OSTREAM & operator<<(OSTREAM &, const IteratedFor &)