source: git/factory/fac_iterfor.h @ fbb0173

spielwiese
Last change on this file since fbb0173 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
RevLine 
[493c477]1/* emacs edit mode for this file is -*- C++ -*- */
[341696]2/* $Id$ */
[2dd068]3
[493c477]4#ifndef INCL_FAC_ITERFOR_H
5#define INCL_FAC_ITERFOR_H
[2dd068]6
[b973c0]7#include <config.h>
8
[a347e8]9#ifndef NOSTREAMIO
[1dc616]10#ifdef HAVE_IOSTREAM
11#include <iostream>
[181148]12#define OSTREAM std::ostream
[1dc616]13#elif defined(HAVE_IOSTREAM_H)
[2dd068]14#include <iostream.h>
[181148]15#define OSTREAM ostream
[1dc616]16#endif
[a347e8]17#endif /* NOSTREAMIO */
[2dd068]18
19class IteratedFor
20{
21private:
22    int MAX;
[d675c7]23    int FROM;
24    int TO;
[2dd068]25    int N;
26    bool last;
27    int * index;
28    int * imax;
29    void fill ( int from, int n );
30public:
[d675c7]31    IteratedFor( int from, int to, int max );
[2dd068]32    IteratedFor( const IteratedFor & );
33    ~IteratedFor();
34    IteratedFor& operator= ( const IteratedFor & );
[d675c7]35    int from() const { return FROM; }
36    int to() const { return TO; }
37    int n() const { return N; };
[2dd068]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
[a347e8]46#ifndef NOSTREAMIO
[181148]47OSTREAM& operator<< ( OSTREAM &, const IteratedFor & );
[a347e8]48#endif /* NOSTREAMIO */
[2dd068]49
[493c477]50#endif /* ! INCL_FAC_ITERFOR_H */
Note: See TracBrowser for help on using the repository browser.