Frobby  0.9.5
IOHandlerCommon.cpp
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 #include "stdinc.h"
19 #include "IOHandlerCommon.h"
20 
21 #include "VarNames.h"
22 #include "BigTermConsumer.h"
23 #include "BigTermRecorder.h"
24 #include "error.h"
25 #include "InputConsumer.h"
26 
27 IO::IOHandlerCommon::IOHandlerCommon(const char* formatName,
28  const char* formatDescription):
29  IOHandlerImpl(formatName, formatDescription) {
30 }
31 
33  doReadRing(in, names);
34 }
35 
37  return doPeekRing(in);
38 }
39 
41  doReadBareIdeal(in, consumer);
42 }
43 
45  const VarNames& names,
46  CoefBigTermConsumer& consumer) {
47  doReadBarePolynomial(in, names, consumer);
48 }
49 
51  VarNames names;
52  readRing(in, names);
53  consumer.consumeRing(names);
54  readBareIdeal(in, consumer);
55 }
56 
58  VarNames names;
59  readRing(in, names);
60  consumer.consumeRing(names);
61  if (!hasMoreInput(in))
62  return;
63  readBareIdeal(in, consumer);
64 
65  while (hasMoreInput(in)) {
66  if (peekRing(in)) {
67  readRing(in, names);
68  consumer.consumeRing(names);
69  }
70  readBareIdeal(in, consumer);
71  }
72 }
73 
75  CoefBigTermConsumer& consumer) {
76  VarNames names;
77  readRing(in, names);
78  readBarePolynomial(in, names, consumer);
79 }
80 
82  const VarNames& names,
83  CoefBigTermConsumer& consumer) {
85 }
86 
88 (Scanner& in, InputConsumer& consumer) {
90 }
void readBareIdeal(Scanner &in, InputConsumer &consumer)
Reads an ideal without a ring preceding it.
virtual void doReadIdeal(Scanner &in, InputConsumer &consumer)
void readRing(Scanner &in, VarNames &names)
Reads a ring, i.e.
virtual void doReadPolynomial(Scanner &in, CoefBigTermConsumer &consumer)
virtual void doReadBarePolynomial(Scanner &in, const VarNames &names, CoefBigTermConsumer &consumer)
IOHandlerCommon(const char *formatName, const char *formatDescription)
virtual void doReadIdeals(Scanner &in, InputConsumer &consumer)
virtual void doReadBareIdeal(Scanner &in, InputConsumer &consumer)
bool peekRing(Scanner &in)
Returns true if what follows in the input is a ring, assuming there are no syntax errors.
void readBarePolynomial(Scanner &in, const VarNames &names, CoefBigTermConsumer &consumer)
Reads a polynomial without a ring preceding it.
This class contains a minimum level of functionality that makes it more convenient to derive from tha...
Definition: IOHandlerImpl.h:37
void consumeRing(const VarNames &names)
This class offers an input interface which is more convenient and for some purposes more efficient th...
Definition: Scanner.h:50
Defines the variables of a polynomial ring and facilities IO involving them.
Definition: VarNames.h:40
#define INTERNAL_ERROR_UNIMPLEMENTED()
Definition: error.h:47
void readRing(Scanner &in, VarNames &names)