|
Clingo
|
The base capturing derived assignment aggregate atoms. More...
#include <assignment_aggregate.hh>
Public Types | |
| using | AtomMap = Util::ordered_map< Symbol const *, AtomAssignAggr, Util::array_hash, Util::array_equal_to > |
| Map containing the atoms. | |
| using | AtomSet = Util::ordered_map< Key, size_t > |
| Map containing the derived atoms and their values. | |
| using | Key = KeyType |
| The key identifies an atom and is usually associated with further state. | |
Public Types inherited from CppClingo::Ground::BaseImpl< std::pair< size_t, Symbol >, BaseAssignAggr > | |
| using | Key = std::pair< size_t, Symbol > |
| The key identifies an atom and is usually associated with further state. | |
Public Member Functions | |
| BaseAssignAggr (size_t size, bool domain_elems, bool single_pass_elems) | |
| Construct an empty base. | |
| auto | is_fact (Key sym) const -> bool |
| Check if the given atom is a fact. | |
| auto | add (size_t idx, Symbol val) -> bool |
| Add an atom to the base. | |
| auto | size () const -> size_t |
| Get the number of derived atoms. | |
| auto | index (Key sym) const -> size_t |
| Get the atom index of the given symbol. | |
| auto | nth (size_t i) const -> AtomSet::const_iterator |
| Get the i-th atom in the base. | |
| auto | nth (size_t i) -> AtomSet::iterator |
| Get the i-th atom in the base. | |
| auto | atoms () -> AtomMap & |
| Get the underlying atoms. | |
| auto | derived () -> AtomSet & |
| Get the derived atoms. | |
| auto | domain_elems () const -> bool |
| Check whether all relevant elements of the aggregate are domain. | |
| auto | single_pass_elems () const -> bool |
| Check whether all relevant elements of the aggregate can be grounded in a single pass. | |
| 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< std::pair< size_t, Symbol >, BaseAssignAggr > | |
| 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. | |
The base capturing derived assignment aggregate atoms.
| auto CppClingo::Ground::BaseAssignAggr::add | ( | size_t | idx, |
| Symbol | val | ||
| ) | -> bool |
Add an atom to the base.
This function should be called during propagation if an aggregate can match.
| auto CppClingo::Ground::BaseAssignAggr::index | ( | Key | sym | ) | const -> size_t |
Get the atom index of the given symbol.
Note that only derived atoms have indices.
| auto CppClingo::Ground::BaseAssignAggr::is_fact | ( | Key | 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.