60 ASSERT(ideal->getGeneratorCount() == 1);
91 throwError<UnsupportedException>
93 " format does not support output of a monomial ideal.");
100 throwError<UnsupportedException>
102 " format does not support output of a list of monomial ideals.");
112 throwError<UnsupportedException>
114 " format does not support output of a polynomial.");
129 IOHandlerFactory getIOHandlerFactory() {
130 IOHandlerFactory factory(
"format");
132 nameFactoryRegister<IO::Macaulay2IOHandler>(factory);
133 nameFactoryRegister<IO::CoCoA4IOHandler>(factory);
134 nameFactoryRegister<IO::SingularIOHandler>(factory);
135 nameFactoryRegister<IO::MonosIOHandler>(factory);
136 nameFactoryRegister<IO::NewMonosIOHandler>(factory);
137 nameFactoryRegister<IO::Fourti2IOHandler>(factory);
138 nameFactoryRegister<IO::NullIOHandler>(factory);
139 nameFactoryRegister<IO::CountingIOHandler>(factory);
157 getIOHandlerFactory().getNamesWithPrefix(
"", names);
170 errorMsg <<
"Read the number " << n
171 <<
" while reading Frobenius instance. "
172 <<
"Only integers strictly larger than 1 are valid.";
176 numbers.push_back(n);
181 (in,
"Read empty Frobenius instance, which is not allowed.");
183 mpz_class
gcd = numbers[0];
184 for (
size_t i = 1; i < numbers.size(); ++i)
185 mpz_gcd(
gcd.get_mpz_t(),
gcd.get_mpz_t(), numbers[i].get_mpz_t());
191 errorMsg <<
"The numbers in the Frobenius instance are not "
192 <<
"relatively prime. They are all divisible by "
216 case '0':
case '1':
case '2':
case '3':
case '4':
217 case '5':
case '6':
case '7':
case '8':
case '9':
void readFrobeniusInstance(Scanner &in, vector< mpz_class > &numbers)
void getIOHandlerNames(vector< string > &names)
Add the name of each fomat to names.
string getFormatNameIndicatingToUseInputFormatAsOutputFormat()
Using the returned string in place of an (output) format name indicates to use the input format as th...
string getFormatNameIndicatingToGuessTheInputFormat()
Using the returned string in place of an (input) format name indicates to guess the format based on w...
auto_ptr< IOHandler > createIOHandler(const string &prefix)
Returns an IOHandler for the format whose name has the given prefix.
auto_ptr< IOHandler > createOHandler(const string &input, const string &output)
Returns an IOHandler for the output format.
string autoDetectFormat(Scanner &in)
Return the format of what in is reading based on the first non-whitespace character.
auto_ptr< AbstractProduct > createWithPrefix(const NameFactory< AbstractProduct > &factory, const string &prefix)
Creates the unique product that has the indicated prefix, or create the actual product that has name ...
The intention of this class is to describe the different kinds of mathematical structures that Frobby...
static const DataType & getMonomialIdealListType()
Returns the one and only instance for monomial ideal lists.
static const DataType & getMonomialIdealType()
Returns the one and only instance for monomial ideals.
static const DataType & getPolynomialType()
Returns the one and only instance for polynomials.
A replacement for stringstream.
virtual void doWriteTerm(const vector< mpz_class > &term, const VarNames &names, FILE *out)=0
virtual void doReadSatBinomIdeal(Scanner &in, SatBinomConsumer &consumer)=0
void readSatBinomIdeal(Scanner &in, SatBinomConsumer &consumer)
void readPolynomial(Scanner &in, CoefBigTermConsumer &consumer)
virtual bool doSupportsInput(const DataType &type) const =0
virtual void doReadIdeals(Scanner &in, InputConsumer &consumer)=0
void writeTerm(const vector< mpz_class > &term, const VarNames &names, FILE *out)
virtual const char * doGetDescription() const =0
virtual void doReadPolynomial(Scanner &in, CoefBigTermConsumer &consumer)=0
virtual CoefBigTermConsumer * doCreatePolynomialWriter(FILE *out)=0
void readIdeal(Scanner &in, InputConsumer &consumer)
Read an ideal and feed it to the consumer.
bool supportsInput(const DataType &type) const
auto_ptr< BigTermConsumer > createIdealWriter(FILE *out)
const char * getName() const
virtual const char * doGetName() const =0
auto_ptr< CoefBigTermConsumer > createPolynomialWriter(FILE *out)
virtual BigTermConsumer * doCreateIdealWriter(FILE *out)=0
virtual bool doSupportsOutput(const DataType &type) const =0
virtual void doReadIdeal(Scanner &in, InputConsumer &consumer)=0
auto_ptr< BigTermConsumer > createIdealListWriter(FILE *out)
const char * getDescription() const
virtual bool doHasMoreInput(Scanner &in) const =0
bool supportsOutput(const DataType &type) const
virtual void doReadTerm(Scanner &in, InputConsumer &consumer)=0
void readTerm(Scanner &in, const VarNames &names, vector< mpz_class > &term)
bool hasMoreInput(Scanner &in) const
void readIdeals(Scanner &in, InputConsumer &consumer)
Read a number of ideals and feed them to the consumer.
static const char * staticGetName()
static const char * staticGetName()
static const char * staticGetName()
static const char * staticGetName()
static const char * staticGetName()
static const char * staticGetName()
A NameFactory takes a name and then creates an instance of a class that has been previously registere...
This class offers an input interface which is more convenient and for some purposes more efficient th...
bool peek(char character)
Skips whitespace and returns true if the next character is equal to the parameter(s).
void eatWhite()
Reads past any whitespace, where whitespace is defined by the standard function isspace().
bool matchEOF()
Return true if no more input.
void readInteger(mpz_class &integer)
Read an arbitrary-precision integer.
Defines the variables of a polynomial ring and facilities IO involving them.
void reportSyntaxError(const Scanner &scanner, const string &errorMsg)
void gcd(Word *res, const Word *resEnd, const Word *a, const Word *b)