IOHandlerCommon.cpp
Go to the documentation of this file.
/* Frobby: Software for monomial ideal computations.
Copyright (C) 2009 University of Aarhus
Contact Bjarke Hammersholt Roune for license information (www.broune.com)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see http://www.gnu.org/licenses/.
*/
#include "stdinc.h"
#include "IOHandlerCommon.h"
#include "VarNames.h"
#include "BigTermConsumer.h"
#include "BigTermRecorder.h"
#include "error.h"
#include "InputConsumer.h"
IO::IOHandlerCommon::IOHandlerCommon(const char* formatName,
const char* formatDescription):
IOHandlerImpl(formatName, formatDescription) {
}
void IO::IOHandlerCommon::readRing(Scanner& in, VarNames& names) {
doReadRing(in, names);
}
bool IO::IOHandlerCommon::peekRing(Scanner& in) {
return doPeekRing(in);
}
void IO::IOHandlerCommon::readBareIdeal(Scanner& in, InputConsumer& consumer) {
doReadBareIdeal(in, consumer);
}
void IO::IOHandlerCommon::readBarePolynomial(Scanner& in,
const VarNames& names,
CoefBigTermConsumer& consumer) {
doReadBarePolynomial(in, names, consumer);
}
void IO::IOHandlerCommon::doReadIdeal(Scanner& in, InputConsumer& consumer) {
VarNames names;
readRing(in, names);
consumer.consumeRing(names);
readBareIdeal(in, consumer);
}
void IO::IOHandlerCommon::doReadIdeals(Scanner& in, InputConsumer& consumer) {
VarNames names;
readRing(in, names);
consumer.consumeRing(names);
if (!hasMoreInput(in))
return;
readBareIdeal(in, consumer);
while (hasMoreInput(in)) {
if (peekRing(in)) {
readRing(in, names);
consumer.consumeRing(names);
}
readBareIdeal(in, consumer);
}
}
void IO::IOHandlerCommon::doReadPolynomial(Scanner& in,
CoefBigTermConsumer& consumer) {
VarNames names;
readRing(in, names);
readBarePolynomial(in, names, consumer);
}
void IO::IOHandlerCommon::doReadBarePolynomial(Scanner& in,
const VarNames& names,
CoefBigTermConsumer& consumer) {
INTERNAL_ERROR_UNIMPLEMENTED();
}
void IO::IOHandlerCommon::doReadBareIdeal
(Scanner& in, InputConsumer& consumer) {
INTERNAL_ERROR_UNIMPLEMENTED();
}
BigTermConsumer.h
BigTermRecorder.h
IOHandlerCommon.h
InputConsumer.h
VarNames.h
CoefBigTermConsumer
Definition CoefBigTermConsumer.h:29
IOHandler::hasMoreInput
bool hasMoreInput(Scanner &in) const
Definition IOHandler.cpp:77
IO::IOHandlerCommon::readBareIdeal
void readBareIdeal(Scanner &in, InputConsumer &consumer)
Reads an ideal without a ring preceding it.
Definition IOHandlerCommon.cpp:40
IO::IOHandlerCommon::doReadIdeal
virtual void doReadIdeal(Scanner &in, InputConsumer &consumer)
Definition IOHandlerCommon.cpp:50
IO::IOHandlerCommon::doReadRing
virtual void doReadRing(Scanner &in, VarNames &names)=0
IO::IOHandlerCommon::readRing
void readRing(Scanner &in, VarNames &names)
Reads a ring, i.e.
Definition IOHandlerCommon.cpp:32
IO::IOHandlerCommon::doPeekRing
virtual bool doPeekRing(Scanner &in)=0
IO::IOHandlerCommon::doReadPolynomial
virtual void doReadPolynomial(Scanner &in, CoefBigTermConsumer &consumer)
Definition IOHandlerCommon.cpp:74
IO::IOHandlerCommon::doReadBarePolynomial
virtual void doReadBarePolynomial(Scanner &in, const VarNames &names, CoefBigTermConsumer &consumer)
Definition IOHandlerCommon.cpp:81
IO::IOHandlerCommon::IOHandlerCommon
IOHandlerCommon(const char *formatName, const char *formatDescription)
Definition IOHandlerCommon.cpp:27
IO::IOHandlerCommon::doReadIdeals
virtual void doReadIdeals(Scanner &in, InputConsumer &consumer)
Definition IOHandlerCommon.cpp:57
IO::IOHandlerCommon::doReadBareIdeal
virtual void doReadBareIdeal(Scanner &in, InputConsumer &consumer)
Definition IOHandlerCommon.cpp:88
IO::IOHandlerCommon::peekRing
bool peekRing(Scanner &in)
Returns true if what follows in the input is a ring, assuming there are no syntax errors.
Definition IOHandlerCommon.cpp:36
IO::IOHandlerCommon::readBarePolynomial
void readBarePolynomial(Scanner &in, const VarNames &names, CoefBigTermConsumer &consumer)
Reads a polynomial without a ring preceding it.
Definition IOHandlerCommon.cpp:44
IO::IOHandlerImpl::IOHandlerImpl
IOHandlerImpl(const char *formatName, const char *formatDescription)
Definition IOHandlerImpl.cpp:36
InputConsumer
Definition InputConsumer.h:30
InputConsumer::consumeRing
void consumeRing(const VarNames &names)
Definition InputConsumer.cpp:33
Scanner
This class offers an input interface which is more convenient and for some purposes more efficient th...
Definition Scanner.h:50
VarNames
Defines the variables of a polynomial ring and facilities IO involving them.
Definition VarNames.h:40
error.h
INTERNAL_ERROR_UNIMPLEMENTED
#define INTERNAL_ERROR_UNIMPLEMENTED()
Definition error.h:47
stdinc.h
This header file includes common definitions and is included as the first line of code in every imple...