Clingo
Loading...
Searching...
No Matches

A base that maps signatures to atom bases, and captures term and theory bases. More...

#include <base.hh>

Public Types

using key_type = std::tuple< std::string_view, size_t, bool >
 The key type.
 
using mapped_type = AtomBase
 The mapped type.
 
using value_type = std::pair< key_type, mapped_type >
 The value type.
 
using size_type = std::size_t
 The size type.
 
using difference_type = std::ptrdiff_t
 The difference type.
 
using reference = value_type
 The reference type.
 
using pointer = Detail::ArrowProxy< value_type >
 The pointer type.
 
using iterator = Detail::RandomAccessIterator< Base >
 The iterator type.
 

Public Member Functions

 Base (clingo_base_t const *base)
 Construct a base from its C representation.
 
auto is_external (ProgramLiteral lit) const -> bool
 Check whether the given program literal is external.
 
auto is_fact (ProgramLiteral lit) const -> bool
 Check whether the given program literal is a fact.
 
auto is_shown (ProgramLiteral lit) const -> bool
 Check whether the given program literal is shown.
 
auto is_projected (ProgramLiteral lit) const -> bool
 Check whether the (atom of the) given program literal is projected.
 
auto is_current (ProgramLiteral lit) const -> bool
 Check whether the program literals belongs to the current solving step.
 
auto size () const -> size_type
 Get the number of atom bases in the base.
 
auto at (size_t index) const -> value_type
 Get the signature atom base pair at the given index.
 
auto contains (key_type const &sig) const -> bool
 Check whether the base contains the given signature.
 
auto contains (std::pair< std::string_view, size_t > const &sig) const -> bool
 Check whether the base contains the given short signature.
 
auto contains (Symbol const &sym) const -> bool
 Check whether the base contains the given symbol.
 
auto get (key_type const &sig, std::optional< mapped_type > def=std::nullopt) const -> std::optional< mapped_type >
 Get the atom base for the given signature.
 
auto get (std::pair< std::string_view, size_t > const &sig, std::optional< mapped_type > def=std::nullopt) const -> std::optional< mapped_type >
 Get the atom base for the given short signature.
 
auto get (Symbol const &sym, std::optional< Atom > def=std::nullopt) const -> std::optional< Atom >
 Get the atom base for the given symbol.
 
auto terms () const -> TermBase
 Get the term base of the program.
 
auto theory () const -> TheoryBase
 Get the theory base of the program.
 
auto begin () const -> iterator
 Get an iterator pointing to the first element of the base.
 
auto end () const -> iterator
 Get an iterator pointing to the end of the base.
 

Detailed Description

A base that maps signatures to atom bases, and captures term and theory bases.

Constructor & Destructor Documentation

◆ Base()

Clingo::Base::Base ( clingo_base_t const base)
inlineexplicit

Construct a base from its C representation.

Parameters
basethe C base

Member Function Documentation

◆ at()

auto Clingo::Base::at ( size_t  index) const -> value_type
inline

Get the signature atom base pair at the given index.

Parameters
indexthe index of the atom base
Returns
the signature atom base pair at the index

◆ begin()

auto Clingo::Base::begin ( ) const -> iterator
inline

Get an iterator pointing to the first element of the base.

Returns
an iterator to the first element

◆ contains() [1/3]

auto Clingo::Base::contains ( key_type const sig) const -> bool
inline

Check whether the base contains the given signature.

Parameters
sigthe signature to check
Returns
whether the base contains the signature

◆ contains() [2/3]

auto Clingo::Base::contains ( std::pair< std::string_view, size_t > const sig) const -> bool
inline

Check whether the base contains the given short signature.

The short signature is a pair of a string view and an arity that is considered positive.

Parameters
sigthe short signature to check
Returns
whether the base contains the signature

◆ contains() [3/3]

auto Clingo::Base::contains ( Symbol const sym) const -> bool
inline

Check whether the base contains the given symbol.

Parameters
symthe symbol to check
Returns
whether the base contains the symbol

◆ end()

auto Clingo::Base::end ( ) const -> iterator
inline

Get an iterator pointing to the end of the base.

Returns
an iterator to the end of the base

◆ get() [1/3]

auto Clingo::Base::get ( key_type const sig,
std::optional< mapped_type def = std::nullopt 
) const -> std::optional<mapped_type>
inline

Get the atom base for the given signature.

Parameters
sigthe signature to look for
defthe default value to return if the signature is not found
Returns
the atom base for the signature, or the default value if not found

◆ get() [2/3]

auto Clingo::Base::get ( std::pair< std::string_view, size_t > const sig,
std::optional< mapped_type def = std::nullopt 
) const -> std::optional<mapped_type>
inline

Get the atom base for the given short signature.

Parameters
sigthe short signature to look for
defthe default value to return if the signature is not found
Returns
the atom base for the signature, or the default value if not found

◆ get() [3/3]

auto Clingo::Base::get ( Symbol const sym,
std::optional< Atom def = std::nullopt 
) const -> std::optional<Atom>
inline

Get the atom base for the given symbol.

Parameters
symthe symbol to look for
defthe default value to return if the symbol is not found
Returns
the atom base for the symbol, or the default value if not found

◆ is_current()

auto Clingo::Base::is_current ( ProgramLiteral  lit) const -> bool
inline

Check whether the program literals belongs to the current solving step.

Parameters
litthe program literal to check
Returns
whether the literal belongs to the current step

◆ is_external()

auto Clingo::Base::is_external ( ProgramLiteral  lit) const -> bool
inline

Check whether the given program literal is external.

Parameters
litthe program literal to check
Returns
whether the literal is external

◆ is_fact()

auto Clingo::Base::is_fact ( ProgramLiteral  lit) const -> bool
inline

Check whether the given program literal is a fact.

Parameters
litthe program literal to check
Returns
whether the literal is a fact

◆ is_projected()

auto Clingo::Base::is_projected ( ProgramLiteral  lit) const -> bool
inline

Check whether the (atom of the) given program literal is projected.

Parameters
litthe program literal to check
Returns
whether the literal is projected

◆ is_shown()

auto Clingo::Base::is_shown ( ProgramLiteral  lit) const -> bool
inline

Check whether the given program literal is shown.

Parameters
litthe program literal to check
Returns
whether the literal is shown

◆ size()

auto Clingo::Base::size ( ) const -> size_type
inline

Get the number of atom bases in the base.

Returns
the number of atom bases

◆ terms()

auto Clingo::Base::terms ( ) const -> TermBase
inline

Get the term base of the program.

Returns
the term base of the program

◆ theory()

auto Clingo::Base::theory ( ) const -> TheoryBase
inline

Get the theory base of the program.

Returns
the theory base of the program

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