25#ifndef PL_SEARCH_TERM_HPP
26#define PL_SEARCH_TERM_HPP
50 class Term :
public std::enable_shared_from_this<Term> {
79 virtual std::string
repr()
const {
return "TERM"; }
Abstract base class for terms that approximate Prolog terms.
Definition term.hpp:50
friend bool operator<=(Term &t1, Term &t2)
<= operator for Term
Definition term.cpp:78
friend bool operator<(Term &t1, Term &t2)
< operator for Terms.
Definition term.cpp:67
virtual Term * deref_term()
Similar to dereference but returning the "raw" pointer.
Definition term.hpp:65
friend std::ostream & operator<<(std::ostream &os, const Term &t)
Overloaded output stream operator for Term.
Definition term.hpp:119
virtual ~Term()
Virtual destructor for proper cleanup.
Definition term.hpp:111
virtual bool is_var()
Checks if the term is a variable.
Definition term.hpp:101
virtual bool isEqualTo(Term &t) const =0
Checks if the term is equal to another term.
Term()
Default constructor.
Definition term.hpp:106
friend bool operator==(Term &t1, Term &t2)
== operator for Terms
Definition term.cpp:48
virtual TermPtr dereference()
Dereferences the term. The default is to return a shared pointer to term itself.
Definition term.hpp:73
virtual bool isLessThan(Term &t) const =0
Checks if the term is less than another term.
virtual std::string repr() const
Returns a string representation of the term.
Definition term.hpp:79
virtual bool unifyWith(Trail *trail, TermPtr t)
A hook for unification of user-defined classes. Only override this method if you want to unify user-d...
Definition term.hpp:95
The Trail class is used to manage variable bindings during the execution of Prolog-like predicates.
Definition trail.hpp:64
bool unify(TermPtr t1, TermPtr t2, Trail *trail)
Unifies two terms, binding variables as necessary.
Definition term.cpp:165
std::shared_ptr< Term > TermPtr
Typedefs for shared pointers to Terms and subclasses.
Definition typedefs.hpp:44
Definition of common typedefs used in the pl_search library.