source: git/factory/fac_iterfor.h @ 341696

spielwiese
Last change on this file since 341696 was 341696, checked in by Hans Schönemann <hannes@…>, 14 years ago
Adding Id property to all files git-svn-id: file:///usr/local/Singular/svn/trunk@12231 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 1.1 KB
Line 
1/* emacs edit mode for this file is -*- C++ -*- */
2/* $Id$ */
3
4#ifndef INCL_FAC_ITERFOR_H
5#define INCL_FAC_ITERFOR_H
6
7#include <config.h>
8
9#ifndef NOSTREAMIO
10#ifdef HAVE_IOSTREAM
11#include <iostream>
12#define OSTREAM std::ostream
13#elif defined(HAVE_IOSTREAM_H)
14#include <iostream.h>
15#define OSTREAM ostream
16#endif
17#endif /* NOSTREAMIO */
18
19class IteratedFor
20{
21private:
22    int MAX;
23    int FROM;
24    int TO;
25    int N;
26    bool last;
27    int * index;
28    int * imax;
29    void fill ( int from, int n );
30public:
31    IteratedFor( int from, int to, int max );
32    IteratedFor( const IteratedFor & );
33    ~IteratedFor();
34    IteratedFor& operator= ( const IteratedFor & );
35    int from() const { return FROM; }
36    int to() const { return TO; }
37    int n() const { return N; };
38    int max() const { return MAX; }
39    void nextiteration();
40    void operator++ () { nextiteration(); }
41    void operator++ ( int ) { nextiteration(); }
42    bool iterations_left() const { return ! last; }
43    int operator[] ( int ) const;
44};
45
46#ifndef NOSTREAMIO
47OSTREAM& operator<< ( OSTREAM &, const IteratedFor & );
48#endif /* NOSTREAMIO */
49
50#endif /* ! INCL_FAC_ITERFOR_H */
Note: See TracBrowser for help on using the repository browser.