knowrob  2.1.0
A Knowledge Base System for Cognition-enabled Robots
knowrob::PrologList Class Reference

#include <PrologTerm.h>

Inheritance diagram for knowrob::PrologList:
Collaboration diagram for knowrob::PrologList:

Public Member Functions

 PrologList (const std::vector< PrologTerm > &elements)
 
 PrologList (const std::vector< PrologTerm > &elements)
 
- Public Member Functions inherited from knowrob::PrologTerm
 PrologTerm ()
 
 PrologTerm (const GraphQueryPtr &query)
 
 PrologTerm (const std::shared_ptr< GraphTerm > &kbTerm)
 
 PrologTerm (const TermPtr &kbTerm)
 
 PrologTerm (const FormulaPtr &kbFormula)
 
 PrologTerm (const TriplePattern &literal, const char *triple_functor)
 
 PrologTerm (const Triple &triple, std::string_view functor)
 
 PrologTerm (const std::vector< PrologTerm > &args, std::string_view functor)
 
template<typename ... Args>
 PrologTerm (std::string_view functor, Args &&... args)
 
 PrologTerm (const PrologTerm &other)=default
 
term_t operator() () const
 
PrologTerm operator& (const PrologTerm &other) const
 
PrologTerm operator| (const PrologTerm &other) const
 
PrologTerm operator~ () const
 
void setModule (std::string_view module)
 
auto module () const
 
bool putTriple (std::string_view functor, const Triple &triple)
 
bool putTerm (const TermPtr &kbTerm)
 
bool putTerm (const std::shared_ptr< GraphTerm > &kbTerm)
 
bool putFormula (const FormulaPtr &phi)
 
bool isGround () const
 
auto & vars () const
 
qid_t openQuery (int flags) const
 
TermPtr toKnowRobTerm () const
 
FormulaPtr toKnowRobFormula () const
 
void write (std::ostream &os) const override
 
 PrologTerm ()
 
 PrologTerm (const GraphQueryPtr &query)
 
 PrologTerm (const std::shared_ptr< GraphTerm > &kbTerm)
 
 PrologTerm (const TermPtr &kbTerm)
 
 PrologTerm (const FormulaPtr &kbFormula)
 
 PrologTerm (const TriplePattern &literal, const char *triple_functor)
 
 PrologTerm (const Triple &triple, std::string_view functor)
 
 PrologTerm (const std::vector< PrologTerm > &args, std::string_view functor)
 
template<typename ... Args>
 PrologTerm (std::string_view functor, Args &&... args)
 
 PrologTerm (const PrologTerm &other)=default
 
term_t operator() () const
 
PrologTerm operator& (const PrologTerm &other) const
 
PrologTerm operator| (const PrologTerm &other) const
 
PrologTerm operator~ () const
 
void setModule (std::string_view module)
 
auto module () const
 
bool putTriple (std::string_view functor, const Triple &triple)
 
bool putTerm (const TermPtr &kbTerm)
 
bool putTerm (const std::shared_ptr< GraphTerm > &kbTerm)
 
bool putFormula (const FormulaPtr &phi)
 
bool isGround () const
 
auto & vars () const
 
qid_t openQuery (int flags) const
 
TermPtr toKnowRobTerm () const
 
FormulaPtr toKnowRobFormula () const
 
void write (std::ostream &os) const override
 
- Public Member Functions inherited from knowrob::Printable
virtual ~Printable ()=default
 
virtual std::string format () const
 
virtual ~Printable ()=default
 
virtual std::string format () const
 

Additional Inherited Members

- Static Public Member Functions inherited from knowrob::PrologTerm
static const atom_t & ATOM_fail ()
 
static const atom_t & ATOM_false ()
 
static const atom_t & ATOM_true ()
 
static const atom_t & ATOM_comma ()
 
static const atom_t & ATOM_semicolon ()
 
static const functor_t & FUNCTOR_comma ()
 
static const functor_t & FUNCTOR_semicolon ()
 
static const predicate_t & PREDICATE_comma ()
 
static const predicate_t & PREDICATE_semicolon ()
 
static bool nextSolution (qid_t qid)
 
static TermPtr toKnowRobTerm (const term_t &t)
 
static FormulaPtr toKnowRobFormula (const TermPtr &t)
 
static std::string getVarName (term_t plTerm)
 
static PrologTerm nil ()
 
static bool display (std::ostream &os, term_t t, const std::string &indent="")
 
