Clingo
Loading...
Searching...
No Matches

Class to provide access to symbolic atoms. More...

#include <base.hh>

Public Member Functions

 Atom (clingo_atom_base_t const *base, size_t index)
 Construct an atom from its C representation.
 
auto literal () const -> ProgramLiteral
 Get the program literal of the atom.
 
auto symbol () const -> Symbol
 Get the atom's symbol.
 
auto hash () const noexcept -> size_t
 Get the header of the atom.
 

Friends

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

Detailed Description

Class to provide access to symbolic atoms.

Constructor & Destructor Documentation

◆ Atom()

Clingo::Atom::Atom ( clingo_atom_base_t const base,
size_t  index 
)
inlineexplicit

Construct an atom from its C representation.

For internal use.

Parameters
basethe associated base
indexthe index of the atom

Member Function Documentation

◆ hash()

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

Get the header of the atom.

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

Returns
the atom's hash

◆ literal()

auto Clingo::Atom::literal ( ) const -> ProgramLiteral
inline

Get the program literal of the atom.

Returns
the program literal

◆ symbol()

auto Clingo::Atom::symbol ( ) const -> Symbol
inline

Get the atom's symbol.

Returns
the atom's symbol

Friends And Related Symbol Documentation

◆ operator<=>

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

Compare two atoms.

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

◆ operator==

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

Compare two atoms for equality.

Parameters
athe first atom
bthe second atom
Returns
whether the two atoms are equal

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