25#ifndef PL_SEARCH_PVAR_HPP
26#define PL_SEARCH_PVAR_HPP
96 std::string
repr()
const override {
return "X" + std::to_string(
var_id); }
100 if (
PVar *v =
dynamic_cast<PVar *
>(&other)) {
Represents a Prolog variable.
Definition pvar.hpp:44
virtual bool isEqualTo(Term &other) const override
Checks if the term is equal to another term.
Definition pvar.hpp:99
int var_id
The ID of the variable.
Definition pvar.hpp:109
TermPtr dereference() override
Dereferences the variable to find the actual term it points to.
Definition pvar.cpp:42
TermPtr value
The value of the variable.
Definition pvar.hpp:49
static int id
Static member to generate unique IDs for variables.
Definition pvar.hpp:47
int getVarId() const
Returns the variable ID.
Definition pvar.hpp:94
PVar()
Constructs a PVar.
Definition pvar.hpp:54
Term * deref_term() override
Similar to dereference but returning the "raw" pointer.
Definition pvar.cpp:60
void reset(const TermPtr &t)
Resets the variable to point at the supplied term.
Definition pvar.cpp:110
std::string repr() const override
Returns a string representation of the term.
Definition pvar.hpp:96
bool is_var() override
Checks if the term is a variable.
Definition pvar.cpp:82
virtual bool bind(const TermPtr &t)
Binds the variable to a term.
Definition pvar.cpp:95
bool isLessThan(Term &other) const override
Checks if the variable is less than another term.
Definition pvar.cpp:117
Abstract base class for terms that approximate Prolog terms.
Definition term.hpp:50
UpdatableVar implements what some Prologs call updatable assignment.
Definition pvar.hpp:123
TermPtr dereference() override
Dereferences the variable to find the actual term it points to.
Definition pvar.hpp:132
Term * deref_term() override
Similar to dereference but returning the "raw" pointer.
Definition pvar.hpp:135
UpdatablePVar(TermPtr t)
Definition pvar.hpp:126
Definition choice_iterator.hpp:16
std::shared_ptr< Term > TermPtr
Typedefs for shared pointers to Terms and subclasses.
Definition typedefs.hpp:43
Definition of the Term class.
Definition of common typedefs used in the pl_search library.