static const atom_t & ATOM_fail ()
 
static const atom_t & ATOM_false ()
 
static const atom_t & ATOM_true ()
 
static const atom_t & ATOM_comma ()
 
static const atom_t & ATOM_semicolon ()
 
static const functor_t & FUNCTOR_comma ()
 
static const functor_t & FUNCTOR_semicolon ()
 
static const predicate_t & PREDICATE_comma ()
 
static const predicate_t & PREDICATE_semicolon ()
 
static bool nextSolution (qid_t qid)
 
static TermPtr toKnowRobTerm (const term_t &t)
 
static FormulaPtr toKnowRobFormula (const TermPtr &t)
 
static std::string getVarName (term_t plTerm)
 
static PrologTerm nil ()
 
static bool display (std::ostream &os, term_t t, const std::string &indent="")
 
- Protected Member Functions inherited from knowrob::PrologTerm
bool putFormula (const FormulaPtr &phi, term_t plTerm)
 
bool putFunction (Function *fn, term_t pl_term)
 
bool putList (ListTerm *list, term_t pl_term)
 
bool putTerm (const TermPtr &kbTerm, term_t plTerm)
 
bool putCompound (CompoundFormula *phi, term_t pl_term, const functor_t &pl_functor)
 
bool putCompoundTerm (term_t plTerm, std::string_view functor, const std::vector< PrologTerm > &args)
 
bool putTerm (const std::shared_ptr< GraphTerm > &term, term_t plTerm)
 
bool putTriplePattern (const TriplePattern &pattern, const char *functor, term_t plTerm)
 
bool putRDFAtomic (const std::shared_ptr< Atomic > &atomic, term_t pl_term) const
 
bool putBuiltin (const std::shared_ptr< GraphBuiltin > &builtin, term_t plTerm)
 
void unifyVars (const PrologTerm &other)
 
template<typename ... Args>
std::vector< PrologTermreadArgs (Args &&... args)
 
bool putFormula (const FormulaPtr &phi, term_t plTerm)
 
bool putFunction (Function *fn, term_t pl_term)
 
bool putList (ListTerm *list, term_t pl_term)
 
bool putTerm (const TermPtr &kbTerm, term_t plTerm)
 
bool putCompound (CompoundFormula *phi, term_t pl_term, const functor_t &pl_functor)
 
bool putCompoundTerm (term_t plTerm, std::string_view functor, const std::vector< PrologTerm > &args)
 
bool putTerm (const std::shared_ptr< GraphTerm > &term, term_t plTerm)
 
bool putTriplePattern (const TriplePattern &pattern, const char *functor, term_t plTerm)
 
bool putRDFAtomic (const std::shared_ptr< Atomic > &atomic, term_t pl_term) const
 
bool putBuiltin (const std::shared_ptr< GraphBuiltin > &builtin, term_t plTerm)
 
void unifyVars (const PrologTerm &other)
 
template<typename ... Args>
std::vector< PrologTermreadArgs (Args &&... args)
 
- Static Protected Member Functions inherited from knowrob::PrologTerm
static bool putNativeAtomic (const std::shared_ptr< Atomic > &atomic, term_t pl_term)
 
static bool putNativeAtomic (const std::shared_ptr< Atomic > &atomic, term_t pl_term)
 
- Protected Attributes inherited from knowrob::PrologTerm
std::map< Variable, term_t, std::less<> > vars_
 
std::optional< std::string_view > module_
 
term_t plTerm_
 
bool isRDFTerm_ = false
 
bool isRDFFilter_ = false
 

Detailed Description

Definition at line 308 of file PrologTerm.h.

Constructor & Destructor Documentation

◆ PrologList() [1/2]

PrologList::PrologList ( const std::vector< PrologTerm > &  elements)
explicit

Definition at line 38 of file PrologTerm.cpp.

39  : PrologTerm() {
40  PL_put_nil(plTerm_); // initialize as empty list
41  for (auto &elem: elements) {
42  if (!PL_cons_list(plTerm_, elem(), plTerm_)) {
43  throw QueryError("Failed to put element into PrologList.");
44  }
45  unifyVars(elem);
46  }
47 }
void unifyVars(const PrologTerm &other)
Definition: PrologTerm.cpp:123

◆ PrologList() [2/2]

knowrob::PrologList::PrologList ( const std::vector< PrologTerm > &  elements)
explicit

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