Frobby  0.9.5
IdealWriter.h
Go to the documentation of this file.
1 /* Frobby: Software for monomial ideal computations.
2  Copyright (C) 2009 University of Aarhus
3  Contact Bjarke Hammersholt Roune for license information (www.broune.com)
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 IDEAL_WRITER_GUARD
19 #define IDEAL_WRITER_GUARD
20 
21 #include "VarNames.h"
22 #include "BigTermConsumer.h"
23 
24 class TermTranslator;
25 class Term;
26 
27 namespace IO {
28  class IdealWriter : public BigTermConsumer {
29  public:
30  IdealWriter(FILE* out);
31 
32  virtual void consumeRing(const VarNames& names);
33 
34  virtual void beginConsumingList();
35  virtual void beginConsuming();
36  virtual void consume(const Term& term, const TermTranslator& translator);
37  virtual void consume(const vector<mpz_class>& term);
38  virtual void doneConsuming();
39  virtual void doneConsumingList();
40 
41  virtual void consume(const BigIdeal& ideal);
42 
43  FILE* getFile() {return _out;}
44  const VarNames& getNames() {return _names;}
45 
46  private:
47  virtual void doWriteHeader(bool firstIdeal, size_t generatorCount);
48  virtual void doWriteHeader(bool firstIdeal) = 0;
49  virtual void doWriteTerm(const Term& term,
50  const TermTranslator& translator,
51  bool firstGenerator) = 0;
52  virtual void doWriteTerm(const vector<mpz_class>& term,
53  bool firstGenerator) = 0;
54  virtual void doWriteFooter(bool wasZeroIdeal) = 0;
55  virtual void doWriteEmptyList() = 0;
56 
57  FILE* const _out;
61  };
62 }
63 
64 #endif
bool _firstGenerator
Definition: IdealWriter.h:59
FILE *const _out
Definition: IdealWriter.h:57
virtual void consume(const Term &term, const TermTranslator &translator)
Definition: IdealWriter.cpp:47
virtual void doneConsumingList()
Must be called once after each time beginConsumingList has been called.
Definition: IdealWriter.cpp:66
virtual void doneConsuming()
Must be called once after each time beginConsuming has been called.
Definition: IdealWriter.cpp:61
IdealWriter(FILE *out)
Definition: IdealWriter.cpp:25
virtual void doWriteTerm(const Term &term, const TermTranslator &translator, bool firstGenerator)=0
FILE * getFile()
Definition: IdealWriter.h:43
virtual void doWriteEmptyList()=0
const VarNames & getNames()
Definition: IdealWriter.h:44
virtual void doWriteHeader(bool firstIdeal, size_t generatorCount)
Definition: IdealWriter.cpp:81
virtual void beginConsuming()
Tell the consumer to begin consuming an ideal.
Definition: IdealWriter.cpp:42
virtual void consumeRing(const VarNames &names)
Tell the consumer which ring is being used.
Definition: IdealWriter.cpp:31
VarNames _names
Definition: IdealWriter.h:60
virtual void doWriteFooter(bool wasZeroIdeal)=0
virtual void doWriteHeader(bool firstIdeal)=0
virtual void beginConsumingList()
Tell the consumer that the ideals that are consumed until the next call to doneConsumingList are to b...
Definition: IdealWriter.cpp:38
virtual void doWriteTerm(const vector< mpz_class > &term, bool firstGenerator)=0
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