pl_search_cpp 1.4
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | List of all members
pl_search::PInt Class Reference

Represents a Prolog integer. More...

#include <pint.hpp>

Inheritance diagram for pl_search::PInt:
Inheritance graph
[legend]
Collaboration diagram for pl_search::PInt:
Collaboration graph
[legend]

Public Member Functions

 PInt (int value)
 Constructs a PInt with the given value.
 
std::string repr () const override
 Returns a string representation of the integer.
 
bool isEqualTo (Term &t) const override
 Checks if the term is equal to another term.
 
bool isLessThan (Term &t) const override
 < operator for a PInt and a Term
 
int getValue () const
 Get the value of the integer.
 
- Public Member Functions inherited from pl_search::Term
virtual TermPtr dereference ()
 Dereferences the term. The default is to return a shared pointer to term itself.
 
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.
 
virtual bool is_var ()
 Checks if the term is a variable.
 
 Term ()
 Default constructor.
 
virtual ~Term ()
 Virtual destructor for proper cleanup.
 

Protected Attributes

int value
 The value of the integer.
 

Additional Inherited Members

- Protected Member Functions inherited from pl_search::Term
virtual Termderef_term ()
 Similar to dereference but returning the "raw" pointer.
 

Detailed Description

Represents a Prolog integer.

PInt objects approximate Prolog integers. Integers are immutable and cannot be bound to other terms.

Constructor & Destructor Documentation

◆ PInt()

pl_search::PInt::PInt ( int  value)
inline

Constructs a PInt with the given value.

Parameters
valueThe value of the integer.

Member Function Documentation

◆ getValue()

int pl_search::PInt::getValue ( ) const
inline

Get the value of the integer.

Returns
The value of the integer.

◆ isEqualTo()

bool pl_search::PInt::isEqualTo ( Term t) const
inlineoverridevirtual

Checks if the term is equal to another term.

Parameters
tThe term to compare to.
Returns
True if the terms are equal, false otherwise.

Implements pl_search::Term.

◆ isLessThan()

bool pl_search::PInt::isLessThan ( Term other) const
overridevirtual

< operator for a PInt and a Term

Parameters
otherThe term being compared
Returns
True if the this PInt is < other, false otherwise.

Implements pl_search::Term.

◆ repr()

std::string pl_search::PInt::repr ( ) const
inlineoverridevirtual

Returns a string representation of the integer.

Returns
A string representation of the integer.

Reimplemented from pl_search::Term.

Member Data Documentation

◆ value

int pl_search::PInt::value
protected

The value of the integer.


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