Frobby 0.10.0
Loading...
Searching...
No Matches
PolyWriter.h
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
24namespace IO {
25 class PolyWriter : public CoefBigTermConsumer {
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;
57 VarNames _names;
58 };
59}
60
61#endif
Definition BigPolynomial.h:27
Definition CoefBigTermConsumer.h:29
Definition TermTranslator.h:41
Definition Term.h:49
Definition VarNames.h:38