dlvhex
2.5.0
|
Lookup table for predicates. More...
#include <include/dlvhex2/PredicateTable.h>
Public Types | |
typedef Container::index < impl::AddressTag >::type | AddressIndex |
typedef AddressIndex::iterator | AddressIterator |
typedef Container::index < impl::PredicateNameTag > ::type | PredicateNameIndex |
Public Member Functions | |
const Predicate & | getByID (ID id) const throw () |
Retrieve by ID. | |
void | setArity (ID id, int arity) |
Change the arity of a specific predicate with ID id . | |
ID | getIDByString (const std::string &str) const throw () |
Given string, look if already stored. | |
const Predicate & | getByString (const std::string &str) const throw () |
Get the Predicate by predicate name. | |
ID | storeAndGetID (const Predicate &symb) throw () |
Store symbol, assuming it does not exist. | |
std::pair< AddressIterator, AddressIterator > | getAllByAddress () const throw () |
Get range over all atoms sorted by address. |
Lookup table for predicates.
Definition at line 50 of file PredicateTable.h.
typedef Container::index<impl::AddressTag>::type PredicateTable::AddressIndex |
Definition at line 71 of file PredicateTable.h.
typedef AddressIndex::iterator PredicateTable::AddressIterator |
Definition at line 72 of file PredicateTable.h.
typedef Container::index<impl::PredicateNameTag>::type PredicateTable::PredicateNameIndex |
Definition at line 73 of file PredicateTable.h.
std::pair< PredicateTable::AddressIterator, PredicateTable::AddressIterator > PredicateTable::getAllByAddress | ( | ) | const throw () [inline] |
Get range over all atoms sorted by address.
NOTE: you may need to lock the mutex also while iterating!
Definition at line 212 of file PredicateTable.h.
References Table< ValueT, IndexT >::container, and Table< ValueT, IndexT >::mutex.
const Predicate & PredicateTable::getByID | ( | ID | id | ) | const throw () [inline] |
Retrieve by ID.
Assert that id.kind is correct for Term.Predicate. Assert that ID exists.
id | ID of the predicate to retrieve. |
id
. Definition at line 119 of file PredicateTable.h.
References Table< ValueT, IndexT >::container, and Table< ValueT, IndexT >::mutex.
Referenced by RawPrinter::print().
const Predicate & PredicateTable::getByString | ( | const std::string & | str | ) | const throw () [inline] |
Get the Predicate by predicate name.
str | String representation of a predicate. |
str
. Definition at line 171 of file PredicateTable.h.
References Table< ValueT, IndexT >::container, Table< ValueT, IndexT >::mutex, PREDICATE_FAIL(), and WARNING().
ID PredicateTable::getIDByString | ( | const std::string & | str | ) | const throw () [inline] |
Given string, look if already stored.
str | String representation of a predicate. |
str
is not stored as a predicate, otherwise return ID. Definition at line 154 of file PredicateTable.h.
References Table< ValueT, IndexT >::container, ID_FAIL(), and Table< ValueT, IndexT >::mutex.
Referenced by Registry::storeConstantTerm(), and Registry::storeConstOrVarTerm().
void PredicateTable::setArity | ( | ID | id, |
int | arity | ||
) | [inline] |
Change the arity of a specific predicate with ID id
.
id | ID of a predicate in the table. |
arity | the new arity of predicate id . |
Definition at line 135 of file PredicateTable.h.
References Table< ValueT, IndexT >::container, DBGLOG, and Table< ValueT, IndexT >::mutex.
ID PredicateTable::storeAndGetID | ( | const Predicate & | symb | ) | throw () [inline] |
Store symbol, assuming it does not exist.
Assert that symbol did not exist.
symb | Predicate to store. |
Definition at line 187 of file PredicateTable.h.
References Table< ValueT, IndexT >::container, and Table< ValueT, IndexT >::mutex.