29 for (
size_t i = 0; i < varCount; ++i) {
31 out <<
'x' << (i + 1);
97 return *
this == names;
116 if (
this != &names) {
121 for (
size_t var = 0; var < names.
getVarCount(); ++var)
181 fputs(
"VarNames(", file);
185 fprintf(file,
"%lu<->\"%s\"", (
unsigned long)i,
getName(i).c_str());
A replacement for stringstream.
This class offers an input interface which is more convenient and for some purposes more efficient th...
Defines the variables of a polynomial ring and facilities IO involving them.
bool addVar(const string &name)
Adds the variable and returns true if name is not already a variable.
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.
static bool compareNames(const string *a, const string *b)
void swap(VarNames &names)
void projectVar(size_t index)
bool operator!=(const VarNames &names) const
void swapVariables(size_t a, size_t b)
Swaps the variables with indexes a and b.
bool namesAreDefault() const
Returns true if the names are x1, x2 and so on.
static const size_t invalidIndex
Returns a fixed variable offset that is always invalid.
void clear()
Resets the number of variables to zero.
void print(FILE *file) const
vector< const string * > _indexToName
bool operator<(const VarNames &names) const
This also depends on the order of the names.
size_t getIndex(const string &name) const
Returns VarNames::invalidIndex() if name is not known.
VarNames & operator=(const VarNames &names)
void toString(string &str) const
void addVarSyntaxCheckUnique(const Scanner &in, const string &name)
As addvar, except it reports a syntax error if name is already a variable.
bool empty() const
Returns true if the number of variables is zero.
bool operator==(const VarNames &names) const
bool contains(const string &name) const
Returns true if name is the name of a variable.
void reportSyntaxError(const Scanner &scanner, const string &errorMsg)
void reportError(const string &errorMsg)
void swap(hashtable< _Val, _Key, _HF, _Extract, _EqKey, _All > &__ht1, hashtable< _Val, _Key, _HF, _Extract, _EqKey, _All > &__ht2)