dlvhex  2.5.0
PluginAtom::Answer Struct Reference

Output of an external atom call. More...

#include <include/dlvhex2/PluginInterface.h>

Public Member Functions

 Answer ()
 Constructor.
std::vector< Tuple > & get ()
 Access true storage (read/write) and mark answer as used.
const std::vector< Tuple > & get () const
 Access true storage (read only).
std::vector< Tuple > & getUnknown ()
 Access unknown storage (read/write) and mark answer as used.
const std::vector< Tuple > & getUnknown () const
 Access unknown storage (read only).
bool hasBeenUsed () const
 Usage report (for cache).
void use ()
 Mark as used (in case you do not add tuples).
Answeroperator= (const Answer &other)
 Assignment (marks as used).
bool operator== (const Answer &other) const
 Comparison non-implementation (produces linker error on purpose).

Private Attributes

boost::shared_ptr< std::vector
< Tuple > > 
output
boost::shared_ptr< std::vector
< Tuple > > 
unknown
bool used

Detailed Description

Output of an external atom call.

Answer objects are created in external computations, i.e., in PluginAtom::retrieve or PluginAtom::retrieveCached.

The storage of tuples is accessible only via get() such that the object can be copied with low cost (only shared pointer is copied) and such that the Answer cache can be implemented efficiently.

Definition at line 835 of file PluginInterface.h.


Constructor & Destructor Documentation

Constructor.

Definition at line 130 of file PluginInterface.cpp.


Member Function Documentation

std::vector<Tuple>& PluginAtom::Answer::get ( ) [inline]

Access true storage (read/write) and mark answer as used.

Definition at line 845 of file PluginInterface.h.

Referenced by TestCautiousQueryAtom::answerQuery(), TestBraveQueryAtom::answerQuery(), BaseModelGenerator::evaluateExternalAtomQuery(), ExternalLearningHelper::getOutputAtoms(), ExternalLearningHelper::learnFromFunctionality(), ExternalLearningHelper::learnFromNegativeAtoms(), TestZeroArityAtom::retrieve(), TestConcatAtom::retrieve(), TestConcatAllAtom::retrieve(), TestListDomainAtom::retrieve(), TestListConcatAtom::retrieve(), FunctionInterprete::retrieve(), TestListLengthAtom::retrieve(), TestListSplitAtom::retrieve(), TestListSplitHalfAtom::retrieve(), TestListMergeAtom::retrieve(), ComfortPluginAtom::retrieve(), TestSubstrAtom::retrieve(), TestSmallerThanAtom::retrieve(), TestFirstAtom::retrieve(), TestPushAtom::retrieve(), TestMoveAtom::retrieve(), TestStrlenAtom::retrieve(), TestSetMinusNonComfortAtom::retrieve(), TestSetMinusPartialAtom::retrieve(), TestSetMinusNogoodBasedLearningAtom::retrieve(), TestSetMinusNongroundNogoodBasedLearningAtom::retrieve(), TestSetMinusRuleBasedLearningAtom::retrieve(), TestNonmonAtom::retrieve(), TestNonmon2Atom::retrieve(), TestIdAtom::retrieve(), TestIdpAtom::retrieve(), TestIdcAtom::retrieve(), TestNegAtom::retrieve(), TestLessThanAtom::retrieve(), TestEqualAtom::retrieve(), TestTransitiveClosureAtom::retrieve(), TestCycleAtom::retrieve(), TestAppendAtom::retrieve(), TestDisjAtom::retrieve(), TestHashAtom::retrieve(), TestTrueMultiInpAtom::retrieve(), TestTrueMultiInpAtom2::retrieve(), TestReachableAtom::retrieve(), TestDLSimulatorAtom::retrieve(), TestPlugin::TestSetUnionAtom::retrieve(), TestPlugin::TestGen2Atom::retrieve(), TestPlugin::TestIsEmpty::retrieve(), TestPlugin::TestNumberOfBalls::retrieve(), TestPlugin::TestNumberOfBallsSE::retrieve(), TestPlugin::TestNumberOfBallsGE::retrieve(), and PluginAtom::retrieveFacade().

const std::vector<Tuple>& PluginAtom::Answer::get ( ) const [inline]

Access true storage (read only).

Do NOT mark as used.

Definition at line 850 of file PluginInterface.h.

const std::vector<Tuple>& PluginAtom::Answer::getUnknown ( ) const [inline]

Access unknown storage (read only).

Do NOT mark as used.

Definition at line 860 of file PluginInterface.h.

bool PluginAtom::Answer::hasBeenUsed ( ) const [inline]

Usage report (for cache).

Returns:
True if the answer object has been used, otherwise false.

Definition at line 866 of file PluginInterface.h.

Answer& PluginAtom::Answer::operator= ( const Answer other) [inline]

Assignment (marks as used).

Parameters:
otherAnswer to assign.
Returns:
Reference to this object.

Definition at line 881 of file PluginInterface.h.

References output, and unknown.

bool PluginAtom::Answer::operator== ( const Answer other) const

Comparison non-implementation (produces linker error on purpose).

Rationale: shallow comparison may yield wrong results, deep comparison is inefficient and should (at the moment) never be necessary, as answer tuples are immediately integrated into ordinary ground atoms.

Parameters:
otherAnswer to compare to.
Returns:
True if this object is equivalent to other.
void PluginAtom::Answer::use ( ) [inline]

Mark as used (in case you do not add tuples).

Call this method in your PluginAtom::retrieve implementation if you do not return tuples. (Otherwise dlvhex will complain.)

Definition at line 874 of file PluginInterface.h.

Referenced by TestZeroArityAtom::retrieve(), and PluginAtom::retrieveCached().


Field Documentation

boost::shared_ptr<std::vector<Tuple> > PluginAtom::Answer::output [private]

Definition at line 897 of file PluginInterface.h.

Referenced by operator=().

boost::shared_ptr<std::vector<Tuple> > PluginAtom::Answer::unknown [private]

Definition at line 899 of file PluginInterface.h.

Referenced by operator=().

bool PluginAtom::Answer::used [private]

Definition at line 901 of file PluginInterface.h.


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