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

Represents a Prolog float. More...

#include <pfloat.hpp>

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

Public Member Functions

 PFloat (double value)
 Constructs a PFloat with the given value.
 
std::string repr () const override
 Returns a string representation of the float.
 
bool isEqualTo (Term &t) const override
 Checks if the term is equal to another term.
 
bool isLessThan (Term &t) const override
 < operator for a PFloat and a Term
 
double getValue () const
 Returns the value of the float.
 
- 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

double value
 The value of the float.
 

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 float.

PFloat objects approximate Prolog floats. Floats are immutable and cannot be bound to other terms.

Constructor & Destructor Documentation

◆ PFloat()

pl_search::PFloat::PFloat ( double  value)
inline

Constructs a PFloat with the given value.

Parameters
valueThe value of the float.

Member Function Documentation

◆ getValue()

double pl_search::PFloat::getValue ( ) const
inline

Returns the value of the float.

Returns
The value of the float.

◆ isEqualTo()

bool pl_search::PFloat::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::PFloat::isLessThan ( Term other) const
overridevirtual

< operator for a PFloat and a Term

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

Implements pl_search::Term.

◆ repr()

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

Returns a string representation of the float.

Returns
A string representation of the float.

Reimplemented from pl_search::Term.

Member Data Documentation

◆ value

double pl_search::PFloat::value
protected

The value of the float.


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