Clingo
Loading...
Searching...
No Matches

Class to provide access to theory terms. More...

#include <base.hh>

Public Member Functions

 TheoryTerm (clingo_theory_base_t const &base, size_t index)
 Construct a theory term from its C representation.
 
auto type () const -> TheoryTermType
 Get the type of the theory term.
 
auto number () const -> int
 Get the numeric value of the term if it is a number term.
 
auto name () const -> std::string_view
 Get the name of the term if it is a constant or function term.
 
auto arguments () const -> std::vector< TheoryTerm >
 Get the arguments of the term if it is a function term.
 
auto to_string () const -> std::string
 Convert the term to a string representation.
 
auto hash () const noexcept -> size_t
 Get the hash of the term.
 

Friends

auto operator== (TheoryTerm const &a, TheoryTerm const &b) noexcept -> bool
 Compare two theory terms for equality.
 
auto operator<=> (TheoryTerm const &a, TheoryTerm const &b) noexcept -> std::strong_ordering
 Compare two theory terms.
 

Detailed Description

Class to provide access to theory terms.

Constructor & Destructor Documentation

◆ TheoryTerm()

Clingo::TheoryTerm::TheoryTerm ( clingo_theory_base_t const base,
size_t  index 
)
inlineexplicit

Construct a theory term from its C representation.

Parameters
basethe C theory base
indexthe index of the term

Member Function Documentation

◆ arguments()

auto Clingo::TheoryTerm::arguments ( ) const -> std::vector<TheoryTerm>
inline

Get the arguments of the term if it is a function term.

Returns
the arguments as a vector of theory terms

◆ hash()

auto Clingo::TheoryTerm::hash ( ) const -> size_t
inlinenoexcept

Get the hash of the term.

The hash enables usage in hash tables. There is also an associtaed specialization of std::hash for this class.

Returns
the term's hash

◆ name()

auto Clingo::TheoryTerm::name ( ) const -> std::string_view
inline

Get the name of the term if it is a constant or function term.

Returns
the value

◆ number()

auto Clingo::TheoryTerm::number ( ) const -> int
inline

Get the numeric value of the term if it is a number term.

Returns
the value

◆ to_string()

auto Clingo::TheoryTerm::to_string ( ) const -> std::string
inline

Convert the term to a string representation.

Returns
the string representation of the term

Friends And Related Symbol Documentation

◆ operator<=>

auto operator<=> ( TheoryTerm const a,
TheoryTerm const b 
) -> std::strong_ordering
friend

Compare two theory terms.

Parameters
athe first term
bthe second term
Returns
the result of the comparison

◆ operator==

auto operator== ( TheoryTerm const a,
TheoryTerm const b 
) -> bool
friend

Compare two theory terms for equality.

Parameters
athe first term
bthe second term
Returns
whether the two terms are equal

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