Clingo
Loading...
Searching...
No Matches
Clingo::TheoryElement Class Reference

Class to provide access to theory elements. More...

#include <base.hh>

Public Member Functions

 TheoryElement (clingo_theory_base_t const &base, size_t index)
 Constructor from C representation.
 
auto tuple () const -> TheoryTermVector
 Get the tuple of the theory element.
 
auto condition () const -> ProgramLiteralSpan
 Get the condition of the theory element.
 
auto condition_id () const -> std::optional< ProgramLiteral >
 Get a program literal for the condition of the theory element.
 
auto to_string () const -> std::string
 Convert the theory element to a string representation.
 
auto hash () const noexcept -> size_t
 Get the hash of the theory element.
 

Friends

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

Detailed Description

Class to provide access to theory elements.

Constructor & Destructor Documentation

◆ TheoryElement()

Clingo::TheoryElement::TheoryElement ( clingo_theory_base_t const &  base,
size_t  index 
)
inlineexplicit

Constructor from C representation.

Parameters
basethe C theory base
indexthe index of the element

Member Function Documentation

◆ condition()

auto Clingo::TheoryElement::condition ( ) const -> ProgramLiteralSpan
inline

Get the condition of the theory element.

Returns
the condition as a span of program literals

◆ condition_id()

auto Clingo::TheoryElement::condition_id ( ) const -> std::optional<ProgramLiteral>
inline

Get a program literal for the condition of the theory element.

True conditions do not have a condition id, in which case std::nullopt is returned. A condition id is only valid for the current solving step.

A condition id can be mapped to a solver literal using Clingo::PropagateInit::solver_literal().

Returns
the condition id as a program literal

◆ hash()

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

Get the hash of the theory element.

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

Returns
the theory element's hash

◆ to_string()

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

Convert the theory element to a string representation.

Returns
the string representation of the theory element

◆ tuple()

auto Clingo::TheoryElement::tuple ( ) const -> TheoryTermVector
inline

Get the tuple of the theory element.

Returns
the tuple as a vector of theory terms

Friends And Related Symbol Documentation

◆ operator<=>

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

Compare two theory elements.

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

◆ operator==

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

Compare two theory elements for equality.

Parameters
athe first element
bthe second element
Returns
whether the two elements are equal

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