3#include <clingo/input/literal.hh>
8namespace CppClingo::Input {
14using LGuard = std::optional<std::pair<Term, Relation>>;
16using RGuard = std::optional<std::pair<Relation, Term>>;
20 if (!lhs.has_value() && !rhs.has_value()) {
35 auto check = [](
auto rel,
bool less) {
40 return (!lhs || check(lhs->second,
less)) && (!rhs || check(rhs->first, !
less));
50 return std::tuple{
a_loc = &SetAggregateElement::loc_,
a_lit = &SetAggregateElement::lit_,
51 a_cond = &SetAggregateElement::cond_};
56 : loc_{std::move(
loc)}, lit_{std::move(
lit)}, cond_{std::move(
cond)} {}
58 [[nodiscard]]
auto loc() const ->
Location const & {
return loc_; }
60 [[nodiscard]]
auto lit() const ->
Lit const & {
return lit_; }
62 [[nodiscard]]
auto cond() const ->
LitArray const & {
return cond_; }
76template <
bool HasSign>
80 using Base = std::conditional_t<HasSign, Signed, Unsigned>;
84 if constexpr (HasSign) {
86 a_elems = &SetAggregate::elems_,
a_rhs = &SetAggregate::rhs_};
88 return std::tuple{
a_loc = &SetAggregate::loc_,
a_lhs = &SetAggregate::lhs_,
a_elems = &SetAggregate::elems_,
89 a_rhs = &SetAggregate::rhs_};
95 : loc_{std::move(
loc)}, elems_{std::move(
elems)}, lhs_(std::move(
lhs)), rhs_(std::move(
rhs)) {
96 static_assert(!HasSign);
101 :
Signed{sign}, loc_{std::move(
loc)}, elems_{std::move(
elems)}, lhs_(std::move(
lhs)), rhs_(std::move(
rhs)) {
102 static_assert(HasSign);
106 [[nodiscard]]
auto loc() const ->
Location const & {
return loc_; }
110 [[nodiscard]]
auto lhs() const ->
LGuard const & {
return lhs_; }
112 [[nodiscard]]
auto rhs() const ->
RGuard const & {
return rhs_; }
The Location of an expression in an input source.
Definition location.hh:44
Sign
Enumeration of signs (default negation).
Definition core.hh:16
AggregateFunction
Enumeration of aggregate functions.
Definition core.hh:87
@ greater_equal
The greater than or equal to symbol (>=).
@ less_equal
The less than or equal to symbol (<=).
@ greater
The greater than symbol (>).
@ not_equal
The not equal to symbol (!=).
@ less
The less than symbol (<).
@ sum
The #count function.