source: git/factory/cf_generator.h @ 086f3e

fieker-DuValspielwiese
Last change on this file since 086f3e was 67294f1, checked in by Martin Lee <martinlee84@…>, 10 years ago
chg: move IntGenerator from facAlgFuncUtil to cf_generator
  • Property mode set to 100644
File size: 2.2 KB
Line 
1/* emacs edit mode for this file is -*- C++ -*- */
2
3#ifndef INCL_CF_GENERATOR_H
4#define INCL_CF_GENERATOR_H
5
6// #include "config.h"
7
8#include "canonicalform.h"
9
10/*BEGINPUBLIC*/
11
12class CFGenerator
13{
14public:
15    CFGenerator() {}
16    virtual ~CFGenerator() {}
17    virtual bool hasItems() const { return false; }
18    virtual void reset() {};
19    virtual CanonicalForm item() const { return 0; }
20    virtual void next() {};
21    virtual CFGenerator * clone() const { return new CFGenerator();}
22};
23
24class IntGenerator : public CFGenerator
25{
26private:
27    int current;
28public:
29    IntGenerator() : current(0) {}
30    ~IntGenerator() {}
31    bool hasItems() const;
32    void reset() { current = 0; }
33    CanonicalForm item() const;
34    void next();
35    void operator++ () { next(); }
36    void operator++ ( int ) { next(); }
37    CFGenerator * clone() const;
38};
39
40class FFGenerator : public CFGenerator
41{
42private:
43    int current;
44public:
45    FFGenerator() : current(0) {}
46    ~FFGenerator() {}
47    bool hasItems() const;
48    void reset() { current = 0; }
49    CanonicalForm item() const;
50    void next();
51    void operator++ () { next(); }
52    void operator++ ( int ) { next(); }
53    CFGenerator * clone() const;
54};
55
56class GFGenerator : public CFGenerator
57{
58private:
59    int current;
60public:
61    GFGenerator();
62    ~GFGenerator() {}
63    bool hasItems() const;
64    void reset();
65    CanonicalForm item() const;
66    void next();
67    void operator++ () { next(); }
68    void operator++ ( int ) { next(); }
69    CFGenerator * clone() const;
70};
71
72class AlgExtGenerator: public CFGenerator
73{
74private:
75    Variable algext;
76    FFGenerator **gensf;
77    GFGenerator **gensg;
78    int n;
79    bool nomoreitems;
80    AlgExtGenerator();
81    AlgExtGenerator( const AlgExtGenerator & );
82    AlgExtGenerator& operator= ( const AlgExtGenerator & );
83public:
84    AlgExtGenerator( const Variable & a );
85    ~AlgExtGenerator();
86
87    bool hasItems() const { return ! nomoreitems; }
88    void reset();
89    CanonicalForm item() const;
90    void next();
91    void operator++ () { next(); }
92    void operator++ ( int ) { next(); }
93    CFGenerator * clone() const;
94};
95
96class CFGenFactory
97{
98public:
99    static CFGenerator* generate();
100};
101
102/*ENDPUBLIC*/
103
104#endif /* ! INCL_CF_GENERATOR_H */
Note: See TracBrowser for help on using the repository browser.