dlvhex
2.5.0
|
Allows for efficient retrieval of all atoms over a given predicate. More...
#include <include/dlvhex2/PredicateMask.h>
Public Member Functions | |
PredicateMask () | |
Constructor. | |
~PredicateMask () | |
Destructor. | |
PredicateMask (const PredicateMask &p) | |
Copy-constructor. | |
PredicateMask & | operator= (const PredicateMask &p) |
Copy-constructor. | |
void | setRegistry (RegistryPtr registry) |
Set registry and create initial interpretation. | |
void | addPredicate (ID pred) |
Add apredicate. | |
void | updateMask () |
Incrementally updates mask for all predicates. | |
InterpretationConstPtr | mask () const |
Get mask. | |
Protected Attributes | |
std::set< IDAddress > | predicates |
Addresses of IDs of all relevant input predicates for this eatom. | |
InterpretationPtr | maski |
Bitset interpretation for masking inputs. | |
IDAddress | knownAddresses |
Address of the last ogatom already inspected for updating mask. | |
boost::mutex | updateMutex |
Mutex for multithreading access. |
Allows for efficient retrieval of all atoms over a given predicate.
Definition at line 49 of file PredicateMask.h.
Constructor.
Definition at line 53 of file PredicateMask.cpp.
Destructor.
Definition at line 84 of file PredicateMask.cpp.
PredicateMask::PredicateMask | ( | const PredicateMask & | p | ) |
Copy-constructor.
Has a tricky implementation. Copying a mask is not useful, masks should and can be shared (for a new registry they need to be recreated anyways). Therefore copy constructing with maski != NULL will log a warning.
p | Other PredicateMask. |
Definition at line 60 of file PredicateMask.cpp.
void PredicateMask::addPredicate | ( | ID | pred | ) |
Add apredicate.
Incrementally updates mask for new pred up to known address of other preds (does not update mask for other preds!).
pred | Predicate to add. |
Definition at line 98 of file PredicateMask.cpp.
References ID::address, DBGLOG, DBGLOG_VSCOPE, ID::isConstantTerm(), ID::isTerm(), knownAddresses, predicates, and updateMutex.
Referenced by FLPModelGeneratorFactoryBase::createEatomGuessingRule(), FLPModelGeneratorFactoryBase::createFLPRules(), ExternalAtomMask::setEAtom(), StrongNegationPlugin::setupProgramCtx(), and HigherOrderPlugin::setupProgramCtx().
InterpretationConstPtr PredicateMask::mask | ( | ) | const [inline] |
Get mask.
Definition at line 90 of file PredicateMask.h.
Referenced by GuessAndCheckModelGenerator::generateNextModel(), GenuineGuessAndCheckModelGenerator::generateNextModel(), FLPModelGeneratorBase::isCompatibleSet(), FLPModelGeneratorBase::isSubsetMinimalFLPModel(), AnnotatedGroundProgram::mapAuxToEAtoms(), and BaseModelGenerator::VerifyExternalAtomCB::VerifyExternalAtomCB().
PredicateMask & PredicateMask::operator= | ( | const PredicateMask & | p | ) |
Copy-constructor.
Has a tricky implementation. Copying a mask is not useful, masks should and can be shared (for a new registry they need to be recreated anyways). Therefore copy constructing with maski != NULL will log a warning.
p | Other PredicateMask. |
Definition at line 72 of file PredicateMask.cpp.
References knownAddresses, LOG, maski, predicates, and WARNING().
void PredicateMask::setRegistry | ( | RegistryPtr | registry | ) |
Set registry and create initial interpretation.
Set | registry to use (cannot by changed later!). |
Definition at line 89 of file PredicateMask.cpp.
References maski.
Referenced by FLPModelGeneratorFactoryBase::FLPModelGeneratorFactoryBase(), ExternalAtomMask::setEAtom(), StrongNegationPlugin::setupProgramCtx(), and HigherOrderPlugin::setupProgramCtx().
void PredicateMask::updateMask | ( | ) |
Incrementally updates mask for all predicates.
Reimplemented in ExternalAtomMask.
Definition at line 110 of file PredicateMask.cpp.
References DBGLOG, DBGLOG_VSCOPE, knownAddresses, ID::MAINKIND_TERM, maski, predicates, RawPrinter::print(), printset(), bm::bvector< Alloc >::set(), ID::SUBKIND_TERM_CONSTANT, Atom::tuple, and updateMutex.
Referenced by FLPModelGeneratorBase::isCompatibleSet(), FLPModelGeneratorBase::isSubsetMinimalFLPModel(), StrongNegationPlugin::setupProgramCtx(), and HigherOrderPlugin::setupProgramCtx().
IDAddress PredicateMask::knownAddresses [mutable, protected] |
Address of the last ogatom already inspected for updating mask.
Definition at line 101 of file PredicateMask.h.
Referenced by addPredicate(), operator=(), and updateMask().
InterpretationPtr PredicateMask::maski [mutable, protected] |
Bitset interpretation for masking inputs.
Definition at line 99 of file PredicateMask.h.
Referenced by ExternalAtomMask::addOutputAtoms(), operator=(), PredicateMask(), setRegistry(), updateMask(), and ExternalAtomMask::updateMask().
std::set<IDAddress> PredicateMask::predicates [protected] |
Addresses of IDs of all relevant input predicates for this eatom.
The corresponding IDKinds are ID::MAINKIND_TERM | ID::SUBKIND_CONSTANT_TERM with maybe auxiliary bit set.
Definition at line 97 of file PredicateMask.h.
Referenced by addPredicate(), operator=(), and updateMask().
boost::mutex PredicateMask::updateMutex [protected] |
Mutex for multithreading access.
Definition at line 104 of file PredicateMask.h.
Referenced by addPredicate(), updateMask(), and ExternalAtomMask::updateMask().