dlvhex
2.5.0
|
Mask for external atoms. More...
#include <include/dlvhex2/PredicateMask.h>
Public Member Functions | |
ExternalAtomMask () | |
Constructor. | |
~ExternalAtomMask () | |
Destructor. | |
void | setEAtom (const ProgramCtx &ctx, const ExternalAtom &eatom, const std::vector< ID > &groundidb) |
Sets the ExternalAtom to watch. | |
void | addOutputAtoms (InterpretationConstPtr intr) |
Allows for adding additional atoms to the mask, which are not in the IDB passed in setEatom. | |
virtual void | updateMask () |
Incrementally updates mask for all predicates. | |
const InterpretationConstPtr | getAuxInputMask () const |
Returns the set of all auxiliaries belonging to ExternalAtomMask::eatom. | |
Protected Member Functions | |
bool | matchOutputAtom (const Tuple &togatom) |
Checks if a given tuple of a ground atom matches this external atom. | |
Private Attributes | |
const ProgramCtx * | ctx |
ProgramCtx. | |
const ExternalAtom * | eatom |
ExternalAtom to watch. | |
InterpretationPtr | outputAtoms |
Bits of all ground output atoms (positive and negative ground replacement atoms) that are relevant in the respective ground program. | |
InterpretationPtr | auxInputMask |
Bits of all ground auxiliary input replacement atoms (that are relevant in the respective ground program). | |
Tuple | preparedTuple |
Cache for replacement tuple: first=positive_repl, including auxinputpred if IncludeAuxInputInAuxiliaries, including constants and variables should not be modified. | |
Tuple | workTuple |
Can be modified if protected by mutex, should always be reset to preparedTuple. |
Mask for external atoms.
Extends PredicateMask by support for auxiliary atoms related to an external atom.
Definition at line 110 of file PredicateMask.h.
Constructor.
Definition at line 186 of file PredicateMask.cpp.
Destructor.
Definition at line 191 of file PredicateMask.cpp.
void ExternalAtomMask::addOutputAtoms | ( | InterpretationConstPtr | intr | ) |
Allows for adding additional atoms to the mask, which are not in the IDB passed in setEatom.
The mask will include all atoms in intr
which belong to ExternalAtomMask::eatom.
intr | A set of ground atoms. |
Definition at line 284 of file PredicateMask.cpp.
References ctx, DBGLOG, eatom, PredicateMask::maski, matchOutputAtom(), ExternalAtom::predicate, ProgramCtx::registry(), OrdinaryAtom::text, and Atom::tuple.
Referenced by setEAtom().
const InterpretationConstPtr ExternalAtomMask::getAuxInputMask | ( | ) | const |
Returns the set of all auxiliaries belonging to ExternalAtomMask::eatom.
Definition at line 536 of file PredicateMask.cpp.
References auxInputMask.
bool ExternalAtomMask::matchOutputAtom | ( | const Tuple & | togatom | ) | [protected] |
Checks if a given tuple of a ground atom matches this external atom.
togatom | Ground tuple representing an atom. |
togatom
belongs to this ExternalAtom and false otherwise. Definition at line 314 of file PredicateMask.cpp.
References ExternalAtom::auxInputMapping, auxInputMask, ExternalAtom::auxInputPredicate, ProgramCtx::config, PluginAtom::CONSTANT, ctx, DBGLOG, eatom, PluginAtom::getInputType(), Configuration::getOption(), PluginAtom::getRegistry(), ID_FAIL(), ExternalAtom::inputs, ID::isConstantTerm(), ID::isIntegerTerm(), ID::isVariableTerm(), ExternalAtom::pluginAtom, ExternalAtom::predicate, PluginAtom::PREDICATE, preparedTuple, Atom::tuple, and workTuple.
Referenced by addOutputAtoms(), and updateMask().
void ExternalAtomMask::setEAtom | ( | const ProgramCtx & | ctx, |
const ExternalAtom & | eatom, | ||
const std::vector< ID > & | groundidb | ||
) |
Sets the ExternalAtom to watch.
ctx | See ExternalAtomMask::ctx. |
eatom | See ExternalAtomMask::eatom. |
groundidb | The IDB to analyze for ground atoms belonging to this external atom. |
Definition at line 198 of file PredicateMask.cpp.
References addOutputAtoms(), PredicateMask::addPredicate(), ID::address, auxInputMask, Rule::body, ProgramCtx::config, ctx, DBGLOG, eatom, Configuration::getOption(), Rule::head, ID_FAIL(), ID::isExternalAuxiliary(), LOG, LOG_SCOPE, outputAtoms, PluginAtom::PREDICATE, preparedTuple, PredicateMask::setRegistry(), Atom::tuple, and workTuple.
void ExternalAtomMask::updateMask | ( | ) | [virtual] |
Incrementally updates mask for all predicates.
Reimplemented from PredicateMask.
Definition at line 485 of file PredicateMask.cpp.
References auxInputMask, ExternalAtom::auxInputPredicate, DBGLOG, eatom, PluginAtom::getRegistry(), PredicateMask::maski, matchOutputAtom(), outputAtoms, ExternalAtom::pluginAtom, OrdinaryAtom::text, Atom::tuple, and PredicateMask::updateMutex.
InterpretationPtr ExternalAtomMask::auxInputMask [mutable, private] |
Bits of all ground auxiliary input replacement atoms (that are relevant in the respective ground program).
Definition at line 120 of file PredicateMask.h.
Referenced by getAuxInputMask(), matchOutputAtom(), setEAtom(), and updateMask().
const ProgramCtx* ExternalAtomMask::ctx [private] |
Definition at line 114 of file PredicateMask.h.
Referenced by addOutputAtoms(), matchOutputAtom(), and setEAtom().
const ExternalAtom* ExternalAtomMask::eatom [private] |
ExternalAtom to watch.
Definition at line 116 of file PredicateMask.h.
Referenced by addOutputAtoms(), matchOutputAtom(), setEAtom(), and updateMask().
InterpretationPtr ExternalAtomMask::outputAtoms [mutable, private] |
Bits of all ground output atoms (positive and negative ground replacement atoms) that are relevant in the respective ground program.
Definition at line 118 of file PredicateMask.h.
Referenced by setEAtom(), and updateMask().
Tuple ExternalAtomMask::preparedTuple [mutable, private] |
Cache for replacement tuple: first=positive_repl, including auxinputpred if IncludeAuxInputInAuxiliaries, including constants and variables should not be modified.
Definition at line 122 of file PredicateMask.h.
Referenced by matchOutputAtom(), and setEAtom().
Tuple ExternalAtomMask::workTuple [mutable, private] |
Can be modified if protected by mutex, should always be reset to preparedTuple.
Definition at line 124 of file PredicateMask.h.
Referenced by matchOutputAtom(), and setEAtom().