25#ifndef VARIABLEINDEX_HPP
26#define VARIABLEINDEX_HPP
33#include<unordered_map>
35#include "Variable.hpp"
43using std::unordered_map;
44using std::istringstream;
47using MapType = pair<string, Variable*>;
66 vector<Variable*> vars;
70 unordered_map<string, Variable*> name_index;
83 ID first_anon_variable;
88 ID highest_anon_variable;
101 vector<ID> backtrack_points;
Basic representation of variables.
Definition Variable.hpp:58
Storage of named variables, and management of new, anonymous variables.
Definition VariableIndex.hpp:61
ID get_next_index() const
Straightforward access function.
Definition VariableIndex.hpp:118
void reset()
Get rid of all the markers used for backtracking.
Definition VariableIndex.cpp:143
void clear_substitutions()
Undo all substitutions made, to anything, ever.
Definition VariableIndex.cpp:67
Variable * add_named_var(const string &)
Add a variable with the specified name to the index.
Definition VariableIndex.cpp:43
ID get_first_anon_variable() const
Straightforward access function.
Definition VariableIndex.hpp:122
ID add_named_backtrack_point()
Same as add_backtrack_point, but return an identifier allowing multiple levels of backtracking using ...
Definition VariableIndex.cpp:121
void set_all_names_added()
Call this to indicate that only anonymous variables can now be created.
Definition VariableIndex.cpp:62
bool get_all_names_added() const
Straightforward access function.
Definition VariableIndex.hpp:130
size_t get_num_backtracks() const
Straightforward access function.
Definition VariableIndex.hpp:134
void backtrack_to_named_point(ID)
Backtrack, possibly multiple times, to the specified point.
Definition VariableIndex.cpp:135
Variable * add_anon_var()
Add an anonymous variable.
Definition VariableIndex.cpp:72
void backtrack()
Backtrack to the last marker.
Definition VariableIndex.cpp:126
void add_backtrack_point()
Add a backtrack point.
Definition VariableIndex.cpp:117
ID get_highest_anon_variable() const
Straightforward access function.
Definition VariableIndex.hpp:126
Variable * find_variable(const string &)
Look up a variable by name.
Definition VariableIndex.cpp:94
VariableIndex(const VariableIndex &)=delete
Copying this would be a very silly idea, so explicitly disallow it.