NullIOHandler.cpp
Go to the documentation of this file.
/* Frobby: Software for monomial ideal computations.
Copyright (C) 2007 Bjarke Hammersholt Roune (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 "NullIOHandler.h"
#include "BigIdeal.h"
#include "NullCoefTermConsumer.h"
#include "NullTermConsumer.h"
#include "BigPolynomial.h"
#include "VarNames.h"
#include "DataType.h"
#include "SatBinomConsumer.h"
#include "SatBinomIdeal.h"
#include "InputConsumer.h"
namespace IO {
NullIOHandler::NullIOHandler():
IOHandlerImpl(staticGetName(),
"Ignores input and produces no output.") {
registerInput(DataType::getMonomialIdealType());
registerInput(DataType::getPolynomialType());
registerInput(DataType::getMonomialIdealListType());
registerOutput(DataType::getMonomialIdealType());
registerOutput(DataType::getPolynomialType());
registerOutput(DataType::getMonomialIdealListType());
}
const char* NullIOHandler::staticGetName() {
return "null";
}
BigTermConsumer* NullIOHandler::doCreateIdealWriter(FILE* out) {
return new NullTermConsumer();
}
CoefBigTermConsumer* NullIOHandler::doCreatePolynomialWriter(FILE* out) {
return new NullCoefTermConsumer();
}
void NullIOHandler::doWriteTerm(const vector<mpz_class>& term,
const VarNames& names,
FILE* out) {
}
void NullIOHandler::doReadIdeal(Scanner& in, InputConsumer& consumer) {
consumer.consumeRing(VarNames());
consumer.beginIdeal();
consumer.endIdeal();
}
void NullIOHandler::doReadIdeals(Scanner& in, InputConsumer& consumer) {
consumer.consumeRing(VarNames());
}
void NullIOHandler::doReadTerm(Scanner& in, InputConsumer& consumer) {
consumer.beginTerm();
consumer.endTerm();
}
void NullIOHandler::doReadPolynomial(Scanner& in, CoefBigTermConsumer& consumer) {
consumer.consume(BigPolynomial());
}
void NullIOHandler::doReadSatBinomIdeal(Scanner& in, SatBinomConsumer& consumer) {
consumer.consume(SatBinomIdeal());
}
bool NullIOHandler::doHasMoreInput(Scanner& in) const {
return false;
}
}
BigIdeal.h
BigPolynomial.h
DataType.h
InputConsumer.h
NullCoefTermConsumer.h
NullIOHandler.h
NullTermConsumer.h
SatBinomConsumer.h
SatBinomIdeal.h
VarNames.h
BigPolynomial
Definition BigPolynomial.h:27
BigTermConsumer
Definition BigTermConsumer.h:29
CoefBigTermConsumer
Definition CoefBigTermConsumer.h:29
CoefBigTermConsumer::consume
virtual void consume(const mpz_class &coef, const Term &term)
Definition CoefBigTermConsumer.cpp:25
DataType::getMonomialIdealListType
static const DataType & getMonomialIdealListType()
Returns the one and only instance for monomial ideal lists.
Definition DataType.cpp:54
DataType::getMonomialIdealType
static const DataType & getMonomialIdealType()
Returns the one and only instance for monomial ideals.
Definition DataType.cpp:45
DataType::getPolynomialType
static const DataType & getPolynomialType()
Returns the one and only instance for polynomials.
Definition DataType.cpp:50
IO::IOHandlerImpl::registerInput
void registerInput(const DataType &type)
Specify that input of the argument type is supported.
Definition IOHandlerImpl.cpp:60
IO::IOHandlerImpl::IOHandlerImpl
IOHandlerImpl(const char *formatName, const char *formatDescription)
Definition IOHandlerImpl.cpp:36
IO::IOHandlerImpl::registerOutput
void registerOutput(const DataType &type)
Specify that output of the argument type is supported.
Definition IOHandlerImpl.cpp:67
IO::NullIOHandler::doReadSatBinomIdeal
virtual void doReadSatBinomIdeal(Scanner &in, SatBinomConsumer &consumer)
Definition NullIOHandler.cpp:79
IO::NullIOHandler::NullIOHandler
NullIOHandler()
Definition NullIOHandler.cpp:31
IO::NullIOHandler::doCreateIdealWriter
virtual BigTermConsumer * doCreateIdealWriter(FILE *out)
Definition NullIOHandler.cpp:47
IO::NullIOHandler::doReadPolynomial
virtual void doReadPolynomial(Scanner &in, CoefBigTermConsumer &consumer)
Definition NullIOHandler.cpp:75
IO::NullIOHandler::doReadIdeal
virtual void doReadIdeal(Scanner &in, InputConsumer &consumer)
Definition NullIOHandler.cpp:60
IO::NullIOHandler::doCreatePolynomialWriter
virtual CoefBigTermConsumer * doCreatePolynomialWriter(FILE *out)
Definition NullIOHandler.cpp:51
IO::NullIOHandler::doHasMoreInput
virtual bool doHasMoreInput(Scanner &in) const
Definition NullIOHandler.cpp:83
IO::NullIOHandler::staticGetName
static const char * staticGetName()
Definition NullIOHandler.cpp:43
IO::NullIOHandler::doReadIdeals
virtual void doReadIdeals(Scanner &in, InputConsumer &consumer)
Definition NullIOHandler.cpp:66
IO::NullIOHandler::doReadTerm
virtual void doReadTerm(Scanner &in, InputConsumer &consumer)
Definition NullIOHandler.cpp:70
IO::NullIOHandler::doWriteTerm
virtual void doWriteTerm(const vector< mpz_class > &term, const VarNames &names, FILE *out)
Definition NullIOHandler.cpp:55
InputConsumer
Definition InputConsumer.h:30
InputConsumer::beginTerm
void beginTerm()
Start consuming a term.
Definition InputConsumer.cpp:62
InputConsumer::beginIdeal
void beginIdeal()
Start consuming an ideal.
Definition InputConsumer.cpp:50
InputConsumer::consumeRing
void consumeRing(const VarNames &names)
Definition InputConsumer.cpp:33
InputConsumer::endIdeal
void endIdeal()
Done reading an ideal.
Definition InputConsumer.cpp:191
InputConsumer::endTerm
void endTerm()
Done reading a term.
Definition InputConsumer.cpp:164
NullCoefTermConsumer
This follows the null object pattern.
Definition NullCoefTermConsumer.h:31
NullTermConsumer
This follows the null object pattern.
Definition NullTermConsumer.h:25
SatBinomConsumer
Definition SatBinomConsumer.h:25
SatBinomConsumer::consume
virtual void consume(const vector< mpz_class > &term)=0
SatBinomIdeal
Represents a saturated binomial ideal.
Definition SatBinomIdeal.h:28
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
IO
Definition CoCoA4IOHandler.cpp:33
stdinc.h
This header file includes common definitions and is included as the first line of code in every imple...