Frobby 0.10.0
Loading...
Searching...
No Matches
TranslatingTermConsumer.h
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
22class BigTermConsumer;
23class TermTranslator;
24class VarNames;
25class 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.
30class TranslatingTermConsumer : public BigTermConsumer {
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 unique_ptr.
36 TranslatingTermConsumer(BigTermConsumer& consumer,
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(unique_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:
58 const TermTranslator& _translator;
59 BigTermConsumer& _consumer;
60 unique_ptr<BigTermConsumer> _consumerOwner;
61};
62
63#endif
Definition BigIdeal.h:27
Definition BigTermConsumer.h:29
Definition TermTranslator.h:41
Definition Term.h:49
virtual void consumeRing(const VarNames &names)
Definition TranslatingTermConsumer.cpp:42
virtual void doneConsumingList()
Definition TranslatingTermConsumer.cpp:69
virtual void beginConsuming()
Definition TranslatingTermConsumer.cpp:46
virtual void doneConsuming()
Definition TranslatingTermConsumer.cpp:65
virtual void consume(const Term &term)
Definition TranslatingTermConsumer.cpp:50
virtual void beginConsumingList()
Definition TranslatingTermConsumer.cpp:38
Definition VarNames.h:38