Clingo
Loading...
Searching...
No Matches

A term base that maps symbols to terms. More...

#include <base.hh>

Public Types

using key_type = Symbol
 The key type.
 
using mapped_type = Term
 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< TermBase >
 The iterator type.
 

Public Member Functions

 TermBase (clingo_term_base_t const &base)
 Construct a term base from its C representation.
 
auto size () const -> size_type
 The size of the term base.
 
auto at (size_t index) const -> value_type
 Get the symbol term pair at the given index.
 
auto contains (key_type const &symbol) const -> bool
 Whether the term base contains the given symbol.
 
auto get (key_type const &symbol, std::optional< mapped_type > def=std::nullopt) const -> std::optional< mapped_type >
 Get the term for the given symbol.
 
auto begin () const -> iterator
 Get an iterator pointing to the first element of the term base.
 
auto end () const -> iterator
 Get an iterator pointing to the end of the term base.
 

Detailed Description

A term base that maps symbols to terms.

Constructor & Destructor Documentation

◆ TermBase()

Clingo::TermBase::TermBase ( clingo_term_base_t const base)
inlineexplicit

Construct a term base from its C representation.

Parameters
basethe C term base

Member Function Documentation

◆ at()

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

Get the symbol term pair at the given index.

Parameters
indexthe index of the term
Returns
the symbol term pair

◆ begin()

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

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

Returns
the resulting iterator

◆ contains()

auto Clingo::TermBase::contains ( key_type const symbol) const -> bool
inline

Whether the term base contains the given symbol.

Parameters
symbolthe symbol to check
Returns
whether the term base contains the symbol

◆ end()

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

Get an iterator pointing to the end of the term base.

Returns
the resulting iterator

◆ get()

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

Get the term for the given symbol.

Parameters
symbolthe symbol to look for
defthe default value to return if the symbol is not found
Returns
the term for the symbol, or the default value if not found

◆ size()

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

The size of the term base.

Returns
the size

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