dlvhex  2.5.0
ExternalAtom Struct Reference

Stores an external atom of form &<predicate>[<inputs>](<outputs>). More...

#include <include/dlvhex2/Atoms.h>

Inheritance diagram for ExternalAtom:
Collaboration diagram for ExternalAtom:

Public Types

typedef std::vector< std::list
< unsigned > > 
AuxInputMapping

Public Member Functions

 ExternalAtom (IDKind kind, ID predicate, const Tuple &inputs, const Tuple &outputs)
 Constructor.
 ExternalAtom (IDKind kind)
 Constructor.
 ~ExternalAtom ()
 ExternalAtom (const ExternalAtom &ea)
 Copy constructor.
void operator= (const ExternalAtom &ea)
 Assignment operator.
const ExtSourcePropertiesgetExtSourceProperties () const
std::ostream & print (std::ostream &o) const
void updatePredicateInputMask () const
 Updates inputMask (creates mask with registry if it does not exist).
InterpretationConstPtr getPredicateInputMask () const
 Returns the predicate input mask.
InterpretationConstPtr getAuxInputMask () const
 Returns the auxiliary input mask.

Data Fields

ID predicate
 External atom name (constant term).
Tuple inputs
 Input terms (in squared brackets).
PluginAtompluginAtom
 POD-style pointer to plugin atom.
ID auxInputPredicate
 Auxiliary input predicate for this occurance in this rule, ID_FAIL if no input here.
AuxInputMapping auxInputMapping
 This mapping stores for each argument of auxInputPredicate a list of positions in the input tuple where this argument applies.
boost::shared_ptr< PredicateMaskinputMask
 inputMask stores a bitmask to project interpretations to relevant predicate inputs.
boost::shared_ptr< PredicateMaskauxInputMask
 Similarly we store a bitmask for all ogatoms with predicate auxInputPredicate.
ExtSourceProperties prop
 Properties of this external atom.

Detailed Description

Stores an external atom of form &<predicate>[<inputs>](<outputs>).

This is one concrete atom in one rule. The general external atom functionality provided by the user is PluginAtom.

Definition at line 301 of file Atoms.h.


Member Typedef Documentation

typedef std::vector<std::list<unsigned> > ExternalAtom::AuxInputMapping

Definition at line 325 of file Atoms.h.


Constructor & Destructor Documentation

ExternalAtom::ExternalAtom ( IDKind  kind,
ID  predicate,
const Tuple inputs,
const Tuple outputs 
) [inline]

Constructor.

Parameters:
kindSee Atom::kind.
predicateSee ExternalAtom::predicate.
inputsSee ExternalAtom::inputs.
outputsOutput elements of the external atom, stored in Atom::tuple.

Definition at line 377 of file Atoms.h.

ExternalAtom::ExternalAtom ( IDKind  kind) [inline]

Constructor.

Parameters:
kindSee Atom::kind.

Definition at line 390 of file Atoms.h.

Definition at line 401 of file Atoms.cpp.

ExternalAtom::ExternalAtom ( const ExternalAtom ea) [inline]

Copy constructor.

Parameters:
eaExternal atom to copy.

Definition at line 405 of file Atoms.h.

References auxInputMapping, auxInputMask, auxInputPredicate, ExtSourceProperties::ea, inputMask, inputs, pluginAtom, predicate, and prop.


Member Function Documentation

void ExternalAtom::operator= ( const ExternalAtom ea) [inline]

Assignment operator.

Parameters:
eaExternal atom to copy.

Definition at line 421 of file Atoms.h.

References auxInputMapping, auxInputMask, auxInputPredicate, ExtSourceProperties::ea, inputMask, inputs, pluginAtom, predicate, and prop.


Field Documentation

This mapping stores for each argument of auxInputPredicate a list of positions in the input tuple where this argument applies.

E.g., for &foo[a,C,d,X,C]() we have

  • either aux(C,X) and inputs <a,C,d,X,C> then we have mapping < [1,4], [3] >: for index 0 = argument C we have to set index 1 and 4 in inputs for index 1 = argument X we have to set index 3 in inputs
  • or aux(X,C) and inputs <a,C,d,X,C> then we have mapping < [3], [1,4] >: for index 0 = argument X we have to set index 3 in inputs for index 1 = argument C we have to set index 1 and 4 in inputs

Definition at line 340 of file Atoms.h.

Referenced by BaseModelGenerator::buildEAtomInputTuples(), DependencyGraph::createAuxiliaryRuleIfRequired(), FLPModelGeneratorFactoryBase::createEatomGuessingRule(), ExternalAtom(), ExternalAtomMask::matchOutputAtom(), and operator=().

boost::shared_ptr<PredicateMask> ExternalAtom::auxInputMask [mutable]

Similarly we store a bitmask for all ogatoms with predicate auxInputPredicate.

Definition at line 359 of file Atoms.h.

Referenced by DependencyGraph::createAuxiliaryRuleIfRequired(), ExternalAtom(), operator=(), and updatePredicateInputMask().

boost::shared_ptr<PredicateMask> ExternalAtom::inputMask [mutable]

