Clingo
Loading...
Searching...
No Matches
CppClingo::Ground::BaseBdAggr Class Reference

The base capturing derived body aggregate atoms. More...

#include <body_aggregate.hh>

Inheritance diagram for CppClingo::Ground::BaseBdAggr:
CppClingo::Ground::BaseImpl< Symbol const *, BaseBdAggr >

Public Types

using AtomMap = Util::ordered_map< Symbol const *, AtomBdAggr, Util::array_hash, Util::array_equal_to >
 Map containing the atoms.
 
- Public Types inherited from CppClingo::Ground::BaseImpl< Symbol const *, BaseBdAggr >
using Key = Symbol const *
 The key identifies an atom and is usually associated with further state.
 

Public Member Functions

 BaseBdAggr (size_t size)
 Construct an empty base.
 
auto is_fact (Symbol const *sym) const -> bool
 Check if the given atom is a fact.
 
void add (AtomMap::iterator it)
 Add an atom to the base.
 
auto size () const -> size_t
 Get the number of derived atoms.
 
auto index (Symbol const *sym) const -> size_t
 Get the atom index of the given symbol.
 
auto nth (size_t i) const -> AtomMap::const_iterator
 Get the i-th atom in the base.
 
auto nth (size_t i) -> AtomMap::iterator
 Get the i-th atom in the base.
 
auto atoms () -> AtomMap &
 Get the underlying atom map (includes atoms not yet derived).
 
auto contains (Key const &sym, MatcherType type) const -> std::optional< size_t >
 Check if the base contains the given atom with in the given generation.
 
- Public Member Functions inherited from CppClingo::Ground::BaseImpl< Symbol const *, BaseBdAggr >
auto begin (MatcherType type) const -> size_t
 Get the index of the first atom in the given generation.
 
auto end (MatcherType type) const -> size_t
 Get the index plus one of the last atom in the given generation.
 
auto contains (Key const &sym, MatcherType type) const -> std::optional< size_t >
 Check if the base contains the given atom with in the given generation.
 
void update (size_t generation)
 Update the generation counts.
 
void ensure (size_t generation)
 Ensure that atoms are added to the given generation.
 
auto context () -> T &
 Get the context of the base with the desired type.
 
void clear_context ()
 Clear the current context.
 
auto has_update () const -> bool
 Check if the base has an update.
 

Detailed Description

The base capturing derived body aggregate atoms.

Member Function Documentation

◆ add()

void CppClingo::Ground::BaseBdAggr::add ( AtomMap::iterator  it)

Add an atom to the base.

This function should be called during propagation if an aggregate can match.

◆ index()

auto CppClingo::Ground::BaseBdAggr::index ( Symbol const *  sym) const -> size_t

Get the atom index of the given symbol.

Note that only derived atoms have indices.

◆ is_fact()

auto CppClingo::Ground::BaseBdAggr::is_fact ( Symbol const *  sym) const -> bool

Check if the given atom is a fact.

This function does not take into account to which generation an atom belongs. It can also return true for atoms added to upcoming generations.


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