dlvhex
2.5.0
|
Lookup table for rules. More...
#include <include/dlvhex2/RuleTable.h>
Public Types | |
typedef Container::index < impl::AddressTag >::type | AddressIndex |
typedef Container::index < impl::KindTag >::type | KindIndex |
typedef Container::index < impl::ElementTag >::type | ElementIndex |
typedef AddressIndex::iterator | AddressIterator |
typedef ElementIndex::iterator | ElementIterator |
Public Member Functions | |
const Rule & | getByID (ID id) const throw () |
Retrieve by ID. | |
ID | getIDByElement (const Rule &rule) const throw () |
Get the ID of the rule. | |
ID | storeAndGetID (const Rule &rule) throw () |
Stores rule. | |
void | clear () |
Clears the table. | |
void | update (const Rule &oldStorage, Rule &newStorage) throw () |
Update a rule in the table. | |
std::ostream & | print (std::ostream &o, RegistryPtr reg) const throw () |
Prints the table in human-readable format. | |
std::pair< AddressIterator, AddressIterator > | getAllByAddress () const throw () |
Get range over all atoms sorted by address. |
Lookup table for rules.
Definition at line 51 of file RuleTable.h.
typedef Container::index<impl::AddressTag>::type RuleTable::AddressIndex |
Definition at line 87 of file RuleTable.h.
typedef AddressIndex::iterator RuleTable::AddressIterator |
Definition at line 90 of file RuleTable.h.
typedef Container::index<impl::ElementTag>::type RuleTable::ElementIndex |
Definition at line 89 of file RuleTable.h.
typedef ElementIndex::iterator RuleTable::ElementIterator |
Definition at line 91 of file RuleTable.h.
typedef Container::index<impl::KindTag>::type RuleTable::KindIndex |
Definition at line 88 of file RuleTable.h.
void RuleTable::clear | ( | ) | [inline] |
Clears the table.
Definition at line 209 of file RuleTable.h.
References Table< ValueT, IndexT >::container, and Table< ValueT, IndexT >::mutex.
std::pair< RuleTable::AddressIterator, RuleTable::AddressIterator > RuleTable::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 234 of file RuleTable.h.
References Table< ValueT, IndexT >::container, and Table< ValueT, IndexT >::mutex.
const Rule & RuleTable::getByID | ( | ID | id | ) | const throw () [inline] |
Retrieve by ID.
Assert that id.kind is correct for Rule. Assert that ID exists in table.
id | ID of the rule to retrieve. |
id
. Definition at line 147 of file RuleTable.h.
References Table< ValueT, IndexT >::container, and Table< ValueT, IndexT >::mutex.
Referenced by BOOST_AUTO_TEST_CASE(), and RawPrinter::print().
ID RuleTable::getIDByElement | ( | const Rule & | rule | ) | const throw () [inline] |
Get the ID of the rule.
rule
. Definition at line 161 of file RuleTable.h.
References Table< ValueT, IndexT >::container, ID_FAIL(), and Table< ValueT, IndexT >::mutex.
Referenced by Registry::storeRule().
std::ostream & RuleTable::print | ( | std::ostream & | o, |
RegistryPtr | reg | ||
) | const throw () |
Prints the table in human-readable format.
Implementation in Registry.cpp!
o | Stream to print to. |
reg | Registry used to resolve IDs. |
o
. Definition at line 182 of file Registry.cpp.
Referenced by Registry::print().
ID RuleTable::storeAndGetID | ( | const Rule & | rule | ) | throw () [inline] |
Stores rule.
Assert that rule did not exist in table.
rule | Rule to store. |
Definition at line 180 of file RuleTable.h.
References Table< ValueT, IndexT >::container, and Table< ValueT, IndexT >::mutex.
Referenced by BOOST_AUTO_TEST_CASE(), and Registry::storeRule().
void RuleTable::update | ( | const Rule & | oldStorage, |
Rule & | newStorage | ||
) | throw () [inline] |
Update a rule in the table.
oldStorage must be from getByID() or from *const_iterator.
oldStorage | Old rule. |
newStorage | New rule. |
Definition at line 216 of file RuleTable.h.
References Table< ValueT, IndexT >::container, and Table< ValueT, IndexT >::mutex.