Clingo
Loading...
Searching...
No Matches

An atom base that maps symbols to atoms. More...

#include <base.hh>

Public Types

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

Public Member Functions

 AtomBase (clingo_atom_base_t const *base)
 Construct an atom base from its C representation.
 
auto size () const -> size_type
 The size of the atom base.
 
auto at (size_t index) const -> value_type
 Get the symbol atom pair at the given index.
 
auto contains (key_type const &symbol) const -> bool
 Whether the atom 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 atom for the given symbol.
 
auto begin () const -> iterator
 Get an iterator pointing to the first element of the atom base.
 
auto end () const -> iterator
 Get an iterator pointing to the end of the atom base.
 

Detailed Description

An atom base that maps symbols to atoms.

Constructor & Destructor Documentation

◆ AtomBase()

Clingo::AtomBase::AtomBase ( clingo_atom_base_t const base)
inlineexplicit

Construct an atom base from its C representation.

For internal use.

Parameters
basethe C atom base

Member Function Documentation

◆ at()

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

Get the symbol atom pair at the given index.

Parameters
indexthe index of the atom
Returns
the symbol atom pair

◆ begin()

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

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

Returns
an iterator to the first element

◆ contains()

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

Whether the atom base contains the given symbol.

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

◆ end()

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

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

Returns
an iterator to the end of the atom base

◆ get()

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

Get the atom for the given symbol.

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

◆ size()

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

The size of the atom base.

Returns
the size of the atom base

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