![]() |
Connect++ 0.6.0
A fast, readable connection prover for first-order logic.
|
Mechanism for looking after functions. More...
#include <FunctionIndex.hpp>
Public Member Functions | |
FunctionIndex (const FunctionIndex &)=delete | |
As usual, trying to copy one of these is a really bad idea. | |
FunctionIndex (const FunctionIndex &&)=delete | |
FunctionIndex & | operator= (const FunctionIndex &)=delete |
FunctionIndex & | operator= (const FunctionIndex &&)=delete |
size_t | get_size () const |
Self-explanatory. | |
Function * | add_function (const string &, Arity) |
Add a new function to the index. | |
Function * | make_skolem_function (Arity) |
Add a new Skolem function. Naming is automatic. | |
Function * | find_function (const string &, Arity) |
Look up a stored Function by name and arity. | |
Arity | find_maximum_arity () const |
Find the largest arity appearing for any Function in the index. | |
Arity | find_minimum_arity () const |
Find the smallest arity appearing for any Function in the index. | |
Function * | operator[] (size_t i) |
Access to pointers to Functions, but don't mess with them! | |
Private Attributes | |
vector< Function * > | funs |
Pointers to all the Functions used. | |
unordered_map< pair< string, Arity >, Function *, fun_hash > | name_index |
Fast lookup from name/arity to pointer to the Function. | |
ID | next_index |
Keep track of ids for adding new Functions. | |
uint32_t | skolem_function_number |
Automate the naming of Skolem functions. | |
Friends | |
ostream & | operator<< (ostream &, const FunctionIndex &) |
Mechanism for looking after functions.
Function names are only stored once, but functions can have the same name and a different arity.
Somewhat more straightforward than looking after variables as there is no need for anonymous functions other than Skolem functions, and those do not get recycled. For the same reason, there is no need to take account of backtracking.
You should only use this to make new Functions. As long as you do, it will take care of allocation and deallocation for you.
Definition at line 64 of file FunctionIndex.hpp.
FunctionIndex::FunctionIndex | ( | ) |
Definition at line 27 of file FunctionIndex.cpp.
FunctionIndex::~FunctionIndex | ( | ) |
Definition at line 34 of file FunctionIndex.cpp.
Function * FunctionIndex::add_function | ( | const string & | name, |
Arity | arity ) |
Add a new function to the index.
If you add twice, the original will get re-used.
Definition at line 39 of file FunctionIndex.cpp.
Function * FunctionIndex::find_function | ( | const string & | fun_name, |
Arity | arity ) |
Look up a stored Function by name and arity.
Definition at line 60 of file FunctionIndex.cpp.
Arity FunctionIndex::find_maximum_arity | ( | ) | const |
Find the largest arity appearing for any Function in the index.
Definition at line 71 of file FunctionIndex.cpp.
Arity FunctionIndex::find_minimum_arity | ( | ) | const |
Find the smallest arity appearing for any Function in the index.
Definition at line 81 of file FunctionIndex.cpp.
|
inline |
Function * FunctionIndex::make_skolem_function | ( | Arity | arity | ) |
Add a new Skolem function. Naming is automatic.
arity | The arity of the new Skolem function. |
Definition at line 54 of file FunctionIndex.cpp.
|
inline |
Access to pointers to Functions, but don't mess with them!
Definition at line 133 of file FunctionIndex.hpp.
|
friend |
Definition at line 91 of file FunctionIndex.cpp.
|
private |
Pointers to all the Functions used.
Definition at line 69 of file FunctionIndex.hpp.
Fast lookup from name/arity to pointer to the Function.
Definition at line 73 of file FunctionIndex.hpp.
|
private |
Keep track of ids for adding new Functions.
Definition at line 77 of file FunctionIndex.hpp.
|
private |
Automate the naming of Skolem functions.
Definition at line 81 of file FunctionIndex.hpp.