3#ifndef __PERCEMON_S4U_HPP__
4#define __PERCEMON_S4U_HPP__
15#include "percemon/ast/ast.hpp"
17namespace percemon::ast {
23 SpArea(SpatialExpr arg_,
double scale_ = 1.0) : arg{std::move(arg_)}, scale{scale_} {}
25 SpArea& operator*=(
const double rhs) {
29 friend SpArea operator*(
const SpArea& lhs,
const double rhs) {
30 return SpArea{lhs.arg, lhs.scale * rhs};
32 friend SpArea operator*(
const double lhs,
const SpArea& rhs) {
return rhs * lhs; }
38 std::variant<double, SpArea> rhs;
42 lhs{std::move(lhs_)}, op{op_}, rhs{std::move(rhs_)} {
43 if (op == ComparisonOp::EQ || op == ComparisonOp::NE) {
44 throw std::invalid_argument(
45 "Cannot use relational operators ==, != to compare SpArea(id)");
65 Complement(SpatialExpr arg_) : arg{std::move(arg_)} {};
69 std::vector<SpatialExpr> args;
71 Intersect(
const std::vector<SpatialExpr>& args_) : args{args_} {
72 if (args_.size() < 2) {
73 throw std::invalid_argument(
74 "It doesn't make sense to have an Intersect operator with < 2 operands");
80 std::vector<SpatialExpr> args;
82 Union(
const std::vector<SpatialExpr>& args_) : args{args_} {
83 if (args_.size() < 2) {
84 throw std::invalid_argument(
85 "It doesn't make sense to have an Union operator with < 2 operands");
93 Interior(SpatialExpr arg_) : arg{std::move(arg_)} {};
99 Closure(SpatialExpr arg_) : arg{std::move(arg_)} {};
105 SpExists(SpatialExpr arg_) : arg{std::move(arg_)} {};
111 SpForall(SpatialExpr arg_) : arg{std::move(arg_)} {};
118 SpPrevious(SpatialExpr arg_) : arg{std::move(arg_)} {};
122 std::optional<FrameInterval> interval = {};
126 SpAlways(SpatialExpr arg_) : arg{std::move(arg_)} {};
131 std::optional<FrameInterval> interval = {};
135 SpSometimes(SpatialExpr arg_) : arg{std::move(arg_)} {};
140 std::optional<FrameInterval> interval = {};
141 std::pair<SpatialExpr, SpatialExpr> args;
144 SpSince(
const SpatialExpr& arg0,
const SpatialExpr& arg1) :
145 args{std::make_pair(arg0, arg1)} {};
147 interval{i}, args{std::make_pair(arg0, arg1)} {};
151 std::optional<FrameInterval> interval = {};
152 std::pair<SpatialExpr, SpatialExpr> args;
155 SpBackTo(
const SpatialExpr& arg0,
const SpatialExpr& arg1) :
156 args{std::make_pair(arg0, arg1)} {};
158 interval{i}, args{std::make_pair(arg0, arg1)} {};
Definition: functions.hpp:36