3#include <clingo/input/statement.hh>
5#include <clingo/core/logger.hh>
7#include <clingo/util/enum.hh>
8#include <clingo/util/ordered_map.hh>
9#include <clingo/util/ordered_set.hh>
11namespace CppClingo::Input {
61 [[nodiscard]]
auto empty() const ->
bool;
120 void meta(std::vector<Stm>
const &stms) { do_meta(stms); }
122 void fact(std::vector<Symbol>
const &facts) { do_fact(facts); }
128 virtual void do_meta(std::vector<Stm>
const &stms) = 0;
129 virtual void do_fact(
SymbolVec const &facts) = 0;
130 [[nodiscard]]
virtual auto do_components(
Components const &comps) ->
bool = 0;
149 for (
auto const &stm : script_stms_) {
152 if (default_parts_) {
153 fun(*default_parts_);
155 for (
auto const &stm : defined_stms_) {
158 for (
auto const &[
id, sym] : const_map_) {
159 fun(
Stm{
StmConst{sym.first.
loc(), sym.first.type(), sym.first.name(),
160 TermSymbol{location(sym.first.value()), *sym.second}}});
162 for (
auto const &stm : thy_stms_) {
165 for (
auto const &stm : meta_stms_) {
168 for (
auto const &[
sig, part] : parts_) {
169 auto pum = param_map_(store, part);
170 auto loc = part.part.loc();
173 for (
auto const &fact : part.facts) {
176 for (
auto const &stm : part.stms) {
177 if (
auto unmapped = unmap_(store, pum, stm); unmapped) {
178 fun(std::move(unmapped).value());
207 [[nodiscard]]
auto default_parts() -> std::optional<StmParts> & {
return default_parts_; }
213 using Signature = std::pair<SharedString, size_t>;
227 std::vector<StmScript> script_stms_;
229 std::vector<StmDefined> defined_stms_;
231 std::vector<StmTheory> thy_stms_;
233 std::optional<StmParts> default_parts_;
243 size_t depend_offset_ = 0;
Simple logger to report message to stderr or via a callback.
Definition logger.hh:63
Helper class to mark owned symbols.
Definition symbol.hh:429
A store for symbols.
Definition symbol.hh:454
auto begin() const noexcept -> const_iterator
Get an iterator pointing to the beginning of the array.
Definition immutable_array.hh:117
std::vector< Symbol > SymbolVec
A vector of symbols.
Definition symbol.hh:220
std::vector< TheorySig > TheorySigVec
A vector of theory atom signatures.
Definition core.hh:184
tsl::hopscotch_set< Key, Hash, KeyEqual, Allocator, NeighborhoodSize, StoreHash, GrowthPolicy > unordered_set
Alias for unordered sets.
Definition unordered_set.hh:16
tsl::ordered_map< Key, T, Hash, KeyEqual, Allocator, ValueTypeContainer, IndexType > ordered_map
Alias for ordered maps.
Definition ordered_map.hh:16
#define CLINGO_ENABLE_BITSET_ENUM(E,...)
Opt-in macro for enabling bit operations for a given enum type.
Definition enum.hh:18