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;
89 ID first_anon_variable;
94 ID highest_anon_variable;
102 bool all_names_added;
107 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:124
Variable * add_unique_var()
Add a unique variable when converting to CNF.
Definition VariableIndex.cpp:95
void reset()
Get rid of all the markers used for backtracking.
Definition VariableIndex.cpp:151
void clear_substitutions()
Undo all substitutions made, to anything, ever.
Definition VariableIndex.cpp:68
Variable * add_named_var(const string &)
Add a variable with the specified name to the index.
Definition VariableIndex.cpp:44
ID get_first_anon_variable() const
Straightforward access function.
Definition VariableIndex.hpp:128
ID add_named_backtrack_point()
Same as add_backtrack_point, but return an identifier allowing multiple levels of backtracking using ...
Definition VariableIndex.cpp:129
void set_all_names_added()
Call this to indicate that only anonymous variables can now be created.
Definition VariableIndex.cpp:63
bool get_all_names_added() const
Straightforward access function.
Definition VariableIndex.hpp:136
size_t get_num_backtracks() const
Straightforward access function.
Definition VariableIndex.hpp:140
void backtrack_to_named_point(ID)
Backtrack, possibly multiple times, to the specified point.
Definition VariableIndex.cpp:143
Variable * add_anon_var()
Add an anonymous variable.
Definition VariableIndex.cpp:73
void backtrack()
Backtrack to the last marker.
Definition VariableIndex.cpp:134
void add_backtrack_point()
Add a backtrack point.
Definition VariableIndex.cpp:125
ID get_highest_anon_variable() const
Straightforward access function.
Definition VariableIndex.hpp:132
Variable * find_variable(const string &)
Look up a variable by name.
Definition VariableIndex.cpp:102
VariableIndex(const VariableIndex &)=delete
Copying this would be a very silly idea, so explicitly disallow it.