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*>;
Basic representation of variables.
Storage of named variables, and management of new, anonymous and unique variables.
ID get_next_index() const
Straightforward access function.
Variable * add_unique_var()
Add a unique variable when converting to CNF.
void reset()
Get rid of all the markers used for backtracking.
ID next_unique_index
When converting to CNF you need new, unique variables, but they need to be treated separately from an...
vector< ID > backtrack_points
Backtrack points stored as indices in the vars vector.
void clear_substitutions()
Undo all substitutions made, to anything, ever.
Variable * add_named_var(const string &)
Add a variable with the specified name to the index.
ID get_first_anon_variable() const
Straightforward access function.
ID next_index
Keep track of automatically generated Variable indices.
ID add_named_backtrack_point()
Same as add_backtrack_point, but return an identifier allowing multiple levels of backtracking using ...
ID first_anon_variable
Set after you've added all the named variables for the problem.
void set_all_names_added()
Call this to indicate that only anonymous variables can now be created.
bool get_all_names_added() const
Straightforward access function.
size_t get_num_backtracks() const
Straightforward access function.
ID highest_anon_variable
Keep track of how many anonymous Variables you currently have available.
void backtrack_to_named_point(ID)
Backtrack, possibly multiple times, to the specified point.
vector< Variable * > vars
All the variables made, named, unique and anonymous.
Variable * add_anon_var()
Add an anonymous variable.
void backtrack()
Backtrack to the last marker.
void add_backtrack_point()
Add a backtrack point.
ID get_highest_anon_variable() const
Straightforward access function.
unordered_map< string, Variable * > name_index
Fast lookup of Variables by name.
bool all_names_added
Set after you've added all the named variables for the problem.
Variable * find_variable(const string &)
Look up a variable by name.
VariableIndex(const VariableIndex &)=delete
Copying this would be a very silly idea, so explicitly disallow it.