Clingo
Loading...
Searching...
No Matches
CppClingo::Symbol Class Reference

Variant-like class to store symbols stored in a symbol store. More...

#include <symbol.hh>

Public Member Functions

constexpr Symbol ()=default
 Create a reference to number zero.
 
auto type () const noexcept -> SymbolType
 Get the type of the symbol.
 
auto num () const noexcept -> Number const &
 Get the numeric value of the symbol.
 
auto str () const noexcept -> String
 Get the (raw) string value of the symbol.
 
auto name () const noexcept -> String
 Get the name of the symbol.
 
auto args () const noexcept -> SymbolSpan
 Get the arguments of the symbol.
 
auto flip_classical_sign () const -> std::optional< Symbol >
 Flip the classical sign of the symbol.
 
auto has_sign () const -> bool
 Check whether the symbol has a sign.
 
auto has_classical_sign () const -> bool
 Check whether the symbol has a sign.
 
auto hash () const -> size_t
 Compute the hash of the symbol.
 
auto signature () const -> std::optional< std::tuple< String, size_t, bool > >
 Get the signature of the symbol.
 
void acquire () const noexcept
 Manually increment the reference count of the symbol.
 
void release () const noexcept
 Manually decrement the reference count of the symbol.
 

Static Public Member Functions

static auto to_rep (Symbol sym) noexcept -> uint64_t
 Get the representation of the symbol.
 
static auto from_rep (uint64_t rep) noexcept -> Symbol
 Create a symbol from its representation.
 

Friends

auto compare (Symbol const &a, Symbol const &b) -> int
 Compare two symbols.
 
auto compare (Number const &a, Symbol const &b) -> int
 Compare two symbols.
 
auto compare (Symbol const &a, Number const &b) -> int
 Compare two symbols.
 
auto operator== (Symbol const &a, Symbol const &b) -> bool
 Equality compare two symbols.
 
auto operator== (Number const &a, Symbol const &b) -> bool
 Equality compare numbers and symbols.
 
auto operator== (Symbol const &a, Number const &b) -> bool
 Equality compare numbers and symbols.
 
auto operator<=> (Symbol const &a, Symbol const &b) -> std::strong_ordering
 Compare two symbols.
 
auto operator<=> (Number const &a, Symbol const &b) -> std::strong_ordering
 Compare symbols and numbers.
 
auto operator<=> (Symbol const &a, Number const &b) -> std::strong_ordering
 Compare symbols and numbers.
 
auto operator<< (std::ostream &out, Symbol const &sym) -> std::ostream &
 Output the given symbol.
 
auto operator<< (Util::OutputBuffer &out, Symbol const &sym) -> Util::OutputBuffer &
 Output the symbol to the given buffer.
 

Detailed Description

Variant-like class to store symbols stored in a symbol store.

Constructor & Destructor Documentation

◆ Symbol()

constexpr CppClingo::Symbol::Symbol ( )
constexprdefault

Create a reference to number zero.

Number zero can exist independently of a symbol store.

Member Function Documentation

◆ has_classical_sign()

auto CppClingo::Symbol::has_classical_sign ( ) const -> bool

Check whether the symbol has a sign.

Returns true for negated functions.

◆ has_sign()

auto CppClingo::Symbol::has_sign ( ) const -> bool

Check whether the symbol has a sign.

Returns true for negative integers and negated functions.

◆ signature()

auto CppClingo::Symbol::signature ( ) const -> std::optional< std::tuple< String, size_t, bool > >

Get the signature of the symbol.

Returns std::nullopt if the symbol is not a function.


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