25#include "FunctionIndex.hpp"
27FunctionIndex::FunctionIndex()
31, skolem_function_number(1)
34FunctionIndex::~FunctionIndex() {
35 for (
size_t i = 0; i <
funs.size(); i++)
41 auto i =
name_index.find(FunIndexType(name, arity));
44 funs.push_back(new_fun);
45 name_index.insert(FunMapType(FunIndexType(name, arity),
55 string name(params::unique_skolem_prefix);
63 auto i =
name_index.find(FunIndexType(fun_name, arity));
67 cerr <<
"That function name doesn't exist" << endl;
73 for (
size_t i = 0; i <
funs.size(); i++) {
74 Arity current =
funs[i]->get_arity();
82 Arity result = UINT32_MAX;
83 for (
size_t i = 0; i <
funs.size(); i++) {
84 Arity current =
funs[i]->get_arity();
92 out <<
"Function Index" << endl;
93 out <<
"--------------" << endl;
Basic representation of functions.
Mechanism for looking after functions.
unordered_map< pair< string, Arity >, Function *, fun_hash > name_index
Fast lookup from name/arity to pointer to the Function.
Arity find_minimum_arity() const
Find the smallest arity appearing for any Function in the index.
ID next_index
keep track of ids for adding new Functions.
Arity find_maximum_arity() const
Find the largest arity appearing for any Function in the index.
Function * find_function(const string &, Arity)
Look up a stored Function by name and arity.
Function * add_function(const string &, Arity)
Add a new function to the index.
uint32_t skolem_function_number
Automate the naming of Skolem functions.
vector< Function * > funs
Pointers to all the Functions used.
Function * make_skolem_function(Arity)
Add a new Skolem function. Naming is automatic.