Loading...
Searching...
No Matches
cf_generator.h
Go to the documentation of this file.
/* emacs edit mode for this file is -*- C++ -*- */
/**
* @file cf_generator.h
*
* generate integers, elements of finite fields
**/
#ifndef INCL_CF_GENERATOR_H
#define INCL_CF_GENERATOR_H
// #include "config.h"
#include "canonicalform.h"
/*BEGINPUBLIC*/
/**
* virtual class for generators
**/
class CFGenerator
{
public:
CFGenerator() {}
virtual ~CFGenerator() {}
virtual bool hasItems() const { return false; }
virtual void reset() {};
virtual CanonicalForm item() const { return 0; }
virtual void next() {};
virtual CFGenerator * clone() const { return new CFGenerator();}
};
/**
* generate integers starting from 0
**/
class IntGenerator : public CFGenerator
{
private:
int current;
public:
IntGenerator() : current(0) {}
~IntGenerator() {}
bool hasItems() const;
void reset() { current = 0; }
CanonicalForm item() const;
void next();
void operator++ () { next(); }
void operator++ ( int ) { next(); }
CFGenerator * clone() const;
};
/**
* generate all elements in F_p starting from 0
**/
class FFGenerator : public CFGenerator
{
private:
int current;
public:
FFGenerator() : current(0) {}
~FFGenerator() {}
bool hasItems() const;
void reset() { current = 0; }
CanonicalForm item() const;
void next();
void operator++ () { next(); }
void operator++ ( int ) { next(); }
CFGenerator * clone() const;
};
/**
* generate all elements in GF starting from 0
**/
class GFGenerator : public CFGenerator
{
private:
int current;
public:
GFGenerator();
~GFGenerator() {}
bool hasItems() const;
void reset();
CanonicalForm item() const;
void next();
void operator++ () { next(); }
void operator++ ( int ) { next(); }
CFGenerator * clone() const;
};
/**
* generate all elements in F_p(alpha) starting from 0
**/
class AlgExtGenerator: public CFGenerator
{
private:
Variable algext;
FFGenerator **gensf;
GFGenerator **gensg;
int n;
bool nomoreitems;
AlgExtGenerator();
AlgExtGenerator( const AlgExtGenerator & );
AlgExtGenerator& operator= ( const AlgExtGenerator & );
public:
AlgExtGenerator( const Variable & a );
~AlgExtGenerator();
bool hasItems() const { return ! nomoreitems; }
void reset();
CanonicalForm item() const;
void next();
void operator++ () { next(); }
void operator++ ( int ) { next(); }
CFGenerator * clone() const;
};
class CFGenFactory
{
public:
static CFGenerator* generate();
};
/*ENDPUBLIC*/
#endif /* ! INCL_CF_GENERATOR_H */
canonicalform.h
Header for factory's main class CanonicalForm.
AlgExtGenerator::gensf
FFGenerator ** gensf
Definition cf_generator.h:97
AlgExtGenerator::operator++
void operator++()
Definition cf_generator.h:112
AlgExtGenerator::n
int n
Definition cf_generator.h:99
AlgExtGenerator::reset
void reset()
Definition cf_generator.cc:147
AlgExtGenerator::gensg
GFGenerator ** gensg
Definition cf_generator.h:98
AlgExtGenerator::item
CanonicalForm item() const
Definition cf_generator.cc:162
AlgExtGenerator::clone
CFGenerator * clone() const
Definition cf_generator.cc:216
AlgExtGenerator::hasItems
bool hasItems() const
Definition cf_generator.h:108
AlgExtGenerator::nomoreitems
bool nomoreitems
Definition cf_generator.h:100
AlgExtGenerator::AlgExtGenerator
AlgExtGenerator()
Definition cf_generator.cc:94
AlgExtGenerator::~AlgExtGenerator
~AlgExtGenerator()
Definition cf_generator.cc:131
AlgExtGenerator::operator=
AlgExtGenerator & operator=(const AlgExtGenerator &)
Definition cf_generator.cc:104
AlgExtGenerator::next
void next()
Definition cf_generator.cc:179
AlgExtGenerator::algext
Variable algext
Definition cf_generator.h:96
CFGenFactory
Definition cf_generator.h:118
CFGenFactory::generate
static CFGenerator * generate()
Definition cf_generator.cc:221
CFGenerator
virtual class for generators
Definition cf_generator.h:22
CFGenerator::CFGenerator
CFGenerator()
Definition cf_generator.h:24
CFGenerator::clone
virtual CFGenerator * clone() const
Definition cf_generator.h:30
CFGenerator::item
virtual CanonicalForm item() const
Definition cf_generator.h:28
CFGenerator::~CFGenerator
virtual ~CFGenerator()
Definition cf_generator.h:25
CFGenerator::hasItems
virtual bool hasItems() const
Definition cf_generator.h:26
CFGenerator::next
virtual void next()
Definition cf_generator.h:29
CFGenerator::reset
virtual void reset()
Definition cf_generator.h:27
CanonicalForm
factory's main class
Definition canonicalform.h:86
FFGenerator
generate all elements in F_p starting from 0
Definition cf_generator.h:56
FFGenerator::current
int current
Definition cf_generator.h:58
FFGenerator::FFGenerator
FFGenerator()
Definition cf_generator.h:60
FFGenerator::operator++
void operator++()
Definition cf_generator.h:66
FFGenerator::~FFGenerator
~FFGenerator()
Definition cf_generator.h:61
FFGenerator::hasItems
bool hasItems() const
Definition cf_generator.cc:35
FFGenerator::reset
void reset()
Definition cf_generator.h:63
FFGenerator::item
CanonicalForm item() const
Definition cf_generator.cc:40
FFGenerator::clone
CFGenerator * clone() const
Definition cf_generator.cc:52
FFGenerator::next
void next()
Definition cf_generator.cc:46
GFGenerator
generate all elements in GF starting from 0
Definition cf_generator.h:75
GFGenerator::hasItems
bool hasItems() const
Definition cf_generator.cc:62
GFGenerator::item
CanonicalForm item() const
Definition cf_generator.cc:72
GFGenerator::next
void next()
Definition cf_generator.cc:78
GFGenerator::clone
CFGenerator * clone() const
Definition cf_generator.cc:89
GFGenerator::current
int current
Definition cf_generator.h:77
GFGenerator::GFGenerator
GFGenerator()
Definition cf_generator.cc:57
GFGenerator::operator++
void operator++()
Definition cf_generator.h:85
GFGenerator::~GFGenerator
~GFGenerator()
Definition cf_generator.h:80
GFGenerator::reset
void reset()
Definition cf_generator.cc:67
IntGenerator::clone
CFGenerator * clone() const
Definition cf_generator.cc:30
IntGenerator::~IntGenerator
~IntGenerator()
Definition cf_generator.h:42
IntGenerator::operator++
void operator++()
Definition cf_generator.h:47
IntGenerator::reset
void reset()
Definition cf_generator.h:44
IntGenerator::item
CanonicalForm item() const
Definition cf_generator.cc:20
IntGenerator::next
void next()
Definition cf_generator.cc:25
IntGenerator::current
int current
Definition cf_generator.h:39
IntGenerator::hasItems
bool hasItems() const
Definition cf_generator.cc:15
IntGenerator::IntGenerator
IntGenerator()
Definition cf_generator.h:41
Variable
factory's class for variables
Definition factory.h:127