My Project  debian-1:4.1.1-p2+ds-4build3
cf_generator.h
Go to the documentation of this file.
1 /* emacs edit mode for this file is -*- C++ -*- */
2 
3 /**
4  * @file cf_generator.h
5  *
6  * generate integers, elements of finite fields
7 **/
8 
9 #ifndef INCL_CF_GENERATOR_H
10 #define INCL_CF_GENERATOR_H
11 
12 // #include "config.h"
13 
14 #include "canonicalform.h"
15 
16 /*BEGINPUBLIC*/
17 
18 /**
19  * virtual class for generators
20 **/
22 {
23 public:
25  virtual ~CFGenerator() {}
26  virtual bool hasItems() const { return false; }
27  virtual void reset() {};
28  virtual CanonicalForm item() const { return 0; }
29  virtual void next() {};
30  virtual CFGenerator * clone() const { return new CFGenerator();}
31 };
32 
33 /**
34  * generate integers starting from 0
35 **/
36 class IntGenerator : public CFGenerator
37 {
38 private:
39  int current;
40 public:
43  bool hasItems() const;
44  void reset() { current = 0; }
45  CanonicalForm item() const;
46  void next();
47  void operator++ () { next(); }
48  void operator++ ( int ) { next(); }
49  CFGenerator * clone() const;
50 };
51 
52 /**
53  * generate all elements in F_p starting from 0
54 **/
55 class FFGenerator : public CFGenerator
56 {
57 private:
58  int current;
59 public:
60  FFGenerator() : current(0) {}
62  bool hasItems() const;
63  void reset() { current = 0; }
64  CanonicalForm item() const;
65  void next();
66  void operator++ () { next(); }
67  void operator++ ( int ) { next(); }
68  CFGenerator * clone() const;
69 };
70 
71 /**
72  * generate all elements in GF starting from 0
73 **/
74 class GFGenerator : public CFGenerator
75 {
76 private:
77  int current;
78 public:
79  GFGenerator();
81  bool hasItems() const;
82  void reset();
83  CanonicalForm item() const;
84  void next();
85  void operator++ () { next(); }
86  void operator++ ( int ) { next(); }
87  CFGenerator * clone() const;
88 };
89 
90 /**
91  * generate all elements in F_p(alpha) starting from 0
92 **/
94 {
95 private:
99  int n;
101  AlgExtGenerator();
102  AlgExtGenerator( const AlgExtGenerator & );
104 public:
105  AlgExtGenerator( const Variable & a );
107 
108  bool hasItems() const { return ! nomoreitems; }
109  void reset();
110  CanonicalForm item() const;
111  void next();
112  void operator++ () { next(); }
113  void operator++ ( int ) { next(); }
114  CFGenerator * clone() const;
115 };
116 
118 {
119 public:
120  static CFGenerator* generate();
121 };
122 
123 /*ENDPUBLIC*/
124 
125 #endif /* ! INCL_CF_GENERATOR_H */
AlgExtGenerator::nomoreitems
bool nomoreitems
Definition: cf_generator.h:100
CFGenerator::~CFGenerator
virtual ~CFGenerator()
Definition: cf_generator.h:25
IntGenerator
generate integers starting from 0
Definition: cf_generator.h:37
canonicalform.h
AlgExtGenerator::n
int n
Definition: cf_generator.h:99
GFGenerator::next
void next()
Definition: cf_generator.cc:78
AlgExtGenerator::hasItems
bool hasItems() const
Definition: cf_generator.h:108
AlgExtGenerator::gensg
GFGenerator ** gensg
Definition: cf_generator.h:98
AlgExtGenerator::algext
Variable algext
Definition: cf_generator.h:96
CFGenFactory
Definition: cf_generator.h:118
GFGenerator::~GFGenerator
~GFGenerator()
Definition: cf_generator.h:80
AlgExtGenerator::~AlgExtGenerator
~AlgExtGenerator()
Definition: cf_generator.cc:131
FFGenerator::operator++
void operator++()
Definition: cf_generator.h:66
FFGenerator::hasItems
bool hasItems() const
Definition: cf_generator.cc:35
IntGenerator::IntGenerator
IntGenerator()
Definition: cf_generator.h:41
CFGenerator
virtual class for generators
Definition: cf_generator.h:22
FFGenerator::reset
void reset()
Definition: cf_generator.h:63
GFGenerator::GFGenerator
GFGenerator()
Definition: cf_generator.cc:57
CanonicalForm
factory's main class
Definition: canonicalform.h:83
IntGenerator::operator++
void operator++()
Definition: cf_generator.h:47
AlgExtGenerator::next
void next()
Definition: cf_generator.cc:179
AlgExtGenerator::item
CanonicalForm item() const
Definition: cf_generator.cc:162
FFGenerator::FFGenerator
FFGenerator()
Definition: cf_generator.h:60
FFGenerator
generate all elements in F_p starting from 0
Definition: cf_generator.h:56
FFGenerator::item
CanonicalForm item() const
Definition: cf_generator.cc:40
IntGenerator::current
int current
Definition: cf_generator.h:39
GFGenerator::item
CanonicalForm item() const
Definition: cf_generator.cc:72
GFGenerator::reset
void reset()
Definition: cf_generator.cc:67
FFGenerator::next
void next()
Definition: cf_generator.cc:46
AlgExtGenerator::gensf
FFGenerator ** gensf
Definition: cf_generator.h:97
GFGenerator::operator++
void operator++()
Definition: cf_generator.h:85
IntGenerator::~IntGenerator
~IntGenerator()
Definition: cf_generator.h:42
CFGenerator::clone
virtual CFGenerator * clone() const
Definition: cf_generator.h:30
FFGenerator::current
int current
Definition: cf_generator.h:58
CFGenerator::hasItems
virtual bool hasItems() const
Definition: cf_generator.h:26
AlgExtGenerator::reset
void reset()
Definition: cf_generator.cc:147
AlgExtGenerator::operator=
AlgExtGenerator & operator=(const AlgExtGenerator &)
Definition: cf_generator.cc:104
Variable
factory's class for variables
Definition: factory.h:118
IntGenerator::next
void next()
Definition: cf_generator.cc:25
GFGenerator::current
int current
Definition: cf_generator.h:77
IntGenerator::item
CanonicalForm item() const
Definition: cf_generator.cc:20
AlgExtGenerator::AlgExtGenerator
AlgExtGenerator()
Definition: cf_generator.cc:94
GFGenerator::clone
CFGenerator * clone() const
Definition: cf_generator.cc:89
CFGenerator::reset
virtual void reset()
Definition: cf_generator.h:27
FFGenerator::~FFGenerator
~FFGenerator()
Definition: cf_generator.h:61
CFGenerator::next
virtual void next()
Definition: cf_generator.h:29
AlgExtGenerator::operator++
void operator++()
Definition: cf_generator.h:112
IntGenerator::hasItems
bool hasItems() const
Definition: cf_generator.cc:15
AlgExtGenerator::clone
CFGenerator * clone() const
Definition: cf_generator.cc:216
CFGenerator::item
virtual CanonicalForm item() const
Definition: cf_generator.h:28
GFGenerator
generate all elements in GF starting from 0
Definition: cf_generator.h:75
CFGenFactory::generate
static CFGenerator * generate()
Definition: cf_generator.cc:221
GFGenerator::hasItems
bool hasItems() const
Definition: cf_generator.cc:62
IntGenerator::clone
CFGenerator * clone() const
Definition: cf_generator.cc:30
CFGenerator::CFGenerator
CFGenerator()
Definition: cf_generator.h:24
FFGenerator::clone
CFGenerator * clone() const
Definition: cf_generator.cc:52
IntGenerator::reset
void reset()
Definition: cf_generator.h:44
AlgExtGenerator
generate all elements in F_p(alpha) starting from 0
Definition: cf_generator.h:94