Fawkes API  Fawkes Development Version
EffectToCLIPSFactVisitor Class Reference

Translate a PDDL effect into CLIPS facts. More...

#include "effect_visitor.h"

Inheritance diagram for EffectToCLIPSFactVisitor:

Public Member Functions

 EffectToCLIPSFactVisitor (const std::string &pddl_operator, bool positive)
 Constructor. More...
 
std::vector< std::string > operator() (pddl_parser::Atom &a) const
 Translate an Atom into a vector of strings. More...
 
std::vector< std::string > operator() (pddl_parser::Predicate &p) const
 Translate a Predicate into a vector of strings. More...
 

Detailed Description

Translate a PDDL effect into CLIPS facts.

Author
Till Hofmann Helper class to translate an effect from pddl_parser::Expression to a CLIPS fact. An expression is a boost::variant, and this class is a visitor for the variant that translates the Expression into a a vector of CLIPS facts.

Definition at line 30 of file effect_visitor.h.

Constructor & Destructor Documentation

◆ EffectToCLIPSFactVisitor()

EffectToCLIPSFactVisitor::EffectToCLIPSFactVisitor ( const std::string &  pddl_operator,
bool  positive 
)

Constructor.

Parameters
pddl_operatorThe name of the operator this effect belongs to.
positiveTrue iff this is a positive (not a negative) effect.

Definition at line 38 of file effect_visitor.cpp.

Referenced by operator()().

Member Function Documentation

◆ operator()() [1/2]

vector< string > EffectToCLIPSFactVisitor::operator() ( pddl_parser::Atom &  a) const

Translate an Atom into a vector of strings.

Note that this does not return a CLIPS fact because we do not store atoms (parameter names or constants) as separate facts. This needs to be further processed by the caller instead.

Parameters
aThe atom to translate into a string.
Returns
A vector that only contains the atom as is.

Definition at line 51 of file effect_visitor.cpp.

◆ operator()() [2/2]

vector< string > EffectToCLIPSFactVisitor::operator() ( pddl_parser::Predicate p) const

Translate a Predicate into a vector of strings.

This creates proper CLIPS effect fact strings for the Predicate and all its arguments. For compound formulae (e.g., conjunctions), this also translates all sub-formulae recursively.

Parameters
pThe predicate to translate.
Returns
A vector of strings, each string is a properly formed CLIPS fact.

Definition at line 64 of file effect_visitor.cpp.

References pddl_parser::Predicate::arguments, EffectToCLIPSFactVisitor(), and pddl_parser::Predicate::function.


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