Go to the documentation of this file.
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 doWriteTerm(const vector< mpz_class > &term, const VarNames &names, FILE *out)
void readCoefTerm(BigPolynomial &polynomial, bool firstTerm, Scanner &in)
void writeTermProduct(const Term &term, const TermTranslator &translator, FILE *out)
static const DataType & getMonomialIdealListType()
Returns the one and only instance for monomial ideal lists.
static const DataType & getPolynomialType()
Returns the one and only instance for polynomials.
virtual void doReadBarePolynomial(Scanner &in, const VarNames &names, CoefBigTermConsumer &consumer)
This class offers an input interface which is more convenient and for some purposes more efficient th...
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.
virtual void consumeRing(const VarNames &names)=0
SingularPolyWriter(FILE *out)
const VarNames & getNames()
void writeRing(const VarNames &names, FILE *out)
virtual CoefBigTermConsumer * doCreatePolynomialWriter(FILE *out)
virtual void beginConsuming()=0
Tell the consumer to begin consuming an ideal.
bool match(char c)
Return true if the next character is c, and in that case skip past it.
virtual void doWriteEmptyList()
virtual void beginConsuming()=0
virtual void doReadTerm(Scanner &in, const VarNames &names, vector< mpz_class > &term)
const char * readIdentifier()
The returned string is only valid until the next method on this object gets called.
const string & getName(size_t index) const
The returned reference can become invalid next time addVar is called.
virtual void consume(const vector< mpz_class > &term)=0
TermTranslator handles translation between terms whose exponents are infinite precision integers and ...
static const char * staticGetName()
virtual void doWriteTerm(const Term &term, const TermTranslator &translator, bool first)
virtual void doReadBareIdeal(Scanner &in, const VarNames &names, BigTermConsumer &consumer)
void addVarSyntaxCheckUnique(const Scanner &in, const string &name)
As addvar, except it reports a syntax error if name is already a variable.
virtual void doWriteHeader(bool first)
const VarNames & getNames() const
size_t getVarCount() const
Returns the current number of variables.
virtual void doneConsuming()=0
Must be called once after each time beginConsuming has been called.
virtual void doneConsuming()=0
Term represents a product of variables which does not include a coefficient.
void writeCoefTermProduct(const mpz_class &coef, const Term &term, const TermTranslator &translator, bool hidePlus, FILE *out)
virtual void doWriteTerm(const mpz_class &coef, const vector< mpz_class > &term, bool firstGenerator)
virtual bool doPeekRing(Scanner &in)
void expect(char expected)
Require the next character to be equal to expected.
void reportSyntaxError(const Scanner &scanner, const string &errorMsg)
void clear()
Resets the number of variables to zero.
virtual void doWriteTerm(const mpz_class &coef, const Term &term, const TermTranslator &translator, bool firstGenerator)
void registerOutput(const DataType &type)
Specify that output of the argument type is supported.
static const DataType & getMonomialIdealType()
Returns the one and only instance for monomial ideals.
virtual void doWriteHeader()
A replacement for stringstream.
virtual void doWriteFooter(bool wasZeroIdeal)
virtual void doWriteTerm(const vector< mpz_class > &term, bool first)
virtual void doReadRing(Scanner &in, VarNames &names)
virtual void consume(const mpz_class &coef, const Term &term)
virtual BigTermConsumer * doCreateIdealWriter(FILE *out)
void readTerm(Scanner &in, const VarNames &names, vector< mpz_class > &term)
Defines the variables of a polynomial ring and facilities IO involving them.
void readTermProduct(Scanner &in, const VarNames &names, vector< mpz_class > &term)
bool peek(char character)
Skips whitespace and returns true if the next character is equal to the parameter(s).
SingularIdealWriter(FILE *out)
virtual void doWriteFooter(bool wasZero)