inputMask stores a bitmask to project interpretations to relevant predicate inputs.

Kind of a cache: interpretation with all ground atoms set that must be passed to the pluginAtom for subsequent calls this must be extended (new values may have been invented), but this extension need only look to the bits not yet covered by predicateInputMask.

updatePredicateInputMask may update this while this object is stored in an ExternalAtomTable (where only const refs can be retrieved) we should be fine "as long as we don't use predicateInputMask in an index of the multi_index_container"

Definition at line 357 of file Atoms.h.

Referenced by DependencyGraph::createExternalPredicateInputDependencies(), ExternalAtom(), operator=(), and updatePredicateInputMask().

Input terms (in squared brackets).

Definition at line 309 of file Atoms.h.

Referenced by LiberalSafetyChecker::addBoundedVariable(), LiberalSafetyChecker::addDomainExpansionSafeAttribute(), BaseModelGeneratorFactory::addDomainPredicatesAndCreateDomainExplorationProgram(), BaseModelGenerator::buildEAtomInputTuples(), ComponentGraph::calculatePredicatesOfComponent(), ComponentGraph::calculateStratificationInfo(), FunctionRewriter::composeTerm(), AnnotatedGroundProgram::computeAdditionalDependencies(), AnnotatedGroundProgram::computeAtomDependencyGraph(), ComponentGraph::computeCollapsedComponentInfos(), BaseModelGenerator::computeExtensionOfDomainPredicates(), ComponentGraph::computeRecursiveAggregatesInComponent(), BaseModelGeneratorFactory::convertRuleBody(), DependencyGraph::createAuxiliaryRuleIfRequired(), LiberalSafetyChecker::createDependencyGraph(), FLPModelGeneratorFactoryBase::createEatomGuessingRule(), DependencyGraph::createExternalPredicateInputDependencies(), DependencyGraph::createNodesAndIntraRuleDependenciesForBody(), LiberalSafetyChecker::createPreconditionsAndLocationIndices(), FunctionRewriter::decomposeTerm(), BaseModelGenerator::evaluateExternalAtom(), BaseModelGenerator::evaluateExternalAtomQuery(), ExternalAtom(), Registry::getVariablesInID(), ExtSourceProperties::interpretProperties(), BaseModelGenerator::learnSupportSetsForExternalAtom(), ExternalAtomMask::matchOutputAtom(), sem< HexGrammarSemantics::externalAtom >::operator()(), sem< FunctionParserModuleTermSemantics::functionTermConstruct >::operator()(), sem< FunctionParserModuleAtomSemantics::functionTermEval >::operator()(), operator=(), InternalGrounder::preprocessRule(), RawPrinter::print(), print(), FunctionRewriter::rewrite(), DLVHEX_NAMESPACE_BEGIN::FinitenessChecker::run(), and DLVHEX_NAMESPACE_BEGIN::FiniteFiberChecker::run().

POD-style pointer to plugin atom.

(cannot be indexed in multi_index_container as it is mutable)

This is a POD-style pointer as the target object is dynamically loaded shared library code, which cannot be weak_ptr- or shared_ptr-managed. (TODO use a weak ptr here with an empty deleter and adjust everything accordingly, then the shared library problem disappears and there is transparent and correct memory management)

Definition at line 321 of file Atoms.h.

Referenced by ComponentGraph::calculatePredicatesOfComponent(), ComponentGraph::calculateStratificationInfo(), AnnotatedGroundProgram::computeAdditionalDependencies(), ComponentGraph::computeCollapsedComponentInfos(), BaseModelGenerator::computeExtensionOfDomainPredicates(), ComponentGraph::computeRecursiveAggregatesInComponent(), BaseModelGeneratorFactory::convertRuleBody(), LiberalSafetyChecker::createDependencyGraph(), DependencyGraph::createExternalPredicateInputDependencies(), DependencyGraph::createNodesAndIntraRuleDependenciesForBody(), LiberalSafetyChecker::createPreconditionsAndLocationIndices(), BaseModelGenerator::evaluateExternalAtom(), BaseModelGenerator::evaluateExternalAtomQuery(), ExternalAtom(), GenuineGuessAndCheckModelGenerator::initializeHeuristics(), ExtSourceProperties::isAntimonotonic(), ExtSourceProperties::isMonotonic(), BaseModelGenerator::learnSupportSetsForExternalAtom(), ExternalAtomMask::matchOutputAtom(), operator=(), print(), DLVHEX_NAMESPACE_BEGIN::FinitenessChecker::run(), ExternalAtomMask::updateMask(), updatePredicateInputMask(), BaseModelGenerator::verifyEAtomAnswerTuple(), and BaseModelGenerator::VerifyExternalAtomCB::VerifyExternalAtomCB().

Properties of this external atom.

These properties hold only for this particular external atom and not necessarily for other external atoms over the same predicate.

Definition at line 367 of file Atoms.h.

Referenced by ExternalAtom(), getExtSourceProperties(), sem< HexGrammarSemantics::externalAtom >::operator()(), sem< FunctionParserModuleAtomSemantics::functionTermEval >::operator()(), and operator=().


The documentation for this struct was generated from the following files: