pl_search_cpp 1.4
|
Represents a Prolog variable. More...
#include <pvar.hpp>
Public Member Functions | |
PVar () | |
Constructs a PVar. | |
TermPtr | dereference () override |
Dereferences the variable to find the actual term it points to. | |
virtual bool | bind (const TermPtr &t) |
Binds the variable to a term. | |
void | reset (const TermPtr &t) |
Resets the variable to point at the supplied term. | |
bool | is_var () override |
Checks if the term is a variable. | |
bool | isLessThan (Term &other) const override |
Checks if the variable is less than another term. | |
int | getVarId () const |
Returns the variable ID. | |
std::string | repr () const override |
Returns a string representation of the term. | |
![]() | |
virtual bool | unifyWith (Engine *engine, TermPtr t) |
A hook for unification of user-defined classes. Only override this method if you want to unify user-defined classes. | |
Term () | |
Default constructor. | |
virtual | ~Term () |
Virtual destructor for proper cleanup. | |
Public Attributes | |
TermPtr | value |
The value of the variable. | |
Static Public Attributes | |
static int | id = 0 |
Static member to generate unique IDs for variables. | |
Protected Member Functions | |
virtual bool | isEqualTo (Term &other) const override |
Checks if the term is equal to another term. | |
Term * | deref_term () override |
Similar to dereference but returning the "raw" pointer. | |
Protected Attributes | |
int | var_id |
The ID of the variable. | |
Represents a Prolog variable.
PVar objects approximate Prolog variables. Variables can be bound to other terms. An unbound variable is represented by a PVar object with a null value.
|
inline |
Constructs a PVar.
|
virtual |
Binds the variable to a term.
t | The term to bind to. |
|
overrideprotectedvirtual |
Similar to dereference but returning the "raw" pointer.
Reimplemented from pl_search::Term.
Reimplemented in pl_search::UpdatablePVar.
|
overridevirtual |
Dereferences the variable to find the actual term it points to.
Reimplemented from pl_search::Term.
Reimplemented in pl_search::UpdatablePVar.
|
inline |
Returns the variable ID.
|
overridevirtual |
Checks if the term is a variable.
Reimplemented from pl_search::Term.
|
inlineoverrideprotectedvirtual |
Checks if the term is equal to another term.
t | The term to compare to. |
Implements pl_search::Term.
|
overridevirtual |
Checks if the variable is less than another term.
t | The term to compare to. |
Implements pl_search::Term.
|
inlineoverridevirtual |
Returns a string representation of the term.
Reimplemented from pl_search::Term.
void pl_search::PVar::reset | ( | const TermPtr & | t | ) |
Resets the variable to point at the supplied term.
t | The term to reset to. |
|
static |
Static member to generate unique IDs for variables.
TermPtr pl_search::PVar::value |
The value of the variable.
|
protected |
The ID of the variable.