dlvhex  2.5.0
PredicateTable Class Reference

Lookup table for predicates. More...

#include <include/dlvhex2/PredicateTable.h>

Inheritance diagram for PredicateTable:
Collaboration diagram for PredicateTable:

Public Types

typedef Container::index
< impl::AddressTag >::type 
AddressIndex
typedef AddressIndex::iterator AddressIterator
typedef Container::index
< impl::PredicateNameTag >
::type 
PredicateNameIndex

Public Member Functions

const PredicategetByID (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 PredicategetByString (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.

Detailed Description

Lookup table for predicates.

Definition at line 50 of file PredicateTable.h.


Member Typedef Documentation

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.

Definition at line 73 of file PredicateTable.h.


Member Function Documentation

Get range over all atoms sorted by address.

NOTE: you may need to lock the mutex also while iterating!

Returns:
Pair of begin and end iterator representing all predicates in this table.

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.

Parameters:
idID of the predicate to retrieve.
Returns:
Predicate corresponding to 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.

Parameters:
strString representation of a predicate.
Returns:
Predicate corresponding to 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.

Parameters:
strString representation of a predicate.
Returns:
Return ID_FAIL if 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.

Parameters:
idID of a predicate in the table.
aritythe 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.

Parameters:
symbPredicate to store.
Returns:
ID of the stored Predicate.

Definition at line 187 of file PredicateTable.h.

References Table< ValueT, IndexT >::container, and Table< ValueT, IndexT >::mutex.


The documentation for this class was generated from the following file: