dlvhex  2.5.0
ModuleAtomTable Class Reference

Lookup table for module atoms. More...

#include <include/dlvhex2/ModuleAtomTable.h>

Inheritance diagram for ModuleAtomTable:
Collaboration diagram for ModuleAtomTable:

Public Types

typedef Container::index
< impl::AddressTag >::type 
AddressIndex
typedef AddressIndex::iterator AddressIterator
typedef Container::index
< impl::PredicateTag >::type 
PredicateIndex
typedef PredicateIndex::iterator PredicateIterator
typedef Container::index
< impl::ElementTag >::type 
ElementIndex
typedef ElementIndex::iterator ElementIterator

Public Member Functions

const ModuleAtomgetByID (ID id) const throw ()
 Get the ModuleAtom by ID.
ID getIDByElement (ID predicate1, const Tuple &inputs1, ID outputAtom1) const throw ()
 Get the ID of the module atom with predicate, inputs, and output atom specified.
std::pair< PredicateIterator,
PredicateIterator
getRangeByPredicateID (ID id) const throw ()
 Get all module atoms with certain predicate id.
std::pair< AddressIterator,
AddressIterator
getAllByAddress () const throw ()
 Get range over all atoms sorted by address.
ID storeAndGetID (const ModuleAtom &atom) throw ()
 Store atom, assuming it does not exist.
void update (const ModuleAtom &oldStorage, ModuleAtom &newStorage) throw ()
 Update a ModuleAtom in the table.

Detailed Description

Lookup table for module atoms.

Definition at line 49 of file ModuleAtomTable.h.


Member Typedef Documentation

typedef Container::index<impl::AddressTag>::type ModuleAtomTable::AddressIndex

Definition at line 77 of file ModuleAtomTable.h.

typedef AddressIndex::iterator ModuleAtomTable::AddressIterator

Definition at line 78 of file ModuleAtomTable.h.

typedef Container::index<impl::ElementTag>::type ModuleAtomTable::ElementIndex

Definition at line 81 of file ModuleAtomTable.h.

typedef ElementIndex::iterator ModuleAtomTable::ElementIterator

Definition at line 82 of file ModuleAtomTable.h.

typedef Container::index<impl::PredicateTag>::type ModuleAtomTable::PredicateIndex

Definition at line 79 of file ModuleAtomTable.h.

typedef PredicateIndex::iterator ModuleAtomTable::PredicateIterator

Definition at line 80 of file ModuleAtomTable.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 a begin and an end iterator representing all ModuleAtoms in this table.

Definition at line 183 of file ModuleAtomTable.h.

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

const ModuleAtom & ModuleAtomTable::getByID ( ID  id) const throw () [inline]

Get the ModuleAtom by ID.

Parameters:
idID of a module atom. ModuleAtom corresponding to id.

Definition at line 132 of file ModuleAtomTable.h.

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

Referenced by RawPrinter::print().

ID ModuleAtomTable::getIDByElement ( ID  predicate1,
const Tuple inputs1,
ID  outputAtom1 
) const throw () [inline]

Get the ID of the module atom with predicate, inputs, and output atom specified.

Returns:
predicate1 ID of the predicate to use for constructing the module atom.
inputs1 Input IDs to the constructed the module atom.
outputAtom1 Output IDs of constructed the module atom.
ID of the stored ModuleAtom.

Definition at line 149 of file ModuleAtomTable.h.

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

Get all module atoms with certain predicate id.

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

Parameters:
idA predicate ID.
Returns:
Pair of a begin and an end iterator representing all ModuleAtoms with the given predicate in this table.

Definition at line 171 of file ModuleAtomTable.h.

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

ID ModuleAtomTable::storeAndGetID ( const ModuleAtom atom) throw () [inline]

Store atom, assuming it does not exist.

Parameters:
atomModuleAtom to store.
Returns:
ID of the stored ModuleAtom.

Definition at line 192 of file ModuleAtomTable.h.

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

void ModuleAtomTable::update ( const ModuleAtom oldStorage,
ModuleAtom newStorage 
) throw () [inline]

Update a ModuleAtom in the table.

oldStorage must be from getByID() or from *const_iterator.

Parameters:
oldStorageOld ModuleAtom.
newStorageNew ModuleAtom.

Definition at line 215 of file ModuleAtomTable.h.

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


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