Frobby  0.9.5
PolyWriter.h
Go to the documentation of this file.
1 /* Frobby: Software for monomial ideal computations.
2  Copyright (C) 2007 Bjarke Hammersholt Roune (www.broune.com)
3  Copyright (C) 2009 University of Aarhus
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with this program. If not, see http://www.gnu.org/licenses/.
17 */
18 #ifndef POLY_WRITER_GUARD
19 #define POLY_WRITER_GUARD
20 
21 #include "CoefBigTermConsumer.h"
22 #include "VarNames.h"
23 
24 namespace IO {
26  public:
27  PolyWriter(FILE* out);
28 
29  virtual void consumeRing(const VarNames& names);
30 
31  virtual void beginConsuming();
32  virtual void consume(const mpz_class& coef,
33  const Term& term,
34  const TermTranslator& translator);
35  virtual void consume(const mpz_class& coef, const vector<mpz_class>& term);
36  virtual void doneConsuming();
37 
38  virtual void consume(const BigPolynomial& poly);
39 
40  FILE* getFile() {return _out;}
41  const VarNames& getNames() const {return _names;}
42 
43  private:
44  virtual void doWriteHeader(size_t generatorCount);
45  virtual void doWriteHeader() = 0;
46  virtual void doWriteTerm(const mpz_class& coef,
47  const Term& term,
48  const TermTranslator& translator,
49  bool firstGenerator) = 0;
50  virtual void doWriteTerm(const mpz_class& coef,
51  const vector<mpz_class>& term,
52  bool firstGenerator) = 0;
53  virtual void doWriteFooter(bool wasZero) = 0;
54 
55  FILE* const _out;
56  bool _firstTerm;
58  };
59 }
60 
61 #endif
virtual void doWriteFooter(bool wasZero)=0
PolyWriter(FILE *out)
Definition: PolyWriter.cpp:25
virtual void doneConsuming()
Definition: PolyWriter.cpp:55
virtual void doWriteHeader()=0
FILE * getFile()
Definition: PolyWriter.h:40
const VarNames & getNames() const
Definition: PolyWriter.h:41
virtual void beginConsuming()
Definition: PolyWriter.cpp:34
virtual void consumeRing(const VarNames &names)
Definition: PolyWriter.cpp:30
FILE *const _out
Definition: PolyWriter.h:55
virtual void doWriteTerm(const mpz_class &coef, const Term &term, const TermTranslator &translator, bool firstGenerator)=0
virtual void doWriteTerm(const mpz_class &coef, const vector< mpz_class > &term, bool firstGenerator)=0
VarNames _names
Definition: PolyWriter.h:57
virtual void consume(const mpz_class &coef, const Term &term, const TermTranslator &translator)
Definition: PolyWriter.cpp:39
TermTranslator handles translation between terms whose exponents are infinite precision integers and ...
Term represents a product of variables which does not include a coefficient.
Definition: Term.h:49
Defines the variables of a polynomial ring and facilities IO involving them.
Definition: VarNames.h:40