25#include "PredicateIndex.hpp"
27PredicateIndex::PredicateIndex()
31, next_definitional_id(0)
35PredicateIndex::~PredicateIndex() {
36 for (
size_t i = 0; i <
preds.size(); i++)
43 auto i =
name_index.find(PredIndexType(name, arity));
46 preds.push_back(new_pred);
47 name_index.insert(PredMapType(PredIndexType(name, arity), new_pred));
58 auto i =
name_index.find(PredIndexType(fun_name, arity));
62 cerr <<
"That predicate name doesn't exist" << endl;
68 for (
size_t i = 0; i <
preds.size(); i++) {
69 Arity current =
preds[i]->get_arity();
77 auto i =
name_index.find(PredIndexType(
string(
"$true"), 0));
80 i =
name_index.find(PredIndexType(
string(
"$false"), 0));
87 out <<
"Predicate Index" << endl;
88 out <<
"---------------" << endl;
Basic representation of predicates: here just names, ids and arities.
Management of Predicate objects.
vector< Predicate * > preds
Pointers to all predicates.
Predicate * find_predicate(const string &, Arity)
Self-explanatory.
Predicate * add_predicate(const string &, Arity)
Self-explanatory.
bool true_false_added() const
Sometimes $true and $false appear in the TPTP collection. See if you included them during the parsing...
ID next_index
Automatically generate IDs.
Arity find_maximum_arity() const
Find the largest arity appearing in the index.
unordered_map< PredIndexType, Predicate *, fun_hash > name_index
Fast lookup using name and arity.