source: git/factory/cf_generator.h @ b52d27

spielwiese
Last change on this file since b52d27 was b52d27, checked in by Martin Lee <martinlee84@…>, 10 years ago
chg: more docu changes
  • Property mode set to 100644
File size: 2.4 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
12/**
13 * virtual class for generators
14**/
15class CFGenerator
16{
17public:
18    CFGenerator() {}
19    virtual ~CFGenerator() {}
20    virtual bool hasItems() const { return false; }
21    virtual void reset() {};
22    virtual CanonicalForm item() const { return 0; }
23    virtual void next() {};
24    virtual CFGenerator * clone() const { return new CFGenerator();}
25};
26
27/**
28 * generate integers starting from 0
29**/
30class IntGenerator : public CFGenerator
31{
32private:
33    int current;
34public:
35    IntGenerator() : current(0) {}
36    ~IntGenerator() {}
37    bool hasItems() const;
38    void reset() { current = 0; }
39    CanonicalForm item() const;
40    void next();
41    void operator++ () { next(); }
42    void operator++ ( int ) { next(); }
43    CFGenerator * clone() const;
44};
45
46/**
47 * generate all elements in F_p starting from 0
48**/
49class FFGenerator : public CFGenerator
50{
51private:
52    int current;
53public:
54    FFGenerator() : current(0) {}
55    ~FFGenerator() {}
56    bool hasItems() const;
57    void reset() { current = 0; }
58    CanonicalForm item() const;
59    void next();
60    void operator++ () { next(); }
61    void operator++ ( int ) { next(); }
62    CFGenerator * clone() const;
63};
64
65/**
66 * generate all elements in GF starting from 0
67**/
68class GFGenerator : public CFGenerator
69{
70private:
71    int current;
72public:
73    GFGenerator();
74    ~GFGenerator() {}
75    bool hasItems() const;
76    void reset();
77    CanonicalForm item() const;
78    void next();
79    void operator++ () { next(); }
80    void operator++ ( int ) { next(); }
81    CFGenerator * clone() const;
82};
83
84/**
85 * generate all elements in F_p(alpha) starting from 0
86**/
87class AlgExtGenerator: public CFGenerator
88{
89private:
90    Variable algext;
91    FFGenerator **gensf;
92    GFGenerator **gensg;
93    int n;
94    bool nomoreitems;
95    AlgExtGenerator();
96    AlgExtGenerator( const AlgExtGenerator & );
97    AlgExtGenerator& operator= ( const AlgExtGenerator & );
98public:
99    AlgExtGenerator( const Variable & a );
100    ~AlgExtGenerator();
101
102    bool hasItems() const { return ! nomoreitems; }
103    void reset();
104    CanonicalForm item() const;
105    void next();
106    void operator++ () { next(); }
107    void operator++ ( int ) { next(); }
108    CFGenerator * clone() const;
109};
110
111class CFGenFactory
112{
113public:
114    static CFGenerator* generate();
115};
116
117/*ENDPUBLIC*/
118
119#endif /* ! INCL_CF_GENERATOR_H */
Note: See TracBrowser for help on using the repository browser.