37 namespace S = Singular;
53 fputs(first ?
"\n " :
",\n ",
getFile());
59 fputs(first ?
"\n " :
",\n ",
getFile());
87 bool firstGenerator) {
93 const vector<mpz_class>& term,
94 bool firstGenerator) {
108 "Format understandable by the program Singular.") {
137 vector<mpz_class>& term) {
157 }
while (in.
match(
','));
169 names.
getName(0) !=
string(
"dummy")) {
172 "A singular ring with no actual variables must have a single "
173 "place-holder variable named \"dummy\", and in this case ";
176 <<
" place-holder variables.";
178 errorMsg <<
"it has the name \"" << names.
getName(0) <<
"\".";
183 }
else if (!in.
match(
'0')) {
192 return in.
peek(
'r') || in.
peek(
'R');
204 if (!in.
match(
'0')) {
208 }
while (in.
match(
','));
223 if (!in.
match(
'0')) {
226 }
while (in.
match(
','));
250 }
while (!in.
match(
';'));
256 fputs(
"ring R = 0, (dummy), lp;\nint noVars = 1;\n", out);
258 fputs(
"ring R = 0, (", out);
260 const char* pre =
"";
261 for (
unsigned int i = 0; i < names.
getVarCount(); ++i) {
263 fputs(names.
getName(i).c_str(), out);
266 fputs(
"), lp;\nint noVars = 0;\n", out);
virtual void consume(const vector< mpz_class > &term)=0
virtual void doneConsuming()=0
Must be called once after each time beginConsuming has been called.
virtual void beginConsuming()=0
Tell the consumer to begin consuming an ideal.
virtual void beginConsuming()=0
virtual void consume(const mpz_class &coef, const Term &term)
virtual void doneConsuming()=0
virtual void consumeRing(const VarNames &names)=0
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.
void readTerm(Scanner &in, const VarNames &names, vector< mpz_class > &term)
This class contains further functionality that makes it more convenient to derive from than IOHandler...
void registerInput(const DataType &type)
Specify that input of the argument type is supported.
void registerOutput(const DataType &type)
Specify that output of the argument type is supported.
const VarNames & getNames()
const VarNames & getNames() const
virtual void doReadBarePolynomial(Scanner &in, const VarNames &names, CoefBigTermConsumer &consumer)
virtual void doReadBareIdeal(Scanner &in, const VarNames &names, BigTermConsumer &consumer)
virtual bool doPeekRing(Scanner &in)
virtual CoefBigTermConsumer * doCreatePolynomialWriter(FILE *out)
virtual BigTermConsumer * doCreateIdealWriter(FILE *out)
virtual void doReadRing(Scanner &in, VarNames &names)
virtual void doReadTerm(Scanner &in, const VarNames &names, vector< mpz_class > &term)
virtual void doWriteTerm(const vector< mpz_class > &term, const VarNames &names, FILE *out)
static const char * staticGetName()
virtual void doWriteFooter(bool wasZeroIdeal)
SingularIdealWriter(FILE *out)
virtual void doWriteTerm(const vector< mpz_class > &term, bool first)
virtual void doWriteTerm(const Term &term, const TermTranslator &translator, bool first)
virtual void doWriteEmptyList()
virtual void doWriteHeader(bool first)
SingularPolyWriter(FILE *out)
virtual void doWriteHeader()
virtual void doWriteTerm(const mpz_class &coef, const Term &term, const TermTranslator &translator, bool firstGenerator)
virtual void doWriteTerm(const mpz_class &coef, const vector< mpz_class > &term, bool firstGenerator)
virtual void doWriteFooter(bool wasZero)
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 expect(char expected)
Require the next character to be equal to expected.
const char * readIdentifier()
The returned string is only valid until the next method on this object gets called.
bool match(char c)
Return true if the next character is c, and in that case skip past it.
TermTranslator handles translation between terms whose exponents are infinite precision integers and ...
Term represents a product of variables which does not include a coefficient.
Defines the variables of a polynomial ring and facilities IO involving them.
size_t getVarCount() const
Returns the current number of variables.
const string & getName(size_t index) const
The returned reference can become invalid next time addVar is called.
void clear()
Resets the number of variables to zero.
void addVarSyntaxCheckUnique(const Scanner &in, const string &name)
As addvar, except it reports a syntax error if name is already a variable.
void reportSyntaxError(const Scanner &scanner, const string &errorMsg)
void writeRing(const VarNames &names, FILE *out)
void writeCoefTermProduct(const mpz_class &coef, const Term &term, const TermTranslator &translator, bool hidePlus, FILE *out)
void readCoefTerm(BigPolynomial &polynomial, bool firstTerm, Scanner &in)
void readTermProduct(Scanner &in, const VarNames &names, vector< mpz_class > &term)
void writeTermProduct(const Term &term, const TermTranslator &translator, FILE *out)