Frobby  0.9.5
TranslatingTermConsumer.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 
4  This program is free software; you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation; either version 2 of the License, or
7  (at your option) any later version.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with this program. If not, see http://www.gnu.org/licenses/.
16 */
17 #ifndef TRANSLATING_TERM_CONSUMER_GUARD
18 #define TRANSLATING_TERM_CONSUMER_GUARD
19 
20 #include "BigTermConsumer.h"
21 
22 class BigTermConsumer;
23 class TermTranslator;
24 class VarNames;
25 class Term;
26 
27 // The purpose of this class is to replace calls to consume(term) by
28 // consume(term, translator) when term is a Term. Thus untranslated
29 // terms get translated by the translator specified in the translator.
31  public:
32  // Does not copy the consumer or translator, so they need to remain
33  // valid for the lifetime of this object. Does not take over
34  // ownership of consumer, as is strongly indicated by it being a
35  // reference as opposed to an auto_ptr.
37  const TermTranslator& translator);
38 
39  // Does not copy the translator, so it needs to remain valid for the
40  // lifetime of this object. Takes over ownership of consumer.
41  TranslatingTermConsumer(auto_ptr<BigTermConsumer> consumer,
42  const TermTranslator& translator);
43 
44  virtual void beginConsumingList();
45  virtual void consumeRing(const VarNames& names);
46  virtual void beginConsuming();
47 
48  virtual void consume(const Term& term);
49  virtual void consume(const vector<mpz_class>& term);
50  virtual void consume(const Term& term, const TermTranslator& translator);
51 
52  virtual void doneConsuming();
53  virtual void doneConsumingList();
54 
55  virtual void consume(const BigIdeal& ideal);
56 
57  private:
60  auto_ptr<BigTermConsumer> _consumerOwner;
61 };
62 
63 #endif
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
TranslatingTermConsumer(BigTermConsumer &consumer, const TermTranslator &translator)
virtual void consumeRing(const VarNames &names)
Tell the consumer which ring is being used.
virtual void doneConsumingList()
Must be called once after each time beginConsumingList has been called.
auto_ptr< BigTermConsumer > _consumerOwner
virtual void beginConsuming()
Tell the consumer to begin consuming an ideal.
const TermTranslator & _translator
virtual void doneConsuming()
Must be called once after each time beginConsuming has been called.
virtual void consume(const Term &term)
Consume a term.
virtual void beginConsumingList()
Tell the consumer that the ideals that are consumed until the next call to doneConsumingList are to b...
Defines the variables of a polynomial ring and facilities IO involving them.
Definition: VarNames.h:40