blob: 0d885a58266600eeae90e1bf54bd94d6830446bd [file] [log] [blame]
Olivier Deprezf4ef2d02021-04-20 13:36:24 +02001/// These are automatically generated C++ bindings for isl.
2///
3/// isl is a library for computing with integer sets and maps described by
4/// Presburger formulas. On top of this, isl provides various tools for
5/// polyhedral compilation, ranging from dependence analysis over scheduling
6/// to AST generation.
7
8#ifndef ISL_CPP
9#define ISL_CPP
10
11#include <isl/id.h>
12#include <isl/space.h>
13#include <isl/val.h>
14#include <isl/aff.h>
15#include <isl/set.h>
16#include <isl/map.h>
17#include <isl/ilp.h>
18#include <isl/union_set.h>
19#include <isl/union_map.h>
20#include <isl/flow.h>
21#include <isl/schedule.h>
22#include <isl/schedule_node.h>
23#include <isl/ast_build.h>
24#include <isl/fixed_box.h>
25
26#include <isl/ctx.h>
27#include <isl/options.h>
28
29#include <functional>
30#include <memory>
31#include <ostream>
32#include <stdexcept>
33#include <string>
34#include <type_traits>
35
36/* ISL_USE_EXCEPTIONS should be defined to 1 if exceptions are available.
37 * gcc and clang define __cpp_exceptions; MSVC and xlC define _CPPUNWIND.
38 * Older versions of gcc (e.g., 4.9) only define __EXCEPTIONS.
39 * If exceptions are not available, any error condition will result
40 * in an abort.
41 */
42#ifndef ISL_USE_EXCEPTIONS
43#if defined(__cpp_exceptions) || defined(_CPPUNWIND) || defined(__EXCEPTIONS)
44#define ISL_USE_EXCEPTIONS 1
45#else
46#define ISL_USE_EXCEPTIONS 0
47#endif
48#endif
49
50namespace isl {
51
52class ctx {
53 isl_ctx *ptr;
54public:
55 /* implicit */ ctx(isl_ctx *ctx) : ptr(ctx) {}
56 isl_ctx *release() {
57 auto tmp = ptr;
58 ptr = nullptr;
59 return tmp;
60 }
61 isl_ctx *get() {
62 return ptr;
63 }
64};
65
66/* Macros hiding try/catch.
67 * If exceptions are not available, then no exceptions will be thrown and
68 * there is nothing to catch.
69 */
70#if ISL_USE_EXCEPTIONS
71#define ISL_CPP_TRY try
72#define ISL_CPP_CATCH_ALL catch (...)
73#else
74#define ISL_CPP_TRY if (1)
75#define ISL_CPP_CATCH_ALL if (0)
76#endif
77
78#if ISL_USE_EXCEPTIONS
79
80/* Class capturing isl errors.
81 *
82 * The what() return value is stored in a reference counted string
83 * to ensure that the copy constructor and the assignment operator
84 * do not throw any exceptions.
85 */
86class exception : public std::exception {
87 std::shared_ptr<std::string> what_str;
88
89protected:
90 inline exception(const char *what_arg, const char *msg,
91 const char *file, int line);
92public:
93 exception() {}
94 exception(const char *what_arg) {
95 what_str = std::make_shared<std::string>(what_arg);
96 }
97 static inline void throw_error(enum isl_error error, const char *msg,
98 const char *file, int line);
99 virtual const char *what() const noexcept {
100 return what_str->c_str();
101 }
102
103 /* Default behavior on error conditions that occur inside isl calls
104 * performed from inside the bindings.
105 * In the case exceptions are available, isl should continue
106 * without printing a warning since the warning message
107 * will be included in the exception thrown from inside the bindings.
108 */
109 static constexpr auto on_error = ISL_ON_ERROR_CONTINUE;
110 /* Wrapper for throwing an exception with the given message.
111 */
112 static void throw_invalid(const char *msg, const char *file, int line) {
113 throw_error(isl_error_invalid, msg, file, line);
114 }
115 static inline void throw_last_error(ctx ctx);
116};
117
118/* Create an exception of a type described by "what_arg", with
119 * error message "msg" in line "line" of file "file".
120 *
121 * Create a string holding the what() return value that
122 * corresponds to what isl would have printed.
123 * If no error message or no error file was set, then use "what_arg" instead.
124 */
125exception::exception(const char *what_arg, const char *msg, const char *file,
126 int line)
127{
128 if (!msg || !file)
129 what_str = std::make_shared<std::string>(what_arg);
130 else
131 what_str = std::make_shared<std::string>(std::string(file) +
132 ":" + std::to_string(line) + ": " + msg);
133}
134
135class exception_abort : public exception {
136 friend exception;
137 exception_abort(const char *msg, const char *file, int line) :
138 exception("execution aborted", msg, file, line) {}
139};
140
141class exception_alloc : public exception {
142 friend exception;
143 exception_alloc(const char *msg, const char *file, int line) :
144 exception("memory allocation failure", msg, file, line) {}
145};
146
147class exception_unknown : public exception {
148 friend exception;
149 exception_unknown(const char *msg, const char *file, int line) :
150 exception("unknown failure", msg, file, line) {}
151};
152
153class exception_internal : public exception {
154 friend exception;
155 exception_internal(const char *msg, const char *file, int line) :
156 exception("internal error", msg, file, line) {}
157};
158
159class exception_invalid : public exception {
160 friend exception;
161 exception_invalid(const char *msg, const char *file, int line) :
162 exception("invalid argument", msg, file, line) {}
163};
164
165class exception_quota : public exception {
166 friend exception;
167 exception_quota(const char *msg, const char *file, int line) :
168 exception("quota exceeded", msg, file, line) {}
169};
170
171class exception_unsupported : public exception {
172 friend exception;
173 exception_unsupported(const char *msg, const char *file, int line) :
174 exception("unsupported operation", msg, file, line) {}
175};
176
177/* Throw an exception of the class that corresponds to "error", with
178 * error message "msg" in line "line" of file "file".
179 *
180 * isl_error_none is treated as an invalid error type.
181 */
182void exception::throw_error(enum isl_error error, const char *msg,
183 const char *file, int line)
184{
185 switch (error) {
186 case isl_error_none:
187 break;
188 case isl_error_abort: throw exception_abort(msg, file, line);
189 case isl_error_alloc: throw exception_alloc(msg, file, line);
190 case isl_error_unknown: throw exception_unknown(msg, file, line);
191 case isl_error_internal: throw exception_internal(msg, file, line);
192 case isl_error_invalid: throw exception_invalid(msg, file, line);
193 case isl_error_quota: throw exception_quota(msg, file, line);
194 case isl_error_unsupported:
195 throw exception_unsupported(msg, file, line);
196 }
197
198 throw exception_invalid("invalid error type", file, line);
199}
200
201/* Throw an exception corresponding to the last error on "ctx" and
202 * reset the error.
203 *
204 * If "ctx" is NULL or if it is not in an error state at the start,
205 * then an invalid argument exception is thrown.
206 */
207void exception::throw_last_error(ctx ctx)
208{
209 enum isl_error error;
210 const char *msg, *file;
211 int line;
212
213 error = isl_ctx_last_error(ctx.get());
214 msg = isl_ctx_last_error_msg(ctx.get());
215 file = isl_ctx_last_error_file(ctx.get());
216 line = isl_ctx_last_error_line(ctx.get());
217 isl_ctx_reset_error(ctx.get());
218
219 throw_error(error, msg, file, line);
220}
221
222#else
223
224#include <stdio.h>
225#include <stdlib.h>
226
227class exception {
228public:
229 /* Default behavior on error conditions that occur inside isl calls
230 * performed from inside the bindings.
231 * In the case exceptions are not available, isl should abort.
232 */
233 static constexpr auto on_error = ISL_ON_ERROR_ABORT;
234 /* Wrapper for throwing an exception with the given message.
235 * In the case exceptions are not available, print an error and abort.
236 */
237 static void throw_invalid(const char *msg, const char *file, int line) {
238 fprintf(stderr, "%s:%d: %s\n", file, line, msg);
239 abort();
240 }
241 /* Throw an exception corresponding to the last
242 * error on "ctx".
243 * isl should already abort when an error condition occurs,
244 * so this function should never be called.
245 */
246 static void throw_last_error(ctx ctx) {
247 abort();
248 }
249};
250
251#endif
252
253/* Helper class for setting the on_error and resetting the option
254 * to the original value when leaving the scope.
255 */
256class options_scoped_set_on_error {
257 isl_ctx *ctx;
258 int saved_on_error;
259public:
260 options_scoped_set_on_error(class ctx ctx, int on_error) {
261 this->ctx = ctx.get();
262 saved_on_error = isl_options_get_on_error(this->ctx);
263 isl_options_set_on_error(this->ctx, on_error);
264 }
265 ~options_scoped_set_on_error() {
266 isl_options_set_on_error(ctx, saved_on_error);
267 }
268};
269
270} // namespace isl
271
272namespace isl {
273
274// forward declarations
275class aff;
276class aff_list;
277class ast_build;
278class ast_expr;
279class ast_expr_id;
280class ast_expr_int;
281class ast_expr_op;
282class ast_expr_op_access;
283class ast_expr_op_add;
284class ast_expr_op_address_of;
285class ast_expr_op_and;
286class ast_expr_op_and_then;
287class ast_expr_op_call;
288class ast_expr_op_cond;
289class ast_expr_op_div;
290class ast_expr_op_eq;
291class ast_expr_op_fdiv_q;
292class ast_expr_op_ge;
293class ast_expr_op_gt;
294class ast_expr_op_le;
295class ast_expr_op_lt;
296class ast_expr_op_max;
297class ast_expr_op_member;
298class ast_expr_op_min;
299class ast_expr_op_minus;
300class ast_expr_op_mul;
301class ast_expr_op_or;
302class ast_expr_op_or_else;
303class ast_expr_op_pdiv_q;
304class ast_expr_op_pdiv_r;
305class ast_expr_op_select;
306class ast_expr_op_sub;
307class ast_expr_op_zdiv_r;
308class ast_node;
309class ast_node_block;
310class ast_node_for;
311class ast_node_if;
312class ast_node_list;
313class ast_node_mark;
314class ast_node_user;
315class basic_map;
316class basic_set;
317class fixed_box;
318class id;
319class id_list;
320class map;
321class multi_aff;
322class multi_id;
323class multi_pw_aff;
324class multi_union_pw_aff;
325class multi_val;
326class point;
327class pw_aff;
328class pw_aff_list;
329class pw_multi_aff;
330class pw_multi_aff_list;
331class schedule;
332class schedule_constraints;
333class schedule_node;
334class schedule_node_band;
335class schedule_node_context;
336class schedule_node_domain;
337class schedule_node_expansion;
338class schedule_node_extension;
339class schedule_node_filter;
340class schedule_node_guard;
341class schedule_node_leaf;
342class schedule_node_mark;
343class schedule_node_sequence;
344class schedule_node_set;
345class set;
346class space;
347class union_access_info;
348class union_flow;
349class union_map;
350class union_pw_aff;
351class union_pw_aff_list;
352class union_pw_multi_aff;
353class union_set;
354class union_set_list;
355class val;
356class val_list;
357
358// declarations for isl::aff
359inline aff manage(__isl_take isl_aff *ptr);
360inline aff manage_copy(__isl_keep isl_aff *ptr);
361
362class aff {
363 friend inline aff manage(__isl_take isl_aff *ptr);
364 friend inline aff manage_copy(__isl_keep isl_aff *ptr);
365
366protected:
367 isl_aff *ptr = nullptr;
368
369 inline explicit aff(__isl_take isl_aff *ptr);
370
371public:
372 inline /* implicit */ aff();
373 inline /* implicit */ aff(const aff &obj);
374 inline explicit aff(isl::ctx ctx, const std::string &str);
375 inline aff &operator=(aff obj);
376 inline ~aff();
377 inline __isl_give isl_aff *copy() const &;
378 inline __isl_give isl_aff *copy() && = delete;
379 inline __isl_keep isl_aff *get() const;
380 inline __isl_give isl_aff *release();
381 inline bool is_null() const;
382 inline isl::ctx ctx() const;
383
384 inline isl::aff add(isl::aff aff2) const;
385 inline isl::aff add_constant(isl::val v) const;
386 inline isl::aff add_constant(long v) const;
387 inline isl::basic_set bind(isl::id id) const;
388 inline isl::basic_set bind(const std::string &id) const;
389 inline isl::aff ceil() const;
390 inline isl::aff div(isl::aff aff2) const;
391 inline isl::set eq_set(isl::aff aff2) const;
392 inline isl::val eval(isl::point pnt) const;
393 inline isl::aff floor() const;
394 inline isl::set ge_set(isl::aff aff2) const;
395 inline isl::aff gist(isl::set context) const;
396 inline isl::set gt_set(isl::aff aff2) const;
397 inline isl::set le_set(isl::aff aff2) const;
398 inline isl::set lt_set(isl::aff aff2) const;
399 inline isl::aff mod(isl::val mod) const;
400 inline isl::aff mod(long mod) const;
401 inline isl::aff mul(isl::aff aff2) const;
402 inline isl::set ne_set(isl::aff aff2) const;
403 inline isl::aff neg() const;
404 inline isl::aff pullback(isl::multi_aff ma) const;
405 inline isl::aff scale(isl::val v) const;
406 inline isl::aff scale(long v) const;
407 inline isl::aff scale_down(isl::val v) const;
408 inline isl::aff scale_down(long v) const;
409 inline isl::aff sub(isl::aff aff2) const;
410 inline isl::aff unbind_params_insert_domain(isl::multi_id domain) const;
411 static inline isl::aff zero_on_domain(isl::space space);
412};
413
414// declarations for isl::aff_list
415inline aff_list manage(__isl_take isl_aff_list *ptr);
416inline aff_list manage_copy(__isl_keep isl_aff_list *ptr);
417
418class aff_list {
419 friend inline aff_list manage(__isl_take isl_aff_list *ptr);
420 friend inline aff_list manage_copy(__isl_keep isl_aff_list *ptr);
421
422protected:
423 isl_aff_list *ptr = nullptr;
424
425 inline explicit aff_list(__isl_take isl_aff_list *ptr);
426
427public:
428 inline /* implicit */ aff_list();
429 inline /* implicit */ aff_list(const aff_list &obj);
430 inline explicit aff_list(isl::ctx ctx, int n);
431 inline explicit aff_list(isl::aff el);
432 inline aff_list &operator=(aff_list obj);
433 inline ~aff_list();
434 inline __isl_give isl_aff_list *copy() const &;
435 inline __isl_give isl_aff_list *copy() && = delete;
436 inline __isl_keep isl_aff_list *get() const;
437 inline __isl_give isl_aff_list *release();
438 inline bool is_null() const;
439 inline isl::ctx ctx() const;
440
441 inline isl::aff_list add(isl::aff el) const;
442 inline isl::aff_list clear() const;
443 inline isl::aff_list concat(isl::aff_list list2) const;
444 inline isl::aff_list drop(unsigned int first, unsigned int n) const;
445 inline void foreach(const std::function<void(isl::aff)> &fn) const;
446 inline isl::aff at(int index) const;
447 inline isl::aff get_at(int index) const;
448 inline isl::aff_list insert(unsigned int pos, isl::aff el) const;
449 inline unsigned size() const;
450};
451
452// declarations for isl::ast_build
453inline ast_build manage(__isl_take isl_ast_build *ptr);
454inline ast_build manage_copy(__isl_keep isl_ast_build *ptr);
455
456class ast_build {
457 friend inline ast_build manage(__isl_take isl_ast_build *ptr);
458 friend inline ast_build manage_copy(__isl_keep isl_ast_build *ptr);
459
460protected:
461 isl_ast_build *ptr = nullptr;
462
463 inline explicit ast_build(__isl_take isl_ast_build *ptr);
464
465public:
466 inline /* implicit */ ast_build();
467 inline /* implicit */ ast_build(const ast_build &obj);
468 inline explicit ast_build(isl::ctx ctx);
469 inline ast_build &operator=(ast_build obj);
470 inline ~ast_build();
471 inline __isl_give isl_ast_build *copy() const &;
472 inline __isl_give isl_ast_build *copy() && = delete;
473 inline __isl_keep isl_ast_build *get() const;
474 inline __isl_give isl_ast_build *release();
475 inline bool is_null() const;
476 inline isl::ctx ctx() const;
477
478private:
479 inline ast_build &copy_callbacks(const ast_build &obj);
480 struct at_each_domain_data {
481 std::function<isl::ast_node(isl::ast_node, isl::ast_build)> func;
482 std::exception_ptr eptr;
483 };
484 std::shared_ptr<at_each_domain_data> at_each_domain_data;
485 static inline isl_ast_node *at_each_domain(isl_ast_node *arg_0, isl_ast_build *arg_1, void *arg_2);
486 inline void set_at_each_domain_data(const std::function<isl::ast_node(isl::ast_node, isl::ast_build)> &fn);
487public:
488 inline isl::ast_build set_at_each_domain(const std::function<isl::ast_node(isl::ast_node, isl::ast_build)> &fn) const;
489 inline isl::ast_expr access_from(isl::multi_pw_aff mpa) const;
490 inline isl::ast_expr access_from(isl::pw_multi_aff pma) const;
491 inline isl::ast_expr call_from(isl::multi_pw_aff mpa) const;
492 inline isl::ast_expr call_from(isl::pw_multi_aff pma) const;
493 inline isl::ast_expr expr_from(isl::pw_aff pa) const;
494 inline isl::ast_expr expr_from(isl::set set) const;
495 static inline isl::ast_build from_context(isl::set set);
496 inline isl::union_map schedule() const;
497 inline isl::union_map get_schedule() const;
498 inline isl::ast_node node_from(isl::schedule schedule) const;
499 inline isl::ast_node node_from_schedule_map(isl::union_map schedule) const;
500};
501
502// declarations for isl::ast_expr
503inline ast_expr manage(__isl_take isl_ast_expr *ptr);
504inline ast_expr manage_copy(__isl_keep isl_ast_expr *ptr);
505
506class ast_expr {
507 friend inline ast_expr manage(__isl_take isl_ast_expr *ptr);
508 friend inline ast_expr manage_copy(__isl_keep isl_ast_expr *ptr);
509
510protected:
511 isl_ast_expr *ptr = nullptr;
512
513 inline explicit ast_expr(__isl_take isl_ast_expr *ptr);
514
515public:
516 inline /* implicit */ ast_expr();
517 inline /* implicit */ ast_expr(const ast_expr &obj);
518 inline ast_expr &operator=(ast_expr obj);
519 inline ~ast_expr();
520 inline __isl_give isl_ast_expr *copy() const &;
521 inline __isl_give isl_ast_expr *copy() && = delete;
522 inline __isl_keep isl_ast_expr *get() const;
523 inline __isl_give isl_ast_expr *release();
524 inline bool is_null() const;
525private:
526 template <typename T,
527 typename = typename std::enable_if<std::is_same<
528 const decltype(isl_ast_expr_get_type(NULL)),
529 const T>::value>::type>
530 inline bool isa_type(T subtype) const;
531public:
532 template <class T> inline bool isa() const;
533 template <class T> inline T as() const;
534 inline isl::ctx ctx() const;
535
536 inline std::string to_C_str() const;
537};
538
539// declarations for isl::ast_expr_id
540
541class ast_expr_id : public ast_expr {
542 template <class T>
543 friend bool ast_expr::isa() const;
544 friend ast_expr_id ast_expr::as<ast_expr_id>() const;
545 static const auto type = isl_ast_expr_id;
546
547protected:
548 inline explicit ast_expr_id(__isl_take isl_ast_expr *ptr);
549
550public:
551 inline /* implicit */ ast_expr_id();
552 inline /* implicit */ ast_expr_id(const ast_expr_id &obj);
553 inline ast_expr_id &operator=(ast_expr_id obj);
554 inline isl::ctx ctx() const;
555
556 inline isl::id id() const;
557 inline isl::id get_id() const;
558};
559
560// declarations for isl::ast_expr_int
561
562class ast_expr_int : public ast_expr {
563 template <class T>
564 friend bool ast_expr::isa() const;
565 friend ast_expr_int ast_expr::as<ast_expr_int>() const;
566 static const auto type = isl_ast_expr_int;
567
568protected:
569 inline explicit ast_expr_int(__isl_take isl_ast_expr *ptr);
570
571public:
572 inline /* implicit */ ast_expr_int();
573 inline /* implicit */ ast_expr_int(const ast_expr_int &obj);
574 inline ast_expr_int &operator=(ast_expr_int obj);
575 inline isl::ctx ctx() const;
576
577 inline isl::val val() const;
578 inline isl::val get_val() const;
579};
580
581// declarations for isl::ast_expr_op
582
583class ast_expr_op : public ast_expr {
584 template <class T>
585 friend bool ast_expr::isa() const;
586 friend ast_expr_op ast_expr::as<ast_expr_op>() const;
587 static const auto type = isl_ast_expr_op;
588
589protected:
590 inline explicit ast_expr_op(__isl_take isl_ast_expr *ptr);
591
592public:
593 inline /* implicit */ ast_expr_op();
594 inline /* implicit */ ast_expr_op(const ast_expr_op &obj);
595 inline ast_expr_op &operator=(ast_expr_op obj);
596private:
597 template <typename T,
598 typename = typename std::enable_if<std::is_same<
599 const decltype(isl_ast_expr_op_get_type(NULL)),
600 const T>::value>::type>
601 inline bool isa_type(T subtype) const;
602public:
603 template <class T> inline bool isa() const;
604 template <class T> inline T as() const;
605 inline isl::ctx ctx() const;
606
607 inline isl::ast_expr arg(int pos) const;
608 inline isl::ast_expr get_arg(int pos) const;
609 inline unsigned n_arg() const;
610 inline unsigned get_n_arg() const;
611};
612
613// declarations for isl::ast_expr_op_access
614
615class ast_expr_op_access : public ast_expr_op {
616 template <class T>
617 friend bool ast_expr_op::isa() const;
618 friend ast_expr_op_access ast_expr_op::as<ast_expr_op_access>() const;
619 static const auto type = isl_ast_expr_op_access;
620
621protected:
622 inline explicit ast_expr_op_access(__isl_take isl_ast_expr *ptr);
623
624public:
625 inline /* implicit */ ast_expr_op_access();
626 inline /* implicit */ ast_expr_op_access(const ast_expr_op_access &obj);
627 inline ast_expr_op_access &operator=(ast_expr_op_access obj);
628 inline isl::ctx ctx() const;
629
630};
631
632// declarations for isl::ast_expr_op_add
633
634class ast_expr_op_add : public ast_expr_op {
635 template <class T>
636 friend bool ast_expr_op::isa() const;
637 friend ast_expr_op_add ast_expr_op::as<ast_expr_op_add>() const;
638 static const auto type = isl_ast_expr_op_add;
639
640protected:
641 inline explicit ast_expr_op_add(__isl_take isl_ast_expr *ptr);
642
643public:
644 inline /* implicit */ ast_expr_op_add();
645 inline /* implicit */ ast_expr_op_add(const ast_expr_op_add &obj);
646 inline ast_expr_op_add &operator=(ast_expr_op_add obj);
647 inline isl::ctx ctx() const;
648
649};
650
651// declarations for isl::ast_expr_op_address_of
652
653class ast_expr_op_address_of : public ast_expr_op {
654 template <class T>
655 friend bool ast_expr_op::isa() const;
656 friend ast_expr_op_address_of ast_expr_op::as<ast_expr_op_address_of>() const;
657 static const auto type = isl_ast_expr_op_address_of;
658
659protected:
660 inline explicit ast_expr_op_address_of(__isl_take isl_ast_expr *ptr);
661
662public:
663 inline /* implicit */ ast_expr_op_address_of();
664 inline /* implicit */ ast_expr_op_address_of(const ast_expr_op_address_of &obj);
665 inline ast_expr_op_address_of &operator=(ast_expr_op_address_of obj);
666 inline isl::ctx ctx() const;
667
668};
669
670// declarations for isl::ast_expr_op_and
671
672class ast_expr_op_and : public ast_expr_op {
673 template <class T>
674 friend bool ast_expr_op::isa() const;
675 friend ast_expr_op_and ast_expr_op::as<ast_expr_op_and>() const;
676 static const auto type = isl_ast_expr_op_and;
677
678protected:
679 inline explicit ast_expr_op_and(__isl_take isl_ast_expr *ptr);
680
681public:
682 inline /* implicit */ ast_expr_op_and();
683 inline /* implicit */ ast_expr_op_and(const ast_expr_op_and &obj);
684 inline ast_expr_op_and &operator=(ast_expr_op_and obj);
685 inline isl::ctx ctx() const;
686
687};
688
689// declarations for isl::ast_expr_op_and_then
690
691class ast_expr_op_and_then : public ast_expr_op {
692 template <class T>
693 friend bool ast_expr_op::isa() const;
694 friend ast_expr_op_and_then ast_expr_op::as<ast_expr_op_and_then>() const;
695 static const auto type = isl_ast_expr_op_and_then;
696
697protected:
698 inline explicit ast_expr_op_and_then(__isl_take isl_ast_expr *ptr);
699
700public:
701 inline /* implicit */ ast_expr_op_and_then();
702 inline /* implicit */ ast_expr_op_and_then(const ast_expr_op_and_then &obj);
703 inline ast_expr_op_and_then &operator=(ast_expr_op_and_then obj);
704 inline isl::ctx ctx() const;
705
706};
707
708// declarations for isl::ast_expr_op_call
709
710class ast_expr_op_call : public ast_expr_op {
711 template <class T>
712 friend bool ast_expr_op::isa() const;
713 friend ast_expr_op_call ast_expr_op::as<ast_expr_op_call>() const;
714 static const auto type = isl_ast_expr_op_call;
715
716protected:
717 inline explicit ast_expr_op_call(__isl_take isl_ast_expr *ptr);
718
719public:
720 inline /* implicit */ ast_expr_op_call();
721 inline /* implicit */ ast_expr_op_call(const ast_expr_op_call &obj);
722 inline ast_expr_op_call &operator=(ast_expr_op_call obj);
723 inline isl::ctx ctx() const;
724
725};
726
727// declarations for isl::ast_expr_op_cond
728
729class ast_expr_op_cond : public ast_expr_op {
730 template <class T>
731 friend bool ast_expr_op::isa() const;
732 friend ast_expr_op_cond ast_expr_op::as<ast_expr_op_cond>() const;
733 static const auto type = isl_ast_expr_op_cond;
734
735protected:
736 inline explicit ast_expr_op_cond(__isl_take isl_ast_expr *ptr);
737
738public:
739 inline /* implicit */ ast_expr_op_cond();
740 inline /* implicit */ ast_expr_op_cond(const ast_expr_op_cond &obj);
741 inline ast_expr_op_cond &operator=(ast_expr_op_cond obj);
742 inline isl::ctx ctx() const;
743
744};
745
746// declarations for isl::ast_expr_op_div
747
748class ast_expr_op_div : public ast_expr_op {
749 template <class T>
750 friend bool ast_expr_op::isa() const;
751 friend ast_expr_op_div ast_expr_op::as<ast_expr_op_div>() const;
752 static const auto type = isl_ast_expr_op_div;
753
754protected:
755 inline explicit ast_expr_op_div(__isl_take isl_ast_expr *ptr);
756
757public:
758 inline /* implicit */ ast_expr_op_div();
759 inline /* implicit */ ast_expr_op_div(const ast_expr_op_div &obj);
760 inline ast_expr_op_div &operator=(ast_expr_op_div obj);
761 inline isl::ctx ctx() const;
762
763};
764
765// declarations for isl::ast_expr_op_eq
766
767class ast_expr_op_eq : public ast_expr_op {
768 template <class T>
769 friend bool ast_expr_op::isa() const;
770 friend ast_expr_op_eq ast_expr_op::as<ast_expr_op_eq>() const;
771 static const auto type = isl_ast_expr_op_eq;
772
773protected:
774 inline explicit ast_expr_op_eq(__isl_take isl_ast_expr *ptr);
775
776public:
777 inline /* implicit */ ast_expr_op_eq();
778 inline /* implicit */ ast_expr_op_eq(const ast_expr_op_eq &obj);
779 inline ast_expr_op_eq &operator=(ast_expr_op_eq obj);
780 inline isl::ctx ctx() const;
781
782};
783
784// declarations for isl::ast_expr_op_fdiv_q
785
786class ast_expr_op_fdiv_q : public ast_expr_op {
787 template <class T>
788 friend bool ast_expr_op::isa() const;
789 friend ast_expr_op_fdiv_q ast_expr_op::as<ast_expr_op_fdiv_q>() const;
790 static const auto type = isl_ast_expr_op_fdiv_q;
791
792protected:
793 inline explicit ast_expr_op_fdiv_q(__isl_take isl_ast_expr *ptr);
794
795public:
796 inline /* implicit */ ast_expr_op_fdiv_q();
797 inline /* implicit */ ast_expr_op_fdiv_q(const ast_expr_op_fdiv_q &obj);
798 inline ast_expr_op_fdiv_q &operator=(ast_expr_op_fdiv_q obj);
799 inline isl::ctx ctx() const;
800
801};
802
803// declarations for isl::ast_expr_op_ge
804
805class ast_expr_op_ge : public ast_expr_op {
806 template <class T>
807 friend bool ast_expr_op::isa() const;
808 friend ast_expr_op_ge ast_expr_op::as<ast_expr_op_ge>() const;
809 static const auto type = isl_ast_expr_op_ge;
810
811protected:
812 inline explicit ast_expr_op_ge(__isl_take isl_ast_expr *ptr);
813
814public:
815 inline /* implicit */ ast_expr_op_ge();
816 inline /* implicit */ ast_expr_op_ge(const ast_expr_op_ge &obj);
817 inline ast_expr_op_ge &operator=(ast_expr_op_ge obj);
818 inline isl::ctx ctx() const;
819
820};
821
822// declarations for isl::ast_expr_op_gt
823
824class ast_expr_op_gt : public ast_expr_op {
825 template <class T>
826 friend bool ast_expr_op::isa() const;
827 friend ast_expr_op_gt ast_expr_op::as<ast_expr_op_gt>() const;
828 static const auto type = isl_ast_expr_op_gt;
829
830protected:
831 inline explicit ast_expr_op_gt(__isl_take isl_ast_expr *ptr);
832
833public:
834 inline /* implicit */ ast_expr_op_gt();
835 inline /* implicit */ ast_expr_op_gt(const ast_expr_op_gt &obj);
836 inline ast_expr_op_gt &operator=(ast_expr_op_gt obj);
837 inline isl::ctx ctx() const;
838
839};
840
841// declarations for isl::ast_expr_op_le
842
843class ast_expr_op_le : public ast_expr_op {
844 template <class T>
845 friend bool ast_expr_op::isa() const;
846 friend ast_expr_op_le ast_expr_op::as<ast_expr_op_le>() const;
847 static const auto type = isl_ast_expr_op_le;
848
849protected:
850 inline explicit ast_expr_op_le(__isl_take isl_ast_expr *ptr);
851
852public:
853 inline /* implicit */ ast_expr_op_le();
854 inline /* implicit */ ast_expr_op_le(const ast_expr_op_le &obj);
855 inline ast_expr_op_le &operator=(ast_expr_op_le obj);
856 inline isl::ctx ctx() const;
857
858};
859
860// declarations for isl::ast_expr_op_lt
861
862class ast_expr_op_lt : public ast_expr_op {
863 template <class T>
864 friend bool ast_expr_op::isa() const;
865 friend ast_expr_op_lt ast_expr_op::as<ast_expr_op_lt>() const;
866 static const auto type = isl_ast_expr_op_lt;
867
868protected:
869 inline explicit ast_expr_op_lt(__isl_take isl_ast_expr *ptr);
870
871public:
872 inline /* implicit */ ast_expr_op_lt();
873 inline /* implicit */ ast_expr_op_lt(const ast_expr_op_lt &obj);
874 inline ast_expr_op_lt &operator=(ast_expr_op_lt obj);
875 inline isl::ctx ctx() const;
876
877};
878
879// declarations for isl::ast_expr_op_max
880
881class ast_expr_op_max : public ast_expr_op {
882 template <class T>
883 friend bool ast_expr_op::isa() const;
884 friend ast_expr_op_max ast_expr_op::as<ast_expr_op_max>() const;
885 static const auto type = isl_ast_expr_op_max;
886
887protected:
888 inline explicit ast_expr_op_max(__isl_take isl_ast_expr *ptr);
889
890public:
891 inline /* implicit */ ast_expr_op_max();
892 inline /* implicit */ ast_expr_op_max(const ast_expr_op_max &obj);
893 inline ast_expr_op_max &operator=(ast_expr_op_max obj);
894 inline isl::ctx ctx() const;
895
896};
897
898// declarations for isl::ast_expr_op_member
899
900class ast_expr_op_member : public ast_expr_op {
901 template <class T>
902 friend bool ast_expr_op::isa() const;
903 friend ast_expr_op_member ast_expr_op::as<ast_expr_op_member>() const;
904 static const auto type = isl_ast_expr_op_member;
905
906protected:
907 inline explicit ast_expr_op_member(__isl_take isl_ast_expr *ptr);
908
909public:
910 inline /* implicit */ ast_expr_op_member();
911 inline /* implicit */ ast_expr_op_member(const ast_expr_op_member &obj);
912 inline ast_expr_op_member &operator=(ast_expr_op_member obj);
913 inline isl::ctx ctx() const;
914
915};
916
917// declarations for isl::ast_expr_op_min
918
919class ast_expr_op_min : public ast_expr_op {
920 template <class T>
921 friend bool ast_expr_op::isa() const;
922 friend ast_expr_op_min ast_expr_op::as<ast_expr_op_min>() const;
923 static const auto type = isl_ast_expr_op_min;
924
925protected:
926 inline explicit ast_expr_op_min(__isl_take isl_ast_expr *ptr);
927
928public:
929 inline /* implicit */ ast_expr_op_min();
930 inline /* implicit */ ast_expr_op_min(const ast_expr_op_min &obj);
931 inline ast_expr_op_min &operator=(ast_expr_op_min obj);
932 inline isl::ctx ctx() const;
933
934};
935
936// declarations for isl::ast_expr_op_minus
937
938class ast_expr_op_minus : public ast_expr_op {
939 template <class T>
940 friend bool ast_expr_op::isa() const;
941 friend ast_expr_op_minus ast_expr_op::as<ast_expr_op_minus>() const;
942 static const auto type = isl_ast_expr_op_minus;
943
944protected:
945 inline explicit ast_expr_op_minus(__isl_take isl_ast_expr *ptr);
946
947public:
948 inline /* implicit */ ast_expr_op_minus();
949 inline /* implicit */ ast_expr_op_minus(const ast_expr_op_minus &obj);
950 inline ast_expr_op_minus &operator=(ast_expr_op_minus obj);
951 inline isl::ctx ctx() const;
952
953};
954
955// declarations for isl::ast_expr_op_mul
956
957class ast_expr_op_mul : public ast_expr_op {
958 template <class T>
959 friend bool ast_expr_op::isa() const;
960 friend ast_expr_op_mul ast_expr_op::as<ast_expr_op_mul>() const;
961 static const auto type = isl_ast_expr_op_mul;
962
963protected:
964 inline explicit ast_expr_op_mul(__isl_take isl_ast_expr *ptr);
965
966public:
967 inline /* implicit */ ast_expr_op_mul();
968 inline /* implicit */ ast_expr_op_mul(const ast_expr_op_mul &obj);
969 inline ast_expr_op_mul &operator=(ast_expr_op_mul obj);
970 inline isl::ctx ctx() const;
971
972};
973
974// declarations for isl::ast_expr_op_or
975
976class ast_expr_op_or : public ast_expr_op {
977 template <class T>
978 friend bool ast_expr_op::isa() const;
979 friend ast_expr_op_or ast_expr_op::as<ast_expr_op_or>() const;
980 static const auto type = isl_ast_expr_op_or;
981
982protected:
983 inline explicit ast_expr_op_or(__isl_take isl_ast_expr *ptr);
984
985public:
986 inline /* implicit */ ast_expr_op_or();
987 inline /* implicit */ ast_expr_op_or(const ast_expr_op_or &obj);
988 inline ast_expr_op_or &operator=(ast_expr_op_or obj);
989 inline isl::ctx ctx() const;
990
991};
992
993// declarations for isl::ast_expr_op_or_else
994
995class ast_expr_op_or_else : public ast_expr_op {
996 template <class T>
997 friend bool ast_expr_op::isa() const;
998 friend ast_expr_op_or_else ast_expr_op::as<ast_expr_op_or_else>() const;
999 static const auto type = isl_ast_expr_op_or_else;
1000
1001protected:
1002 inline explicit ast_expr_op_or_else(__isl_take isl_ast_expr *ptr);
1003
1004public:
1005 inline /* implicit */ ast_expr_op_or_else();
1006 inline /* implicit */ ast_expr_op_or_else(const ast_expr_op_or_else &obj);
1007 inline ast_expr_op_or_else &operator=(ast_expr_op_or_else obj);
1008 inline isl::ctx ctx() const;
1009
1010};
1011
1012// declarations for isl::ast_expr_op_pdiv_q
1013
1014class ast_expr_op_pdiv_q : public ast_expr_op {
1015 template <class T>
1016 friend bool ast_expr_op::isa() const;
1017 friend ast_expr_op_pdiv_q ast_expr_op::as<ast_expr_op_pdiv_q>() const;
1018 static const auto type = isl_ast_expr_op_pdiv_q;
1019
1020protected:
1021 inline explicit ast_expr_op_pdiv_q(__isl_take isl_ast_expr *ptr);
1022
1023public:
1024 inline /* implicit */ ast_expr_op_pdiv_q();
1025 inline /* implicit */ ast_expr_op_pdiv_q(const ast_expr_op_pdiv_q &obj);
1026 inline ast_expr_op_pdiv_q &operator=(ast_expr_op_pdiv_q obj);
1027 inline isl::ctx ctx() const;
1028
1029};
1030
1031// declarations for isl::ast_expr_op_pdiv_r
1032
1033class ast_expr_op_pdiv_r : public ast_expr_op {
1034 template <class T>
1035 friend bool ast_expr_op::isa() const;
1036 friend ast_expr_op_pdiv_r ast_expr_op::as<ast_expr_op_pdiv_r>() const;
1037 static const auto type = isl_ast_expr_op_pdiv_r;
1038
1039protected:
1040 inline explicit ast_expr_op_pdiv_r(__isl_take isl_ast_expr *ptr);
1041
1042public:
1043 inline /* implicit */ ast_expr_op_pdiv_r();
1044 inline /* implicit */ ast_expr_op_pdiv_r(const ast_expr_op_pdiv_r &obj);
1045 inline ast_expr_op_pdiv_r &operator=(ast_expr_op_pdiv_r obj);
1046 inline isl::ctx ctx() const;
1047
1048};
1049
1050// declarations for isl::ast_expr_op_select
1051
1052class ast_expr_op_select : public ast_expr_op {
1053 template <class T>
1054 friend bool ast_expr_op::isa() const;
1055 friend ast_expr_op_select ast_expr_op::as<ast_expr_op_select>() const;
1056 static const auto type = isl_ast_expr_op_select;
1057
1058protected:
1059 inline explicit ast_expr_op_select(__isl_take isl_ast_expr *ptr);
1060
1061public:
1062 inline /* implicit */ ast_expr_op_select();
1063 inline /* implicit */ ast_expr_op_select(const ast_expr_op_select &obj);
1064 inline ast_expr_op_select &operator=(ast_expr_op_select obj);
1065 inline isl::ctx ctx() const;
1066
1067};
1068
1069// declarations for isl::ast_expr_op_sub
1070
1071class ast_expr_op_sub : public ast_expr_op {
1072 template <class T>
1073 friend bool ast_expr_op::isa() const;
1074 friend ast_expr_op_sub ast_expr_op::as<ast_expr_op_sub>() const;
1075 static const auto type = isl_ast_expr_op_sub;
1076
1077protected:
1078 inline explicit ast_expr_op_sub(__isl_take isl_ast_expr *ptr);
1079
1080public:
1081 inline /* implicit */ ast_expr_op_sub();
1082 inline /* implicit */ ast_expr_op_sub(const ast_expr_op_sub &obj);
1083 inline ast_expr_op_sub &operator=(ast_expr_op_sub obj);
1084 inline isl::ctx ctx() const;
1085
1086};
1087
1088// declarations for isl::ast_expr_op_zdiv_r
1089
1090class ast_expr_op_zdiv_r : public ast_expr_op {
1091 template <class T>
1092 friend bool ast_expr_op::isa() const;
1093 friend ast_expr_op_zdiv_r ast_expr_op::as<ast_expr_op_zdiv_r>() const;
1094 static const auto type = isl_ast_expr_op_zdiv_r;
1095
1096protected:
1097 inline explicit ast_expr_op_zdiv_r(__isl_take isl_ast_expr *ptr);
1098
1099public:
1100 inline /* implicit */ ast_expr_op_zdiv_r();
1101 inline /* implicit */ ast_expr_op_zdiv_r(const ast_expr_op_zdiv_r &obj);
1102 inline ast_expr_op_zdiv_r &operator=(ast_expr_op_zdiv_r obj);
1103 inline isl::ctx ctx() const;
1104
1105};
1106
1107// declarations for isl::ast_node
1108inline ast_node manage(__isl_take isl_ast_node *ptr);
1109inline ast_node manage_copy(__isl_keep isl_ast_node *ptr);
1110
1111class ast_node {
1112 friend inline ast_node manage(__isl_take isl_ast_node *ptr);
1113 friend inline ast_node manage_copy(__isl_keep isl_ast_node *ptr);
1114
1115protected:
1116 isl_ast_node *ptr = nullptr;
1117
1118 inline explicit ast_node(__isl_take isl_ast_node *ptr);
1119
1120public:
1121 inline /* implicit */ ast_node();
1122 inline /* implicit */ ast_node(const ast_node &obj);
1123 inline ast_node &operator=(ast_node obj);
1124 inline ~ast_node();
1125 inline __isl_give isl_ast_node *copy() const &;
1126 inline __isl_give isl_ast_node *copy() && = delete;
1127 inline __isl_keep isl_ast_node *get() const;
1128 inline __isl_give isl_ast_node *release();
1129 inline bool is_null() const;
1130private:
1131 template <typename T,
1132 typename = typename std::enable_if<std::is_same<
1133 const decltype(isl_ast_node_get_type(NULL)),
1134 const T>::value>::type>
1135 inline bool isa_type(T subtype) const;
1136public:
1137 template <class T> inline bool isa() const;
1138 template <class T> inline T as() const;
1139 inline isl::ctx ctx() const;
1140
1141 inline std::string to_C_str() const;
1142};
1143
1144// declarations for isl::ast_node_block
1145
1146class ast_node_block : public ast_node {
1147 template <class T>
1148 friend bool ast_node::isa() const;
1149 friend ast_node_block ast_node::as<ast_node_block>() const;
1150 static const auto type = isl_ast_node_block;
1151
1152protected:
1153 inline explicit ast_node_block(__isl_take isl_ast_node *ptr);
1154
1155public:
1156 inline /* implicit */ ast_node_block();
1157 inline /* implicit */ ast_node_block(const ast_node_block &obj);
1158 inline ast_node_block &operator=(ast_node_block obj);
1159 inline isl::ctx ctx() const;
1160
1161 inline isl::ast_node_list children() const;
1162 inline isl::ast_node_list get_children() const;
1163};
1164
1165// declarations for isl::ast_node_for
1166
1167class ast_node_for : public ast_node {
1168 template <class T>
1169 friend bool ast_node::isa() const;
1170 friend ast_node_for ast_node::as<ast_node_for>() const;
1171 static const auto type = isl_ast_node_for;
1172
1173protected:
1174 inline explicit ast_node_for(__isl_take isl_ast_node *ptr);
1175
1176public:
1177 inline /* implicit */ ast_node_for();
1178 inline /* implicit */ ast_node_for(const ast_node_for &obj);
1179 inline ast_node_for &operator=(ast_node_for obj);
1180 inline isl::ctx ctx() const;
1181
1182 inline isl::ast_node body() const;
1183 inline isl::ast_node get_body() const;
1184 inline isl::ast_expr cond() const;
1185 inline isl::ast_expr get_cond() const;
1186 inline isl::ast_expr inc() const;
1187 inline isl::ast_expr get_inc() const;
1188 inline isl::ast_expr init() const;
1189 inline isl::ast_expr get_init() const;
1190 inline isl::ast_expr iterator() const;
1191 inline isl::ast_expr get_iterator() const;
1192 inline bool is_degenerate() const;
1193};
1194
1195// declarations for isl::ast_node_if
1196
1197class ast_node_if : public ast_node {
1198 template <class T>
1199 friend bool ast_node::isa() const;
1200 friend ast_node_if ast_node::as<ast_node_if>() const;
1201 static const auto type = isl_ast_node_if;
1202
1203protected:
1204 inline explicit ast_node_if(__isl_take isl_ast_node *ptr);
1205
1206public:
1207 inline /* implicit */ ast_node_if();
1208 inline /* implicit */ ast_node_if(const ast_node_if &obj);
1209 inline ast_node_if &operator=(ast_node_if obj);
1210 inline isl::ctx ctx() const;
1211
1212 inline isl::ast_expr cond() const;
1213 inline isl::ast_expr get_cond() const;
1214 inline isl::ast_node else_node() const;
1215 inline isl::ast_node get_else_node() const;
1216 inline isl::ast_node then_node() const;
1217 inline isl::ast_node get_then_node() const;
1218 inline bool has_else_node() const;
1219};
1220
1221// declarations for isl::ast_node_list
1222inline ast_node_list manage(__isl_take isl_ast_node_list *ptr);
1223inline ast_node_list manage_copy(__isl_keep isl_ast_node_list *ptr);
1224
1225class ast_node_list {
1226 friend inline ast_node_list manage(__isl_take isl_ast_node_list *ptr);
1227 friend inline ast_node_list manage_copy(__isl_keep isl_ast_node_list *ptr);
1228
1229protected:
1230 isl_ast_node_list *ptr = nullptr;
1231
1232 inline explicit ast_node_list(__isl_take isl_ast_node_list *ptr);
1233
1234public:
1235 inline /* implicit */ ast_node_list();
1236 inline /* implicit */ ast_node_list(const ast_node_list &obj);
1237 inline explicit ast_node_list(isl::ctx ctx, int n);
1238 inline explicit ast_node_list(isl::ast_node el);
1239 inline ast_node_list &operator=(ast_node_list obj);
1240 inline ~ast_node_list();
1241 inline __isl_give isl_ast_node_list *copy() const &;
1242 inline __isl_give isl_ast_node_list *copy() && = delete;
1243 inline __isl_keep isl_ast_node_list *get() const;
1244 inline __isl_give isl_ast_node_list *release();
1245 inline bool is_null() const;
1246 inline isl::ctx ctx() const;
1247
1248 inline isl::ast_node_list add(isl::ast_node el) const;
1249 inline isl::ast_node_list clear() const;
1250 inline isl::ast_node_list concat(isl::ast_node_list list2) const;
1251 inline isl::ast_node_list drop(unsigned int first, unsigned int n) const;
1252 inline void foreach(const std::function<void(isl::ast_node)> &fn) const;
1253 inline isl::ast_node at(int index) const;
1254 inline isl::ast_node get_at(int index) const;
1255 inline isl::ast_node_list insert(unsigned int pos, isl::ast_node el) const;
1256 inline unsigned size() const;
1257};
1258
1259// declarations for isl::ast_node_mark
1260
1261class ast_node_mark : public ast_node {
1262 template <class T>
1263 friend bool ast_node::isa() const;
1264 friend ast_node_mark ast_node::as<ast_node_mark>() const;
1265 static const auto type = isl_ast_node_mark;
1266
1267protected:
1268 inline explicit ast_node_mark(__isl_take isl_ast_node *ptr);
1269
1270public:
1271 inline /* implicit */ ast_node_mark();
1272 inline /* implicit */ ast_node_mark(const ast_node_mark &obj);
1273 inline ast_node_mark &operator=(ast_node_mark obj);
1274 inline isl::ctx ctx() const;
1275
1276 inline isl::id id() const;
1277 inline isl::id get_id() const;
1278 inline isl::ast_node node() const;
1279 inline isl::ast_node get_node() const;
1280};
1281
1282// declarations for isl::ast_node_user
1283
1284class ast_node_user : public ast_node {
1285 template <class T>
1286 friend bool ast_node::isa() const;
1287 friend ast_node_user ast_node::as<ast_node_user>() const;
1288 static const auto type = isl_ast_node_user;
1289
1290protected:
1291 inline explicit ast_node_user(__isl_take isl_ast_node *ptr);
1292
1293public:
1294 inline /* implicit */ ast_node_user();
1295 inline /* implicit */ ast_node_user(const ast_node_user &obj);
1296 inline ast_node_user &operator=(ast_node_user obj);
1297 inline isl::ctx ctx() const;
1298
1299 inline isl::ast_expr expr() const;
1300 inline isl::ast_expr get_expr() const;
1301};
1302
1303// declarations for isl::basic_map
1304inline basic_map manage(__isl_take isl_basic_map *ptr);
1305inline basic_map manage_copy(__isl_keep isl_basic_map *ptr);
1306
1307class basic_map {
1308 friend inline basic_map manage(__isl_take isl_basic_map *ptr);
1309 friend inline basic_map manage_copy(__isl_keep isl_basic_map *ptr);
1310
1311protected:
1312 isl_basic_map *ptr = nullptr;
1313
1314 inline explicit basic_map(__isl_take isl_basic_map *ptr);
1315
1316public:
1317 inline /* implicit */ basic_map();
1318 inline /* implicit */ basic_map(const basic_map &obj);
1319 inline explicit basic_map(isl::ctx ctx, const std::string &str);
1320 inline basic_map &operator=(basic_map obj);
1321 inline ~basic_map();
1322 inline __isl_give isl_basic_map *copy() const &;
1323 inline __isl_give isl_basic_map *copy() && = delete;
1324 inline __isl_keep isl_basic_map *get() const;
1325 inline __isl_give isl_basic_map *release();
1326 inline bool is_null() const;
1327 inline isl::ctx ctx() const;
1328
1329 inline isl::basic_map affine_hull() const;
1330 inline isl::basic_map apply_domain(isl::basic_map bmap2) const;
1331 inline isl::basic_map apply_range(isl::basic_map bmap2) const;
1332 inline isl::basic_set deltas() const;
1333 inline isl::basic_map detect_equalities() const;
1334 inline isl::basic_map flatten() const;
1335 inline isl::basic_map flatten_domain() const;
1336 inline isl::basic_map flatten_range() const;
1337 inline isl::basic_map gist(isl::basic_map context) const;
1338 inline isl::basic_map intersect(isl::basic_map bmap2) const;
1339 inline isl::basic_map intersect_domain(isl::basic_set bset) const;
1340 inline isl::basic_map intersect_range(isl::basic_set bset) const;
1341 inline bool is_empty() const;
1342 inline bool is_equal(const isl::basic_map &bmap2) const;
1343 inline bool is_subset(const isl::basic_map &bmap2) const;
1344 inline isl::map lexmax() const;
1345 inline isl::map lexmin() const;
1346 inline isl::basic_map reverse() const;
1347 inline isl::basic_map sample() const;
1348 inline isl::map unite(isl::basic_map bmap2) const;
1349};
1350
1351// declarations for isl::basic_set
1352inline basic_set manage(__isl_take isl_basic_set *ptr);
1353inline basic_set manage_copy(__isl_keep isl_basic_set *ptr);
1354
1355class basic_set {
1356 friend inline basic_set manage(__isl_take isl_basic_set *ptr);
1357 friend inline basic_set manage_copy(__isl_keep isl_basic_set *ptr);
1358
1359protected:
1360 isl_basic_set *ptr = nullptr;
1361
1362 inline explicit basic_set(__isl_take isl_basic_set *ptr);
1363
1364public:
1365 inline /* implicit */ basic_set();
1366 inline /* implicit */ basic_set(const basic_set &obj);
1367 inline /* implicit */ basic_set(isl::point pnt);
1368 inline explicit basic_set(isl::ctx ctx, const std::string &str);
1369 inline basic_set &operator=(basic_set obj);
1370 inline ~basic_set();
1371 inline __isl_give isl_basic_set *copy() const &;
1372 inline __isl_give isl_basic_set *copy() && = delete;
1373 inline __isl_keep isl_basic_set *get() const;
1374 inline __isl_give isl_basic_set *release();
1375 inline bool is_null() const;
1376 inline isl::ctx ctx() const;
1377
1378 inline isl::basic_set affine_hull() const;
1379 inline isl::basic_set apply(isl::basic_map bmap) const;
1380 inline isl::basic_set detect_equalities() const;
1381 inline isl::val dim_max_val(int pos) const;
1382 inline isl::basic_set flatten() const;
1383 inline isl::basic_set gist(isl::basic_set context) const;
1384 inline isl::basic_set intersect(isl::basic_set bset2) const;
1385 inline isl::basic_set intersect_params(isl::basic_set bset2) const;
1386 inline bool is_empty() const;
1387 inline bool is_equal(const isl::basic_set &bset2) const;
1388 inline bool is_subset(const isl::basic_set &bset2) const;
1389 inline bool is_wrapping() const;
1390 inline isl::set lexmax() const;
1391 inline isl::set lexmin() const;
1392 inline isl::basic_set params() const;
1393 inline isl::basic_set sample() const;
1394 inline isl::point sample_point() const;
1395 inline isl::set unite(isl::basic_set bset2) const;
1396};
1397
1398// declarations for isl::fixed_box
1399inline fixed_box manage(__isl_take isl_fixed_box *ptr);
1400inline fixed_box manage_copy(__isl_keep isl_fixed_box *ptr);
1401
1402class fixed_box {
1403 friend inline fixed_box manage(__isl_take isl_fixed_box *ptr);
1404 friend inline fixed_box manage_copy(__isl_keep isl_fixed_box *ptr);
1405
1406protected:
1407 isl_fixed_box *ptr = nullptr;
1408
1409 inline explicit fixed_box(__isl_take isl_fixed_box *ptr);
1410
1411public:
1412 inline /* implicit */ fixed_box();
1413 inline /* implicit */ fixed_box(const fixed_box &obj);
1414 inline fixed_box &operator=(fixed_box obj);
1415 inline ~fixed_box();
1416 inline __isl_give isl_fixed_box *copy() const &;
1417 inline __isl_give isl_fixed_box *copy() && = delete;
1418 inline __isl_keep isl_fixed_box *get() const;
1419 inline __isl_give isl_fixed_box *release();
1420 inline bool is_null() const;
1421 inline isl::ctx ctx() const;
1422
1423 inline isl::multi_aff offset() const;
1424 inline isl::multi_aff get_offset() const;
1425 inline isl::multi_val size() const;
1426 inline isl::multi_val get_size() const;
1427 inline isl::space space() const;
1428 inline isl::space get_space() const;
1429 inline bool is_valid() const;
1430};
1431
1432// declarations for isl::id
1433inline id manage(__isl_take isl_id *ptr);
1434inline id manage_copy(__isl_keep isl_id *ptr);
1435
1436class id {
1437 friend inline id manage(__isl_take isl_id *ptr);
1438 friend inline id manage_copy(__isl_keep isl_id *ptr);
1439
1440protected:
1441 isl_id *ptr = nullptr;
1442
1443 inline explicit id(__isl_take isl_id *ptr);
1444
1445public:
1446 inline /* implicit */ id();
1447 inline /* implicit */ id(const id &obj);
1448 inline explicit id(isl::ctx ctx, const std::string &str);
1449 inline id &operator=(id obj);
1450 inline ~id();
1451 inline __isl_give isl_id *copy() const &;
1452 inline __isl_give isl_id *copy() && = delete;
1453 inline __isl_keep isl_id *get() const;
1454 inline __isl_give isl_id *release();
1455 inline bool is_null() const;
1456 inline isl::ctx ctx() const;
1457
1458 inline std::string name() const;
1459 inline std::string get_name() const;
1460};
1461
1462// declarations for isl::id_list
1463inline id_list manage(__isl_take isl_id_list *ptr);
1464inline id_list manage_copy(__isl_keep isl_id_list *ptr);
1465
1466class id_list {
1467 friend inline id_list manage(__isl_take isl_id_list *ptr);
1468 friend inline id_list manage_copy(__isl_keep isl_id_list *ptr);
1469
1470protected:
1471 isl_id_list *ptr = nullptr;
1472
1473 inline explicit id_list(__isl_take isl_id_list *ptr);
1474
1475public:
1476 inline /* implicit */ id_list();
1477 inline /* implicit */ id_list(const id_list &obj);
1478 inline explicit id_list(isl::ctx ctx, int n);
1479 inline explicit id_list(isl::id el);
1480 inline id_list &operator=(id_list obj);
1481 inline ~id_list();
1482 inline __isl_give isl_id_list *copy() const &;
1483 inline __isl_give isl_id_list *copy() && = delete;
1484 inline __isl_keep isl_id_list *get() const;
1485 inline __isl_give isl_id_list *release();
1486 inline bool is_null() const;
1487 inline isl::ctx ctx() const;
1488
1489 inline isl::id_list add(isl::id el) const;
1490 inline isl::id_list add(const std::string &el) const;
1491 inline isl::id_list clear() const;
1492 inline isl::id_list concat(isl::id_list list2) const;
1493 inline isl::id_list drop(unsigned int first, unsigned int n) const;
1494 inline void foreach(const std::function<void(isl::id)> &fn) const;
1495 inline isl::id at(int index) const;
1496 inline isl::id get_at(int index) const;
1497 inline isl::id_list insert(unsigned int pos, isl::id el) const;
1498 inline isl::id_list insert(unsigned int pos, const std::string &el) const;
1499 inline unsigned size() const;
1500};
1501
1502// declarations for isl::map
1503inline map manage(__isl_take isl_map *ptr);
1504inline map manage_copy(__isl_keep isl_map *ptr);
1505
1506class map {
1507 friend inline map manage(__isl_take isl_map *ptr);
1508 friend inline map manage_copy(__isl_keep isl_map *ptr);
1509
1510protected:
1511 isl_map *ptr = nullptr;
1512
1513 inline explicit map(__isl_take isl_map *ptr);
1514
1515public:
1516 inline /* implicit */ map();
1517 inline /* implicit */ map(const map &obj);
1518 inline /* implicit */ map(isl::basic_map bmap);
1519 inline explicit map(isl::ctx ctx, const std::string &str);
1520 inline map &operator=(map obj);
1521 inline ~map();
1522 inline __isl_give isl_map *copy() const &;
1523 inline __isl_give isl_map *copy() && = delete;
1524 inline __isl_keep isl_map *get() const;
1525 inline __isl_give isl_map *release();
1526 inline bool is_null() const;
1527 inline isl::ctx ctx() const;
1528
1529 inline isl::basic_map affine_hull() const;
1530 inline isl::map apply_domain(isl::map map2) const;
1531 inline isl::map apply_range(isl::map map2) const;
1532 inline isl::set bind_domain(isl::multi_id tuple) const;
1533 inline isl::set bind_range(isl::multi_id tuple) const;
1534 inline isl::map coalesce() const;
1535 inline isl::map complement() const;
1536 inline isl::map curry() const;
1537 inline isl::set deltas() const;
1538 inline isl::map detect_equalities() const;
1539 inline isl::set domain() const;
1540 inline isl::map domain_factor_domain() const;
1541 inline isl::map domain_factor_range() const;
1542 inline isl::map domain_product(isl::map map2) const;
1543 static inline isl::map empty(isl::space space);
1544 inline isl::map eq_at(isl::multi_pw_aff mpa) const;
1545 inline isl::map factor_domain() const;
1546 inline isl::map factor_range() const;
1547 inline isl::map flatten() const;
1548 inline isl::map flatten_domain() const;
1549 inline isl::map flatten_range() const;
1550 inline void foreach_basic_map(const std::function<void(isl::basic_map)> &fn) const;
1551 inline isl::fixed_box range_simple_fixed_box_hull() const;
1552 inline isl::fixed_box get_range_simple_fixed_box_hull() const;
1553 inline isl::space space() const;
1554 inline isl::space get_space() const;
1555 inline isl::map gist(isl::map context) const;
1556 inline isl::map gist_domain(isl::set context) const;
1557 inline isl::map intersect(isl::map map2) const;
1558 inline isl::map intersect_domain(isl::set set) const;
1559 inline isl::map intersect_params(isl::set params) const;
1560 inline isl::map intersect_range(isl::set set) const;
1561 inline bool is_bijective() const;
1562 inline bool is_disjoint(const isl::map &map2) const;
1563 inline bool is_empty() const;
1564 inline bool is_equal(const isl::map &map2) const;
1565 inline bool is_injective() const;
1566 inline bool is_single_valued() const;
1567 inline bool is_strict_subset(const isl::map &map2) const;
1568 inline bool is_subset(const isl::map &map2) const;
1569 inline isl::map lex_ge_at(isl::multi_pw_aff mpa) const;
1570 inline isl::map lex_gt_at(isl::multi_pw_aff mpa) const;
1571 inline isl::map lex_le_at(isl::multi_pw_aff mpa) const;
1572 inline isl::map lex_lt_at(isl::multi_pw_aff mpa) const;
1573 inline isl::map lexmax() const;
1574 inline isl::pw_multi_aff lexmax_pw_multi_aff() const;
1575 inline isl::map lexmin() const;
1576 inline isl::pw_multi_aff lexmin_pw_multi_aff() const;
1577 inline isl::map lower_bound(isl::multi_pw_aff lower) const;
1578 inline isl::map lower_bound(isl::multi_val lower) const;
1579 inline isl::multi_pw_aff max_multi_pw_aff() const;
1580 inline isl::multi_pw_aff min_multi_pw_aff() const;
1581 inline isl::basic_map polyhedral_hull() const;
1582 inline isl::map preimage_domain(isl::multi_aff ma) const;
1583 inline isl::map preimage_domain(isl::multi_pw_aff mpa) const;
1584 inline isl::map preimage_domain(isl::pw_multi_aff pma) const;
1585 inline isl::map preimage_range(isl::multi_aff ma) const;
1586 inline isl::map preimage_range(isl::pw_multi_aff pma) const;
1587 inline isl::map project_out_all_params() const;
1588 inline isl::set range() const;
1589 inline isl::map range_factor_domain() const;
1590 inline isl::map range_factor_range() const;
1591 inline isl::map range_product(isl::map map2) const;
1592 inline isl::map range_reverse() const;
1593 inline isl::map reverse() const;
1594 inline isl::basic_map sample() const;
1595 inline isl::map subtract(isl::map map2) const;
1596 inline isl::map uncurry() const;
1597 inline isl::map unite(isl::map map2) const;
1598 static inline isl::map universe(isl::space space);
1599 inline isl::basic_map unshifted_simple_hull() const;
1600 inline isl::map upper_bound(isl::multi_pw_aff upper) const;
1601 inline isl::map upper_bound(isl::multi_val upper) const;
1602 inline isl::set wrap() const;
1603};
1604
1605// declarations for isl::multi_aff
1606inline multi_aff manage(__isl_take isl_multi_aff *ptr);
1607inline multi_aff manage_copy(__isl_keep isl_multi_aff *ptr);
1608
1609class multi_aff {
1610 friend inline multi_aff manage(__isl_take isl_multi_aff *ptr);
1611 friend inline multi_aff manage_copy(__isl_keep isl_multi_aff *ptr);
1612
1613protected:
1614 isl_multi_aff *ptr = nullptr;
1615
1616 inline explicit multi_aff(__isl_take isl_multi_aff *ptr);
1617
1618public:
1619 inline /* implicit */ multi_aff();
1620 inline /* implicit */ multi_aff(const multi_aff &obj);
1621 inline /* implicit */ multi_aff(isl::aff aff);
1622 inline explicit multi_aff(isl::space space, isl::aff_list list);
1623 inline explicit multi_aff(isl::ctx ctx, const std::string &str);
1624 inline multi_aff &operator=(multi_aff obj);
1625 inline ~multi_aff();
1626 inline __isl_give isl_multi_aff *copy() const &;
1627 inline __isl_give isl_multi_aff *copy() && = delete;
1628 inline __isl_keep isl_multi_aff *get() const;
1629 inline __isl_give isl_multi_aff *release();
1630 inline bool is_null() const;
1631 inline isl::ctx ctx() const;
1632
1633 inline isl::multi_aff add(isl::multi_aff multi2) const;
1634 inline isl::multi_aff add_constant(isl::multi_val mv) const;
1635 inline isl::multi_aff add_constant(isl::val v) const;
1636 inline isl::multi_aff add_constant(long v) const;
1637 inline isl::basic_set bind(isl::multi_id tuple) const;
1638 inline isl::multi_aff bind_domain(isl::multi_id tuple) const;
1639 inline isl::multi_aff bind_domain_wrapped_domain(isl::multi_id tuple) const;
1640 static inline isl::multi_aff domain_map(isl::space space);
1641 inline isl::multi_aff flat_range_product(isl::multi_aff multi2) const;
1642 inline isl::multi_aff floor() const;
1643 inline isl::aff at(int pos) const;
1644 inline isl::aff get_at(int pos) const;
1645 inline isl::multi_val constant_multi_val() const;
1646 inline isl::multi_val get_constant_multi_val() const;
1647 inline isl::aff_list list() const;
1648 inline isl::aff_list get_list() const;
1649 inline isl::space space() const;
1650 inline isl::space get_space() const;
1651 inline isl::multi_aff gist(isl::set context) const;
1652 inline isl::multi_aff identity() const;
1653 static inline isl::multi_aff identity_on_domain(isl::space space);
1654 inline isl::multi_aff insert_domain(isl::space domain) const;
1655 inline bool involves_locals() const;
1656 inline isl::multi_aff neg() const;
1657 inline bool plain_is_equal(const isl::multi_aff &multi2) const;
1658 inline isl::multi_aff product(isl::multi_aff multi2) const;
1659 inline isl::multi_aff pullback(isl::multi_aff ma2) const;
1660 static inline isl::multi_aff range_map(isl::space space);
1661 inline isl::multi_aff range_product(isl::multi_aff multi2) const;
1662 inline isl::multi_aff scale(isl::multi_val mv) const;
1663 inline isl::multi_aff scale(isl::val v) const;
1664 inline isl::multi_aff scale(long v) const;
1665 inline isl::multi_aff scale_down(isl::multi_val mv) const;
1666 inline isl::multi_aff scale_down(isl::val v) const;
1667 inline isl::multi_aff scale_down(long v) const;
1668 inline isl::multi_aff set_at(int pos, isl::aff el) const;
1669 inline unsigned size() const;
1670 inline isl::multi_aff sub(isl::multi_aff multi2) const;
1671 inline isl::multi_aff unbind_params_insert_domain(isl::multi_id domain) const;
1672 static inline isl::multi_aff zero(isl::space space);
1673};
1674
1675// declarations for isl::multi_id
1676inline multi_id manage(__isl_take isl_multi_id *ptr);
1677inline multi_id manage_copy(__isl_keep isl_multi_id *ptr);
1678
1679class multi_id {
1680 friend inline multi_id manage(__isl_take isl_multi_id *ptr);
1681 friend inline multi_id manage_copy(__isl_keep isl_multi_id *ptr);
1682
1683protected:
1684 isl_multi_id *ptr = nullptr;
1685
1686 inline explicit multi_id(__isl_take isl_multi_id *ptr);
1687
1688public:
1689 inline /* implicit */ multi_id();
1690 inline /* implicit */ multi_id(const multi_id &obj);
1691 inline explicit multi_id(isl::space space, isl::id_list list);
1692 inline explicit multi_id(isl::ctx ctx, const std::string &str);
1693 inline multi_id &operator=(multi_id obj);
1694 inline ~multi_id();
1695 inline __isl_give isl_multi_id *copy() const &;
1696 inline __isl_give isl_multi_id *copy() && = delete;
1697 inline __isl_keep isl_multi_id *get() const;
1698 inline __isl_give isl_multi_id *release();
1699 inline bool is_null() const;
1700 inline isl::ctx ctx() const;
1701
1702 inline isl::multi_id flat_range_product(isl::multi_id multi2) const;
1703 inline isl::id at(int pos) const;
1704 inline isl::id get_at(int pos) const;
1705 inline isl::id_list list() const;
1706 inline isl::id_list get_list() const;
1707 inline isl::space space() const;
1708 inline isl::space get_space() const;
1709 inline bool plain_is_equal(const isl::multi_id &multi2) const;
1710 inline isl::multi_id range_product(isl::multi_id multi2) const;
1711 inline isl::multi_id set_at(int pos, isl::id el) const;
1712 inline isl::multi_id set_at(int pos, const std::string &el) const;
1713 inline unsigned size() const;
1714};
1715
1716// declarations for isl::multi_pw_aff
1717inline multi_pw_aff manage(__isl_take isl_multi_pw_aff *ptr);
1718inline multi_pw_aff manage_copy(__isl_keep isl_multi_pw_aff *ptr);
1719
1720class multi_pw_aff {
1721 friend inline multi_pw_aff manage(__isl_take isl_multi_pw_aff *ptr);
1722 friend inline multi_pw_aff manage_copy(__isl_keep isl_multi_pw_aff *ptr);
1723
1724protected:
1725 isl_multi_pw_aff *ptr = nullptr;
1726
1727 inline explicit multi_pw_aff(__isl_take isl_multi_pw_aff *ptr);
1728
1729public:
1730 inline /* implicit */ multi_pw_aff();
1731 inline /* implicit */ multi_pw_aff(const multi_pw_aff &obj);
1732 inline /* implicit */ multi_pw_aff(isl::aff aff);
1733 inline /* implicit */ multi_pw_aff(isl::multi_aff ma);
1734 inline /* implicit */ multi_pw_aff(isl::pw_aff pa);
1735 inline explicit multi_pw_aff(isl::space space, isl::pw_aff_list list);
1736 inline /* implicit */ multi_pw_aff(isl::pw_multi_aff pma);
1737 inline explicit multi_pw_aff(isl::ctx ctx, const std::string &str);
1738 inline multi_pw_aff &operator=(multi_pw_aff obj);
1739 inline ~multi_pw_aff();
1740 inline __isl_give isl_multi_pw_aff *copy() const &;
1741 inline __isl_give isl_multi_pw_aff *copy() && = delete;
1742 inline __isl_keep isl_multi_pw_aff *get() const;
1743 inline __isl_give isl_multi_pw_aff *release();
1744 inline bool is_null() const;
1745 inline isl::ctx ctx() const;
1746
1747 inline isl::multi_pw_aff add(isl::multi_pw_aff multi2) const;
1748 inline isl::multi_pw_aff add_constant(isl::multi_val mv) const;
1749 inline isl::multi_pw_aff add_constant(isl::val v) const;
1750 inline isl::multi_pw_aff add_constant(long v) const;
1751 inline isl::set bind(isl::multi_id tuple) const;
1752 inline isl::multi_pw_aff bind_domain(isl::multi_id tuple) const;
1753 inline isl::multi_pw_aff bind_domain_wrapped_domain(isl::multi_id tuple) const;
1754 inline isl::multi_pw_aff coalesce() const;
1755 inline isl::set domain() const;
1756 inline isl::multi_pw_aff flat_range_product(isl::multi_pw_aff multi2) const;
1757 inline isl::pw_aff at(int pos) const;
1758 inline isl::pw_aff get_at(int pos) const;
1759 inline isl::pw_aff_list list() const;
1760 inline isl::pw_aff_list get_list() const;
1761 inline isl::space space() const;
1762 inline isl::space get_space() const;
1763 inline isl::multi_pw_aff gist(isl::set set) const;
1764 inline isl::multi_pw_aff identity() const;
1765 static inline isl::multi_pw_aff identity_on_domain(isl::space space);
1766 inline isl::multi_pw_aff insert_domain(isl::space domain) const;
1767 inline isl::multi_pw_aff intersect_domain(isl::set domain) const;
1768 inline isl::multi_pw_aff intersect_params(isl::set set) const;
1769 inline bool involves_param(const isl::id &id) const;
1770 inline bool involves_param(const std::string &id) const;
1771 inline bool involves_param(const isl::id_list &list) const;
1772 inline isl::multi_pw_aff max(isl::multi_pw_aff multi2) const;
1773 inline isl::multi_val max_multi_val() const;
1774 inline isl::multi_pw_aff min(isl::multi_pw_aff multi2) const;
1775 inline isl::multi_val min_multi_val() const;
1776 inline isl::multi_pw_aff neg() const;
1777 inline bool plain_is_equal(const isl::multi_pw_aff &multi2) const;
1778 inline isl::multi_pw_aff product(isl::multi_pw_aff multi2) const;
1779 inline isl::multi_pw_aff pullback(isl::multi_aff ma) const;
1780 inline isl::multi_pw_aff pullback(isl::multi_pw_aff mpa2) const;
1781 inline isl::multi_pw_aff pullback(isl::pw_multi_aff pma) const;
1782 inline isl::multi_pw_aff range_product(isl::multi_pw_aff multi2) const;
1783 inline isl::multi_pw_aff scale(isl::multi_val mv) const;
1784 inline isl::multi_pw_aff scale(isl::val v) const;
1785 inline isl::multi_pw_aff scale(long v) const;
1786 inline isl::multi_pw_aff scale_down(isl::multi_val mv) const;
1787 inline isl::multi_pw_aff scale_down(isl::val v) const;
1788 inline isl::multi_pw_aff scale_down(long v) const;
1789 inline isl::multi_pw_aff set_at(int pos, isl::pw_aff el) const;
1790 inline unsigned size() const;
1791 inline isl::multi_pw_aff sub(isl::multi_pw_aff multi2) const;
1792 inline isl::multi_pw_aff unbind_params_insert_domain(isl::multi_id domain) const;
1793 inline isl::multi_pw_aff union_add(isl::multi_pw_aff mpa2) const;
1794 static inline isl::multi_pw_aff zero(isl::space space);
1795};
1796
1797// declarations for isl::multi_union_pw_aff
1798inline multi_union_pw_aff manage(__isl_take isl_multi_union_pw_aff *ptr);
1799inline multi_union_pw_aff manage_copy(__isl_keep isl_multi_union_pw_aff *ptr);
1800
1801class multi_union_pw_aff {
1802 friend inline multi_union_pw_aff manage(__isl_take isl_multi_union_pw_aff *ptr);
1803 friend inline multi_union_pw_aff manage_copy(__isl_keep isl_multi_union_pw_aff *ptr);
1804
1805protected:
1806 isl_multi_union_pw_aff *ptr = nullptr;
1807
1808 inline explicit multi_union_pw_aff(__isl_take isl_multi_union_pw_aff *ptr);
1809
1810public:
1811 inline /* implicit */ multi_union_pw_aff();
1812 inline /* implicit */ multi_union_pw_aff(const multi_union_pw_aff &obj);
1813 inline /* implicit */ multi_union_pw_aff(isl::multi_pw_aff mpa);
1814 inline /* implicit */ multi_union_pw_aff(isl::union_pw_aff upa);
1815 inline explicit multi_union_pw_aff(isl::space space, isl::union_pw_aff_list list);
1816 inline explicit multi_union_pw_aff(isl::ctx ctx, const std::string &str);
1817 inline multi_union_pw_aff &operator=(multi_union_pw_aff obj);
1818 inline ~multi_union_pw_aff();
1819 inline __isl_give isl_multi_union_pw_aff *copy() const &;
1820 inline __isl_give isl_multi_union_pw_aff *copy() && = delete;
1821 inline __isl_keep isl_multi_union_pw_aff *get() const;
1822 inline __isl_give isl_multi_union_pw_aff *release();
1823 inline bool is_null() const;
1824 inline isl::ctx ctx() const;
1825
1826 inline isl::multi_union_pw_aff add(isl::multi_union_pw_aff multi2) const;
1827 inline isl::union_set bind(isl::multi_id tuple) const;
1828 inline isl::multi_union_pw_aff coalesce() const;
1829 inline isl::union_set domain() const;
1830 inline isl::multi_union_pw_aff flat_range_product(isl::multi_union_pw_aff multi2) const;
1831 inline isl::union_pw_aff at(int pos) const;
1832 inline isl::union_pw_aff get_at(int pos) const;
1833 inline isl::union_pw_aff_list list() const;
1834 inline isl::union_pw_aff_list get_list() const;
1835 inline isl::space space() const;
1836 inline isl::space get_space() const;
1837 inline isl::multi_union_pw_aff gist(isl::union_set context) const;
1838 inline isl::multi_union_pw_aff intersect_domain(isl::union_set uset) const;
1839 inline isl::multi_union_pw_aff intersect_params(isl::set params) const;
1840 inline isl::multi_union_pw_aff neg() const;
1841 inline bool plain_is_equal(const isl::multi_union_pw_aff &multi2) const;
1842 inline isl::multi_union_pw_aff pullback(isl::union_pw_multi_aff upma) const;
1843 inline isl::multi_union_pw_aff range_product(isl::multi_union_pw_aff multi2) const;
1844 inline isl::multi_union_pw_aff scale(isl::multi_val mv) const;
1845 inline isl::multi_union_pw_aff scale(isl::val v) const;
1846 inline isl::multi_union_pw_aff scale(long v) const;
1847 inline isl::multi_union_pw_aff scale_down(isl::multi_val mv) const;
1848 inline isl::multi_union_pw_aff scale_down(isl::val v) const;
1849 inline isl::multi_union_pw_aff scale_down(long v) const;
1850 inline isl::multi_union_pw_aff set_at(int pos, isl::union_pw_aff el) const;
1851 inline unsigned size() const;
1852 inline isl::multi_union_pw_aff sub(isl::multi_union_pw_aff multi2) const;
1853 inline isl::multi_union_pw_aff union_add(isl::multi_union_pw_aff mupa2) const;
1854 static inline isl::multi_union_pw_aff zero(isl::space space);
1855};
1856
1857// declarations for isl::multi_val
1858inline multi_val manage(__isl_take isl_multi_val *ptr);
1859inline multi_val manage_copy(__isl_keep isl_multi_val *ptr);
1860
1861class multi_val {
1862 friend inline multi_val manage(__isl_take isl_multi_val *ptr);
1863 friend inline multi_val manage_copy(__isl_keep isl_multi_val *ptr);
1864
1865protected:
1866 isl_multi_val *ptr = nullptr;
1867
1868 inline explicit multi_val(__isl_take isl_multi_val *ptr);
1869
1870public:
1871 inline /* implicit */ multi_val();
1872 inline /* implicit */ multi_val(const multi_val &obj);
1873 inline explicit multi_val(isl::space space, isl::val_list list);
1874 inline explicit multi_val(isl::ctx ctx, const std::string &str);
1875 inline multi_val &operator=(multi_val obj);
1876 inline ~multi_val();
1877 inline __isl_give isl_multi_val *copy() const &;
1878 inline __isl_give isl_multi_val *copy() && = delete;
1879 inline __isl_keep isl_multi_val *get() const;
1880 inline __isl_give isl_multi_val *release();
1881 inline bool is_null() const;
1882 inline isl::ctx ctx() const;
1883
1884 inline isl::multi_val add(isl::multi_val multi2) const;
1885 inline isl::multi_val add(isl::val v) const;
1886 inline isl::multi_val add(long v) const;
1887 inline isl::multi_val flat_range_product(isl::multi_val multi2) const;
1888 inline isl::val at(int pos) const;
1889 inline isl::val get_at(int pos) const;
1890 inline isl::val_list list() const;
1891 inline isl::val_list get_list() const;
1892 inline isl::space space() const;
1893 inline isl::space get_space() const;
1894 inline isl::multi_val max(isl::multi_val multi2) const;
1895 inline isl::multi_val min(isl::multi_val multi2) const;
1896 inline isl::multi_val neg() const;
1897 inline bool plain_is_equal(const isl::multi_val &multi2) const;
1898 inline isl::multi_val product(isl::multi_val multi2) const;
1899 inline isl::multi_val range_product(isl::multi_val multi2) const;
1900 inline isl::multi_val scale(isl::multi_val mv) const;
1901 inline isl::multi_val scale(isl::val v) const;
1902 inline isl::multi_val scale(long v) const;
1903 inline isl::multi_val scale_down(isl::multi_val mv) const;
1904 inline isl::multi_val scale_down(isl::val v) const;
1905 inline isl::multi_val scale_down(long v) const;
1906 inline isl::multi_val set_at(int pos, isl::val el) const;
1907 inline isl::multi_val set_at(int pos, long el) const;
1908 inline unsigned size() const;
1909 inline isl::multi_val sub(isl::multi_val multi2) const;
1910 static inline isl::multi_val zero(isl::space space);
1911};
1912
1913// declarations for isl::point
1914inline point manage(__isl_take isl_point *ptr);
1915inline point manage_copy(__isl_keep isl_point *ptr);
1916
1917class point {
1918 friend inline point manage(__isl_take isl_point *ptr);
1919 friend inline point manage_copy(__isl_keep isl_point *ptr);
1920
1921protected:
1922 isl_point *ptr = nullptr;
1923
1924 inline explicit point(__isl_take isl_point *ptr);
1925
1926public:
1927 inline /* implicit */ point();
1928 inline /* implicit */ point(const point &obj);
1929 inline point &operator=(point obj);
1930 inline ~point();
1931 inline __isl_give isl_point *copy() const &;
1932 inline __isl_give isl_point *copy() && = delete;
1933 inline __isl_keep isl_point *get() const;
1934 inline __isl_give isl_point *release();
1935 inline bool is_null() const;
1936 inline isl::ctx ctx() const;
1937
1938 inline isl::multi_val multi_val() const;
1939 inline isl::multi_val get_multi_val() const;
1940};
1941
1942// declarations for isl::pw_aff
1943inline pw_aff manage(__isl_take isl_pw_aff *ptr);
1944inline pw_aff manage_copy(__isl_keep isl_pw_aff *ptr);
1945
1946class pw_aff {
1947 friend inline pw_aff manage(__isl_take isl_pw_aff *ptr);
1948 friend inline pw_aff manage_copy(__isl_keep isl_pw_aff *ptr);
1949
1950protected:
1951 isl_pw_aff *ptr = nullptr;
1952
1953 inline explicit pw_aff(__isl_take isl_pw_aff *ptr);
1954
1955public:
1956 inline /* implicit */ pw_aff();
1957 inline /* implicit */ pw_aff(const pw_aff &obj);
1958 inline /* implicit */ pw_aff(isl::aff aff);
1959 inline explicit pw_aff(isl::ctx ctx, const std::string &str);
1960 inline pw_aff &operator=(pw_aff obj);
1961 inline ~pw_aff();
1962 inline __isl_give isl_pw_aff *copy() const &;
1963 inline __isl_give isl_pw_aff *copy() && = delete;
1964 inline __isl_keep isl_pw_aff *get() const;
1965 inline __isl_give isl_pw_aff *release();
1966 inline bool is_null() const;
1967 inline isl::ctx ctx() const;
1968
1969 inline isl::pw_aff add(isl::pw_aff pwaff2) const;
1970 inline isl::pw_aff add_constant(isl::val v) const;
1971 inline isl::pw_aff add_constant(long v) const;
1972 inline isl::aff as_aff() const;
1973 inline isl::set bind(isl::id id) const;
1974 inline isl::set bind(const std::string &id) const;
1975 inline isl::pw_aff bind_domain(isl::multi_id tuple) const;
1976 inline isl::pw_aff bind_domain_wrapped_domain(isl::multi_id tuple) const;
1977 inline isl::pw_aff ceil() const;
1978 inline isl::pw_aff coalesce() const;
1979 inline isl::pw_aff cond(isl::pw_aff pwaff_true, isl::pw_aff pwaff_false) const;
1980 inline isl::pw_aff div(isl::pw_aff pa2) const;
1981 inline isl::set domain() const;
1982 inline isl::set eq_set(isl::pw_aff pwaff2) const;
1983 inline isl::val eval(isl::point pnt) const;
1984 inline isl::pw_aff floor() const;
1985 inline isl::set ge_set(isl::pw_aff pwaff2) const;
1986 inline isl::pw_aff gist(isl::set context) const;
1987 inline isl::set gt_set(isl::pw_aff pwaff2) const;
1988 inline isl::pw_aff insert_domain(isl::space domain) const;
1989 inline isl::pw_aff intersect_domain(isl::set set) const;
1990 inline isl::pw_aff intersect_params(isl::set set) const;
1991 inline bool isa_aff() const;
1992 inline isl::set le_set(isl::pw_aff pwaff2) const;
1993 inline isl::set lt_set(isl::pw_aff pwaff2) const;
1994 inline isl::pw_aff max(isl::pw_aff pwaff2) const;
1995 inline isl::pw_aff min(isl::pw_aff pwaff2) const;
1996 inline isl::pw_aff mod(isl::val mod) const;
1997 inline isl::pw_aff mod(long mod) const;
1998 inline isl::pw_aff mul(isl::pw_aff pwaff2) const;
1999 inline isl::set ne_set(isl::pw_aff pwaff2) const;
2000 inline isl::pw_aff neg() const;
2001 static inline isl::pw_aff param_on_domain(isl::set domain, isl::id id);
2002 inline isl::pw_aff pullback(isl::multi_aff ma) const;
2003 inline isl::pw_aff pullback(isl::multi_pw_aff mpa) const;
2004 inline isl::pw_aff pullback(isl::pw_multi_aff pma) const;
2005 inline isl::pw_aff scale(isl::val v) const;
2006 inline isl::pw_aff scale(long v) const;
2007 inline isl::pw_aff scale_down(isl::val f) const;
2008 inline isl::pw_aff scale_down(long f) const;
2009 inline isl::pw_aff sub(isl::pw_aff pwaff2) const;
2010 inline isl::pw_aff subtract_domain(isl::set set) const;
2011 inline isl::pw_aff tdiv_q(isl::pw_aff pa2) const;
2012 inline isl::pw_aff tdiv_r(isl::pw_aff pa2) const;
2013 inline isl::pw_aff union_add(isl::pw_aff pwaff2) const;
2014};
2015
2016// declarations for isl::pw_aff_list
2017inline pw_aff_list manage(__isl_take isl_pw_aff_list *ptr);
2018inline pw_aff_list manage_copy(__isl_keep isl_pw_aff_list *ptr);
2019
2020class pw_aff_list {
2021 friend inline pw_aff_list manage(__isl_take isl_pw_aff_list *ptr);
2022 friend inline pw_aff_list manage_copy(__isl_keep isl_pw_aff_list *ptr);
2023
2024protected:
2025 isl_pw_aff_list *ptr = nullptr;
2026
2027 inline explicit pw_aff_list(__isl_take isl_pw_aff_list *ptr);
2028
2029public:
2030 inline /* implicit */ pw_aff_list();
2031 inline /* implicit */ pw_aff_list(const pw_aff_list &obj);
2032 inline explicit pw_aff_list(isl::ctx ctx, int n);
2033 inline explicit pw_aff_list(isl::pw_aff el);
2034 inline pw_aff_list &operator=(pw_aff_list obj);
2035 inline ~pw_aff_list();
2036 inline __isl_give isl_pw_aff_list *copy() const &;
2037 inline __isl_give isl_pw_aff_list *copy() && = delete;
2038 inline __isl_keep isl_pw_aff_list *get() const;
2039 inline __isl_give isl_pw_aff_list *release();
2040 inline bool is_null() const;
2041 inline isl::ctx ctx() const;
2042
2043 inline isl::pw_aff_list add(isl::pw_aff el) const;
2044 inline isl::pw_aff_list clear() const;
2045 inline isl::pw_aff_list concat(isl::pw_aff_list list2) const;
2046 inline isl::pw_aff_list drop(unsigned int first, unsigned int n) const;
2047 inline void foreach(const std::function<void(isl::pw_aff)> &fn) const;
2048 inline isl::pw_aff at(int index) const;
2049 inline isl::pw_aff get_at(int index) const;
2050 inline isl::pw_aff_list insert(unsigned int pos, isl::pw_aff el) const;
2051 inline unsigned size() const;
2052};
2053
2054// declarations for isl::pw_multi_aff
2055inline pw_multi_aff manage(__isl_take isl_pw_multi_aff *ptr);
2056inline pw_multi_aff manage_copy(__isl_keep isl_pw_multi_aff *ptr);
2057
2058class pw_multi_aff {
2059 friend inline pw_multi_aff manage(__isl_take isl_pw_multi_aff *ptr);
2060 friend inline pw_multi_aff manage_copy(__isl_keep isl_pw_multi_aff *ptr);
2061
2062protected:
2063 isl_pw_multi_aff *ptr = nullptr;
2064
2065 inline explicit pw_multi_aff(__isl_take isl_pw_multi_aff *ptr);
2066
2067public:
2068 inline /* implicit */ pw_multi_aff();
2069 inline /* implicit */ pw_multi_aff(const pw_multi_aff &obj);
2070 inline /* implicit */ pw_multi_aff(isl::multi_aff ma);
2071 inline /* implicit */ pw_multi_aff(isl::pw_aff pa);
2072 inline explicit pw_multi_aff(isl::ctx ctx, const std::string &str);
2073 inline pw_multi_aff &operator=(pw_multi_aff obj);
2074 inline ~pw_multi_aff();
2075 inline __isl_give isl_pw_multi_aff *copy() const &;
2076 inline __isl_give isl_pw_multi_aff *copy() && = delete;
2077 inline __isl_keep isl_pw_multi_aff *get() const;
2078 inline __isl_give isl_pw_multi_aff *release();
2079 inline bool is_null() const;
2080 inline isl::ctx ctx() const;
2081
2082 inline isl::pw_multi_aff add(isl::pw_multi_aff pma2) const;
2083 inline isl::pw_multi_aff add_constant(isl::multi_val mv) const;
2084 inline isl::pw_multi_aff add_constant(isl::val v) const;
2085 inline isl::pw_multi_aff add_constant(long v) const;
2086 inline isl::multi_aff as_multi_aff() const;
2087 inline isl::pw_multi_aff bind_domain(isl::multi_id tuple) const;
2088 inline isl::pw_multi_aff bind_domain_wrapped_domain(isl::multi_id tuple) const;
2089 inline isl::pw_multi_aff coalesce() const;
2090 inline isl::set domain() const;
2091 static inline isl::pw_multi_aff domain_map(isl::space space);
2092 inline isl::pw_multi_aff flat_range_product(isl::pw_multi_aff pma2) const;
2093 inline void foreach_piece(const std::function<void(isl::set, isl::multi_aff)> &fn) const;
2094 inline isl::space space() const;
2095 inline isl::space get_space() const;
2096 inline isl::pw_multi_aff gist(isl::set set) const;
2097 inline isl::pw_multi_aff insert_domain(isl::space domain) const;
2098 inline isl::pw_multi_aff intersect_domain(isl::set set) const;
2099 inline isl::pw_multi_aff intersect_params(isl::set set) const;
2100 inline bool involves_locals() const;
2101 inline bool isa_multi_aff() const;
2102 inline isl::multi_val max_multi_val() const;
2103 inline isl::multi_val min_multi_val() const;
2104 inline unsigned n_piece() const;
2105 inline isl::pw_multi_aff product(isl::pw_multi_aff pma2) const;
2106 inline isl::pw_multi_aff pullback(isl::multi_aff ma) const;
2107 inline isl::pw_multi_aff pullback(isl::pw_multi_aff pma2) const;
2108 inline isl::pw_multi_aff range_factor_domain() const;
2109 inline isl::pw_multi_aff range_factor_range() const;
2110 static inline isl::pw_multi_aff range_map(isl::space space);
2111 inline isl::pw_multi_aff range_product(isl::pw_multi_aff pma2) const;
2112 inline isl::pw_multi_aff scale(isl::val v) const;
2113 inline isl::pw_multi_aff scale(long v) const;
2114 inline isl::pw_multi_aff scale_down(isl::val v) const;
2115 inline isl::pw_multi_aff scale_down(long v) const;
2116 inline isl::pw_multi_aff sub(isl::pw_multi_aff pma2) const;
2117 inline isl::pw_multi_aff subtract_domain(isl::set set) const;
2118 inline isl::pw_multi_aff union_add(isl::pw_multi_aff pma2) const;
2119 static inline isl::pw_multi_aff zero(isl::space space);
2120};
2121
2122// declarations for isl::pw_multi_aff_list
2123inline pw_multi_aff_list manage(__isl_take isl_pw_multi_aff_list *ptr);
2124inline pw_multi_aff_list manage_copy(__isl_keep isl_pw_multi_aff_list *ptr);
2125
2126class pw_multi_aff_list {
2127 friend inline pw_multi_aff_list manage(__isl_take isl_pw_multi_aff_list *ptr);
2128 friend inline pw_multi_aff_list manage_copy(__isl_keep isl_pw_multi_aff_list *ptr);
2129
2130protected:
2131 isl_pw_multi_aff_list *ptr = nullptr;
2132
2133 inline explicit pw_multi_aff_list(__isl_take isl_pw_multi_aff_list *ptr);
2134
2135public:
2136 inline /* implicit */ pw_multi_aff_list();
2137 inline /* implicit */ pw_multi_aff_list(const pw_multi_aff_list &obj);
2138 inline explicit pw_multi_aff_list(isl::ctx ctx, int n);
2139 inline explicit pw_multi_aff_list(isl::pw_multi_aff el);
2140 inline pw_multi_aff_list &operator=(pw_multi_aff_list obj);
2141 inline ~pw_multi_aff_list();
2142 inline __isl_give isl_pw_multi_aff_list *copy() const &;
2143 inline __isl_give isl_pw_multi_aff_list *copy() && = delete;
2144 inline __isl_keep isl_pw_multi_aff_list *get() const;
2145 inline __isl_give isl_pw_multi_aff_list *release();
2146 inline bool is_null() const;
2147 inline isl::ctx ctx() const;
2148
2149 inline isl::pw_multi_aff_list add(isl::pw_multi_aff el) const;
2150 inline isl::pw_multi_aff_list clear() const;
2151 inline isl::pw_multi_aff_list concat(isl::pw_multi_aff_list list2) const;
2152 inline isl::pw_multi_aff_list drop(unsigned int first, unsigned int n) const;
2153 inline void foreach(const std::function<void(isl::pw_multi_aff)> &fn) const;
2154 inline isl::pw_multi_aff at(int index) const;
2155 inline isl::pw_multi_aff get_at(int index) const;
2156 inline isl::pw_multi_aff_list insert(unsigned int pos, isl::pw_multi_aff el) const;
2157 inline unsigned size() const;
2158};
2159
2160// declarations for isl::schedule
2161inline schedule manage(__isl_take isl_schedule *ptr);
2162inline schedule manage_copy(__isl_keep isl_schedule *ptr);
2163
2164class schedule {
2165 friend inline schedule manage(__isl_take isl_schedule *ptr);
2166 friend inline schedule manage_copy(__isl_keep isl_schedule *ptr);
2167
2168protected:
2169 isl_schedule *ptr = nullptr;
2170
2171 inline explicit schedule(__isl_take isl_schedule *ptr);
2172
2173public:
2174 inline /* implicit */ schedule();
2175 inline /* implicit */ schedule(const schedule &obj);
2176 inline explicit schedule(isl::ctx ctx, const std::string &str);
2177 inline schedule &operator=(schedule obj);
2178 inline ~schedule();
2179 inline __isl_give isl_schedule *copy() const &;
2180 inline __isl_give isl_schedule *copy() && = delete;
2181 inline __isl_keep isl_schedule *get() const;
2182 inline __isl_give isl_schedule *release();
2183 inline bool is_null() const;
2184 inline isl::ctx ctx() const;
2185
2186 static inline isl::schedule from_domain(isl::union_set domain);
2187 inline isl::union_map map() const;
2188 inline isl::union_map get_map() const;
2189 inline isl::schedule_node root() const;
2190 inline isl::schedule_node get_root() const;
2191 inline isl::schedule pullback(isl::union_pw_multi_aff upma) const;
2192};
2193
2194// declarations for isl::schedule_constraints
2195inline schedule_constraints manage(__isl_take isl_schedule_constraints *ptr);
2196inline schedule_constraints manage_copy(__isl_keep isl_schedule_constraints *ptr);
2197
2198class schedule_constraints {
2199 friend inline schedule_constraints manage(__isl_take isl_schedule_constraints *ptr);
2200 friend inline schedule_constraints manage_copy(__isl_keep isl_schedule_constraints *ptr);
2201
2202protected:
2203 isl_schedule_constraints *ptr = nullptr;
2204
2205 inline explicit schedule_constraints(__isl_take isl_schedule_constraints *ptr);
2206
2207public:
2208 inline /* implicit */ schedule_constraints();
2209 inline /* implicit */ schedule_constraints(const schedule_constraints &obj);
2210 inline explicit schedule_constraints(isl::ctx ctx, const std::string &str);
2211 inline schedule_constraints &operator=(schedule_constraints obj);
2212 inline ~schedule_constraints();
2213 inline __isl_give isl_schedule_constraints *copy() const &;
2214 inline __isl_give isl_schedule_constraints *copy() && = delete;
2215 inline __isl_keep isl_schedule_constraints *get() const;
2216 inline __isl_give isl_schedule_constraints *release();
2217 inline bool is_null() const;
2218 inline isl::ctx ctx() const;
2219
2220 inline isl::schedule compute_schedule() const;
2221 inline isl::union_map coincidence() const;
2222 inline isl::union_map get_coincidence() const;
2223 inline isl::union_map conditional_validity() const;
2224 inline isl::union_map get_conditional_validity() const;
2225 inline isl::union_map conditional_validity_condition() const;
2226 inline isl::union_map get_conditional_validity_condition() const;
2227 inline isl::set context() const;
2228 inline isl::set get_context() const;
2229 inline isl::union_set domain() const;
2230 inline isl::union_set get_domain() const;
2231 inline isl::union_map proximity() const;
2232 inline isl::union_map get_proximity() const;
2233 inline isl::union_map validity() const;
2234 inline isl::union_map get_validity() const;
2235 static inline isl::schedule_constraints on_domain(isl::union_set domain);
2236 inline isl::schedule_constraints set_coincidence(isl::union_map coincidence) const;
2237 inline isl::schedule_constraints set_conditional_validity(isl::union_map condition, isl::union_map validity) const;
2238 inline isl::schedule_constraints set_context(isl::set context) const;
2239 inline isl::schedule_constraints set_proximity(isl::union_map proximity) const;
2240 inline isl::schedule_constraints set_validity(isl::union_map validity) const;
2241};
2242
2243// declarations for isl::schedule_node
2244inline schedule_node manage(__isl_take isl_schedule_node *ptr);
2245inline schedule_node manage_copy(__isl_keep isl_schedule_node *ptr);
2246
2247class schedule_node {
2248 friend inline schedule_node manage(__isl_take isl_schedule_node *ptr);
2249 friend inline schedule_node manage_copy(__isl_keep isl_schedule_node *ptr);
2250
2251protected:
2252 isl_schedule_node *ptr = nullptr;
2253
2254 inline explicit schedule_node(__isl_take isl_schedule_node *ptr);
2255
2256public:
2257 inline /* implicit */ schedule_node();
2258 inline /* implicit */ schedule_node(const schedule_node &obj);
2259 inline schedule_node &operator=(schedule_node obj);
2260 inline ~schedule_node();
2261 inline __isl_give isl_schedule_node *copy() const &;
2262 inline __isl_give isl_schedule_node *copy() && = delete;
2263 inline __isl_keep isl_schedule_node *get() const;
2264 inline __isl_give isl_schedule_node *release();
2265 inline bool is_null() const;
2266private:
2267 template <typename T,
2268 typename = typename std::enable_if<std::is_same<
2269 const decltype(isl_schedule_node_get_type(NULL)),
2270 const T>::value>::type>
2271 inline bool isa_type(T subtype) const;
2272public:
2273 template <class T> inline bool isa() const;
2274 template <class T> inline T as() const;
2275 inline isl::ctx ctx() const;
2276
2277 inline isl::schedule_node ancestor(int generation) const;
2278 inline isl::schedule_node child(int pos) const;
2279 inline bool every_descendant(const std::function<bool(isl::schedule_node)> &test) const;
2280 inline isl::schedule_node first_child() const;
2281 inline void foreach_ancestor_top_down(const std::function<void(isl::schedule_node)> &fn) const;
2282 inline void foreach_descendant_top_down(const std::function<bool(isl::schedule_node)> &fn) const;
2283 static inline isl::schedule_node from_domain(isl::union_set domain);
2284 static inline isl::schedule_node from_extension(isl::union_map extension);
2285 inline unsigned ancestor_child_position(const isl::schedule_node &ancestor) const;
2286 inline unsigned get_ancestor_child_position(const isl::schedule_node &ancestor) const;
2287 inline unsigned child_position() const;
2288 inline unsigned get_child_position() const;
2289 inline isl::multi_union_pw_aff prefix_schedule_multi_union_pw_aff() const;
2290 inline isl::multi_union_pw_aff get_prefix_schedule_multi_union_pw_aff() const;
2291 inline isl::union_map prefix_schedule_union_map() const;
2292 inline isl::union_map get_prefix_schedule_union_map() const;
2293 inline isl::union_pw_multi_aff prefix_schedule_union_pw_multi_aff() const;
2294 inline isl::union_pw_multi_aff get_prefix_schedule_union_pw_multi_aff() const;
2295 inline isl::schedule schedule() const;
2296 inline isl::schedule get_schedule() const;
2297 inline isl::schedule_node shared_ancestor(const isl::schedule_node &node2) const;
2298 inline isl::schedule_node get_shared_ancestor(const isl::schedule_node &node2) const;
2299 inline unsigned tree_depth() const;
2300 inline unsigned get_tree_depth() const;
2301 inline isl::schedule_node graft_after(isl::schedule_node graft) const;
2302 inline isl::schedule_node graft_before(isl::schedule_node graft) const;
2303 inline bool has_children() const;
2304 inline bool has_next_sibling() const;
2305 inline bool has_parent() const;
2306 inline bool has_previous_sibling() const;
2307 inline isl::schedule_node insert_context(isl::set context) const;
2308 inline isl::schedule_node insert_filter(isl::union_set filter) const;
2309 inline isl::schedule_node insert_guard(isl::set context) const;
2310 inline isl::schedule_node insert_mark(isl::id mark) const;
2311 inline isl::schedule_node insert_mark(const std::string &mark) const;
2312 inline isl::schedule_node insert_partial_schedule(isl::multi_union_pw_aff schedule) const;
2313 inline isl::schedule_node insert_sequence(isl::union_set_list filters) const;
2314 inline isl::schedule_node insert_set(isl::union_set_list filters) const;
2315 inline bool is_equal(const isl::schedule_node &node2) const;
2316 inline bool is_subtree_anchored() const;
2317 inline isl::schedule_node map_descendant_bottom_up(const std::function<isl::schedule_node(isl::schedule_node)> &fn) const;
2318 inline unsigned n_children() const;
2319 inline isl::schedule_node next_sibling() const;
2320 inline isl::schedule_node order_after(isl::union_set filter) const;
2321 inline isl::schedule_node order_before(isl::union_set filter) const;
2322 inline isl::schedule_node parent() const;
2323 inline isl::schedule_node previous_sibling() const;
2324 inline isl::schedule_node root() const;
2325};
2326
2327// declarations for isl::schedule_node_band
2328
2329class schedule_node_band : public schedule_node {
2330 template <class T>
2331 friend bool schedule_node::isa() const;
2332 friend schedule_node_band schedule_node::as<schedule_node_band>() const;
2333 static const auto type = isl_schedule_node_band;
2334
2335protected:
2336 inline explicit schedule_node_band(__isl_take isl_schedule_node *ptr);
2337
2338public:
2339 inline /* implicit */ schedule_node_band();
2340 inline /* implicit */ schedule_node_band(const schedule_node_band &obj);
2341 inline schedule_node_band &operator=(schedule_node_band obj);
2342 inline isl::ctx ctx() const;
2343
2344 inline isl::union_set ast_build_options() const;
2345 inline isl::union_set get_ast_build_options() const;
2346 inline isl::set ast_isolate_option() const;
2347 inline isl::set get_ast_isolate_option() const;
2348 inline isl::multi_union_pw_aff partial_schedule() const;
2349 inline isl::multi_union_pw_aff get_partial_schedule() const;
2350 inline bool permutable() const;
2351 inline bool get_permutable() const;
2352 inline bool member_get_coincident(int pos) const;
2353 inline schedule_node_band member_set_coincident(int pos, int coincident) const;
2354 inline schedule_node_band mod(isl::multi_val mv) const;
2355 inline unsigned n_member() const;
2356 inline schedule_node_band scale(isl::multi_val mv) const;
2357 inline schedule_node_band scale_down(isl::multi_val mv) const;
2358 inline schedule_node_band set_ast_build_options(isl::union_set options) const;
2359 inline schedule_node_band set_permutable(int permutable) const;
2360 inline schedule_node_band shift(isl::multi_union_pw_aff shift) const;
2361 inline schedule_node_band split(int pos) const;
2362 inline schedule_node_band tile(isl::multi_val sizes) const;
2363 inline schedule_node_band member_set_ast_loop_default(int pos) const;
2364 inline schedule_node_band member_set_ast_loop_atomic(int pos) const;
2365 inline schedule_node_band member_set_ast_loop_unroll(int pos) const;
2366 inline schedule_node_band member_set_ast_loop_separate(int pos) const;
2367};
2368
2369// declarations for isl::schedule_node_context
2370
2371class schedule_node_context : public schedule_node {
2372 template <class T>
2373 friend bool schedule_node::isa() const;
2374 friend schedule_node_context schedule_node::as<schedule_node_context>() const;
2375 static const auto type = isl_schedule_node_context;
2376
2377protected:
2378 inline explicit schedule_node_context(__isl_take isl_schedule_node *ptr);
2379
2380public:
2381 inline /* implicit */ schedule_node_context();
2382 inline /* implicit */ schedule_node_context(const schedule_node_context &obj);
2383 inline schedule_node_context &operator=(schedule_node_context obj);
2384 inline isl::ctx ctx() const;
2385
2386 inline isl::set context() const;
2387 inline isl::set get_context() const;
2388};
2389
2390// declarations for isl::schedule_node_domain
2391
2392class schedule_node_domain : public schedule_node {
2393 template <class T>
2394 friend bool schedule_node::isa() const;
2395 friend schedule_node_domain schedule_node::as<schedule_node_domain>() const;
2396 static const auto type = isl_schedule_node_domain;
2397
2398protected:
2399 inline explicit schedule_node_domain(__isl_take isl_schedule_node *ptr);
2400
2401public:
2402 inline /* implicit */ schedule_node_domain();
2403 inline /* implicit */ schedule_node_domain(const schedule_node_domain &obj);
2404 inline schedule_node_domain &operator=(schedule_node_domain obj);
2405 inline isl::ctx ctx() const;
2406
2407 inline isl::union_set domain() const;
2408 inline isl::union_set get_domain() const;
2409};
2410
2411// declarations for isl::schedule_node_expansion
2412
2413class schedule_node_expansion : public schedule_node {
2414 template <class T>
2415 friend bool schedule_node::isa() const;
2416 friend schedule_node_expansion schedule_node::as<schedule_node_expansion>() const;
2417 static const auto type = isl_schedule_node_expansion;
2418
2419protected:
2420 inline explicit schedule_node_expansion(__isl_take isl_schedule_node *ptr);
2421
2422public:
2423 inline /* implicit */ schedule_node_expansion();
2424 inline /* implicit */ schedule_node_expansion(const schedule_node_expansion &obj);
2425 inline schedule_node_expansion &operator=(schedule_node_expansion obj);
2426 inline isl::ctx ctx() const;
2427
2428 inline isl::union_pw_multi_aff contraction() const;
2429 inline isl::union_pw_multi_aff get_contraction() const;
2430 inline isl::union_map expansion() const;
2431 inline isl::union_map get_expansion() const;
2432};
2433
2434// declarations for isl::schedule_node_extension
2435
2436class schedule_node_extension : public schedule_node {
2437 template <class T>
2438 friend bool schedule_node::isa() const;
2439 friend schedule_node_extension schedule_node::as<schedule_node_extension>() const;
2440 static const auto type = isl_schedule_node_extension;
2441
2442protected:
2443 inline explicit schedule_node_extension(__isl_take isl_schedule_node *ptr);
2444
2445public:
2446 inline /* implicit */ schedule_node_extension();
2447 inline /* implicit */ schedule_node_extension(const schedule_node_extension &obj);
2448 inline schedule_node_extension &operator=(schedule_node_extension obj);
2449 inline isl::ctx ctx() const;
2450
2451 inline isl::union_map extension() const;
2452 inline isl::union_map get_extension() const;
2453};
2454
2455// declarations for isl::schedule_node_filter
2456
2457class schedule_node_filter : public schedule_node {
2458 template <class T>
2459 friend bool schedule_node::isa() const;
2460 friend schedule_node_filter schedule_node::as<schedule_node_filter>() const;
2461 static const auto type = isl_schedule_node_filter;
2462
2463protected:
2464 inline explicit schedule_node_filter(__isl_take isl_schedule_node *ptr);
2465
2466public:
2467 inline /* implicit */ schedule_node_filter();
2468 inline /* implicit */ schedule_node_filter(const schedule_node_filter &obj);
2469 inline schedule_node_filter &operator=(schedule_node_filter obj);
2470 inline isl::ctx ctx() const;
2471
2472 inline isl::union_set filter() const;
2473 inline isl::union_set get_filter() const;
2474};
2475
2476// declarations for isl::schedule_node_guard
2477
2478class schedule_node_guard : public schedule_node {
2479 template <class T>
2480 friend bool schedule_node::isa() const;
2481 friend schedule_node_guard schedule_node::as<schedule_node_guard>() const;
2482 static const auto type = isl_schedule_node_guard;
2483
2484protected:
2485 inline explicit schedule_node_guard(__isl_take isl_schedule_node *ptr);
2486
2487public:
2488 inline /* implicit */ schedule_node_guard();
2489 inline /* implicit */ schedule_node_guard(const schedule_node_guard &obj);
2490 inline schedule_node_guard &operator=(schedule_node_guard obj);
2491 inline isl::ctx ctx() const;
2492
2493 inline isl::set guard() const;
2494 inline isl::set get_guard() const;
2495};
2496
2497// declarations for isl::schedule_node_leaf
2498
2499class schedule_node_leaf : public schedule_node {
2500 template <class T>
2501 friend bool schedule_node::isa() const;
2502 friend schedule_node_leaf schedule_node::as<schedule_node_leaf>() const;
2503 static const auto type = isl_schedule_node_leaf;
2504
2505protected:
2506 inline explicit schedule_node_leaf(__isl_take isl_schedule_node *ptr);
2507
2508public:
2509 inline /* implicit */ schedule_node_leaf();
2510 inline /* implicit */ schedule_node_leaf(const schedule_node_leaf &obj);
2511 inline schedule_node_leaf &operator=(schedule_node_leaf obj);
2512 inline isl::ctx ctx() const;
2513
2514};
2515
2516// declarations for isl::schedule_node_mark
2517
2518class schedule_node_mark : public schedule_node {
2519 template <class T>
2520 friend bool schedule_node::isa() const;
2521 friend schedule_node_mark schedule_node::as<schedule_node_mark>() const;
2522 static const auto type = isl_schedule_node_mark;
2523
2524protected:
2525 inline explicit schedule_node_mark(__isl_take isl_schedule_node *ptr);
2526
2527public:
2528 inline /* implicit */ schedule_node_mark();
2529 inline /* implicit */ schedule_node_mark(const schedule_node_mark &obj);
2530 inline schedule_node_mark &operator=(schedule_node_mark obj);
2531 inline isl::ctx ctx() const;
2532
2533};
2534
2535// declarations for isl::schedule_node_sequence
2536
2537class schedule_node_sequence : public schedule_node {
2538 template <class T>
2539 friend bool schedule_node::isa() const;
2540 friend schedule_node_sequence schedule_node::as<schedule_node_sequence>() const;
2541 static const auto type = isl_schedule_node_sequence;
2542
2543protected:
2544 inline explicit schedule_node_sequence(__isl_take isl_schedule_node *ptr);
2545
2546public:
2547 inline /* implicit */ schedule_node_sequence();
2548 inline /* implicit */ schedule_node_sequence(const schedule_node_sequence &obj);
2549 inline schedule_node_sequence &operator=(schedule_node_sequence obj);
2550 inline isl::ctx ctx() const;
2551
2552};
2553
2554// declarations for isl::schedule_node_set
2555
2556class schedule_node_set : public schedule_node {
2557 template <class T>
2558 friend bool schedule_node::isa() const;
2559 friend schedule_node_set schedule_node::as<schedule_node_set>() const;
2560 static const auto type = isl_schedule_node_set;
2561
2562protected:
2563 inline explicit schedule_node_set(__isl_take isl_schedule_node *ptr);
2564
2565public:
2566 inline /* implicit */ schedule_node_set();
2567 inline /* implicit */ schedule_node_set(const schedule_node_set &obj);
2568 inline schedule_node_set &operator=(schedule_node_set obj);
2569 inline isl::ctx ctx() const;
2570
2571};
2572
2573// declarations for isl::set
2574inline set manage(__isl_take isl_set *ptr);
2575inline set manage_copy(__isl_keep isl_set *ptr);
2576
2577class set {
2578 friend inline set manage(__isl_take isl_set *ptr);
2579 friend inline set manage_copy(__isl_keep isl_set *ptr);
2580
2581protected:
2582 isl_set *ptr = nullptr;
2583
2584 inline explicit set(__isl_take isl_set *ptr);
2585
2586public:
2587 inline /* implicit */ set();
2588 inline /* implicit */ set(const set &obj);
2589 inline /* implicit */ set(isl::basic_set bset);
2590 inline /* implicit */ set(isl::point pnt);
2591 inline explicit set(isl::ctx ctx, const std::string &str);
2592 inline set &operator=(set obj);
2593 inline ~set();
2594 inline __isl_give isl_set *copy() const &;
2595 inline __isl_give isl_set *copy() && = delete;
2596 inline __isl_keep isl_set *get() const;
2597 inline __isl_give isl_set *release();
2598 inline bool is_null() const;
2599 inline isl::ctx ctx() const;
2600
2601 inline isl::basic_set affine_hull() const;
2602 inline isl::set apply(isl::map map) const;
2603 inline isl::set bind(isl::multi_id tuple) const;
2604 inline isl::set coalesce() const;
2605 inline isl::set complement() const;
2606 inline isl::set detect_equalities() const;
2607 inline isl::val dim_max_val(int pos) const;
2608 inline isl::val dim_min_val(int pos) const;
2609 static inline isl::set empty(isl::space space);
2610 inline isl::set flatten() const;
2611 inline void foreach_basic_set(const std::function<void(isl::basic_set)> &fn) const;
2612 inline void foreach_point(const std::function<void(isl::point)> &fn) const;
2613 inline isl::multi_val plain_multi_val_if_fixed() const;
2614 inline isl::multi_val get_plain_multi_val_if_fixed() const;
2615 inline isl::fixed_box simple_fixed_box_hull() const;
2616 inline isl::fixed_box get_simple_fixed_box_hull() const;
2617 inline isl::space space() const;
2618 inline isl::space get_space() const;
2619 inline isl::val stride(int pos) const;
2620 inline isl::val get_stride(int pos) const;
2621 inline isl::set gist(isl::set context) const;
2622 inline isl::map identity() const;
2623 inline isl::pw_aff indicator_function() const;
2624 inline isl::map insert_domain(isl::space domain) const;
2625 inline isl::set intersect(isl::set set2) const;
2626 inline isl::set intersect_params(isl::set params) const;
2627 inline bool involves_locals() const;
2628 inline bool is_disjoint(const isl::set &set2) const;
2629 inline bool is_empty() const;
2630 inline bool is_equal(const isl::set &set2) const;
2631 inline bool is_singleton() const;
2632 inline bool is_strict_subset(const isl::set &set2) const;
2633 inline bool is_subset(const isl::set &set2) const;
2634 inline bool is_wrapping() const;
2635 inline isl::set lexmax() const;
2636 inline isl::pw_multi_aff lexmax_pw_multi_aff() const;
2637 inline isl::set lexmin() const;
2638 inline isl::pw_multi_aff lexmin_pw_multi_aff() const;
2639 inline isl::set lower_bound(isl::multi_pw_aff lower) const;
2640 inline isl::set lower_bound(isl::multi_val lower) const;
2641 inline isl::multi_pw_aff max_multi_pw_aff() const;
2642 inline isl::val max_val(const isl::aff &obj) const;
2643 inline isl::multi_pw_aff min_multi_pw_aff() const;
2644 inline isl::val min_val(const isl::aff &obj) const;
2645 inline isl::set params() const;
2646 inline isl::basic_set polyhedral_hull() const;
2647 inline isl::set preimage(isl::multi_aff ma) const;
2648 inline isl::set preimage(isl::multi_pw_aff mpa) const;
2649 inline isl::set preimage(isl::pw_multi_aff pma) const;
2650 inline isl::set product(isl::set set2) const;
2651 inline isl::set project_out_all_params() const;
2652 inline isl::set project_out_param(isl::id id) const;
2653 inline isl::set project_out_param(const std::string &id) const;
2654 inline isl::set project_out_param(isl::id_list list) const;
2655 inline isl::basic_set sample() const;
2656 inline isl::point sample_point() const;
2657 inline isl::set subtract(isl::set set2) const;
2658 inline isl::set unbind_params(isl::multi_id tuple) const;
2659 inline isl::map unbind_params_insert_domain(isl::multi_id domain) const;
2660 inline isl::set unite(isl::set set2) const;
2661 static inline isl::set universe(isl::space space);
2662 inline isl::basic_set unshifted_simple_hull() const;
2663 inline isl::map unwrap() const;
2664 inline isl::set upper_bound(isl::multi_pw_aff upper) const;
2665 inline isl::set upper_bound(isl::multi_val upper) const;
2666};
2667
2668// declarations for isl::space
2669inline space manage(__isl_take isl_space *ptr);
2670inline space manage_copy(__isl_keep isl_space *ptr);
2671
2672class space {
2673 friend inline space manage(__isl_take isl_space *ptr);
2674 friend inline space manage_copy(__isl_keep isl_space *ptr);
2675
2676protected:
2677 isl_space *ptr = nullptr;
2678
2679 inline explicit space(__isl_take isl_space *ptr);
2680
2681public:
2682 inline /* implicit */ space();
2683 inline /* implicit */ space(const space &obj);
2684 inline space &operator=(space obj);
2685 inline ~space();
2686 inline __isl_give isl_space *copy() const &;
2687 inline __isl_give isl_space *copy() && = delete;
2688 inline __isl_keep isl_space *get() const;
2689 inline __isl_give isl_space *release();
2690 inline bool is_null() const;
2691 inline isl::ctx ctx() const;
2692
2693 inline isl::space add_named_tuple(isl::id tuple_id, unsigned int dim) const;
2694 inline isl::space add_named_tuple(const std::string &tuple_id, unsigned int dim) const;
2695 inline isl::space add_unnamed_tuple(unsigned int dim) const;
2696 inline isl::space domain() const;
2697 inline isl::space flatten_domain() const;
2698 inline isl::space flatten_range() const;
2699 inline bool is_equal(const isl::space &space2) const;
2700 inline bool is_wrapping() const;
2701 inline isl::space map_from_set() const;
2702 inline isl::space params() const;
2703 inline isl::space range() const;
2704 static inline isl::space unit(isl::ctx ctx);
2705 inline isl::space unwrap() const;
2706 inline isl::space wrap() const;
2707};
2708
2709// declarations for isl::union_access_info
2710inline union_access_info manage(__isl_take isl_union_access_info *ptr);
2711inline union_access_info manage_copy(__isl_keep isl_union_access_info *ptr);
2712
2713class union_access_info {
2714 friend inline union_access_info manage(__isl_take isl_union_access_info *ptr);
2715 friend inline union_access_info manage_copy(__isl_keep isl_union_access_info *ptr);
2716
2717protected:
2718 isl_union_access_info *ptr = nullptr;
2719
2720 inline explicit union_access_info(__isl_take isl_union_access_info *ptr);
2721
2722public:
2723 inline /* implicit */ union_access_info();
2724 inline /* implicit */ union_access_info(const union_access_info &obj);
2725 inline explicit union_access_info(isl::union_map sink);
2726 inline union_access_info &operator=(union_access_info obj);
2727 inline ~union_access_info();
2728 inline __isl_give isl_union_access_info *copy() const &;
2729 inline __isl_give isl_union_access_info *copy() && = delete;
2730 inline __isl_keep isl_union_access_info *get() const;
2731 inline __isl_give isl_union_access_info *release();
2732 inline bool is_null() const;
2733 inline isl::ctx ctx() const;
2734
2735 inline isl::union_flow compute_flow() const;
2736 inline isl::union_access_info set_kill(isl::union_map kill) const;
2737 inline isl::union_access_info set_may_source(isl::union_map may_source) const;
2738 inline isl::union_access_info set_must_source(isl::union_map must_source) const;
2739 inline isl::union_access_info set_schedule(isl::schedule schedule) const;
2740 inline isl::union_access_info set_schedule_map(isl::union_map schedule_map) const;
2741};
2742
2743// declarations for isl::union_flow
2744inline union_flow manage(__isl_take isl_union_flow *ptr);
2745inline union_flow manage_copy(__isl_keep isl_union_flow *ptr);
2746
2747class union_flow {
2748 friend inline union_flow manage(__isl_take isl_union_flow *ptr);
2749 friend inline union_flow manage_copy(__isl_keep isl_union_flow *ptr);
2750
2751protected:
2752 isl_union_flow *ptr = nullptr;
2753
2754 inline explicit union_flow(__isl_take isl_union_flow *ptr);
2755
2756public:
2757 inline /* implicit */ union_flow();
2758 inline /* implicit */ union_flow(const union_flow &obj);
2759 inline union_flow &operator=(union_flow obj);
2760 inline ~union_flow();
2761 inline __isl_give isl_union_flow *copy() const &;
2762 inline __isl_give isl_union_flow *copy() && = delete;
2763 inline __isl_keep isl_union_flow *get() const;
2764 inline __isl_give isl_union_flow *release();
2765 inline bool is_null() const;
2766 inline isl::ctx ctx() const;
2767
2768 inline isl::union_map full_may_dependence() const;
2769 inline isl::union_map get_full_may_dependence() const;
2770 inline isl::union_map full_must_dependence() const;
2771 inline isl::union_map get_full_must_dependence() const;
2772 inline isl::union_map may_dependence() const;
2773 inline isl::union_map get_may_dependence() const;
2774 inline isl::union_map may_no_source() const;
2775 inline isl::union_map get_may_no_source() const;
2776 inline isl::union_map must_dependence() const;
2777 inline isl::union_map get_must_dependence() const;
2778 inline isl::union_map must_no_source() const;
2779 inline isl::union_map get_must_no_source() const;
2780};
2781
2782// declarations for isl::union_map
2783inline union_map manage(__isl_take isl_union_map *ptr);
2784inline union_map manage_copy(__isl_keep isl_union_map *ptr);
2785
2786class union_map {
2787 friend inline union_map manage(__isl_take isl_union_map *ptr);
2788 friend inline union_map manage_copy(__isl_keep isl_union_map *ptr);
2789
2790protected:
2791 isl_union_map *ptr = nullptr;
2792
2793 inline explicit union_map(__isl_take isl_union_map *ptr);
2794
2795public:
2796 inline /* implicit */ union_map();
2797 inline /* implicit */ union_map(const union_map &obj);
2798 inline /* implicit */ union_map(isl::basic_map bmap);
2799 inline /* implicit */ union_map(isl::map map);
2800 inline explicit union_map(isl::ctx ctx, const std::string &str);
2801 inline union_map &operator=(union_map obj);
2802 inline ~union_map();
2803 inline __isl_give isl_union_map *copy() const &;
2804 inline __isl_give isl_union_map *copy() && = delete;
2805 inline __isl_keep isl_union_map *get() const;
2806 inline __isl_give isl_union_map *release();
2807 inline bool is_null() const;
2808 inline isl::ctx ctx() const;
2809
2810 inline isl::union_map affine_hull() const;
2811 inline isl::union_map apply_domain(isl::union_map umap2) const;
2812 inline isl::union_map apply_range(isl::union_map umap2) const;
2813 inline isl::union_set bind_range(isl::multi_id tuple) const;
2814 inline isl::union_map coalesce() const;
2815 inline isl::union_map compute_divs() const;
2816 inline isl::union_map curry() const;
2817 inline isl::union_set deltas() const;
2818 inline isl::union_map detect_equalities() const;
2819 inline isl::union_set domain() const;
2820 inline isl::union_map domain_factor_domain() const;
2821 inline isl::union_map domain_factor_range() const;
2822 inline isl::union_map domain_map() const;
2823 inline isl::union_pw_multi_aff domain_map_union_pw_multi_aff() const;
2824 inline isl::union_map domain_product(isl::union_map umap2) const;
2825 static inline isl::union_map empty(isl::ctx ctx);
2826 inline isl::union_map eq_at(isl::multi_union_pw_aff mupa) const;
2827 inline bool every_map(const std::function<bool(isl::map)> &test) const;
2828 inline isl::map extract_map(isl::space space) const;
2829 inline isl::union_map factor_domain() const;
2830 inline isl::union_map factor_range() const;
2831 inline isl::union_map fixed_power(isl::val exp) const;
2832 inline isl::union_map fixed_power(long exp) const;
2833 inline void foreach_map(const std::function<void(isl::map)> &fn) const;
2834 static inline isl::union_map from(isl::multi_union_pw_aff mupa);
2835 static inline isl::union_map from(isl::union_pw_multi_aff upma);
2836 static inline isl::union_map from_domain(isl::union_set uset);
2837 static inline isl::union_map from_domain_and_range(isl::union_set domain, isl::union_set range);
2838 static inline isl::union_map from_range(isl::union_set uset);
2839 inline isl::space space() const;
2840 inline isl::space get_space() const;
2841 inline isl::union_map gist(isl::union_map context) const;
2842 inline isl::union_map gist_domain(isl::union_set uset) const;
2843 inline isl::union_map gist_params(isl::set set) const;
2844 inline isl::union_map gist_range(isl::union_set uset) const;
2845 inline isl::union_map intersect(isl::union_map umap2) const;
2846 inline isl::union_map intersect_domain(isl::space space) const;
2847 inline isl::union_map intersect_domain(isl::union_set uset) const;
2848 inline isl::union_map intersect_params(isl::set set) const;
2849 inline isl::union_map intersect_range(isl::space space) const;
2850 inline isl::union_map intersect_range(isl::union_set uset) const;
2851 inline bool is_bijective() const;
2852 inline bool is_disjoint(const isl::union_map &umap2) const;
2853 inline bool is_empty() const;
2854 inline bool is_equal(const isl::union_map &umap2) const;
2855 inline bool is_injective() const;
2856 inline bool is_single_valued() const;
2857 inline bool is_strict_subset(const isl::union_map &umap2) const;
2858 inline bool is_subset(const isl::union_map &umap2) const;
2859 inline bool isa_map() const;
2860 inline isl::union_map lexmax() const;
2861 inline isl::union_map lexmin() const;
2862 inline isl::union_map polyhedral_hull() const;
2863 inline isl::union_map preimage_domain(isl::multi_aff ma) const;
2864 inline isl::union_map preimage_domain(isl::multi_pw_aff mpa) const;
2865 inline isl::union_map preimage_domain(isl::pw_multi_aff pma) const;
2866 inline isl::union_map preimage_domain(isl::union_pw_multi_aff upma) const;
2867 inline isl::union_map preimage_range(isl::multi_aff ma) const;
2868 inline isl::union_map preimage_range(isl::pw_multi_aff pma) const;
2869 inline isl::union_map preimage_range(isl::union_pw_multi_aff upma) const;
2870 inline isl::union_map product(isl::union_map umap2) const;
2871 inline isl::union_map project_out_all_params() const;
2872 inline isl::union_set range() const;
2873 inline isl::union_map range_factor_domain() const;
2874 inline isl::union_map range_factor_range() const;
2875 inline isl::union_map range_map() const;
2876 inline isl::union_map range_product(isl::union_map umap2) const;
2877 inline isl::union_map range_reverse() const;
2878 inline isl::union_map reverse() const;
2879 inline isl::union_map subtract(isl::union_map umap2) const;
2880 inline isl::union_map subtract_domain(isl::union_set dom) const;
2881 inline isl::union_map subtract_range(isl::union_set dom) const;
2882 inline isl::union_map uncurry() const;
2883 inline isl::union_map unite(isl::union_map umap2) const;
2884 inline isl::union_map universe() const;
2885 inline isl::union_set wrap() const;
2886 inline isl::union_map zip() const;
2887};
2888
2889// declarations for isl::union_pw_aff
2890inline union_pw_aff manage(__isl_take isl_union_pw_aff *ptr);
2891inline union_pw_aff manage_copy(__isl_keep isl_union_pw_aff *ptr);
2892
2893class union_pw_aff {
2894 friend inline union_pw_aff manage(__isl_take isl_union_pw_aff *ptr);
2895 friend inline union_pw_aff manage_copy(__isl_keep isl_union_pw_aff *ptr);
2896
2897protected:
2898 isl_union_pw_aff *ptr = nullptr;
2899
2900 inline explicit union_pw_aff(__isl_take isl_union_pw_aff *ptr);
2901
2902public:
2903 inline /* implicit */ union_pw_aff();
2904 inline /* implicit */ union_pw_aff(const union_pw_aff &obj);
2905 inline /* implicit */ union_pw_aff(isl::aff aff);
2906 inline /* implicit */ union_pw_aff(isl::pw_aff pa);
2907 inline explicit union_pw_aff(isl::ctx ctx, const std::string &str);
2908 inline union_pw_aff &operator=(union_pw_aff obj);
2909 inline ~union_pw_aff();
2910 inline __isl_give isl_union_pw_aff *copy() const &;
2911 inline __isl_give isl_union_pw_aff *copy() && = delete;
2912 inline __isl_keep isl_union_pw_aff *get() const;
2913 inline __isl_give isl_union_pw_aff *release();
2914 inline bool is_null() const;
2915 inline isl::ctx ctx() const;
2916
2917 inline isl::union_pw_aff add(isl::union_pw_aff upa2) const;
2918 inline isl::union_set bind(isl::id id) const;
2919 inline isl::union_set bind(const std::string &id) const;
2920 inline isl::union_pw_aff coalesce() const;
2921 inline isl::union_set domain() const;
2922 inline isl::space space() const;
2923 inline isl::space get_space() const;
2924 inline isl::union_pw_aff gist(isl::union_set context) const;
2925 inline isl::union_pw_aff intersect_domain(isl::space space) const;
2926 inline isl::union_pw_aff intersect_domain(isl::union_set uset) const;
2927 inline isl::union_pw_aff intersect_domain_wrapped_domain(isl::union_set uset) const;
2928 inline isl::union_pw_aff intersect_domain_wrapped_range(isl::union_set uset) const;
2929 inline isl::union_pw_aff intersect_params(isl::set set) const;
2930 inline isl::union_pw_aff pullback(isl::union_pw_multi_aff upma) const;
2931 inline isl::union_pw_aff sub(isl::union_pw_aff upa2) const;
2932 inline isl::union_pw_aff subtract_domain(isl::space space) const;
2933 inline isl::union_pw_aff subtract_domain(isl::union_set uset) const;
2934 inline isl::union_pw_aff union_add(isl::union_pw_aff upa2) const;
2935};
2936
2937// declarations for isl::union_pw_aff_list
2938inline union_pw_aff_list manage(__isl_take isl_union_pw_aff_list *ptr);
2939inline union_pw_aff_list manage_copy(__isl_keep isl_union_pw_aff_list *ptr);
2940
2941class union_pw_aff_list {
2942 friend inline union_pw_aff_list manage(__isl_take isl_union_pw_aff_list *ptr);
2943 friend inline union_pw_aff_list manage_copy(__isl_keep isl_union_pw_aff_list *ptr);
2944
2945protected:
2946 isl_union_pw_aff_list *ptr = nullptr;
2947
2948 inline explicit union_pw_aff_list(__isl_take isl_union_pw_aff_list *ptr);
2949
2950public:
2951 inline /* implicit */ union_pw_aff_list();
2952 inline /* implicit */ union_pw_aff_list(const union_pw_aff_list &obj);
2953 inline explicit union_pw_aff_list(isl::ctx ctx, int n);
2954 inline explicit union_pw_aff_list(isl::union_pw_aff el);
2955 inline union_pw_aff_list &operator=(union_pw_aff_list obj);
2956 inline ~union_pw_aff_list();
2957 inline __isl_give isl_union_pw_aff_list *copy() const &;
2958 inline __isl_give isl_union_pw_aff_list *copy() && = delete;
2959 inline __isl_keep isl_union_pw_aff_list *get() const;
2960 inline __isl_give isl_union_pw_aff_list *release();
2961 inline bool is_null() const;
2962 inline isl::ctx ctx() const;
2963
2964 inline isl::union_pw_aff_list add(isl::union_pw_aff el) const;
2965 inline isl::union_pw_aff_list clear() const;
2966 inline isl::union_pw_aff_list concat(isl::union_pw_aff_list list2) const;
2967 inline isl::union_pw_aff_list drop(unsigned int first, unsigned int n) const;
2968 inline void foreach(const std::function<void(isl::union_pw_aff)> &fn) const;
2969 inline isl::union_pw_aff at(int index) const;
2970 inline isl::union_pw_aff get_at(int index) const;
2971 inline isl::union_pw_aff_list insert(unsigned int pos, isl::union_pw_aff el) const;
2972 inline unsigned size() const;
2973};
2974
2975// declarations for isl::union_pw_multi_aff
2976inline union_pw_multi_aff manage(__isl_take isl_union_pw_multi_aff *ptr);
2977inline union_pw_multi_aff manage_copy(__isl_keep isl_union_pw_multi_aff *ptr);
2978
2979class union_pw_multi_aff {
2980 friend inline union_pw_multi_aff manage(__isl_take isl_union_pw_multi_aff *ptr);
2981 friend inline union_pw_multi_aff manage_copy(__isl_keep isl_union_pw_multi_aff *ptr);
2982
2983protected:
2984 isl_union_pw_multi_aff *ptr = nullptr;
2985
2986 inline explicit union_pw_multi_aff(__isl_take isl_union_pw_multi_aff *ptr);
2987
2988public:
2989 inline /* implicit */ union_pw_multi_aff();
2990 inline /* implicit */ union_pw_multi_aff(const union_pw_multi_aff &obj);
2991 inline /* implicit */ union_pw_multi_aff(isl::multi_aff ma);
2992 inline /* implicit */ union_pw_multi_aff(isl::pw_multi_aff pma);
2993 inline /* implicit */ union_pw_multi_aff(isl::union_pw_aff upa);
2994 inline explicit union_pw_multi_aff(isl::ctx ctx, const std::string &str);
2995 inline union_pw_multi_aff &operator=(union_pw_multi_aff obj);
2996 inline ~union_pw_multi_aff();
2997 inline __isl_give isl_union_pw_multi_aff *copy() const &;
2998 inline __isl_give isl_union_pw_multi_aff *copy() && = delete;
2999 inline __isl_keep isl_union_pw_multi_aff *get() const;
3000 inline __isl_give isl_union_pw_multi_aff *release();
3001 inline bool is_null() const;
3002 inline isl::ctx ctx() const;
3003
3004 inline isl::union_pw_multi_aff add(isl::union_pw_multi_aff upma2) const;
3005 inline isl::union_pw_multi_aff apply(isl::union_pw_multi_aff upma2) const;
3006 inline isl::pw_multi_aff as_pw_multi_aff() const;
3007 inline isl::union_pw_multi_aff coalesce() const;
3008 inline isl::union_set domain() const;
3009 static inline isl::union_pw_multi_aff empty(isl::ctx ctx);
3010 inline isl::pw_multi_aff extract_pw_multi_aff(isl::space space) const;
3011 inline isl::union_pw_multi_aff flat_range_product(isl::union_pw_multi_aff upma2) const;
3012 inline isl::space space() const;
3013 inline isl::space get_space() const;
3014 inline isl::union_pw_multi_aff gist(isl::union_set context) const;
3015 inline isl::union_pw_multi_aff intersect_domain(isl::space space) const;
3016 inline isl::union_pw_multi_aff intersect_domain(isl::union_set uset) const;
3017 inline isl::union_pw_multi_aff intersect_domain_wrapped_domain(isl::union_set uset) const;
3018 inline isl::union_pw_multi_aff intersect_domain_wrapped_range(isl::union_set uset) const;
3019 inline isl::union_pw_multi_aff intersect_params(isl::set set) const;
3020 inline bool involves_locals() const;
3021 inline bool isa_pw_multi_aff() const;
3022 inline bool plain_is_empty() const;
3023 inline isl::union_pw_multi_aff pullback(isl::union_pw_multi_aff upma2) const;
3024 inline isl::union_pw_multi_aff range_factor_domain() const;
3025 inline isl::union_pw_multi_aff range_factor_range() const;
3026 inline isl::union_pw_multi_aff range_product(isl::union_pw_multi_aff upma2) const;
3027 inline isl::union_pw_multi_aff sub(isl::union_pw_multi_aff upma2) const;
3028 inline isl::union_pw_multi_aff subtract_domain(isl::space space) const;
3029 inline isl::union_pw_multi_aff subtract_domain(isl::union_set uset) const;
3030 inline isl::union_pw_multi_aff union_add(isl::union_pw_multi_aff upma2) const;
3031};
3032
3033// declarations for isl::union_set
3034inline union_set manage(__isl_take isl_union_set *ptr);
3035inline union_set manage_copy(__isl_keep isl_union_set *ptr);
3036
3037class union_set {
3038 friend inline union_set manage(__isl_take isl_union_set *ptr);
3039 friend inline union_set manage_copy(__isl_keep isl_union_set *ptr);
3040
3041protected:
3042 isl_union_set *ptr = nullptr;
3043
3044 inline explicit union_set(__isl_take isl_union_set *ptr);
3045
3046public:
3047 inline /* implicit */ union_set();
3048 inline /* implicit */ union_set(const union_set &obj);
3049 inline /* implicit */ union_set(isl::basic_set bset);
3050 inline /* implicit */ union_set(isl::point pnt);
3051 inline /* implicit */ union_set(isl::set set);
3052 inline explicit union_set(isl::ctx ctx, const std::string &str);
3053 inline union_set &operator=(union_set obj);
3054 inline ~union_set();
3055 inline __isl_give isl_union_set *copy() const &;
3056 inline __isl_give isl_union_set *copy() && = delete;
3057 inline __isl_keep isl_union_set *get() const;
3058 inline __isl_give isl_union_set *release();
3059 inline bool is_null() const;
3060 inline isl::ctx ctx() const;
3061
3062 inline isl::union_set affine_hull() const;
3063 inline isl::union_set apply(isl::union_map umap) const;
3064 inline isl::union_set coalesce() const;
3065 inline isl::union_set compute_divs() const;
3066 inline isl::union_set detect_equalities() const;
3067 static inline isl::union_set empty(isl::ctx ctx);
3068 inline bool every_set(const std::function<bool(isl::set)> &test) const;
3069 inline isl::set extract_set(isl::space space) const;
3070 inline void foreach_point(const std::function<void(isl::point)> &fn) const;
3071 inline void foreach_set(const std::function<void(isl::set)> &fn) const;
3072 inline isl::space space() const;
3073 inline isl::space get_space() const;
3074 inline isl::union_set gist(isl::union_set context) const;
3075 inline isl::union_set gist_params(isl::set set) const;
3076 inline isl::union_map identity() const;
3077 inline isl::union_set intersect(isl::union_set uset2) const;
3078 inline isl::union_set intersect_params(isl::set set) const;
3079 inline bool is_disjoint(const isl::union_set &uset2) const;
3080 inline bool is_empty() const;
3081 inline bool is_equal(const isl::union_set &uset2) const;
3082 inline bool is_strict_subset(const isl::union_set &uset2) const;
3083 inline bool is_subset(const isl::union_set &uset2) const;
3084 inline bool isa_set() const;
3085 inline isl::union_set lexmax() const;
3086 inline isl::union_set lexmin() const;
3087 inline isl::union_set polyhedral_hull() const;
3088 inline isl::union_set preimage(isl::multi_aff ma) const;
3089 inline isl::union_set preimage(isl::pw_multi_aff pma) const;
3090 inline isl::union_set preimage(isl::union_pw_multi_aff upma) const;
3091 inline isl::point sample_point() const;
3092 inline isl::union_set subtract(isl::union_set uset2) const;
3093 inline isl::union_set unite(isl::union_set uset2) const;
3094 inline isl::union_set universe() const;
3095 inline isl::union_map unwrap() const;
3096};
3097
3098// declarations for isl::union_set_list
3099inline union_set_list manage(__isl_take isl_union_set_list *ptr);
3100inline union_set_list manage_copy(__isl_keep isl_union_set_list *ptr);
3101
3102class union_set_list {
3103 friend inline union_set_list manage(__isl_take isl_union_set_list *ptr);
3104 friend inline union_set_list manage_copy(__isl_keep isl_union_set_list *ptr);
3105
3106protected:
3107 isl_union_set_list *ptr = nullptr;
3108
3109 inline explicit union_set_list(__isl_take isl_union_set_list *ptr);
3110
3111public:
3112 inline /* implicit */ union_set_list();
3113 inline /* implicit */ union_set_list(const union_set_list &obj);
3114 inline explicit union_set_list(isl::ctx ctx, int n);
3115 inline explicit union_set_list(isl::union_set el);
3116 inline union_set_list &operator=(union_set_list obj);
3117 inline ~union_set_list();
3118 inline __isl_give isl_union_set_list *copy() const &;
3119 inline __isl_give isl_union_set_list *copy() && = delete;
3120 inline __isl_keep isl_union_set_list *get() const;
3121 inline __isl_give isl_union_set_list *release();
3122 inline bool is_null() const;
3123 inline isl::ctx ctx() const;
3124
3125 inline isl::union_set_list add(isl::union_set el) const;
3126 inline isl::union_set_list clear() const;
3127 inline isl::union_set_list concat(isl::union_set_list list2) const;
3128 inline isl::union_set_list drop(unsigned int first, unsigned int n) const;
3129 inline void foreach(const std::function<void(isl::union_set)> &fn) const;
3130 inline isl::union_set at(int index) const;
3131 inline isl::union_set get_at(int index) const;
3132 inline isl::union_set_list insert(unsigned int pos, isl::union_set el) const;
3133 inline unsigned size() const;
3134};
3135
3136// declarations for isl::val
3137inline val manage(__isl_take isl_val *ptr);
3138inline val manage_copy(__isl_keep isl_val *ptr);
3139
3140class val {
3141 friend inline val manage(__isl_take isl_val *ptr);
3142 friend inline val manage_copy(__isl_keep isl_val *ptr);
3143
3144protected:
3145 isl_val *ptr = nullptr;
3146
3147 inline explicit val(__isl_take isl_val *ptr);
3148
3149public:
3150 inline /* implicit */ val();
3151 inline /* implicit */ val(const val &obj);
3152 inline explicit val(isl::ctx ctx, long i);
3153 inline explicit val(isl::ctx ctx, const std::string &str);
3154 inline val &operator=(val obj);
3155 inline ~val();
3156 inline __isl_give isl_val *copy() const &;
3157 inline __isl_give isl_val *copy() && = delete;
3158 inline __isl_keep isl_val *get() const;
3159 inline __isl_give isl_val *release();
3160 inline bool is_null() const;
3161 inline isl::ctx ctx() const;
3162
3163 inline isl::val abs() const;
3164 inline bool abs_eq(const isl::val &v2) const;
3165 inline bool abs_eq(long v2) const;
3166 inline isl::val add(isl::val v2) const;
3167 inline isl::val add(long v2) const;
3168 inline isl::val ceil() const;
3169 inline int cmp_si(long i) const;
3170 inline isl::val div(isl::val v2) const;
3171 inline isl::val div(long v2) const;
3172 inline bool eq(const isl::val &v2) const;
3173 inline bool eq(long v2) const;
3174 inline isl::val floor() const;
3175 inline isl::val gcd(isl::val v2) const;
3176 inline isl::val gcd(long v2) const;
3177 inline bool ge(const isl::val &v2) const;
3178 inline bool ge(long v2) const;
3179 inline long den_si() const;
3180 inline long get_den_si() const;
3181 inline long num_si() const;
3182 inline long get_num_si() const;
3183 inline bool gt(const isl::val &v2) const;
3184 inline bool gt(long v2) const;
3185 static inline isl::val infty(isl::ctx ctx);
3186 inline isl::val inv() const;
3187 inline bool is_divisible_by(const isl::val &v2) const;
3188 inline bool is_divisible_by(long v2) const;
3189 inline bool is_infty() const;
3190 inline bool is_int() const;
3191 inline bool is_nan() const;
3192 inline bool is_neg() const;
3193 inline bool is_neginfty() const;
3194 inline bool is_negone() const;
3195 inline bool is_nonneg() const;
3196 inline bool is_nonpos() const;
3197 inline bool is_one() const;
3198 inline bool is_pos() const;
3199 inline bool is_rat() const;
3200 inline bool is_zero() const;
3201 inline bool le(const isl::val &v2) const;
3202 inline bool le(long v2) const;
3203 inline bool lt(const isl::val &v2) const;
3204 inline bool lt(long v2) const;
3205 inline isl::val max(isl::val v2) const;
3206 inline isl::val max(long v2) const;
3207 inline isl::val min(isl::val v2) const;
3208 inline isl::val min(long v2) const;
3209 inline isl::val mod(isl::val v2) const;
3210 inline isl::val mod(long v2) const;
3211 inline isl::val mul(isl::val v2) const;
3212 inline isl::val mul(long v2) const;
3213 static inline isl::val nan(isl::ctx ctx);
3214 inline bool ne(const isl::val &v2) const;
3215 inline bool ne(long v2) const;
3216 inline isl::val neg() const;
3217 static inline isl::val neginfty(isl::ctx ctx);
3218 static inline isl::val negone(isl::ctx ctx);
3219 static inline isl::val one(isl::ctx ctx);
3220 inline isl::val pow2() const;
3221 inline int sgn() const;
3222 inline isl::val sub(isl::val v2) const;
3223 inline isl::val sub(long v2) const;
3224 inline isl::val trunc() const;
3225 static inline isl::val zero(isl::ctx ctx);
3226};
3227
3228// declarations for isl::val_list
3229inline val_list manage(__isl_take isl_val_list *ptr);
3230inline val_list manage_copy(__isl_keep isl_val_list *ptr);
3231
3232class val_list {
3233 friend inline val_list manage(__isl_take isl_val_list *ptr);
3234 friend inline val_list manage_copy(__isl_keep isl_val_list *ptr);
3235
3236protected:
3237 isl_val_list *ptr = nullptr;
3238
3239 inline explicit val_list(__isl_take isl_val_list *ptr);
3240
3241public:
3242 inline /* implicit */ val_list();
3243 inline /* implicit */ val_list(const val_list &obj);
3244 inline explicit val_list(isl::ctx ctx, int n);
3245 inline explicit val_list(isl::val el);
3246 inline val_list &operator=(val_list obj);
3247 inline ~val_list();
3248 inline __isl_give isl_val_list *copy() const &;
3249 inline __isl_give isl_val_list *copy() && = delete;
3250 inline __isl_keep isl_val_list *get() const;
3251 inline __isl_give isl_val_list *release();
3252 inline bool is_null() const;
3253 inline isl::ctx ctx() const;
3254
3255 inline isl::val_list add(isl::val el) const;
3256 inline isl::val_list add(long el) const;
3257 inline isl::val_list clear() const;
3258 inline isl::val_list concat(isl::val_list list2) const;
3259 inline isl::val_list drop(unsigned int first, unsigned int n) const;
3260 inline void foreach(const std::function<void(isl::val)> &fn) const;
3261 inline isl::val at(int index) const;
3262 inline isl::val get_at(int index) const;
3263 inline isl::val_list insert(unsigned int pos, isl::val el) const;
3264 inline isl::val_list insert(unsigned int pos, long el) const;
3265 inline unsigned size() const;
3266};
3267
3268// implementations for isl::aff
3269aff manage(__isl_take isl_aff *ptr) {
3270 if (!ptr)
3271 exception::throw_invalid("NULL input", __FILE__, __LINE__);
3272 return aff(ptr);
3273}
3274aff manage_copy(__isl_keep isl_aff *ptr) {
3275 if (!ptr)
3276 exception::throw_invalid("NULL input", __FILE__, __LINE__);
3277 auto saved_ctx = isl_aff_get_ctx(ptr);
3278 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
3279 ptr = isl_aff_copy(ptr);
3280 if (!ptr)
3281 exception::throw_last_error(saved_ctx);
3282 return aff(ptr);
3283}
3284
3285aff::aff()
3286 : ptr(nullptr) {}
3287
3288aff::aff(const aff &obj)
3289 : ptr(nullptr)
3290{
3291 if (!obj.ptr)
3292 exception::throw_invalid("NULL input", __FILE__, __LINE__);
3293 auto saved_ctx = isl_aff_get_ctx(obj.ptr);
3294 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
3295 ptr = obj.copy();
3296 if (!ptr)
3297 exception::throw_last_error(saved_ctx);
3298}
3299
3300aff::aff(__isl_take isl_aff *ptr)
3301 : ptr(ptr) {}
3302
3303aff::aff(isl::ctx ctx, const std::string &str)
3304{
3305 auto saved_ctx = ctx;
3306 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
3307 auto res = isl_aff_read_from_str(ctx.release(), str.c_str());
3308 if (!res)
3309 exception::throw_last_error(saved_ctx);
3310 ptr = res;
3311}
3312
3313aff &aff::operator=(aff obj) {
3314 std::swap(this->ptr, obj.ptr);
3315 return *this;
3316}
3317
3318aff::~aff() {
3319 if (ptr)
3320 isl_aff_free(ptr);
3321}
3322
3323__isl_give isl_aff *aff::copy() const & {
3324 return isl_aff_copy(ptr);
3325}
3326
3327__isl_keep isl_aff *aff::get() const {
3328 return ptr;
3329}
3330
3331__isl_give isl_aff *aff::release() {
3332 isl_aff *tmp = ptr;
3333 ptr = nullptr;
3334 return tmp;
3335}
3336
3337bool aff::is_null() const {
3338 return ptr == nullptr;
3339}
3340
3341isl::ctx aff::ctx() const {
3342 return isl::ctx(isl_aff_get_ctx(ptr));
3343}
3344
3345isl::aff aff::add(isl::aff aff2) const
3346{
3347 if (!ptr || aff2.is_null())
3348 exception::throw_invalid("NULL input", __FILE__, __LINE__);
3349 auto saved_ctx = ctx();
3350 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
3351 auto res = isl_aff_add(copy(), aff2.release());
3352 if (!res)
3353 exception::throw_last_error(saved_ctx);
3354 return manage(res);
3355}
3356
3357isl::aff aff::add_constant(isl::val v) const
3358{
3359 if (!ptr || v.is_null())
3360 exception::throw_invalid("NULL input", __FILE__, __LINE__);
3361 auto saved_ctx = ctx();
3362 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
3363 auto res = isl_aff_add_constant_val(copy(), v.release());
3364 if (!res)
3365 exception::throw_last_error(saved_ctx);
3366 return manage(res);
3367}
3368
3369isl::aff aff::add_constant(long v) const
3370{
3371 if (!ptr)
3372 exception::throw_invalid("NULL input", __FILE__, __LINE__);
3373 return this->add_constant(isl::val(ctx(), v));
3374}
3375
3376isl::basic_set aff::bind(isl::id id) const
3377{
3378 if (!ptr || id.is_null())
3379 exception::throw_invalid("NULL input", __FILE__, __LINE__);
3380 auto saved_ctx = ctx();
3381 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
3382 auto res = isl_aff_bind_id(copy(), id.release());
3383 if (!res)
3384 exception::throw_last_error(saved_ctx);
3385 return manage(res);
3386}
3387
3388isl::basic_set aff::bind(const std::string &id) const
3389{
3390 if (!ptr)
3391 exception::throw_invalid("NULL input", __FILE__, __LINE__);
3392 return this->bind(isl::id(ctx(), id));
3393}
3394
3395isl::aff aff::ceil() const
3396{
3397 if (!ptr)
3398 exception::throw_invalid("NULL input", __FILE__, __LINE__);
3399 auto saved_ctx = ctx();
3400 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
3401 auto res = isl_aff_ceil(copy());
3402 if (!res)
3403 exception::throw_last_error(saved_ctx);
3404 return manage(res);
3405}
3406
3407isl::aff aff::div(isl::aff aff2) const
3408{
3409 if (!ptr || aff2.is_null())
3410 exception::throw_invalid("NULL input", __FILE__, __LINE__);
3411 auto saved_ctx = ctx();
3412 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
3413 auto res = isl_aff_div(copy(), aff2.release());
3414 if (!res)
3415 exception::throw_last_error(saved_ctx);
3416 return manage(res);
3417}
3418
3419isl::set aff::eq_set(isl::aff aff2) const
3420{
3421 if (!ptr || aff2.is_null())
3422 exception::throw_invalid("NULL input", __FILE__, __LINE__);
3423 auto saved_ctx = ctx();
3424 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
3425 auto res = isl_aff_eq_set(copy(), aff2.release());
3426 if (!res)
3427 exception::throw_last_error(saved_ctx);
3428 return manage(res);
3429}
3430
3431isl::val aff::eval(isl::point pnt) const
3432{
3433 if (!ptr || pnt.is_null())
3434 exception::throw_invalid("NULL input", __FILE__, __LINE__);
3435 auto saved_ctx = ctx();
3436 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
3437 auto res = isl_aff_eval(copy(), pnt.release());
3438 if (!res)
3439 exception::throw_last_error(saved_ctx);
3440 return manage(res);
3441}
3442
3443isl::aff aff::floor() const
3444{
3445 if (!ptr)
3446 exception::throw_invalid("NULL input", __FILE__, __LINE__);
3447 auto saved_ctx = ctx();
3448 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
3449 auto res = isl_aff_floor(copy());
3450 if (!res)
3451 exception::throw_last_error(saved_ctx);
3452 return manage(res);
3453}
3454
3455isl::set aff::ge_set(isl::aff aff2) const
3456{
3457 if (!ptr || aff2.is_null())
3458 exception::throw_invalid("NULL input", __FILE__, __LINE__);
3459 auto saved_ctx = ctx();
3460 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
3461 auto res = isl_aff_ge_set(copy(), aff2.release());
3462 if (!res)
3463 exception::throw_last_error(saved_ctx);
3464 return manage(res);
3465}
3466
3467isl::aff aff::gist(isl::set context) const
3468{
3469 if (!ptr || context.is_null())
3470 exception::throw_invalid("NULL input", __FILE__, __LINE__);
3471 auto saved_ctx = ctx();
3472 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
3473 auto res = isl_aff_gist(copy(), context.release());
3474 if (!res)
3475 exception::throw_last_error(saved_ctx);
3476 return manage(res);
3477}
3478
3479isl::set aff::gt_set(isl::aff aff2) const
3480{
3481 if (!ptr || aff2.is_null())
3482 exception::throw_invalid("NULL input", __FILE__, __LINE__);
3483 auto saved_ctx = ctx();
3484 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
3485 auto res = isl_aff_gt_set(copy(), aff2.release());
3486 if (!res)
3487 exception::throw_last_error(saved_ctx);
3488 return manage(res);
3489}
3490
3491isl::set aff::le_set(isl::aff aff2) const
3492{
3493 if (!ptr || aff2.is_null())
3494 exception::throw_invalid("NULL input", __FILE__, __LINE__);
3495 auto saved_ctx = ctx();
3496 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
3497 auto res = isl_aff_le_set(copy(), aff2.release());
3498 if (!res)
3499 exception::throw_last_error(saved_ctx);
3500 return manage(res);
3501}
3502
3503isl::set aff::lt_set(isl::aff aff2) const
3504{
3505 if (!ptr || aff2.is_null())
3506 exception::throw_invalid("NULL input", __FILE__, __LINE__);
3507 auto saved_ctx = ctx();
3508 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
3509 auto res = isl_aff_lt_set(copy(), aff2.release());
3510 if (!res)
3511 exception::throw_last_error(saved_ctx);
3512 return manage(res);
3513}
3514
3515isl::aff aff::mod(isl::val mod) const
3516{
3517 if (!ptr || mod.is_null())
3518 exception::throw_invalid("NULL input", __FILE__, __LINE__);
3519 auto saved_ctx = ctx();
3520 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
3521 auto res = isl_aff_mod_val(copy(), mod.release());
3522 if (!res)
3523 exception::throw_last_error(saved_ctx);
3524 return manage(res);
3525}
3526
3527isl::aff aff::mod(long mod) const
3528{
3529 if (!ptr)
3530 exception::throw_invalid("NULL input", __FILE__, __LINE__);
3531 return this->mod(isl::val(ctx(), mod));
3532}
3533
3534isl::aff aff::mul(isl::aff aff2) const
3535{
3536 if (!ptr || aff2.is_null())
3537 exception::throw_invalid("NULL input", __FILE__, __LINE__);
3538 auto saved_ctx = ctx();
3539 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
3540 auto res = isl_aff_mul(copy(), aff2.release());
3541 if (!res)
3542 exception::throw_last_error(saved_ctx);
3543 return manage(res);
3544}
3545
3546isl::set aff::ne_set(isl::aff aff2) const
3547{
3548 if (!ptr || aff2.is_null())
3549 exception::throw_invalid("NULL input", __FILE__, __LINE__);
3550 auto saved_ctx = ctx();
3551 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
3552 auto res = isl_aff_ne_set(copy(), aff2.release());
3553 if (!res)
3554 exception::throw_last_error(saved_ctx);
3555 return manage(res);
3556}
3557
3558isl::aff aff::neg() const
3559{
3560 if (!ptr)
3561 exception::throw_invalid("NULL input", __FILE__, __LINE__);
3562 auto saved_ctx = ctx();
3563 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
3564 auto res = isl_aff_neg(copy());
3565 if (!res)
3566 exception::throw_last_error(saved_ctx);
3567 return manage(res);
3568}
3569
3570isl::aff aff::pullback(isl::multi_aff ma) const
3571{
3572 if (!ptr || ma.is_null())
3573 exception::throw_invalid("NULL input", __FILE__, __LINE__);
3574 auto saved_ctx = ctx();
3575 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
3576 auto res = isl_aff_pullback_multi_aff(copy(), ma.release());
3577 if (!res)
3578 exception::throw_last_error(saved_ctx);
3579 return manage(res);
3580}
3581
3582isl::aff aff::scale(isl::val v) const
3583{
3584 if (!ptr || v.is_null())
3585 exception::throw_invalid("NULL input", __FILE__, __LINE__);
3586 auto saved_ctx = ctx();
3587 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
3588 auto res = isl_aff_scale_val(copy(), v.release());
3589 if (!res)
3590 exception::throw_last_error(saved_ctx);
3591 return manage(res);
3592}
3593
3594isl::aff aff::scale(long v) const
3595{
3596 if (!ptr)
3597 exception::throw_invalid("NULL input", __FILE__, __LINE__);
3598 return this->scale(isl::val(ctx(), v));
3599}
3600
3601isl::aff aff::scale_down(isl::val v) const
3602{
3603 if (!ptr || v.is_null())
3604 exception::throw_invalid("NULL input", __FILE__, __LINE__);
3605 auto saved_ctx = ctx();
3606 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
3607 auto res = isl_aff_scale_down_val(copy(), v.release());
3608 if (!res)
3609 exception::throw_last_error(saved_ctx);
3610 return manage(res);
3611}
3612
3613isl::aff aff::scale_down(long v) const
3614{
3615 if (!ptr)
3616 exception::throw_invalid("NULL input", __FILE__, __LINE__);
3617 return this->scale_down(isl::val(ctx(), v));
3618}
3619
3620isl::aff aff::sub(isl::aff aff2) const
3621{
3622 if (!ptr || aff2.is_null())
3623 exception::throw_invalid("NULL input", __FILE__, __LINE__);
3624 auto saved_ctx = ctx();
3625 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
3626 auto res = isl_aff_sub(copy(), aff2.release());
3627 if (!res)
3628 exception::throw_last_error(saved_ctx);
3629 return manage(res);
3630}
3631
3632isl::aff aff::unbind_params_insert_domain(isl::multi_id domain) const
3633{
3634 if (!ptr || domain.is_null())
3635 exception::throw_invalid("NULL input", __FILE__, __LINE__);
3636 auto saved_ctx = ctx();
3637 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
3638 auto res = isl_aff_unbind_params_insert_domain(copy(), domain.release());
3639 if (!res)
3640 exception::throw_last_error(saved_ctx);
3641 return manage(res);
3642}
3643
3644isl::aff aff::zero_on_domain(isl::space space)
3645{
3646 if (space.is_null())
3647 exception::throw_invalid("NULL input", __FILE__, __LINE__);
3648 auto saved_ctx = space.ctx();
3649 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
3650 auto res = isl_aff_zero_on_domain_space(space.release());
3651 if (!res)
3652 exception::throw_last_error(saved_ctx);
3653 return manage(res);
3654}
3655
3656inline std::ostream &operator<<(std::ostream &os, const aff &obj)
3657{
3658 if (!obj.get())
3659 exception::throw_invalid("NULL input", __FILE__, __LINE__);
3660 auto saved_ctx = isl_aff_get_ctx(obj.get());
3661 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
3662 char *str = isl_aff_to_str(obj.get());
3663 if (!str)
3664 exception::throw_last_error(saved_ctx);
3665 os << str;
3666 free(str);
3667 return os;
3668}
3669
3670// implementations for isl::aff_list
3671aff_list manage(__isl_take isl_aff_list *ptr) {
3672 if (!ptr)
3673 exception::throw_invalid("NULL input", __FILE__, __LINE__);
3674 return aff_list(ptr);
3675}
3676aff_list manage_copy(__isl_keep isl_aff_list *ptr) {
3677 if (!ptr)
3678 exception::throw_invalid("NULL input", __FILE__, __LINE__);
3679 auto saved_ctx = isl_aff_list_get_ctx(ptr);
3680 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
3681 ptr = isl_aff_list_copy(ptr);
3682 if (!ptr)
3683 exception::throw_last_error(saved_ctx);
3684 return aff_list(ptr);
3685}
3686
3687aff_list::aff_list()
3688 : ptr(nullptr) {}
3689
3690aff_list::aff_list(const aff_list &obj)
3691 : ptr(nullptr)
3692{
3693 if (!obj.ptr)
3694 exception::throw_invalid("NULL input", __FILE__, __LINE__);
3695 auto saved_ctx = isl_aff_list_get_ctx(obj.ptr);
3696 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
3697 ptr = obj.copy();
3698 if (!ptr)
3699 exception::throw_last_error(saved_ctx);
3700}
3701
3702aff_list::aff_list(__isl_take isl_aff_list *ptr)
3703 : ptr(ptr) {}
3704
3705aff_list::aff_list(isl::ctx ctx, int n)
3706{
3707 auto saved_ctx = ctx;
3708 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
3709 auto res = isl_aff_list_alloc(ctx.release(), n);
3710 if (!res)
3711 exception::throw_last_error(saved_ctx);
3712 ptr = res;
3713}
3714
3715aff_list::aff_list(isl::aff el)
3716{
3717 if (el.is_null())
3718 exception::throw_invalid("NULL input", __FILE__, __LINE__);
3719 auto saved_ctx = el.ctx();
3720 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
3721 auto res = isl_aff_list_from_aff(el.release());
3722 if (!res)
3723 exception::throw_last_error(saved_ctx);
3724 ptr = res;
3725}
3726
3727aff_list &aff_list::operator=(aff_list obj) {
3728 std::swap(this->ptr, obj.ptr);
3729 return *this;
3730}
3731
3732aff_list::~aff_list() {
3733 if (ptr)
3734 isl_aff_list_free(ptr);
3735}
3736
3737__isl_give isl_aff_list *aff_list::copy() const & {
3738 return isl_aff_list_copy(ptr);
3739}
3740
3741__isl_keep isl_aff_list *aff_list::get() const {
3742 return ptr;
3743}
3744
3745__isl_give isl_aff_list *aff_list::release() {
3746 isl_aff_list *tmp = ptr;
3747 ptr = nullptr;
3748 return tmp;
3749}
3750
3751bool aff_list::is_null() const {
3752 return ptr == nullptr;
3753}
3754
3755isl::ctx aff_list::ctx() const {
3756 return isl::ctx(isl_aff_list_get_ctx(ptr));
3757}
3758
3759isl::aff_list aff_list::add(isl::aff el) const
3760{
3761 if (!ptr || el.is_null())
3762 exception::throw_invalid("NULL input", __FILE__, __LINE__);
3763 auto saved_ctx = ctx();
3764 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
3765 auto res = isl_aff_list_add(copy(), el.release());
3766 if (!res)
3767 exception::throw_last_error(saved_ctx);
3768 return manage(res);
3769}
3770
3771isl::aff_list aff_list::clear() const
3772{
3773 if (!ptr)
3774 exception::throw_invalid("NULL input", __FILE__, __LINE__);
3775 auto saved_ctx = ctx();
3776 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
3777 auto res = isl_aff_list_clear(copy());
3778 if (!res)
3779 exception::throw_last_error(saved_ctx);
3780 return manage(res);
3781}
3782
3783isl::aff_list aff_list::concat(isl::aff_list list2) const
3784{
3785 if (!ptr || list2.is_null())
3786 exception::throw_invalid("NULL input", __FILE__, __LINE__);
3787 auto saved_ctx = ctx();
3788 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
3789 auto res = isl_aff_list_concat(copy(), list2.release());
3790 if (!res)
3791 exception::throw_last_error(saved_ctx);
3792 return manage(res);
3793}
3794
3795isl::aff_list aff_list::drop(unsigned int first, unsigned int n) const
3796{
3797 if (!ptr)
3798 exception::throw_invalid("NULL input", __FILE__, __LINE__);
3799 auto saved_ctx = ctx();
3800 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
3801 auto res = isl_aff_list_drop(copy(), first, n);
3802 if (!res)
3803 exception::throw_last_error(saved_ctx);
3804 return manage(res);
3805}
3806
3807void aff_list::foreach(const std::function<void(isl::aff)> &fn) const
3808{
3809 if (!ptr)
3810 exception::throw_invalid("NULL input", __FILE__, __LINE__);
3811 auto saved_ctx = ctx();
3812 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
3813 struct fn_data {
3814 std::function<void(isl::aff)> func;
3815 std::exception_ptr eptr;
3816 } fn_data = { fn };
3817 auto fn_lambda = [](isl_aff *arg_0, void *arg_1) -> isl_stat {
3818 auto *data = static_cast<struct fn_data *>(arg_1);
3819 ISL_CPP_TRY {
3820 (data->func)(manage(arg_0));
3821 return isl_stat_ok;
3822 } ISL_CPP_CATCH_ALL {
3823 data->eptr = std::current_exception();
3824 return isl_stat_error;
3825 }
3826 };
3827 auto res = isl_aff_list_foreach(get(), fn_lambda, &fn_data);
3828 if (fn_data.eptr)
3829 std::rethrow_exception(fn_data.eptr);
3830 if (res < 0)
3831 exception::throw_last_error(saved_ctx);
3832 return;
3833}
3834
3835isl::aff aff_list::at(int index) const
3836{
3837 if (!ptr)
3838 exception::throw_invalid("NULL input", __FILE__, __LINE__);
3839 auto saved_ctx = ctx();
3840 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
3841 auto res = isl_aff_list_get_at(get(), index);
3842 if (!res)
3843 exception::throw_last_error(saved_ctx);
3844 return manage(res);
3845}
3846
3847isl::aff aff_list::get_at(int index) const
3848{
3849 return at(index);
3850}
3851
3852isl::aff_list aff_list::insert(unsigned int pos, isl::aff el) const
3853{
3854 if (!ptr || el.is_null())
3855 exception::throw_invalid("NULL input", __FILE__, __LINE__);
3856 auto saved_ctx = ctx();
3857 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
3858 auto res = isl_aff_list_insert(copy(), pos, el.release());
3859 if (!res)
3860 exception::throw_last_error(saved_ctx);
3861 return manage(res);
3862}
3863
3864unsigned aff_list::size() const
3865{
3866 if (!ptr)
3867 exception::throw_invalid("NULL input", __FILE__, __LINE__);
3868 auto saved_ctx = ctx();
3869 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
3870 auto res = isl_aff_list_size(get());
3871 if (res < 0)
3872 exception::throw_last_error(saved_ctx);
3873 return res;
3874}
3875
3876inline std::ostream &operator<<(std::ostream &os, const aff_list &obj)
3877{
3878 if (!obj.get())
3879 exception::throw_invalid("NULL input", __FILE__, __LINE__);
3880 auto saved_ctx = isl_aff_list_get_ctx(obj.get());
3881 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
3882 char *str = isl_aff_list_to_str(obj.get());
3883 if (!str)
3884 exception::throw_last_error(saved_ctx);
3885 os << str;
3886 free(str);
3887 return os;
3888}
3889
3890// implementations for isl::ast_build
3891ast_build manage(__isl_take isl_ast_build *ptr) {
3892 if (!ptr)
3893 exception::throw_invalid("NULL input", __FILE__, __LINE__);
3894 return ast_build(ptr);
3895}
3896ast_build manage_copy(__isl_keep isl_ast_build *ptr) {
3897 if (!ptr)
3898 exception::throw_invalid("NULL input", __FILE__, __LINE__);
3899 auto saved_ctx = isl_ast_build_get_ctx(ptr);
3900 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
3901 ptr = isl_ast_build_copy(ptr);
3902 if (!ptr)
3903 exception::throw_last_error(saved_ctx);
3904 return ast_build(ptr);
3905}
3906
3907ast_build::ast_build()
3908 : ptr(nullptr) {}
3909
3910ast_build::ast_build(const ast_build &obj)
3911 : ptr(nullptr)
3912{
3913 if (!obj.ptr)
3914 exception::throw_invalid("NULL input", __FILE__, __LINE__);
3915 auto saved_ctx = isl_ast_build_get_ctx(obj.ptr);
3916 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
3917 ptr = obj.copy();
3918 copy_callbacks(obj);
3919 if (!ptr)
3920 exception::throw_last_error(saved_ctx);
3921}
3922
3923ast_build::ast_build(__isl_take isl_ast_build *ptr)
3924 : ptr(ptr) {}
3925
3926ast_build::ast_build(isl::ctx ctx)
3927{
3928 auto saved_ctx = ctx;
3929 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
3930 auto res = isl_ast_build_alloc(ctx.release());
3931 if (!res)
3932 exception::throw_last_error(saved_ctx);
3933 ptr = res;
3934}
3935
3936ast_build &ast_build::operator=(ast_build obj) {
3937 std::swap(this->ptr, obj.ptr);
3938 copy_callbacks(obj);
3939 return *this;
3940}
3941
3942ast_build::~ast_build() {
3943 if (ptr)
3944 isl_ast_build_free(ptr);
3945}
3946
3947__isl_give isl_ast_build *ast_build::copy() const & {
3948 return isl_ast_build_copy(ptr);
3949}
3950
3951__isl_keep isl_ast_build *ast_build::get() const {
3952 return ptr;
3953}
3954
3955__isl_give isl_ast_build *ast_build::release() {
3956 if (at_each_domain_data)
3957 exception::throw_invalid("cannot release object with persistent callbacks", __FILE__, __LINE__);
3958 isl_ast_build *tmp = ptr;
3959 ptr = nullptr;
3960 return tmp;
3961}
3962
3963bool ast_build::is_null() const {
3964 return ptr == nullptr;
3965}
3966
3967isl::ctx ast_build::ctx() const {
3968 return isl::ctx(isl_ast_build_get_ctx(ptr));
3969}
3970
3971ast_build &ast_build::copy_callbacks(const ast_build &obj)
3972{
3973 at_each_domain_data = obj.at_each_domain_data;
3974 return *this;
3975}
3976
3977isl_ast_node *ast_build::at_each_domain(isl_ast_node *arg_0, isl_ast_build *arg_1, void *arg_2)
3978{
3979 auto *data = static_cast<struct at_each_domain_data *>(arg_2);
3980 ISL_CPP_TRY {
3981 auto ret = (data->func)(manage(arg_0), manage_copy(arg_1));
3982 return ret.release();
3983 } ISL_CPP_CATCH_ALL {
3984 data->eptr = std::current_exception();
3985 return NULL;
3986 }
3987}
3988
3989void ast_build::set_at_each_domain_data(const std::function<isl::ast_node(isl::ast_node, isl::ast_build)> &fn)
3990{
3991 if (!ptr)
3992 exception::throw_invalid("NULL input", __FILE__, __LINE__);
3993 auto saved_ctx = isl_ast_build_get_ctx(ptr);
3994 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
3995 at_each_domain_data = std::make_shared<struct at_each_domain_data>();
3996 at_each_domain_data->func = fn;
3997 ptr = isl_ast_build_set_at_each_domain(ptr, &at_each_domain, at_each_domain_data.get());
3998 if (!ptr)
3999 exception::throw_last_error(saved_ctx);
4000}
4001
4002isl::ast_build ast_build::set_at_each_domain(const std::function<isl::ast_node(isl::ast_node, isl::ast_build)> &fn) const
4003{
4004 auto copy = *this;
4005 copy.set_at_each_domain_data(fn);
4006 return copy;
4007}
4008
4009isl::ast_expr ast_build::access_from(isl::multi_pw_aff mpa) const
4010{
4011 if (!ptr || mpa.is_null())
4012 exception::throw_invalid("NULL input", __FILE__, __LINE__);
4013 auto saved_ctx = ctx();
4014 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
4015 auto res = isl_ast_build_access_from_multi_pw_aff(get(), mpa.release());
4016 if (at_each_domain_data && at_each_domain_data->eptr) {
4017 std::exception_ptr eptr = at_each_domain_data->eptr;
4018 at_each_domain_data->eptr = nullptr;
4019 std::rethrow_exception(eptr);
4020 }
4021 if (!res)
4022 exception::throw_last_error(saved_ctx);
4023 return manage(res);
4024}
4025
4026isl::ast_expr ast_build::access_from(isl::pw_multi_aff pma) const
4027{
4028 if (!ptr || pma.is_null())
4029 exception::throw_invalid("NULL input", __FILE__, __LINE__);
4030 auto saved_ctx = ctx();
4031 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
4032 auto res = isl_ast_build_access_from_pw_multi_aff(get(), pma.release());
4033 if (at_each_domain_data && at_each_domain_data->eptr) {
4034 std::exception_ptr eptr = at_each_domain_data->eptr;
4035 at_each_domain_data->eptr = nullptr;
4036 std::rethrow_exception(eptr);
4037 }
4038 if (!res)
4039 exception::throw_last_error(saved_ctx);
4040 return manage(res);
4041}
4042
4043isl::ast_expr ast_build::call_from(isl::multi_pw_aff mpa) const
4044{
4045 if (!ptr || mpa.is_null())
4046 exception::throw_invalid("NULL input", __FILE__, __LINE__);
4047 auto saved_ctx = ctx();
4048 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
4049 auto res = isl_ast_build_call_from_multi_pw_aff(get(), mpa.release());
4050 if (at_each_domain_data && at_each_domain_data->eptr) {
4051 std::exception_ptr eptr = at_each_domain_data->eptr;
4052 at_each_domain_data->eptr = nullptr;
4053 std::rethrow_exception(eptr);
4054 }
4055 if (!res)
4056 exception::throw_last_error(saved_ctx);
4057 return manage(res);
4058}
4059
4060isl::ast_expr ast_build::call_from(isl::pw_multi_aff pma) const
4061{
4062 if (!ptr || pma.is_null())
4063 exception::throw_invalid("NULL input", __FILE__, __LINE__);
4064 auto saved_ctx = ctx();
4065 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
4066 auto res = isl_ast_build_call_from_pw_multi_aff(get(), pma.release());
4067 if (at_each_domain_data && at_each_domain_data->eptr) {
4068 std::exception_ptr eptr = at_each_domain_data->eptr;
4069 at_each_domain_data->eptr = nullptr;
4070 std::rethrow_exception(eptr);
4071 }
4072 if (!res)
4073 exception::throw_last_error(saved_ctx);
4074 return manage(res);
4075}
4076
4077isl::ast_expr ast_build::expr_from(isl::pw_aff pa) const
4078{
4079 if (!ptr || pa.is_null())
4080 exception::throw_invalid("NULL input", __FILE__, __LINE__);
4081 auto saved_ctx = ctx();
4082 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
4083 auto res = isl_ast_build_expr_from_pw_aff(get(), pa.release());
4084 if (at_each_domain_data && at_each_domain_data->eptr) {
4085 std::exception_ptr eptr = at_each_domain_data->eptr;
4086 at_each_domain_data->eptr = nullptr;
4087 std::rethrow_exception(eptr);
4088 }
4089 if (!res)
4090 exception::throw_last_error(saved_ctx);
4091 return manage(res);
4092}
4093
4094isl::ast_expr ast_build::expr_from(isl::set set) const
4095{
4096 if (!ptr || set.is_null())
4097 exception::throw_invalid("NULL input", __FILE__, __LINE__);
4098 auto saved_ctx = ctx();
4099 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
4100 auto res = isl_ast_build_expr_from_set(get(), set.release());
4101 if (at_each_domain_data && at_each_domain_data->eptr) {
4102 std::exception_ptr eptr = at_each_domain_data->eptr;
4103 at_each_domain_data->eptr = nullptr;
4104 std::rethrow_exception(eptr);
4105 }
4106 if (!res)
4107 exception::throw_last_error(saved_ctx);
4108 return manage(res);
4109}
4110
4111isl::ast_build ast_build::from_context(isl::set set)
4112{
4113 if (set.is_null())
4114 exception::throw_invalid("NULL input", __FILE__, __LINE__);
4115 auto saved_ctx = set.ctx();
4116 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
4117 auto res = isl_ast_build_from_context(set.release());
4118 if (!res)
4119 exception::throw_last_error(saved_ctx);
4120 return manage(res);
4121}
4122
4123isl::union_map ast_build::schedule() const
4124{
4125 if (!ptr)
4126 exception::throw_invalid("NULL input", __FILE__, __LINE__);
4127 auto saved_ctx = ctx();
4128 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
4129 auto res = isl_ast_build_get_schedule(get());
4130 if (at_each_domain_data && at_each_domain_data->eptr) {
4131 std::exception_ptr eptr = at_each_domain_data->eptr;
4132 at_each_domain_data->eptr = nullptr;
4133 std::rethrow_exception(eptr);
4134 }
4135 if (!res)
4136 exception::throw_last_error(saved_ctx);
4137 return manage(res);
4138}
4139
4140isl::union_map ast_build::get_schedule() const
4141{
4142 return schedule();
4143}
4144
4145isl::ast_node ast_build::node_from(isl::schedule schedule) const
4146{
4147 if (!ptr || schedule.is_null())
4148 exception::throw_invalid("NULL input", __FILE__, __LINE__);
4149 auto saved_ctx = ctx();
4150 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
4151 auto res = isl_ast_build_node_from_schedule(get(), schedule.release());
4152 if (at_each_domain_data && at_each_domain_data->eptr) {
4153 std::exception_ptr eptr = at_each_domain_data->eptr;
4154 at_each_domain_data->eptr = nullptr;
4155 std::rethrow_exception(eptr);
4156 }
4157 if (!res)
4158 exception::throw_last_error(saved_ctx);
4159 return manage(res);
4160}
4161
4162isl::ast_node ast_build::node_from_schedule_map(isl::union_map schedule) const
4163{
4164 if (!ptr || schedule.is_null())
4165 exception::throw_invalid("NULL input", __FILE__, __LINE__);
4166 auto saved_ctx = ctx();
4167 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
4168 auto res = isl_ast_build_node_from_schedule_map(get(), schedule.release());
4169 if (at_each_domain_data && at_each_domain_data->eptr) {
4170 std::exception_ptr eptr = at_each_domain_data->eptr;
4171 at_each_domain_data->eptr = nullptr;
4172 std::rethrow_exception(eptr);
4173 }
4174 if (!res)
4175 exception::throw_last_error(saved_ctx);
4176 return manage(res);
4177}
4178
4179// implementations for isl::ast_expr
4180ast_expr manage(__isl_take isl_ast_expr *ptr) {
4181 if (!ptr)
4182 exception::throw_invalid("NULL input", __FILE__, __LINE__);
4183 return ast_expr(ptr);
4184}
4185ast_expr manage_copy(__isl_keep isl_ast_expr *ptr) {
4186 if (!ptr)
4187 exception::throw_invalid("NULL input", __FILE__, __LINE__);
4188 auto saved_ctx = isl_ast_expr_get_ctx(ptr);
4189 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
4190 ptr = isl_ast_expr_copy(ptr);
4191 if (!ptr)
4192 exception::throw_last_error(saved_ctx);
4193 return ast_expr(ptr);
4194}
4195
4196ast_expr::ast_expr()
4197 : ptr(nullptr) {}
4198
4199ast_expr::ast_expr(const ast_expr &obj)
4200 : ptr(nullptr)
4201{
4202 if (!obj.ptr)
4203 exception::throw_invalid("NULL input", __FILE__, __LINE__);
4204 auto saved_ctx = isl_ast_expr_get_ctx(obj.ptr);
4205 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
4206 ptr = obj.copy();
4207 if (!ptr)
4208 exception::throw_last_error(saved_ctx);
4209}
4210
4211ast_expr::ast_expr(__isl_take isl_ast_expr *ptr)
4212 : ptr(ptr) {}
4213
4214ast_expr &ast_expr::operator=(ast_expr obj) {
4215 std::swap(this->ptr, obj.ptr);
4216 return *this;
4217}
4218
4219ast_expr::~ast_expr() {
4220 if (ptr)
4221 isl_ast_expr_free(ptr);
4222}
4223
4224__isl_give isl_ast_expr *ast_expr::copy() const & {
4225 return isl_ast_expr_copy(ptr);
4226}
4227
4228__isl_keep isl_ast_expr *ast_expr::get() const {
4229 return ptr;
4230}
4231
4232__isl_give isl_ast_expr *ast_expr::release() {
4233 isl_ast_expr *tmp = ptr;
4234 ptr = nullptr;
4235 return tmp;
4236}
4237
4238bool ast_expr::is_null() const {
4239 return ptr == nullptr;
4240}
4241
4242template <typename T, typename>
4243bool ast_expr::isa_type(T subtype) const
4244{
4245 if (is_null())
4246 exception::throw_invalid("NULL input", __FILE__, __LINE__);
4247 return isl_ast_expr_get_type(get()) == subtype;
4248}
4249template <class T>
4250bool ast_expr::isa() const
4251{
4252 return isa_type<decltype(T::type)>(T::type);
4253}
4254template <class T>
4255T ast_expr::as() const
4256{
4257 if (!isa<T>())
4258 exception::throw_invalid("not an object of the requested subtype", __FILE__, __LINE__);
4259 return T(copy());
4260}
4261
4262isl::ctx ast_expr::ctx() const {
4263 return isl::ctx(isl_ast_expr_get_ctx(ptr));
4264}
4265
4266std::string ast_expr::to_C_str() const
4267{
4268 if (!ptr)
4269 exception::throw_invalid("NULL input", __FILE__, __LINE__);
4270 auto saved_ctx = ctx();
4271 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
4272 auto res = isl_ast_expr_to_C_str(get());
4273 std::string tmp(res);
4274 free(res);
4275 return tmp;
4276}
4277
4278inline std::ostream &operator<<(std::ostream &os, const ast_expr &obj)
4279{
4280 if (!obj.get())
4281 exception::throw_invalid("NULL input", __FILE__, __LINE__);
4282 auto saved_ctx = isl_ast_expr_get_ctx(obj.get());
4283 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
4284 char *str = isl_ast_expr_to_str(obj.get());
4285 if (!str)
4286 exception::throw_last_error(saved_ctx);
4287 os << str;
4288 free(str);
4289 return os;
4290}
4291
4292// implementations for isl::ast_expr_id
4293ast_expr_id::ast_expr_id()
4294 : ast_expr() {}
4295
4296ast_expr_id::ast_expr_id(const ast_expr_id &obj)
4297 : ast_expr(obj)
4298{
4299}
4300
4301ast_expr_id::ast_expr_id(__isl_take isl_ast_expr *ptr)
4302 : ast_expr(ptr) {}
4303
4304ast_expr_id &ast_expr_id::operator=(ast_expr_id obj) {
4305 std::swap(this->ptr, obj.ptr);
4306 return *this;
4307}
4308
4309isl::ctx ast_expr_id::ctx() const {
4310 return isl::ctx(isl_ast_expr_get_ctx(ptr));
4311}
4312
4313isl::id ast_expr_id::id() const
4314{
4315 if (!ptr)
4316 exception::throw_invalid("NULL input", __FILE__, __LINE__);
4317 auto saved_ctx = ctx();
4318 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
4319 auto res = isl_ast_expr_id_get_id(get());
4320 if (!res)
4321 exception::throw_last_error(saved_ctx);
4322 return manage(res);
4323}
4324
4325isl::id ast_expr_id::get_id() const
4326{
4327 return id();
4328}
4329
4330inline std::ostream &operator<<(std::ostream &os, const ast_expr_id &obj)
4331{
4332 if (!obj.get())
4333 exception::throw_invalid("NULL input", __FILE__, __LINE__);
4334 auto saved_ctx = isl_ast_expr_get_ctx(obj.get());
4335 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
4336 char *str = isl_ast_expr_to_str(obj.get());
4337 if (!str)
4338 exception::throw_last_error(saved_ctx);
4339 os << str;
4340 free(str);
4341 return os;
4342}
4343
4344// implementations for isl::ast_expr_int
4345ast_expr_int::ast_expr_int()
4346 : ast_expr() {}
4347
4348ast_expr_int::ast_expr_int(const ast_expr_int &obj)
4349 : ast_expr(obj)
4350{
4351}
4352
4353ast_expr_int::ast_expr_int(__isl_take isl_ast_expr *ptr)
4354 : ast_expr(ptr) {}
4355
4356ast_expr_int &ast_expr_int::operator=(ast_expr_int obj) {
4357 std::swap(this->ptr, obj.ptr);
4358 return *this;
4359}
4360
4361isl::ctx ast_expr_int::ctx() const {
4362 return isl::ctx(isl_ast_expr_get_ctx(ptr));
4363}
4364
4365isl::val ast_expr_int::val() const
4366{
4367 if (!ptr)
4368 exception::throw_invalid("NULL input", __FILE__, __LINE__);
4369 auto saved_ctx = ctx();
4370 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
4371 auto res = isl_ast_expr_int_get_val(get());
4372 if (!res)
4373 exception::throw_last_error(saved_ctx);
4374 return manage(res);
4375}
4376
4377isl::val ast_expr_int::get_val() const
4378{
4379 return val();
4380}
4381
4382inline std::ostream &operator<<(std::ostream &os, const ast_expr_int &obj)
4383{
4384 if (!obj.get())
4385 exception::throw_invalid("NULL input", __FILE__, __LINE__);
4386 auto saved_ctx = isl_ast_expr_get_ctx(obj.get());
4387 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
4388 char *str = isl_ast_expr_to_str(obj.get());
4389 if (!str)
4390 exception::throw_last_error(saved_ctx);
4391 os << str;
4392 free(str);
4393 return os;
4394}
4395
4396// implementations for isl::ast_expr_op
4397ast_expr_op::ast_expr_op()
4398 : ast_expr() {}
4399
4400ast_expr_op::ast_expr_op(const ast_expr_op &obj)
4401 : ast_expr(obj)
4402{
4403}
4404
4405ast_expr_op::ast_expr_op(__isl_take isl_ast_expr *ptr)
4406 : ast_expr(ptr) {}
4407
4408ast_expr_op &ast_expr_op::operator=(ast_expr_op obj) {
4409 std::swap(this->ptr, obj.ptr);
4410 return *this;
4411}
4412
4413template <typename T, typename>
4414bool ast_expr_op::isa_type(T subtype) const
4415{
4416 if (is_null())
4417 exception::throw_invalid("NULL input", __FILE__, __LINE__);
4418 return isl_ast_expr_op_get_type(get()) == subtype;
4419}
4420template <class T>
4421bool ast_expr_op::isa() const
4422{
4423 return isa_type<decltype(T::type)>(T::type);
4424}
4425template <class T>
4426T ast_expr_op::as() const
4427{
4428 if (!isa<T>())
4429 exception::throw_invalid("not an object of the requested subtype", __FILE__, __LINE__);
4430 return T(copy());
4431}
4432
4433isl::ctx ast_expr_op::ctx() const {
4434 return isl::ctx(isl_ast_expr_get_ctx(ptr));
4435}
4436
4437isl::ast_expr ast_expr_op::arg(int pos) const
4438{
4439 if (!ptr)
4440 exception::throw_invalid("NULL input", __FILE__, __LINE__);
4441 auto saved_ctx = ctx();
4442 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
4443 auto res = isl_ast_expr_op_get_arg(get(), pos);
4444 if (!res)
4445 exception::throw_last_error(saved_ctx);
4446 return manage(res);
4447}
4448
4449isl::ast_expr ast_expr_op::get_arg(int pos) const
4450{
4451 return arg(pos);
4452}
4453
4454unsigned ast_expr_op::n_arg() const
4455{
4456 if (!ptr)
4457 exception::throw_invalid("NULL input", __FILE__, __LINE__);
4458 auto saved_ctx = ctx();
4459 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
4460 auto res = isl_ast_expr_op_get_n_arg(get());
4461 if (res < 0)
4462 exception::throw_last_error(saved_ctx);
4463 return res;
4464}
4465
4466unsigned ast_expr_op::get_n_arg() const
4467{
4468 return n_arg();
4469}
4470
4471inline std::ostream &operator<<(std::ostream &os, const ast_expr_op &obj)
4472{
4473 if (!obj.get())
4474 exception::throw_invalid("NULL input", __FILE__, __LINE__);
4475 auto saved_ctx = isl_ast_expr_get_ctx(obj.get());
4476 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
4477 char *str = isl_ast_expr_to_str(obj.get());
4478 if (!str)
4479 exception::throw_last_error(saved_ctx);
4480 os << str;
4481 free(str);
4482 return os;
4483}
4484
4485// implementations for isl::ast_expr_op_access
4486ast_expr_op_access::ast_expr_op_access()
4487 : ast_expr_op() {}
4488
4489ast_expr_op_access::ast_expr_op_access(const ast_expr_op_access &obj)
4490 : ast_expr_op(obj)
4491{
4492}
4493
4494ast_expr_op_access::ast_expr_op_access(__isl_take isl_ast_expr *ptr)
4495 : ast_expr_op(ptr) {}
4496
4497ast_expr_op_access &ast_expr_op_access::operator=(ast_expr_op_access obj) {
4498 std::swap(this->ptr, obj.ptr);
4499 return *this;
4500}
4501
4502isl::ctx ast_expr_op_access::ctx() const {
4503 return isl::ctx(isl_ast_expr_get_ctx(ptr));
4504}
4505
4506inline std::ostream &operator<<(std::ostream &os, const ast_expr_op_access &obj)
4507{
4508 if (!obj.get())
4509 exception::throw_invalid("NULL input", __FILE__, __LINE__);
4510 auto saved_ctx = isl_ast_expr_get_ctx(obj.get());
4511 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
4512 char *str = isl_ast_expr_to_str(obj.get());
4513 if (!str)
4514 exception::throw_last_error(saved_ctx);
4515 os << str;
4516 free(str);
4517 return os;
4518}
4519
4520// implementations for isl::ast_expr_op_add
4521ast_expr_op_add::ast_expr_op_add()
4522 : ast_expr_op() {}
4523
4524ast_expr_op_add::ast_expr_op_add(const ast_expr_op_add &obj)
4525 : ast_expr_op(obj)
4526{
4527}
4528
4529ast_expr_op_add::ast_expr_op_add(__isl_take isl_ast_expr *ptr)
4530 : ast_expr_op(ptr) {}
4531
4532ast_expr_op_add &ast_expr_op_add::operator=(ast_expr_op_add obj) {
4533 std::swap(this->ptr, obj.ptr);
4534 return *this;
4535}
4536
4537isl::ctx ast_expr_op_add::ctx() const {
4538 return isl::ctx(isl_ast_expr_get_ctx(ptr));
4539}
4540
4541inline std::ostream &operator<<(std::ostream &os, const ast_expr_op_add &obj)
4542{
4543 if (!obj.get())
4544 exception::throw_invalid("NULL input", __FILE__, __LINE__);
4545 auto saved_ctx = isl_ast_expr_get_ctx(obj.get());
4546 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
4547 char *str = isl_ast_expr_to_str(obj.get());
4548 if (!str)
4549 exception::throw_last_error(saved_ctx);
4550 os << str;
4551 free(str);
4552 return os;
4553}
4554
4555// implementations for isl::ast_expr_op_address_of
4556ast_expr_op_address_of::ast_expr_op_address_of()
4557 : ast_expr_op() {}
4558
4559ast_expr_op_address_of::ast_expr_op_address_of(const ast_expr_op_address_of &obj)
4560 : ast_expr_op(obj)
4561{
4562}
4563
4564ast_expr_op_address_of::ast_expr_op_address_of(__isl_take isl_ast_expr *ptr)
4565 : ast_expr_op(ptr) {}
4566
4567ast_expr_op_address_of &ast_expr_op_address_of::operator=(ast_expr_op_address_of obj) {
4568 std::swap(this->ptr, obj.ptr);
4569 return *this;
4570}
4571
4572isl::ctx ast_expr_op_address_of::ctx() const {
4573 return isl::ctx(isl_ast_expr_get_ctx(ptr));
4574}
4575
4576inline std::ostream &operator<<(std::ostream &os, const ast_expr_op_address_of &obj)
4577{
4578 if (!obj.get())
4579 exception::throw_invalid("NULL input", __FILE__, __LINE__);
4580 auto saved_ctx = isl_ast_expr_get_ctx(obj.get());
4581 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
4582 char *str = isl_ast_expr_to_str(obj.get());
4583 if (!str)
4584 exception::throw_last_error(saved_ctx);
4585 os << str;
4586 free(str);
4587 return os;
4588}
4589
4590// implementations for isl::ast_expr_op_and
4591ast_expr_op_and::ast_expr_op_and()
4592 : ast_expr_op() {}
4593
4594ast_expr_op_and::ast_expr_op_and(const ast_expr_op_and &obj)
4595 : ast_expr_op(obj)
4596{
4597}
4598
4599ast_expr_op_and::ast_expr_op_and(__isl_take isl_ast_expr *ptr)
4600 : ast_expr_op(ptr) {}
4601
4602ast_expr_op_and &ast_expr_op_and::operator=(ast_expr_op_and obj) {
4603 std::swap(this->ptr, obj.ptr);
4604 return *this;
4605}
4606
4607isl::ctx ast_expr_op_and::ctx() const {
4608 return isl::ctx(isl_ast_expr_get_ctx(ptr));
4609}
4610
4611inline std::ostream &operator<<(std::ostream &os, const ast_expr_op_and &obj)
4612{
4613 if (!obj.get())
4614 exception::throw_invalid("NULL input", __FILE__, __LINE__);
4615 auto saved_ctx = isl_ast_expr_get_ctx(obj.get());
4616 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
4617 char *str = isl_ast_expr_to_str(obj.get());
4618 if (!str)
4619 exception::throw_last_error(saved_ctx);
4620 os << str;
4621 free(str);
4622 return os;
4623}
4624
4625// implementations for isl::ast_expr_op_and_then
4626ast_expr_op_and_then::ast_expr_op_and_then()
4627 : ast_expr_op() {}
4628
4629ast_expr_op_and_then::ast_expr_op_and_then(const ast_expr_op_and_then &obj)
4630 : ast_expr_op(obj)
4631{
4632}
4633
4634ast_expr_op_and_then::ast_expr_op_and_then(__isl_take isl_ast_expr *ptr)
4635 : ast_expr_op(ptr) {}
4636
4637ast_expr_op_and_then &ast_expr_op_and_then::operator=(ast_expr_op_and_then obj) {
4638 std::swap(this->ptr, obj.ptr);
4639 return *this;
4640}
4641
4642isl::ctx ast_expr_op_and_then::ctx() const {
4643 return isl::ctx(isl_ast_expr_get_ctx(ptr));
4644}
4645
4646inline std::ostream &operator<<(std::ostream &os, const ast_expr_op_and_then &obj)
4647{
4648 if (!obj.get())
4649 exception::throw_invalid("NULL input", __FILE__, __LINE__);
4650 auto saved_ctx = isl_ast_expr_get_ctx(obj.get());
4651 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
4652 char *str = isl_ast_expr_to_str(obj.get());
4653 if (!str)
4654 exception::throw_last_error(saved_ctx);
4655 os << str;
4656 free(str);
4657 return os;
4658}
4659
4660// implementations for isl::ast_expr_op_call
4661ast_expr_op_call::ast_expr_op_call()
4662 : ast_expr_op() {}
4663
4664ast_expr_op_call::ast_expr_op_call(const ast_expr_op_call &obj)
4665 : ast_expr_op(obj)
4666{
4667}
4668
4669ast_expr_op_call::ast_expr_op_call(__isl_take isl_ast_expr *ptr)
4670 : ast_expr_op(ptr) {}
4671
4672ast_expr_op_call &ast_expr_op_call::operator=(ast_expr_op_call obj) {
4673 std::swap(this->ptr, obj.ptr);
4674 return *this;
4675}
4676
4677isl::ctx ast_expr_op_call::ctx() const {
4678 return isl::ctx(isl_ast_expr_get_ctx(ptr));
4679}
4680
4681inline std::ostream &operator<<(std::ostream &os, const ast_expr_op_call &obj)
4682{
4683 if (!obj.get())
4684 exception::throw_invalid("NULL input", __FILE__, __LINE__);
4685 auto saved_ctx = isl_ast_expr_get_ctx(obj.get());
4686 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
4687 char *str = isl_ast_expr_to_str(obj.get());
4688 if (!str)
4689 exception::throw_last_error(saved_ctx);
4690 os << str;
4691 free(str);
4692 return os;
4693}
4694
4695// implementations for isl::ast_expr_op_cond
4696ast_expr_op_cond::ast_expr_op_cond()
4697 : ast_expr_op() {}
4698
4699ast_expr_op_cond::ast_expr_op_cond(const ast_expr_op_cond &obj)
4700 : ast_expr_op(obj)
4701{
4702}
4703
4704ast_expr_op_cond::ast_expr_op_cond(__isl_take isl_ast_expr *ptr)
4705 : ast_expr_op(ptr) {}
4706
4707ast_expr_op_cond &ast_expr_op_cond::operator=(ast_expr_op_cond obj) {
4708 std::swap(this->ptr, obj.ptr);
4709 return *this;
4710}
4711
4712isl::ctx ast_expr_op_cond::ctx() const {
4713 return isl::ctx(isl_ast_expr_get_ctx(ptr));
4714}
4715
4716inline std::ostream &operator<<(std::ostream &os, const ast_expr_op_cond &obj)
4717{
4718 if (!obj.get())
4719 exception::throw_invalid("NULL input", __FILE__, __LINE__);
4720 auto saved_ctx = isl_ast_expr_get_ctx(obj.get());
4721 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
4722 char *str = isl_ast_expr_to_str(obj.get());
4723 if (!str)
4724 exception::throw_last_error(saved_ctx);
4725 os << str;
4726 free(str);
4727 return os;
4728}
4729
4730// implementations for isl::ast_expr_op_div
4731ast_expr_op_div::ast_expr_op_div()
4732 : ast_expr_op() {}
4733
4734ast_expr_op_div::ast_expr_op_div(const ast_expr_op_div &obj)
4735 : ast_expr_op(obj)
4736{
4737}
4738
4739ast_expr_op_div::ast_expr_op_div(__isl_take isl_ast_expr *ptr)
4740 : ast_expr_op(ptr) {}
4741
4742ast_expr_op_div &ast_expr_op_div::operator=(ast_expr_op_div obj) {
4743 std::swap(this->ptr, obj.ptr);
4744 return *this;
4745}
4746
4747isl::ctx ast_expr_op_div::ctx() const {
4748 return isl::ctx(isl_ast_expr_get_ctx(ptr));
4749}
4750
4751inline std::ostream &operator<<(std::ostream &os, const ast_expr_op_div &obj)
4752{
4753 if (!obj.get())
4754 exception::throw_invalid("NULL input", __FILE__, __LINE__);
4755 auto saved_ctx = isl_ast_expr_get_ctx(obj.get());
4756 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
4757 char *str = isl_ast_expr_to_str(obj.get());
4758 if (!str)
4759 exception::throw_last_error(saved_ctx);
4760 os << str;
4761 free(str);
4762 return os;
4763}
4764
4765// implementations for isl::ast_expr_op_eq
4766ast_expr_op_eq::ast_expr_op_eq()
4767 : ast_expr_op() {}
4768
4769ast_expr_op_eq::ast_expr_op_eq(const ast_expr_op_eq &obj)
4770 : ast_expr_op(obj)
4771{
4772}
4773
4774ast_expr_op_eq::ast_expr_op_eq(__isl_take isl_ast_expr *ptr)
4775 : ast_expr_op(ptr) {}
4776
4777ast_expr_op_eq &ast_expr_op_eq::operator=(ast_expr_op_eq obj) {
4778 std::swap(this->ptr, obj.ptr);
4779 return *this;
4780}
4781
4782isl::ctx ast_expr_op_eq::ctx() const {
4783 return isl::ctx(isl_ast_expr_get_ctx(ptr));
4784}
4785
4786inline std::ostream &operator<<(std::ostream &os, const ast_expr_op_eq &obj)
4787{
4788 if (!obj.get())
4789 exception::throw_invalid("NULL input", __FILE__, __LINE__);
4790 auto saved_ctx = isl_ast_expr_get_ctx(obj.get());
4791 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
4792 char *str = isl_ast_expr_to_str(obj.get());
4793 if (!str)
4794 exception::throw_last_error(saved_ctx);
4795 os << str;
4796 free(str);
4797 return os;
4798}
4799
4800// implementations for isl::ast_expr_op_fdiv_q
4801ast_expr_op_fdiv_q::ast_expr_op_fdiv_q()
4802 : ast_expr_op() {}
4803
4804ast_expr_op_fdiv_q::ast_expr_op_fdiv_q(const ast_expr_op_fdiv_q &obj)
4805 : ast_expr_op(obj)
4806{
4807}
4808
4809ast_expr_op_fdiv_q::ast_expr_op_fdiv_q(__isl_take isl_ast_expr *ptr)
4810 : ast_expr_op(ptr) {}
4811
4812ast_expr_op_fdiv_q &ast_expr_op_fdiv_q::operator=(ast_expr_op_fdiv_q obj) {
4813 std::swap(this->ptr, obj.ptr);
4814 return *this;
4815}
4816
4817isl::ctx ast_expr_op_fdiv_q::ctx() const {
4818 return isl::ctx(isl_ast_expr_get_ctx(ptr));
4819}
4820
4821inline std::ostream &operator<<(std::ostream &os, const ast_expr_op_fdiv_q &obj)
4822{
4823 if (!obj.get())
4824 exception::throw_invalid("NULL input", __FILE__, __LINE__);
4825 auto saved_ctx = isl_ast_expr_get_ctx(obj.get());
4826 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
4827 char *str = isl_ast_expr_to_str(obj.get());
4828 if (!str)
4829 exception::throw_last_error(saved_ctx);
4830 os << str;
4831 free(str);
4832 return os;
4833}
4834
4835// implementations for isl::ast_expr_op_ge
4836ast_expr_op_ge::ast_expr_op_ge()
4837 : ast_expr_op() {}
4838
4839ast_expr_op_ge::ast_expr_op_ge(const ast_expr_op_ge &obj)
4840 : ast_expr_op(obj)
4841{
4842}
4843
4844ast_expr_op_ge::ast_expr_op_ge(__isl_take isl_ast_expr *ptr)
4845 : ast_expr_op(ptr) {}
4846
4847ast_expr_op_ge &ast_expr_op_ge::operator=(ast_expr_op_ge obj) {
4848 std::swap(this->ptr, obj.ptr);
4849 return *this;
4850}
4851
4852isl::ctx ast_expr_op_ge::ctx() const {
4853 return isl::ctx(isl_ast_expr_get_ctx(ptr));
4854}
4855
4856inline std::ostream &operator<<(std::ostream &os, const ast_expr_op_ge &obj)
4857{
4858 if (!obj.get())
4859 exception::throw_invalid("NULL input", __FILE__, __LINE__);
4860 auto saved_ctx = isl_ast_expr_get_ctx(obj.get());
4861 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
4862 char *str = isl_ast_expr_to_str(obj.get());
4863 if (!str)
4864 exception::throw_last_error(saved_ctx);
4865 os << str;
4866 free(str);
4867 return os;
4868}
4869
4870// implementations for isl::ast_expr_op_gt
4871ast_expr_op_gt::ast_expr_op_gt()
4872 : ast_expr_op() {}
4873
4874ast_expr_op_gt::ast_expr_op_gt(const ast_expr_op_gt &obj)
4875 : ast_expr_op(obj)
4876{
4877}
4878
4879ast_expr_op_gt::ast_expr_op_gt(__isl_take isl_ast_expr *ptr)
4880 : ast_expr_op(ptr) {}
4881
4882ast_expr_op_gt &ast_expr_op_gt::operator=(ast_expr_op_gt obj) {
4883 std::swap(this->ptr, obj.ptr);
4884 return *this;
4885}
4886
4887isl::ctx ast_expr_op_gt::ctx() const {
4888 return isl::ctx(isl_ast_expr_get_ctx(ptr));
4889}
4890
4891inline std::ostream &operator<<(std::ostream &os, const ast_expr_op_gt &obj)
4892{
4893 if (!obj.get())
4894 exception::throw_invalid("NULL input", __FILE__, __LINE__);
4895 auto saved_ctx = isl_ast_expr_get_ctx(obj.get());
4896 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
4897 char *str = isl_ast_expr_to_str(obj.get());
4898 if (!str)
4899 exception::throw_last_error(saved_ctx);
4900 os << str;
4901 free(str);
4902 return os;
4903}
4904
4905// implementations for isl::ast_expr_op_le
4906ast_expr_op_le::ast_expr_op_le()
4907 : ast_expr_op() {}
4908
4909ast_expr_op_le::ast_expr_op_le(const ast_expr_op_le &obj)
4910 : ast_expr_op(obj)
4911{
4912}
4913
4914ast_expr_op_le::ast_expr_op_le(__isl_take isl_ast_expr *ptr)
4915 : ast_expr_op(ptr) {}
4916
4917ast_expr_op_le &ast_expr_op_le::operator=(ast_expr_op_le obj) {
4918 std::swap(this->ptr, obj.ptr);
4919 return *this;
4920}
4921
4922isl::ctx ast_expr_op_le::ctx() const {
4923 return isl::ctx(isl_ast_expr_get_ctx(ptr));
4924}
4925
4926inline std::ostream &operator<<(std::ostream &os, const ast_expr_op_le &obj)
4927{
4928 if (!obj.get())
4929 exception::throw_invalid("NULL input", __FILE__, __LINE__);
4930 auto saved_ctx = isl_ast_expr_get_ctx(obj.get());
4931 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
4932 char *str = isl_ast_expr_to_str(obj.get());
4933 if (!str)
4934 exception::throw_last_error(saved_ctx);
4935 os << str;
4936 free(str);
4937 return os;
4938}
4939
4940// implementations for isl::ast_expr_op_lt
4941ast_expr_op_lt::ast_expr_op_lt()
4942 : ast_expr_op() {}
4943
4944ast_expr_op_lt::ast_expr_op_lt(const ast_expr_op_lt &obj)
4945 : ast_expr_op(obj)
4946{
4947}
4948
4949ast_expr_op_lt::ast_expr_op_lt(__isl_take isl_ast_expr *ptr)
4950 : ast_expr_op(ptr) {}
4951
4952ast_expr_op_lt &ast_expr_op_lt::operator=(ast_expr_op_lt obj) {
4953 std::swap(this->ptr, obj.ptr);
4954 return *this;
4955}
4956
4957isl::ctx ast_expr_op_lt::ctx() const {
4958 return isl::ctx(isl_ast_expr_get_ctx(ptr));
4959}
4960
4961inline std::ostream &operator<<(std::ostream &os, const ast_expr_op_lt &obj)
4962{
4963 if (!obj.get())
4964 exception::throw_invalid("NULL input", __FILE__, __LINE__);
4965 auto saved_ctx = isl_ast_expr_get_ctx(obj.get());
4966 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
4967 char *str = isl_ast_expr_to_str(obj.get());
4968 if (!str)
4969 exception::throw_last_error(saved_ctx);
4970 os << str;
4971 free(str);
4972 return os;
4973}
4974
4975// implementations for isl::ast_expr_op_max
4976ast_expr_op_max::ast_expr_op_max()
4977 : ast_expr_op() {}
4978
4979ast_expr_op_max::ast_expr_op_max(const ast_expr_op_max &obj)
4980 : ast_expr_op(obj)
4981{
4982}
4983
4984ast_expr_op_max::ast_expr_op_max(__isl_take isl_ast_expr *ptr)
4985 : ast_expr_op(ptr) {}
4986
4987ast_expr_op_max &ast_expr_op_max::operator=(ast_expr_op_max obj) {
4988 std::swap(this->ptr, obj.ptr);
4989 return *this;
4990}
4991
4992isl::ctx ast_expr_op_max::ctx() const {
4993 return isl::ctx(isl_ast_expr_get_ctx(ptr));
4994}
4995
4996inline std::ostream &operator<<(std::ostream &os, const ast_expr_op_max &obj)
4997{
4998 if (!obj.get())
4999 exception::throw_invalid("NULL input", __FILE__, __LINE__);
5000 auto saved_ctx = isl_ast_expr_get_ctx(obj.get());
5001 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
5002 char *str = isl_ast_expr_to_str(obj.get());
5003 if (!str)
5004 exception::throw_last_error(saved_ctx);
5005 os << str;
5006 free(str);
5007 return os;
5008}
5009
5010// implementations for isl::ast_expr_op_member
5011ast_expr_op_member::ast_expr_op_member()
5012 : ast_expr_op() {}
5013
5014ast_expr_op_member::ast_expr_op_member(const ast_expr_op_member &obj)
5015 : ast_expr_op(obj)
5016{
5017}
5018
5019ast_expr_op_member::ast_expr_op_member(__isl_take isl_ast_expr *ptr)
5020 : ast_expr_op(ptr) {}
5021
5022ast_expr_op_member &ast_expr_op_member::operator=(ast_expr_op_member obj) {
5023 std::swap(this->ptr, obj.ptr);
5024 return *this;
5025}
5026
5027isl::ctx ast_expr_op_member::ctx() const {
5028 return isl::ctx(isl_ast_expr_get_ctx(ptr));
5029}
5030
5031inline std::ostream &operator<<(std::ostream &os, const ast_expr_op_member &obj)
5032{
5033 if (!obj.get())
5034 exception::throw_invalid("NULL input", __FILE__, __LINE__);
5035 auto saved_ctx = isl_ast_expr_get_ctx(obj.get());
5036 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
5037 char *str = isl_ast_expr_to_str(obj.get());
5038 if (!str)
5039 exception::throw_last_error(saved_ctx);
5040 os << str;
5041 free(str);
5042 return os;
5043}
5044
5045// implementations for isl::ast_expr_op_min
5046ast_expr_op_min::ast_expr_op_min()
5047 : ast_expr_op() {}
5048
5049ast_expr_op_min::ast_expr_op_min(const ast_expr_op_min &obj)
5050 : ast_expr_op(obj)
5051{
5052}
5053
5054ast_expr_op_min::ast_expr_op_min(__isl_take isl_ast_expr *ptr)
5055 : ast_expr_op(ptr) {}
5056
5057ast_expr_op_min &ast_expr_op_min::operator=(ast_expr_op_min obj) {
5058 std::swap(this->ptr, obj.ptr);
5059 return *this;
5060}
5061
5062isl::ctx ast_expr_op_min::ctx() const {
5063 return isl::ctx(isl_ast_expr_get_ctx(ptr));
5064}
5065
5066inline std::ostream &operator<<(std::ostream &os, const ast_expr_op_min &obj)
5067{
5068 if (!obj.get())
5069 exception::throw_invalid("NULL input", __FILE__, __LINE__);
5070 auto saved_ctx = isl_ast_expr_get_ctx(obj.get());
5071 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
5072 char *str = isl_ast_expr_to_str(obj.get());
5073 if (!str)
5074 exception::throw_last_error(saved_ctx);
5075 os << str;
5076 free(str);
5077 return os;
5078}
5079
5080// implementations for isl::ast_expr_op_minus
5081ast_expr_op_minus::ast_expr_op_minus()
5082 : ast_expr_op() {}
5083
5084ast_expr_op_minus::ast_expr_op_minus(const ast_expr_op_minus &obj)
5085 : ast_expr_op(obj)
5086{
5087}
5088
5089ast_expr_op_minus::ast_expr_op_minus(__isl_take isl_ast_expr *ptr)
5090 : ast_expr_op(ptr) {}
5091
5092ast_expr_op_minus &ast_expr_op_minus::operator=(ast_expr_op_minus obj) {
5093 std::swap(this->ptr, obj.ptr);
5094 return *this;
5095}
5096
5097isl::ctx ast_expr_op_minus::ctx() const {
5098 return isl::ctx(isl_ast_expr_get_ctx(ptr));
5099}
5100
5101inline std::ostream &operator<<(std::ostream &os, const ast_expr_op_minus &obj)
5102{
5103 if (!obj.get())
5104 exception::throw_invalid("NULL input", __FILE__, __LINE__);
5105 auto saved_ctx = isl_ast_expr_get_ctx(obj.get());
5106 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
5107 char *str = isl_ast_expr_to_str(obj.get());
5108 if (!str)
5109 exception::throw_last_error(saved_ctx);
5110 os << str;
5111 free(str);
5112 return os;
5113}
5114
5115// implementations for isl::ast_expr_op_mul
5116ast_expr_op_mul::ast_expr_op_mul()
5117 : ast_expr_op() {}
5118
5119ast_expr_op_mul::ast_expr_op_mul(const ast_expr_op_mul &obj)
5120 : ast_expr_op(obj)
5121{
5122}
5123
5124ast_expr_op_mul::ast_expr_op_mul(__isl_take isl_ast_expr *ptr)
5125 : ast_expr_op(ptr) {}
5126
5127ast_expr_op_mul &ast_expr_op_mul::operator=(ast_expr_op_mul obj) {
5128 std::swap(this->ptr, obj.ptr);
5129 return *this;
5130}
5131
5132isl::ctx ast_expr_op_mul::ctx() const {
5133 return isl::ctx(isl_ast_expr_get_ctx(ptr));
5134}
5135
5136inline std::ostream &operator<<(std::ostream &os, const ast_expr_op_mul &obj)
5137{
5138 if (!obj.get())
5139 exception::throw_invalid("NULL input", __FILE__, __LINE__);
5140 auto saved_ctx = isl_ast_expr_get_ctx(obj.get());
5141 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
5142 char *str = isl_ast_expr_to_str(obj.get());
5143 if (!str)
5144 exception::throw_last_error(saved_ctx);
5145 os << str;
5146 free(str);
5147 return os;
5148}
5149
5150// implementations for isl::ast_expr_op_or
5151ast_expr_op_or::ast_expr_op_or()
5152 : ast_expr_op() {}
5153
5154ast_expr_op_or::ast_expr_op_or(const ast_expr_op_or &obj)
5155 : ast_expr_op(obj)
5156{
5157}
5158
5159ast_expr_op_or::ast_expr_op_or(__isl_take isl_ast_expr *ptr)
5160 : ast_expr_op(ptr) {}
5161
5162ast_expr_op_or &ast_expr_op_or::operator=(ast_expr_op_or obj) {
5163 std::swap(this->ptr, obj.ptr);
5164 return *this;
5165}
5166
5167isl::ctx ast_expr_op_or::ctx() const {
5168 return isl::ctx(isl_ast_expr_get_ctx(ptr));
5169}
5170
5171inline std::ostream &operator<<(std::ostream &os, const ast_expr_op_or &obj)
5172{
5173 if (!obj.get())
5174 exception::throw_invalid("NULL input", __FILE__, __LINE__);
5175 auto saved_ctx = isl_ast_expr_get_ctx(obj.get());
5176 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
5177 char *str = isl_ast_expr_to_str(obj.get());
5178 if (!str)
5179 exception::throw_last_error(saved_ctx);
5180 os << str;
5181 free(str);
5182 return os;
5183}
5184
5185// implementations for isl::ast_expr_op_or_else
5186ast_expr_op_or_else::ast_expr_op_or_else()
5187 : ast_expr_op() {}
5188
5189ast_expr_op_or_else::ast_expr_op_or_else(const ast_expr_op_or_else &obj)
5190 : ast_expr_op(obj)
5191{
5192}
5193
5194ast_expr_op_or_else::ast_expr_op_or_else(__isl_take isl_ast_expr *ptr)
5195 : ast_expr_op(ptr) {}
5196
5197ast_expr_op_or_else &ast_expr_op_or_else::operator=(ast_expr_op_or_else obj) {
5198 std::swap(this->ptr, obj.ptr);
5199 return *this;
5200}
5201
5202isl::ctx ast_expr_op_or_else::ctx() const {
5203 return isl::ctx(isl_ast_expr_get_ctx(ptr));
5204}
5205
5206inline std::ostream &operator<<(std::ostream &os, const ast_expr_op_or_else &obj)
5207{
5208 if (!obj.get())
5209 exception::throw_invalid("NULL input", __FILE__, __LINE__);
5210 auto saved_ctx = isl_ast_expr_get_ctx(obj.get());
5211 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
5212 char *str = isl_ast_expr_to_str(obj.get());
5213 if (!str)
5214 exception::throw_last_error(saved_ctx);
5215 os << str;
5216 free(str);
5217 return os;
5218}
5219
5220// implementations for isl::ast_expr_op_pdiv_q
5221ast_expr_op_pdiv_q::ast_expr_op_pdiv_q()
5222 : ast_expr_op() {}
5223
5224ast_expr_op_pdiv_q::ast_expr_op_pdiv_q(const ast_expr_op_pdiv_q &obj)
5225 : ast_expr_op(obj)
5226{
5227}
5228
5229ast_expr_op_pdiv_q::ast_expr_op_pdiv_q(__isl_take isl_ast_expr *ptr)
5230 : ast_expr_op(ptr) {}
5231
5232ast_expr_op_pdiv_q &ast_expr_op_pdiv_q::operator=(ast_expr_op_pdiv_q obj) {
5233 std::swap(this->ptr, obj.ptr);
5234 return *this;
5235}
5236
5237isl::ctx ast_expr_op_pdiv_q::ctx() const {
5238 return isl::ctx(isl_ast_expr_get_ctx(ptr));
5239}
5240
5241inline std::ostream &operator<<(std::ostream &os, const ast_expr_op_pdiv_q &obj)
5242{
5243 if (!obj.get())
5244 exception::throw_invalid("NULL input", __FILE__, __LINE__);
5245 auto saved_ctx = isl_ast_expr_get_ctx(obj.get());
5246 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
5247 char *str = isl_ast_expr_to_str(obj.get());
5248 if (!str)
5249 exception::throw_last_error(saved_ctx);
5250 os << str;
5251 free(str);
5252 return os;
5253}
5254
5255// implementations for isl::ast_expr_op_pdiv_r
5256ast_expr_op_pdiv_r::ast_expr_op_pdiv_r()
5257 : ast_expr_op() {}
5258
5259ast_expr_op_pdiv_r::ast_expr_op_pdiv_r(const ast_expr_op_pdiv_r &obj)
5260 : ast_expr_op(obj)
5261{
5262}
5263
5264ast_expr_op_pdiv_r::ast_expr_op_pdiv_r(__isl_take isl_ast_expr *ptr)
5265 : ast_expr_op(ptr) {}
5266
5267ast_expr_op_pdiv_r &ast_expr_op_pdiv_r::operator=(ast_expr_op_pdiv_r obj) {
5268 std::swap(this->ptr, obj.ptr);
5269 return *this;
5270}
5271
5272isl::ctx ast_expr_op_pdiv_r::ctx() const {
5273 return isl::ctx(isl_ast_expr_get_ctx(ptr));
5274}
5275
5276inline std::ostream &operator<<(std::ostream &os, const ast_expr_op_pdiv_r &obj)
5277{
5278 if (!obj.get())
5279 exception::throw_invalid("NULL input", __FILE__, __LINE__);
5280 auto saved_ctx = isl_ast_expr_get_ctx(obj.get());
5281 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
5282 char *str = isl_ast_expr_to_str(obj.get());
5283 if (!str)
5284 exception::throw_last_error(saved_ctx);
5285 os << str;
5286 free(str);
5287 return os;
5288}
5289
5290// implementations for isl::ast_expr_op_select
5291ast_expr_op_select::ast_expr_op_select()
5292 : ast_expr_op() {}
5293
5294ast_expr_op_select::ast_expr_op_select(const ast_expr_op_select &obj)
5295 : ast_expr_op(obj)
5296{
5297}
5298
5299ast_expr_op_select::ast_expr_op_select(__isl_take isl_ast_expr *ptr)
5300 : ast_expr_op(ptr) {}
5301
5302ast_expr_op_select &ast_expr_op_select::operator=(ast_expr_op_select obj) {
5303 std::swap(this->ptr, obj.ptr);
5304 return *this;
5305}
5306
5307isl::ctx ast_expr_op_select::ctx() const {
5308 return isl::ctx(isl_ast_expr_get_ctx(ptr));
5309}
5310
5311inline std::ostream &operator<<(std::ostream &os, const ast_expr_op_select &obj)
5312{
5313 if (!obj.get())
5314 exception::throw_invalid("NULL input", __FILE__, __LINE__);
5315 auto saved_ctx = isl_ast_expr_get_ctx(obj.get());
5316 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
5317 char *str = isl_ast_expr_to_str(obj.get());
5318 if (!str)
5319 exception::throw_last_error(saved_ctx);
5320 os << str;
5321 free(str);
5322 return os;
5323}
5324
5325// implementations for isl::ast_expr_op_sub
5326ast_expr_op_sub::ast_expr_op_sub()
5327 : ast_expr_op() {}
5328
5329ast_expr_op_sub::ast_expr_op_sub(const ast_expr_op_sub &obj)
5330 : ast_expr_op(obj)
5331{
5332}
5333
5334ast_expr_op_sub::ast_expr_op_sub(__isl_take isl_ast_expr *ptr)
5335 : ast_expr_op(ptr) {}
5336
5337ast_expr_op_sub &ast_expr_op_sub::operator=(ast_expr_op_sub obj) {
5338 std::swap(this->ptr, obj.ptr);
5339 return *this;
5340}
5341
5342isl::ctx ast_expr_op_sub::ctx() const {
5343 return isl::ctx(isl_ast_expr_get_ctx(ptr));
5344}
5345
5346inline std::ostream &operator<<(std::ostream &os, const ast_expr_op_sub &obj)
5347{
5348 if (!obj.get())
5349 exception::throw_invalid("NULL input", __FILE__, __LINE__);
5350 auto saved_ctx = isl_ast_expr_get_ctx(obj.get());
5351 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
5352 char *str = isl_ast_expr_to_str(obj.get());
5353 if (!str)
5354 exception::throw_last_error(saved_ctx);
5355 os << str;
5356 free(str);
5357 return os;
5358}
5359
5360// implementations for isl::ast_expr_op_zdiv_r
5361ast_expr_op_zdiv_r::ast_expr_op_zdiv_r()
5362 : ast_expr_op() {}
5363
5364ast_expr_op_zdiv_r::ast_expr_op_zdiv_r(const ast_expr_op_zdiv_r &obj)
5365 : ast_expr_op(obj)
5366{
5367}
5368
5369ast_expr_op_zdiv_r::ast_expr_op_zdiv_r(__isl_take isl_ast_expr *ptr)
5370 : ast_expr_op(ptr) {}
5371
5372ast_expr_op_zdiv_r &ast_expr_op_zdiv_r::operator=(ast_expr_op_zdiv_r obj) {
5373 std::swap(this->ptr, obj.ptr);
5374 return *this;
5375}
5376
5377isl::ctx ast_expr_op_zdiv_r::ctx() const {
5378 return isl::ctx(isl_ast_expr_get_ctx(ptr));
5379}
5380
5381inline std::ostream &operator<<(std::ostream &os, const ast_expr_op_zdiv_r &obj)
5382{
5383 if (!obj.get())
5384 exception::throw_invalid("NULL input", __FILE__, __LINE__);
5385 auto saved_ctx = isl_ast_expr_get_ctx(obj.get());
5386 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
5387 char *str = isl_ast_expr_to_str(obj.get());
5388 if (!str)
5389 exception::throw_last_error(saved_ctx);
5390 os << str;
5391 free(str);
5392 return os;
5393}
5394
5395// implementations for isl::ast_node
5396ast_node manage(__isl_take isl_ast_node *ptr) {
5397 if (!ptr)
5398 exception::throw_invalid("NULL input", __FILE__, __LINE__);
5399 return ast_node(ptr);
5400}
5401ast_node manage_copy(__isl_keep isl_ast_node *ptr) {
5402 if (!ptr)
5403 exception::throw_invalid("NULL input", __FILE__, __LINE__);
5404 auto saved_ctx = isl_ast_node_get_ctx(ptr);
5405 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
5406 ptr = isl_ast_node_copy(ptr);
5407 if (!ptr)
5408 exception::throw_last_error(saved_ctx);
5409 return ast_node(ptr);
5410}
5411
5412ast_node::ast_node()
5413 : ptr(nullptr) {}
5414
5415ast_node::ast_node(const ast_node &obj)
5416 : ptr(nullptr)
5417{
5418 if (!obj.ptr)
5419 exception::throw_invalid("NULL input", __FILE__, __LINE__);
5420 auto saved_ctx = isl_ast_node_get_ctx(obj.ptr);
5421 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
5422 ptr = obj.copy();
5423 if (!ptr)
5424 exception::throw_last_error(saved_ctx);
5425}
5426
5427ast_node::ast_node(__isl_take isl_ast_node *ptr)
5428 : ptr(ptr) {}
5429
5430ast_node &ast_node::operator=(ast_node obj) {
5431 std::swap(this->ptr, obj.ptr);
5432 return *this;
5433}
5434
5435ast_node::~ast_node() {
5436 if (ptr)
5437 isl_ast_node_free(ptr);
5438}
5439
5440__isl_give isl_ast_node *ast_node::copy() const & {
5441 return isl_ast_node_copy(ptr);
5442}
5443
5444__isl_keep isl_ast_node *ast_node::get() const {
5445 return ptr;
5446}
5447
5448__isl_give isl_ast_node *ast_node::release() {
5449 isl_ast_node *tmp = ptr;
5450 ptr = nullptr;
5451 return tmp;
5452}
5453
5454bool ast_node::is_null() const {
5455 return ptr == nullptr;
5456}
5457
5458template <typename T, typename>
5459bool ast_node::isa_type(T subtype) const
5460{
5461 if (is_null())
5462 exception::throw_invalid("NULL input", __FILE__, __LINE__);
5463 return isl_ast_node_get_type(get()) == subtype;
5464}
5465template <class T>
5466bool ast_node::isa() const
5467{
5468 return isa_type<decltype(T::type)>(T::type);
5469}
5470template <class T>
5471T ast_node::as() const
5472{
5473 if (!isa<T>())
5474 exception::throw_invalid("not an object of the requested subtype", __FILE__, __LINE__);
5475 return T(copy());
5476}
5477
5478isl::ctx ast_node::ctx() const {
5479 return isl::ctx(isl_ast_node_get_ctx(ptr));
5480}
5481
5482std::string ast_node::to_C_str() const
5483{
5484 if (!ptr)
5485 exception::throw_invalid("NULL input", __FILE__, __LINE__);
5486 auto saved_ctx = ctx();
5487 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
5488 auto res = isl_ast_node_to_C_str(get());
5489 std::string tmp(res);
5490 free(res);
5491 return tmp;
5492}
5493
5494inline std::ostream &operator<<(std::ostream &os, const ast_node &obj)
5495{
5496 if (!obj.get())
5497 exception::throw_invalid("NULL input", __FILE__, __LINE__);
5498 auto saved_ctx = isl_ast_node_get_ctx(obj.get());
5499 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
5500 char *str = isl_ast_node_to_str(obj.get());
5501 if (!str)
5502 exception::throw_last_error(saved_ctx);
5503 os << str;
5504 free(str);
5505 return os;
5506}
5507
5508// implementations for isl::ast_node_block
5509ast_node_block::ast_node_block()
5510 : ast_node() {}
5511
5512ast_node_block::ast_node_block(const ast_node_block &obj)
5513 : ast_node(obj)
5514{
5515}
5516
5517ast_node_block::ast_node_block(__isl_take isl_ast_node *ptr)
5518 : ast_node(ptr) {}
5519
5520ast_node_block &ast_node_block::operator=(ast_node_block obj) {
5521 std::swap(this->ptr, obj.ptr);
5522 return *this;
5523}
5524
5525isl::ctx ast_node_block::ctx() const {
5526 return isl::ctx(isl_ast_node_get_ctx(ptr));
5527}
5528
5529isl::ast_node_list ast_node_block::children() const
5530{
5531 if (!ptr)
5532 exception::throw_invalid("NULL input", __FILE__, __LINE__);
5533 auto saved_ctx = ctx();
5534 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
5535 auto res = isl_ast_node_block_get_children(get());
5536 if (!res)
5537 exception::throw_last_error(saved_ctx);
5538 return manage(res);
5539}
5540
5541isl::ast_node_list ast_node_block::get_children() const
5542{
5543 return children();
5544}
5545
5546inline std::ostream &operator<<(std::ostream &os, const ast_node_block &obj)
5547{
5548 if (!obj.get())
5549 exception::throw_invalid("NULL input", __FILE__, __LINE__);
5550 auto saved_ctx = isl_ast_node_get_ctx(obj.get());
5551 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
5552 char *str = isl_ast_node_to_str(obj.get());
5553 if (!str)
5554 exception::throw_last_error(saved_ctx);
5555 os << str;
5556 free(str);
5557 return os;
5558}
5559
5560// implementations for isl::ast_node_for
5561ast_node_for::ast_node_for()
5562 : ast_node() {}
5563
5564ast_node_for::ast_node_for(const ast_node_for &obj)
5565 : ast_node(obj)
5566{
5567}
5568
5569ast_node_for::ast_node_for(__isl_take isl_ast_node *ptr)
5570 : ast_node(ptr) {}
5571
5572ast_node_for &ast_node_for::operator=(ast_node_for obj) {
5573 std::swap(this->ptr, obj.ptr);
5574 return *this;
5575}
5576
5577isl::ctx ast_node_for::ctx() const {
5578 return isl::ctx(isl_ast_node_get_ctx(ptr));
5579}
5580
5581isl::ast_node ast_node_for::body() const
5582{
5583 if (!ptr)
5584 exception::throw_invalid("NULL input", __FILE__, __LINE__);
5585 auto saved_ctx = ctx();
5586 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
5587 auto res = isl_ast_node_for_get_body(get());
5588 if (!res)
5589 exception::throw_last_error(saved_ctx);
5590 return manage(res);
5591}
5592
5593isl::ast_node ast_node_for::get_body() const
5594{
5595 return body();
5596}
5597
5598isl::ast_expr ast_node_for::cond() const
5599{
5600 if (!ptr)
5601 exception::throw_invalid("NULL input", __FILE__, __LINE__);
5602 auto saved_ctx = ctx();
5603 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
5604 auto res = isl_ast_node_for_get_cond(get());
5605 if (!res)
5606 exception::throw_last_error(saved_ctx);
5607 return manage(res);
5608}
5609
5610isl::ast_expr ast_node_for::get_cond() const
5611{
5612 return cond();
5613}
5614
5615isl::ast_expr ast_node_for::inc() const
5616{
5617 if (!ptr)
5618 exception::throw_invalid("NULL input", __FILE__, __LINE__);
5619 auto saved_ctx = ctx();
5620 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
5621 auto res = isl_ast_node_for_get_inc(get());
5622 if (!res)
5623 exception::throw_last_error(saved_ctx);
5624 return manage(res);
5625}
5626
5627isl::ast_expr ast_node_for::get_inc() const
5628{
5629 return inc();
5630}
5631
5632isl::ast_expr ast_node_for::init() const
5633{
5634 if (!ptr)
5635 exception::throw_invalid("NULL input", __FILE__, __LINE__);
5636 auto saved_ctx = ctx();
5637 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
5638 auto res = isl_ast_node_for_get_init(get());
5639 if (!res)
5640 exception::throw_last_error(saved_ctx);
5641 return manage(res);
5642}
5643
5644isl::ast_expr ast_node_for::get_init() const
5645{
5646 return init();
5647}
5648
5649isl::ast_expr ast_node_for::iterator() const
5650{
5651 if (!ptr)
5652 exception::throw_invalid("NULL input", __FILE__, __LINE__);
5653 auto saved_ctx = ctx();
5654 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
5655 auto res = isl_ast_node_for_get_iterator(get());
5656 if (!res)
5657 exception::throw_last_error(saved_ctx);
5658 return manage(res);
5659}
5660
5661isl::ast_expr ast_node_for::get_iterator() const
5662{
5663 return iterator();
5664}
5665
5666bool ast_node_for::is_degenerate() const
5667{
5668 if (!ptr)
5669 exception::throw_invalid("NULL input", __FILE__, __LINE__);
5670 auto saved_ctx = ctx();
5671 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
5672 auto res = isl_ast_node_for_is_degenerate(get());
5673 if (res < 0)
5674 exception::throw_last_error(saved_ctx);
5675 return res;
5676}
5677
5678inline std::ostream &operator<<(std::ostream &os, const ast_node_for &obj)
5679{
5680 if (!obj.get())
5681 exception::throw_invalid("NULL input", __FILE__, __LINE__);
5682 auto saved_ctx = isl_ast_node_get_ctx(obj.get());
5683 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
5684 char *str = isl_ast_node_to_str(obj.get());
5685 if (!str)
5686 exception::throw_last_error(saved_ctx);
5687 os << str;
5688 free(str);
5689 return os;
5690}
5691
5692// implementations for isl::ast_node_if
5693ast_node_if::ast_node_if()
5694 : ast_node() {}
5695
5696ast_node_if::ast_node_if(const ast_node_if &obj)
5697 : ast_node(obj)
5698{
5699}
5700
5701ast_node_if::ast_node_if(__isl_take isl_ast_node *ptr)
5702 : ast_node(ptr) {}
5703
5704ast_node_if &ast_node_if::operator=(ast_node_if obj) {
5705 std::swap(this->ptr, obj.ptr);
5706 return *this;
5707}
5708
5709isl::ctx ast_node_if::ctx() const {
5710 return isl::ctx(isl_ast_node_get_ctx(ptr));
5711}
5712
5713isl::ast_expr ast_node_if::cond() const
5714{
5715 if (!ptr)
5716 exception::throw_invalid("NULL input", __FILE__, __LINE__);
5717 auto saved_ctx = ctx();
5718 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
5719 auto res = isl_ast_node_if_get_cond(get());
5720 if (!res)
5721 exception::throw_last_error(saved_ctx);
5722 return manage(res);
5723}
5724
5725isl::ast_expr ast_node_if::get_cond() const
5726{
5727 return cond();
5728}
5729
5730isl::ast_node ast_node_if::else_node() const
5731{
5732 if (!ptr)
5733 exception::throw_invalid("NULL input", __FILE__, __LINE__);
5734 auto saved_ctx = ctx();
5735 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
5736 auto res = isl_ast_node_if_get_else_node(get());
5737 if (!res)
5738 exception::throw_last_error(saved_ctx);
5739 return manage(res);
5740}
5741
5742isl::ast_node ast_node_if::get_else_node() const
5743{
5744 return else_node();
5745}
5746
5747isl::ast_node ast_node_if::then_node() const
5748{
5749 if (!ptr)
5750 exception::throw_invalid("NULL input", __FILE__, __LINE__);
5751 auto saved_ctx = ctx();
5752 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
5753 auto res = isl_ast_node_if_get_then_node(get());
5754 if (!res)
5755 exception::throw_last_error(saved_ctx);
5756 return manage(res);
5757}
5758
5759isl::ast_node ast_node_if::get_then_node() const
5760{
5761 return then_node();
5762}
5763
5764bool ast_node_if::has_else_node() const
5765{
5766 if (!ptr)
5767 exception::throw_invalid("NULL input", __FILE__, __LINE__);
5768 auto saved_ctx = ctx();
5769 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
5770 auto res = isl_ast_node_if_has_else_node(get());
5771 if (res < 0)
5772 exception::throw_last_error(saved_ctx);
5773 return res;
5774}
5775
5776inline std::ostream &operator<<(std::ostream &os, const ast_node_if &obj)
5777{
5778 if (!obj.get())
5779 exception::throw_invalid("NULL input", __FILE__, __LINE__);
5780 auto saved_ctx = isl_ast_node_get_ctx(obj.get());
5781 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
5782 char *str = isl_ast_node_to_str(obj.get());
5783 if (!str)
5784 exception::throw_last_error(saved_ctx);
5785 os << str;
5786 free(str);
5787 return os;
5788}
5789
5790// implementations for isl::ast_node_list
5791ast_node_list manage(__isl_take isl_ast_node_list *ptr) {
5792 if (!ptr)
5793 exception::throw_invalid("NULL input", __FILE__, __LINE__);
5794 return ast_node_list(ptr);
5795}
5796ast_node_list manage_copy(__isl_keep isl_ast_node_list *ptr) {
5797 if (!ptr)
5798 exception::throw_invalid("NULL input", __FILE__, __LINE__);
5799 auto saved_ctx = isl_ast_node_list_get_ctx(ptr);
5800 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
5801 ptr = isl_ast_node_list_copy(ptr);
5802 if (!ptr)
5803 exception::throw_last_error(saved_ctx);
5804 return ast_node_list(ptr);
5805}
5806
5807ast_node_list::ast_node_list()
5808 : ptr(nullptr) {}
5809
5810ast_node_list::ast_node_list(const ast_node_list &obj)
5811 : ptr(nullptr)
5812{
5813 if (!obj.ptr)
5814 exception::throw_invalid("NULL input", __FILE__, __LINE__);
5815 auto saved_ctx = isl_ast_node_list_get_ctx(obj.ptr);
5816 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
5817 ptr = obj.copy();
5818 if (!ptr)
5819 exception::throw_last_error(saved_ctx);
5820}
5821
5822ast_node_list::ast_node_list(__isl_take isl_ast_node_list *ptr)
5823 : ptr(ptr) {}
5824
5825ast_node_list::ast_node_list(isl::ctx ctx, int n)
5826{
5827 auto saved_ctx = ctx;
5828 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
5829 auto res = isl_ast_node_list_alloc(ctx.release(), n);
5830 if (!res)
5831 exception::throw_last_error(saved_ctx);
5832 ptr = res;
5833}
5834
5835ast_node_list::ast_node_list(isl::ast_node el)
5836{
5837 if (el.is_null())
5838 exception::throw_invalid("NULL input", __FILE__, __LINE__);
5839 auto saved_ctx = el.ctx();
5840 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
5841 auto res = isl_ast_node_list_from_ast_node(el.release());
5842 if (!res)
5843 exception::throw_last_error(saved_ctx);
5844 ptr = res;
5845}
5846
5847ast_node_list &ast_node_list::operator=(ast_node_list obj) {
5848 std::swap(this->ptr, obj.ptr);
5849 return *this;
5850}
5851
5852ast_node_list::~ast_node_list() {
5853 if (ptr)
5854 isl_ast_node_list_free(ptr);
5855}
5856
5857__isl_give isl_ast_node_list *ast_node_list::copy() const & {
5858 return isl_ast_node_list_copy(ptr);
5859}
5860
5861__isl_keep isl_ast_node_list *ast_node_list::get() const {
5862 return ptr;
5863}
5864
5865__isl_give isl_ast_node_list *ast_node_list::release() {
5866 isl_ast_node_list *tmp = ptr;
5867 ptr = nullptr;
5868 return tmp;
5869}
5870
5871bool ast_node_list::is_null() const {
5872 return ptr == nullptr;
5873}
5874
5875isl::ctx ast_node_list::ctx() const {
5876 return isl::ctx(isl_ast_node_list_get_ctx(ptr));
5877}
5878
5879isl::ast_node_list ast_node_list::add(isl::ast_node el) const
5880{
5881 if (!ptr || el.is_null())
5882 exception::throw_invalid("NULL input", __FILE__, __LINE__);
5883 auto saved_ctx = ctx();
5884 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
5885 auto res = isl_ast_node_list_add(copy(), el.release());
5886 if (!res)
5887 exception::throw_last_error(saved_ctx);
5888 return manage(res);
5889}
5890
5891isl::ast_node_list ast_node_list::clear() const
5892{
5893 if (!ptr)
5894 exception::throw_invalid("NULL input", __FILE__, __LINE__);
5895 auto saved_ctx = ctx();
5896 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
5897 auto res = isl_ast_node_list_clear(copy());
5898 if (!res)
5899 exception::throw_last_error(saved_ctx);
5900 return manage(res);
5901}
5902
5903isl::ast_node_list ast_node_list::concat(isl::ast_node_list list2) const
5904{
5905 if (!ptr || list2.is_null())
5906 exception::throw_invalid("NULL input", __FILE__, __LINE__);
5907 auto saved_ctx = ctx();
5908 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
5909 auto res = isl_ast_node_list_concat(copy(), list2.release());
5910 if (!res)
5911 exception::throw_last_error(saved_ctx);
5912 return manage(res);
5913}
5914
5915isl::ast_node_list ast_node_list::drop(unsigned int first, unsigned int n) const
5916{
5917 if (!ptr)
5918 exception::throw_invalid("NULL input", __FILE__, __LINE__);
5919 auto saved_ctx = ctx();
5920 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
5921 auto res = isl_ast_node_list_drop(copy(), first, n);
5922 if (!res)
5923 exception::throw_last_error(saved_ctx);
5924 return manage(res);
5925}
5926
5927void ast_node_list::foreach(const std::function<void(isl::ast_node)> &fn) const
5928{
5929 if (!ptr)
5930 exception::throw_invalid("NULL input", __FILE__, __LINE__);
5931 auto saved_ctx = ctx();
5932 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
5933 struct fn_data {
5934 std::function<void(isl::ast_node)> func;
5935 std::exception_ptr eptr;
5936 } fn_data = { fn };
5937 auto fn_lambda = [](isl_ast_node *arg_0, void *arg_1) -> isl_stat {
5938 auto *data = static_cast<struct fn_data *>(arg_1);
5939 ISL_CPP_TRY {
5940 (data->func)(manage(arg_0));
5941 return isl_stat_ok;
5942 } ISL_CPP_CATCH_ALL {
5943 data->eptr = std::current_exception();
5944 return isl_stat_error;
5945 }
5946 };
5947 auto res = isl_ast_node_list_foreach(get(), fn_lambda, &fn_data);
5948 if (fn_data.eptr)
5949 std::rethrow_exception(fn_data.eptr);
5950 if (res < 0)
5951 exception::throw_last_error(saved_ctx);
5952 return;
5953}
5954
5955isl::ast_node ast_node_list::at(int index) const
5956{
5957 if (!ptr)
5958 exception::throw_invalid("NULL input", __FILE__, __LINE__);
5959 auto saved_ctx = ctx();
5960 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
5961 auto res = isl_ast_node_list_get_at(get(), index);
5962 if (!res)
5963 exception::throw_last_error(saved_ctx);
5964 return manage(res);
5965}
5966
5967isl::ast_node ast_node_list::get_at(int index) const
5968{
5969 return at(index);
5970}
5971
5972isl::ast_node_list ast_node_list::insert(unsigned int pos, isl::ast_node el) const
5973{
5974 if (!ptr || el.is_null())
5975 exception::throw_invalid("NULL input", __FILE__, __LINE__);
5976 auto saved_ctx = ctx();
5977 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
5978 auto res = isl_ast_node_list_insert(copy(), pos, el.release());
5979 if (!res)
5980 exception::throw_last_error(saved_ctx);
5981 return manage(res);
5982}
5983
5984unsigned ast_node_list::size() const
5985{
5986 if (!ptr)
5987 exception::throw_invalid("NULL input", __FILE__, __LINE__);
5988 auto saved_ctx = ctx();
5989 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
5990 auto res = isl_ast_node_list_size(get());
5991 if (res < 0)
5992 exception::throw_last_error(saved_ctx);
5993 return res;
5994}
5995
5996inline std::ostream &operator<<(std::ostream &os, const ast_node_list &obj)
5997{
5998 if (!obj.get())
5999 exception::throw_invalid("NULL input", __FILE__, __LINE__);
6000 auto saved_ctx = isl_ast_node_list_get_ctx(obj.get());
6001 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6002 char *str = isl_ast_node_list_to_str(obj.get());
6003 if (!str)
6004 exception::throw_last_error(saved_ctx);
6005 os << str;
6006 free(str);
6007 return os;
6008}
6009
6010// implementations for isl::ast_node_mark
6011ast_node_mark::ast_node_mark()
6012 : ast_node() {}
6013
6014ast_node_mark::ast_node_mark(const ast_node_mark &obj)
6015 : ast_node(obj)
6016{
6017}
6018
6019ast_node_mark::ast_node_mark(__isl_take isl_ast_node *ptr)
6020 : ast_node(ptr) {}
6021
6022ast_node_mark &ast_node_mark::operator=(ast_node_mark obj) {
6023 std::swap(this->ptr, obj.ptr);
6024 return *this;
6025}
6026
6027isl::ctx ast_node_mark::ctx() const {
6028 return isl::ctx(isl_ast_node_get_ctx(ptr));
6029}
6030
6031isl::id ast_node_mark::id() const
6032{
6033 if (!ptr)
6034 exception::throw_invalid("NULL input", __FILE__, __LINE__);
6035 auto saved_ctx = ctx();
6036 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6037 auto res = isl_ast_node_mark_get_id(get());
6038 if (!res)
6039 exception::throw_last_error(saved_ctx);
6040 return manage(res);
6041}
6042
6043isl::id ast_node_mark::get_id() const
6044{
6045 return id();
6046}
6047
6048isl::ast_node ast_node_mark::node() const
6049{
6050 if (!ptr)
6051 exception::throw_invalid("NULL input", __FILE__, __LINE__);
6052 auto saved_ctx = ctx();
6053 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6054 auto res = isl_ast_node_mark_get_node(get());
6055 if (!res)
6056 exception::throw_last_error(saved_ctx);
6057 return manage(res);
6058}
6059
6060isl::ast_node ast_node_mark::get_node() const
6061{
6062 return node();
6063}
6064
6065inline std::ostream &operator<<(std::ostream &os, const ast_node_mark &obj)
6066{
6067 if (!obj.get())
6068 exception::throw_invalid("NULL input", __FILE__, __LINE__);
6069 auto saved_ctx = isl_ast_node_get_ctx(obj.get());
6070 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6071 char *str = isl_ast_node_to_str(obj.get());
6072 if (!str)
6073 exception::throw_last_error(saved_ctx);
6074 os << str;
6075 free(str);
6076 return os;
6077}
6078
6079// implementations for isl::ast_node_user
6080ast_node_user::ast_node_user()
6081 : ast_node() {}
6082
6083ast_node_user::ast_node_user(const ast_node_user &obj)
6084 : ast_node(obj)
6085{
6086}
6087
6088ast_node_user::ast_node_user(__isl_take isl_ast_node *ptr)
6089 : ast_node(ptr) {}
6090
6091ast_node_user &ast_node_user::operator=(ast_node_user obj) {
6092 std::swap(this->ptr, obj.ptr);
6093 return *this;
6094}
6095
6096isl::ctx ast_node_user::ctx() const {
6097 return isl::ctx(isl_ast_node_get_ctx(ptr));
6098}
6099
6100isl::ast_expr ast_node_user::expr() const
6101{
6102 if (!ptr)
6103 exception::throw_invalid("NULL input", __FILE__, __LINE__);
6104 auto saved_ctx = ctx();
6105 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6106 auto res = isl_ast_node_user_get_expr(get());
6107 if (!res)
6108 exception::throw_last_error(saved_ctx);
6109 return manage(res);
6110}
6111
6112isl::ast_expr ast_node_user::get_expr() const
6113{
6114 return expr();
6115}
6116
6117inline std::ostream &operator<<(std::ostream &os, const ast_node_user &obj)
6118{
6119 if (!obj.get())
6120 exception::throw_invalid("NULL input", __FILE__, __LINE__);
6121 auto saved_ctx = isl_ast_node_get_ctx(obj.get());
6122 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6123 char *str = isl_ast_node_to_str(obj.get());
6124 if (!str)
6125 exception::throw_last_error(saved_ctx);
6126 os << str;
6127 free(str);
6128 return os;
6129}
6130
6131// implementations for isl::basic_map
6132basic_map manage(__isl_take isl_basic_map *ptr) {
6133 if (!ptr)
6134 exception::throw_invalid("NULL input", __FILE__, __LINE__);
6135 return basic_map(ptr);
6136}
6137basic_map manage_copy(__isl_keep isl_basic_map *ptr) {
6138 if (!ptr)
6139 exception::throw_invalid("NULL input", __FILE__, __LINE__);
6140 auto saved_ctx = isl_basic_map_get_ctx(ptr);
6141 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6142 ptr = isl_basic_map_copy(ptr);
6143 if (!ptr)
6144 exception::throw_last_error(saved_ctx);
6145 return basic_map(ptr);
6146}
6147
6148basic_map::basic_map()
6149 : ptr(nullptr) {}
6150
6151basic_map::basic_map(const basic_map &obj)
6152 : ptr(nullptr)
6153{
6154 if (!obj.ptr)
6155 exception::throw_invalid("NULL input", __FILE__, __LINE__);
6156 auto saved_ctx = isl_basic_map_get_ctx(obj.ptr);
6157 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6158 ptr = obj.copy();
6159 if (!ptr)
6160 exception::throw_last_error(saved_ctx);
6161}
6162
6163basic_map::basic_map(__isl_take isl_basic_map *ptr)
6164 : ptr(ptr) {}
6165
6166basic_map::basic_map(isl::ctx ctx, const std::string &str)
6167{
6168 auto saved_ctx = ctx;
6169 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6170 auto res = isl_basic_map_read_from_str(ctx.release(), str.c_str());
6171 if (!res)
6172 exception::throw_last_error(saved_ctx);
6173 ptr = res;
6174}
6175
6176basic_map &basic_map::operator=(basic_map obj) {
6177 std::swap(this->ptr, obj.ptr);
6178 return *this;
6179}
6180
6181basic_map::~basic_map() {
6182 if (ptr)
6183 isl_basic_map_free(ptr);
6184}
6185
6186__isl_give isl_basic_map *basic_map::copy() const & {
6187 return isl_basic_map_copy(ptr);
6188}
6189
6190__isl_keep isl_basic_map *basic_map::get() const {
6191 return ptr;
6192}
6193
6194__isl_give isl_basic_map *basic_map::release() {
6195 isl_basic_map *tmp = ptr;
6196 ptr = nullptr;
6197 return tmp;
6198}
6199
6200bool basic_map::is_null() const {
6201 return ptr == nullptr;
6202}
6203
6204isl::ctx basic_map::ctx() const {
6205 return isl::ctx(isl_basic_map_get_ctx(ptr));
6206}
6207
6208isl::basic_map basic_map::affine_hull() const
6209{
6210 if (!ptr)
6211 exception::throw_invalid("NULL input", __FILE__, __LINE__);
6212 auto saved_ctx = ctx();
6213 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6214 auto res = isl_basic_map_affine_hull(copy());
6215 if (!res)
6216 exception::throw_last_error(saved_ctx);
6217 return manage(res);
6218}
6219
6220isl::basic_map basic_map::apply_domain(isl::basic_map bmap2) const
6221{
6222 if (!ptr || bmap2.is_null())
6223 exception::throw_invalid("NULL input", __FILE__, __LINE__);
6224 auto saved_ctx = ctx();
6225 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6226 auto res = isl_basic_map_apply_domain(copy(), bmap2.release());
6227 if (!res)
6228 exception::throw_last_error(saved_ctx);
6229 return manage(res);
6230}
6231
6232isl::basic_map basic_map::apply_range(isl::basic_map bmap2) const
6233{
6234 if (!ptr || bmap2.is_null())
6235 exception::throw_invalid("NULL input", __FILE__, __LINE__);
6236 auto saved_ctx = ctx();
6237 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6238 auto res = isl_basic_map_apply_range(copy(), bmap2.release());
6239 if (!res)
6240 exception::throw_last_error(saved_ctx);
6241 return manage(res);
6242}
6243
6244isl::basic_set basic_map::deltas() const
6245{
6246 if (!ptr)
6247 exception::throw_invalid("NULL input", __FILE__, __LINE__);
6248 auto saved_ctx = ctx();
6249 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6250 auto res = isl_basic_map_deltas(copy());
6251 if (!res)
6252 exception::throw_last_error(saved_ctx);
6253 return manage(res);
6254}
6255
6256isl::basic_map basic_map::detect_equalities() const
6257{
6258 if (!ptr)
6259 exception::throw_invalid("NULL input", __FILE__, __LINE__);
6260 auto saved_ctx = ctx();
6261 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6262 auto res = isl_basic_map_detect_equalities(copy());
6263 if (!res)
6264 exception::throw_last_error(saved_ctx);
6265 return manage(res);
6266}
6267
6268isl::basic_map basic_map::flatten() const
6269{
6270 if (!ptr)
6271 exception::throw_invalid("NULL input", __FILE__, __LINE__);
6272 auto saved_ctx = ctx();
6273 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6274 auto res = isl_basic_map_flatten(copy());
6275 if (!res)
6276 exception::throw_last_error(saved_ctx);
6277 return manage(res);
6278}
6279
6280isl::basic_map basic_map::flatten_domain() const
6281{
6282 if (!ptr)
6283 exception::throw_invalid("NULL input", __FILE__, __LINE__);
6284 auto saved_ctx = ctx();
6285 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6286 auto res = isl_basic_map_flatten_domain(copy());
6287 if (!res)
6288 exception::throw_last_error(saved_ctx);
6289 return manage(res);
6290}
6291
6292isl::basic_map basic_map::flatten_range() const
6293{
6294 if (!ptr)
6295 exception::throw_invalid("NULL input", __FILE__, __LINE__);
6296 auto saved_ctx = ctx();
6297 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6298 auto res = isl_basic_map_flatten_range(copy());
6299 if (!res)
6300 exception::throw_last_error(saved_ctx);
6301 return manage(res);
6302}
6303
6304isl::basic_map basic_map::gist(isl::basic_map context) const
6305{
6306 if (!ptr || context.is_null())
6307 exception::throw_invalid("NULL input", __FILE__, __LINE__);
6308 auto saved_ctx = ctx();
6309 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6310 auto res = isl_basic_map_gist(copy(), context.release());
6311 if (!res)
6312 exception::throw_last_error(saved_ctx);
6313 return manage(res);
6314}
6315
6316isl::basic_map basic_map::intersect(isl::basic_map bmap2) const
6317{
6318 if (!ptr || bmap2.is_null())
6319 exception::throw_invalid("NULL input", __FILE__, __LINE__);
6320 auto saved_ctx = ctx();
6321 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6322 auto res = isl_basic_map_intersect(copy(), bmap2.release());
6323 if (!res)
6324 exception::throw_last_error(saved_ctx);
6325 return manage(res);
6326}
6327
6328isl::basic_map basic_map::intersect_domain(isl::basic_set bset) const
6329{
6330 if (!ptr || bset.is_null())
6331 exception::throw_invalid("NULL input", __FILE__, __LINE__);
6332 auto saved_ctx = ctx();
6333 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6334 auto res = isl_basic_map_intersect_domain(copy(), bset.release());
6335 if (!res)
6336 exception::throw_last_error(saved_ctx);
6337 return manage(res);
6338}
6339
6340isl::basic_map basic_map::intersect_range(isl::basic_set bset) const
6341{
6342 if (!ptr || bset.is_null())
6343 exception::throw_invalid("NULL input", __FILE__, __LINE__);
6344 auto saved_ctx = ctx();
6345 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6346 auto res = isl_basic_map_intersect_range(copy(), bset.release());
6347 if (!res)
6348 exception::throw_last_error(saved_ctx);
6349 return manage(res);
6350}
6351
6352bool basic_map::is_empty() const
6353{
6354 if (!ptr)
6355 exception::throw_invalid("NULL input", __FILE__, __LINE__);
6356 auto saved_ctx = ctx();
6357 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6358 auto res = isl_basic_map_is_empty(get());
6359 if (res < 0)
6360 exception::throw_last_error(saved_ctx);
6361 return res;
6362}
6363
6364bool basic_map::is_equal(const isl::basic_map &bmap2) const
6365{
6366 if (!ptr || bmap2.is_null())
6367 exception::throw_invalid("NULL input", __FILE__, __LINE__);
6368 auto saved_ctx = ctx();
6369 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6370 auto res = isl_basic_map_is_equal(get(), bmap2.get());
6371 if (res < 0)
6372 exception::throw_last_error(saved_ctx);
6373 return res;
6374}
6375
6376bool basic_map::is_subset(const isl::basic_map &bmap2) const
6377{
6378 if (!ptr || bmap2.is_null())
6379 exception::throw_invalid("NULL input", __FILE__, __LINE__);
6380 auto saved_ctx = ctx();
6381 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6382 auto res = isl_basic_map_is_subset(get(), bmap2.get());
6383 if (res < 0)
6384 exception::throw_last_error(saved_ctx);
6385 return res;
6386}
6387
6388isl::map basic_map::lexmax() const
6389{
6390 if (!ptr)
6391 exception::throw_invalid("NULL input", __FILE__, __LINE__);
6392 auto saved_ctx = ctx();
6393 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6394 auto res = isl_basic_map_lexmax(copy());
6395 if (!res)
6396 exception::throw_last_error(saved_ctx);
6397 return manage(res);
6398}
6399
6400isl::map basic_map::lexmin() const
6401{
6402 if (!ptr)
6403 exception::throw_invalid("NULL input", __FILE__, __LINE__);
6404 auto saved_ctx = ctx();
6405 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6406 auto res = isl_basic_map_lexmin(copy());
6407 if (!res)
6408 exception::throw_last_error(saved_ctx);
6409 return manage(res);
6410}
6411
6412isl::basic_map basic_map::reverse() const
6413{
6414 if (!ptr)
6415 exception::throw_invalid("NULL input", __FILE__, __LINE__);
6416 auto saved_ctx = ctx();
6417 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6418 auto res = isl_basic_map_reverse(copy());
6419 if (!res)
6420 exception::throw_last_error(saved_ctx);
6421 return manage(res);
6422}
6423
6424isl::basic_map basic_map::sample() const
6425{
6426 if (!ptr)
6427 exception::throw_invalid("NULL input", __FILE__, __LINE__);
6428 auto saved_ctx = ctx();
6429 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6430 auto res = isl_basic_map_sample(copy());
6431 if (!res)
6432 exception::throw_last_error(saved_ctx);
6433 return manage(res);
6434}
6435
6436isl::map basic_map::unite(isl::basic_map bmap2) const
6437{
6438 if (!ptr || bmap2.is_null())
6439 exception::throw_invalid("NULL input", __FILE__, __LINE__);
6440 auto saved_ctx = ctx();
6441 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6442 auto res = isl_basic_map_union(copy(), bmap2.release());
6443 if (!res)
6444 exception::throw_last_error(saved_ctx);
6445 return manage(res);
6446}
6447
6448inline std::ostream &operator<<(std::ostream &os, const basic_map &obj)
6449{
6450 if (!obj.get())
6451 exception::throw_invalid("NULL input", __FILE__, __LINE__);
6452 auto saved_ctx = isl_basic_map_get_ctx(obj.get());
6453 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6454 char *str = isl_basic_map_to_str(obj.get());
6455 if (!str)
6456 exception::throw_last_error(saved_ctx);
6457 os << str;
6458 free(str);
6459 return os;
6460}
6461
6462// implementations for isl::basic_set
6463basic_set manage(__isl_take isl_basic_set *ptr) {
6464 if (!ptr)
6465 exception::throw_invalid("NULL input", __FILE__, __LINE__);
6466 return basic_set(ptr);
6467}
6468basic_set manage_copy(__isl_keep isl_basic_set *ptr) {
6469 if (!ptr)
6470 exception::throw_invalid("NULL input", __FILE__, __LINE__);
6471 auto saved_ctx = isl_basic_set_get_ctx(ptr);
6472 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6473 ptr = isl_basic_set_copy(ptr);
6474 if (!ptr)
6475 exception::throw_last_error(saved_ctx);
6476 return basic_set(ptr);
6477}
6478
6479basic_set::basic_set()
6480 : ptr(nullptr) {}
6481
6482basic_set::basic_set(const basic_set &obj)
6483 : ptr(nullptr)
6484{
6485 if (!obj.ptr)
6486 exception::throw_invalid("NULL input", __FILE__, __LINE__);
6487 auto saved_ctx = isl_basic_set_get_ctx(obj.ptr);
6488 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6489 ptr = obj.copy();
6490 if (!ptr)
6491 exception::throw_last_error(saved_ctx);
6492}
6493
6494basic_set::basic_set(__isl_take isl_basic_set *ptr)
6495 : ptr(ptr) {}
6496
6497basic_set::basic_set(isl::point pnt)
6498{
6499 if (pnt.is_null())
6500 exception::throw_invalid("NULL input", __FILE__, __LINE__);
6501 auto saved_ctx = pnt.ctx();
6502 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6503 auto res = isl_basic_set_from_point(pnt.release());
6504 if (!res)
6505 exception::throw_last_error(saved_ctx);
6506 ptr = res;
6507}
6508
6509basic_set::basic_set(isl::ctx ctx, const std::string &str)
6510{
6511 auto saved_ctx = ctx;
6512 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6513 auto res = isl_basic_set_read_from_str(ctx.release(), str.c_str());
6514 if (!res)
6515 exception::throw_last_error(saved_ctx);
6516 ptr = res;
6517}
6518
6519basic_set &basic_set::operator=(basic_set obj) {
6520 std::swap(this->ptr, obj.ptr);
6521 return *this;
6522}
6523
6524basic_set::~basic_set() {
6525 if (ptr)
6526 isl_basic_set_free(ptr);
6527}
6528
6529__isl_give isl_basic_set *basic_set::copy() const & {
6530 return isl_basic_set_copy(ptr);
6531}
6532
6533__isl_keep isl_basic_set *basic_set::get() const {
6534 return ptr;
6535}
6536
6537__isl_give isl_basic_set *basic_set::release() {
6538 isl_basic_set *tmp = ptr;
6539 ptr = nullptr;
6540 return tmp;
6541}
6542
6543bool basic_set::is_null() const {
6544 return ptr == nullptr;
6545}
6546
6547isl::ctx basic_set::ctx() const {
6548 return isl::ctx(isl_basic_set_get_ctx(ptr));
6549}
6550
6551isl::basic_set basic_set::affine_hull() const
6552{
6553 if (!ptr)
6554 exception::throw_invalid("NULL input", __FILE__, __LINE__);
6555 auto saved_ctx = ctx();
6556 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6557 auto res = isl_basic_set_affine_hull(copy());
6558 if (!res)
6559 exception::throw_last_error(saved_ctx);
6560 return manage(res);
6561}
6562
6563isl::basic_set basic_set::apply(isl::basic_map bmap) const
6564{
6565 if (!ptr || bmap.is_null())
6566 exception::throw_invalid("NULL input", __FILE__, __LINE__);
6567 auto saved_ctx = ctx();
6568 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6569 auto res = isl_basic_set_apply(copy(), bmap.release());
6570 if (!res)
6571 exception::throw_last_error(saved_ctx);
6572 return manage(res);
6573}
6574
6575isl::basic_set basic_set::detect_equalities() const
6576{
6577 if (!ptr)
6578 exception::throw_invalid("NULL input", __FILE__, __LINE__);
6579 auto saved_ctx = ctx();
6580 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6581 auto res = isl_basic_set_detect_equalities(copy());
6582 if (!res)
6583 exception::throw_last_error(saved_ctx);
6584 return manage(res);
6585}
6586
6587isl::val basic_set::dim_max_val(int pos) const
6588{
6589 if (!ptr)
6590 exception::throw_invalid("NULL input", __FILE__, __LINE__);
6591 auto saved_ctx = ctx();
6592 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6593 auto res = isl_basic_set_dim_max_val(copy(), pos);
6594 if (!res)
6595 exception::throw_last_error(saved_ctx);
6596 return manage(res);
6597}
6598
6599isl::basic_set basic_set::flatten() const
6600{
6601 if (!ptr)
6602 exception::throw_invalid("NULL input", __FILE__, __LINE__);
6603 auto saved_ctx = ctx();
6604 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6605 auto res = isl_basic_set_flatten(copy());
6606 if (!res)
6607 exception::throw_last_error(saved_ctx);
6608 return manage(res);
6609}
6610
6611isl::basic_set basic_set::gist(isl::basic_set context) const
6612{
6613 if (!ptr || context.is_null())
6614 exception::throw_invalid("NULL input", __FILE__, __LINE__);
6615 auto saved_ctx = ctx();
6616 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6617 auto res = isl_basic_set_gist(copy(), context.release());
6618 if (!res)
6619 exception::throw_last_error(saved_ctx);
6620 return manage(res);
6621}
6622
6623isl::basic_set basic_set::intersect(isl::basic_set bset2) const
6624{
6625 if (!ptr || bset2.is_null())
6626 exception::throw_invalid("NULL input", __FILE__, __LINE__);
6627 auto saved_ctx = ctx();
6628 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6629 auto res = isl_basic_set_intersect(copy(), bset2.release());
6630 if (!res)
6631 exception::throw_last_error(saved_ctx);
6632 return manage(res);
6633}
6634
6635isl::basic_set basic_set::intersect_params(isl::basic_set bset2) const
6636{
6637 if (!ptr || bset2.is_null())
6638 exception::throw_invalid("NULL input", __FILE__, __LINE__);
6639 auto saved_ctx = ctx();
6640 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6641 auto res = isl_basic_set_intersect_params(copy(), bset2.release());
6642 if (!res)
6643 exception::throw_last_error(saved_ctx);
6644 return manage(res);
6645}
6646
6647bool basic_set::is_empty() const
6648{
6649 if (!ptr)
6650 exception::throw_invalid("NULL input", __FILE__, __LINE__);
6651 auto saved_ctx = ctx();
6652 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6653 auto res = isl_basic_set_is_empty(get());
6654 if (res < 0)
6655 exception::throw_last_error(saved_ctx);
6656 return res;
6657}
6658
6659bool basic_set::is_equal(const isl::basic_set &bset2) const
6660{
6661 if (!ptr || bset2.is_null())
6662 exception::throw_invalid("NULL input", __FILE__, __LINE__);
6663 auto saved_ctx = ctx();
6664 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6665 auto res = isl_basic_set_is_equal(get(), bset2.get());
6666 if (res < 0)
6667 exception::throw_last_error(saved_ctx);
6668 return res;
6669}
6670
6671bool basic_set::is_subset(const isl::basic_set &bset2) const
6672{
6673 if (!ptr || bset2.is_null())
6674 exception::throw_invalid("NULL input", __FILE__, __LINE__);
6675 auto saved_ctx = ctx();
6676 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6677 auto res = isl_basic_set_is_subset(get(), bset2.get());
6678 if (res < 0)
6679 exception::throw_last_error(saved_ctx);
6680 return res;
6681}
6682
6683bool basic_set::is_wrapping() const
6684{
6685 if (!ptr)
6686 exception::throw_invalid("NULL input", __FILE__, __LINE__);
6687 auto saved_ctx = ctx();
6688 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6689 auto res = isl_basic_set_is_wrapping(get());
6690 if (res < 0)
6691 exception::throw_last_error(saved_ctx);
6692 return res;
6693}
6694
6695isl::set basic_set::lexmax() const
6696{
6697 if (!ptr)
6698 exception::throw_invalid("NULL input", __FILE__, __LINE__);
6699 auto saved_ctx = ctx();
6700 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6701 auto res = isl_basic_set_lexmax(copy());
6702 if (!res)
6703 exception::throw_last_error(saved_ctx);
6704 return manage(res);
6705}
6706
6707isl::set basic_set::lexmin() const
6708{
6709 if (!ptr)
6710 exception::throw_invalid("NULL input", __FILE__, __LINE__);
6711 auto saved_ctx = ctx();
6712 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6713 auto res = isl_basic_set_lexmin(copy());
6714 if (!res)
6715 exception::throw_last_error(saved_ctx);
6716 return manage(res);
6717}
6718
6719isl::basic_set basic_set::params() const
6720{
6721 if (!ptr)
6722 exception::throw_invalid("NULL input", __FILE__, __LINE__);
6723 auto saved_ctx = ctx();
6724 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6725 auto res = isl_basic_set_params(copy());
6726 if (!res)
6727 exception::throw_last_error(saved_ctx);
6728 return manage(res);
6729}
6730
6731isl::basic_set basic_set::sample() const
6732{
6733 if (!ptr)
6734 exception::throw_invalid("NULL input", __FILE__, __LINE__);
6735 auto saved_ctx = ctx();
6736 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6737 auto res = isl_basic_set_sample(copy());
6738 if (!res)
6739 exception::throw_last_error(saved_ctx);
6740 return manage(res);
6741}
6742
6743isl::point basic_set::sample_point() const
6744{
6745 if (!ptr)
6746 exception::throw_invalid("NULL input", __FILE__, __LINE__);
6747 auto saved_ctx = ctx();
6748 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6749 auto res = isl_basic_set_sample_point(copy());
6750 if (!res)
6751 exception::throw_last_error(saved_ctx);
6752 return manage(res);
6753}
6754
6755isl::set basic_set::unite(isl::basic_set bset2) const
6756{
6757 if (!ptr || bset2.is_null())
6758 exception::throw_invalid("NULL input", __FILE__, __LINE__);
6759 auto saved_ctx = ctx();
6760 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6761 auto res = isl_basic_set_union(copy(), bset2.release());
6762 if (!res)
6763 exception::throw_last_error(saved_ctx);
6764 return manage(res);
6765}
6766
6767inline std::ostream &operator<<(std::ostream &os, const basic_set &obj)
6768{
6769 if (!obj.get())
6770 exception::throw_invalid("NULL input", __FILE__, __LINE__);
6771 auto saved_ctx = isl_basic_set_get_ctx(obj.get());
6772 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6773 char *str = isl_basic_set_to_str(obj.get());
6774 if (!str)
6775 exception::throw_last_error(saved_ctx);
6776 os << str;
6777 free(str);
6778 return os;
6779}
6780
6781// implementations for isl::fixed_box
6782fixed_box manage(__isl_take isl_fixed_box *ptr) {
6783 if (!ptr)
6784 exception::throw_invalid("NULL input", __FILE__, __LINE__);
6785 return fixed_box(ptr);
6786}
6787fixed_box manage_copy(__isl_keep isl_fixed_box *ptr) {
6788 if (!ptr)
6789 exception::throw_invalid("NULL input", __FILE__, __LINE__);
6790 auto saved_ctx = isl_fixed_box_get_ctx(ptr);
6791 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6792 ptr = isl_fixed_box_copy(ptr);
6793 if (!ptr)
6794 exception::throw_last_error(saved_ctx);
6795 return fixed_box(ptr);
6796}
6797
6798fixed_box::fixed_box()
6799 : ptr(nullptr) {}
6800
6801fixed_box::fixed_box(const fixed_box &obj)
6802 : ptr(nullptr)
6803{
6804 if (!obj.ptr)
6805 exception::throw_invalid("NULL input", __FILE__, __LINE__);
6806 auto saved_ctx = isl_fixed_box_get_ctx(obj.ptr);
6807 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6808 ptr = obj.copy();
6809 if (!ptr)
6810 exception::throw_last_error(saved_ctx);
6811}
6812
6813fixed_box::fixed_box(__isl_take isl_fixed_box *ptr)
6814 : ptr(ptr) {}
6815
6816fixed_box &fixed_box::operator=(fixed_box obj) {
6817 std::swap(this->ptr, obj.ptr);
6818 return *this;
6819}
6820
6821fixed_box::~fixed_box() {
6822 if (ptr)
6823 isl_fixed_box_free(ptr);
6824}
6825
6826__isl_give isl_fixed_box *fixed_box::copy() const & {
6827 return isl_fixed_box_copy(ptr);
6828}
6829
6830__isl_keep isl_fixed_box *fixed_box::get() const {
6831 return ptr;
6832}
6833
6834__isl_give isl_fixed_box *fixed_box::release() {
6835 isl_fixed_box *tmp = ptr;
6836 ptr = nullptr;
6837 return tmp;
6838}
6839
6840bool fixed_box::is_null() const {
6841 return ptr == nullptr;
6842}
6843
6844isl::ctx fixed_box::ctx() const {
6845 return isl::ctx(isl_fixed_box_get_ctx(ptr));
6846}
6847
6848isl::multi_aff fixed_box::offset() const
6849{
6850 if (!ptr)
6851 exception::throw_invalid("NULL input", __FILE__, __LINE__);
6852 auto saved_ctx = ctx();
6853 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6854 auto res = isl_fixed_box_get_offset(get());
6855 if (!res)
6856 exception::throw_last_error(saved_ctx);
6857 return manage(res);
6858}
6859
6860isl::multi_aff fixed_box::get_offset() const
6861{
6862 return offset();
6863}
6864
6865isl::multi_val fixed_box::size() const
6866{
6867 if (!ptr)
6868 exception::throw_invalid("NULL input", __FILE__, __LINE__);
6869 auto saved_ctx = ctx();
6870 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6871 auto res = isl_fixed_box_get_size(get());
6872 if (!res)
6873 exception::throw_last_error(saved_ctx);
6874 return manage(res);
6875}
6876
6877isl::multi_val fixed_box::get_size() const
6878{
6879 return size();
6880}
6881
6882isl::space fixed_box::space() const
6883{
6884 if (!ptr)
6885 exception::throw_invalid("NULL input", __FILE__, __LINE__);
6886 auto saved_ctx = ctx();
6887 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6888 auto res = isl_fixed_box_get_space(get());
6889 if (!res)
6890 exception::throw_last_error(saved_ctx);
6891 return manage(res);
6892}
6893
6894isl::space fixed_box::get_space() const
6895{
6896 return space();
6897}
6898
6899bool fixed_box::is_valid() const
6900{
6901 if (!ptr)
6902 exception::throw_invalid("NULL input", __FILE__, __LINE__);
6903 auto saved_ctx = ctx();
6904 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6905 auto res = isl_fixed_box_is_valid(get());
6906 if (res < 0)
6907 exception::throw_last_error(saved_ctx);
6908 return res;
6909}
6910
6911inline std::ostream &operator<<(std::ostream &os, const fixed_box &obj)
6912{
6913 if (!obj.get())
6914 exception::throw_invalid("NULL input", __FILE__, __LINE__);
6915 auto saved_ctx = isl_fixed_box_get_ctx(obj.get());
6916 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6917 char *str = isl_fixed_box_to_str(obj.get());
6918 if (!str)
6919 exception::throw_last_error(saved_ctx);
6920 os << str;
6921 free(str);
6922 return os;
6923}
6924
6925// implementations for isl::id
6926id manage(__isl_take isl_id *ptr) {
6927 if (!ptr)
6928 exception::throw_invalid("NULL input", __FILE__, __LINE__);
6929 return id(ptr);
6930}
6931id manage_copy(__isl_keep isl_id *ptr) {
6932 if (!ptr)
6933 exception::throw_invalid("NULL input", __FILE__, __LINE__);
6934 auto saved_ctx = isl_id_get_ctx(ptr);
6935 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6936 ptr = isl_id_copy(ptr);
6937 if (!ptr)
6938 exception::throw_last_error(saved_ctx);
6939 return id(ptr);
6940}
6941
6942id::id()
6943 : ptr(nullptr) {}
6944
6945id::id(const id &obj)
6946 : ptr(nullptr)
6947{
6948 if (!obj.ptr)
6949 exception::throw_invalid("NULL input", __FILE__, __LINE__);
6950 auto saved_ctx = isl_id_get_ctx(obj.ptr);
6951 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6952 ptr = obj.copy();
6953 if (!ptr)
6954 exception::throw_last_error(saved_ctx);
6955}
6956
6957id::id(__isl_take isl_id *ptr)
6958 : ptr(ptr) {}
6959
6960id::id(isl::ctx ctx, const std::string &str)
6961{
6962 auto saved_ctx = ctx;
6963 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6964 auto res = isl_id_read_from_str(ctx.release(), str.c_str());
6965 if (!res)
6966 exception::throw_last_error(saved_ctx);
6967 ptr = res;
6968}
6969
6970id &id::operator=(id obj) {
6971 std::swap(this->ptr, obj.ptr);
6972 return *this;
6973}
6974
6975id::~id() {
6976 if (ptr)
6977 isl_id_free(ptr);
6978}
6979
6980__isl_give isl_id *id::copy() const & {
6981 return isl_id_copy(ptr);
6982}
6983
6984__isl_keep isl_id *id::get() const {
6985 return ptr;
6986}
6987
6988__isl_give isl_id *id::release() {
6989 isl_id *tmp = ptr;
6990 ptr = nullptr;
6991 return tmp;
6992}
6993
6994bool id::is_null() const {
6995 return ptr == nullptr;
6996}
6997
6998isl::ctx id::ctx() const {
6999 return isl::ctx(isl_id_get_ctx(ptr));
7000}
7001
7002std::string id::name() const
7003{
7004 if (!ptr)
7005 exception::throw_invalid("NULL input", __FILE__, __LINE__);
7006 auto saved_ctx = ctx();
7007 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7008 auto res = isl_id_get_name(get());
7009 std::string tmp(res);
7010 return tmp;
7011}
7012
7013std::string id::get_name() const
7014{
7015 return name();
7016}
7017
7018inline std::ostream &operator<<(std::ostream &os, const id &obj)
7019{
7020 if (!obj.get())
7021 exception::throw_invalid("NULL input", __FILE__, __LINE__);
7022 auto saved_ctx = isl_id_get_ctx(obj.get());
7023 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7024 char *str = isl_id_to_str(obj.get());
7025 if (!str)
7026 exception::throw_last_error(saved_ctx);
7027 os << str;
7028 free(str);
7029 return os;
7030}
7031
7032// implementations for isl::id_list
7033id_list manage(__isl_take isl_id_list *ptr) {
7034 if (!ptr)
7035 exception::throw_invalid("NULL input", __FILE__, __LINE__);
7036 return id_list(ptr);
7037}
7038id_list manage_copy(__isl_keep isl_id_list *ptr) {
7039 if (!ptr)
7040 exception::throw_invalid("NULL input", __FILE__, __LINE__);
7041 auto saved_ctx = isl_id_list_get_ctx(ptr);
7042 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7043 ptr = isl_id_list_copy(ptr);
7044 if (!ptr)
7045 exception::throw_last_error(saved_ctx);
7046 return id_list(ptr);
7047}
7048
7049id_list::id_list()
7050 : ptr(nullptr) {}
7051
7052id_list::id_list(const id_list &obj)
7053 : ptr(nullptr)
7054{
7055 if (!obj.ptr)
7056 exception::throw_invalid("NULL input", __FILE__, __LINE__);
7057 auto saved_ctx = isl_id_list_get_ctx(obj.ptr);
7058 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7059 ptr = obj.copy();
7060 if (!ptr)
7061 exception::throw_last_error(saved_ctx);
7062}
7063
7064id_list::id_list(__isl_take isl_id_list *ptr)
7065 : ptr(ptr) {}
7066
7067id_list::id_list(isl::ctx ctx, int n)
7068{
7069 auto saved_ctx = ctx;
7070 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7071 auto res = isl_id_list_alloc(ctx.release(), n);
7072 if (!res)
7073 exception::throw_last_error(saved_ctx);
7074 ptr = res;
7075}
7076
7077id_list::id_list(isl::id el)
7078{
7079 if (el.is_null())
7080 exception::throw_invalid("NULL input", __FILE__, __LINE__);
7081 auto saved_ctx = el.ctx();
7082 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7083 auto res = isl_id_list_from_id(el.release());
7084 if (!res)
7085 exception::throw_last_error(saved_ctx);
7086 ptr = res;
7087}
7088
7089id_list &id_list::operator=(id_list obj) {
7090 std::swap(this->ptr, obj.ptr);
7091 return *this;
7092}
7093
7094id_list::~id_list() {
7095 if (ptr)
7096 isl_id_list_free(ptr);
7097}
7098
7099__isl_give isl_id_list *id_list::copy() const & {
7100 return isl_id_list_copy(ptr);
7101}
7102
7103__isl_keep isl_id_list *id_list::get() const {
7104 return ptr;
7105}
7106
7107__isl_give isl_id_list *id_list::release() {
7108 isl_id_list *tmp = ptr;
7109 ptr = nullptr;
7110 return tmp;
7111}
7112
7113bool id_list::is_null() const {
7114 return ptr == nullptr;
7115}
7116
7117isl::ctx id_list::ctx() const {
7118 return isl::ctx(isl_id_list_get_ctx(ptr));
7119}
7120
7121isl::id_list id_list::add(isl::id el) const
7122{
7123 if (!ptr || el.is_null())
7124 exception::throw_invalid("NULL input", __FILE__, __LINE__);
7125 auto saved_ctx = ctx();
7126 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7127 auto res = isl_id_list_add(copy(), el.release());
7128 if (!res)
7129 exception::throw_last_error(saved_ctx);
7130 return manage(res);
7131}
7132
7133isl::id_list id_list::add(const std::string &el) const
7134{
7135 if (!ptr)
7136 exception::throw_invalid("NULL input", __FILE__, __LINE__);
7137 return this->add(isl::id(ctx(), el));
7138}
7139
7140isl::id_list id_list::clear() const
7141{
7142 if (!ptr)
7143 exception::throw_invalid("NULL input", __FILE__, __LINE__);
7144 auto saved_ctx = ctx();
7145 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7146 auto res = isl_id_list_clear(copy());
7147 if (!res)
7148 exception::throw_last_error(saved_ctx);
7149 return manage(res);
7150}
7151
7152isl::id_list id_list::concat(isl::id_list list2) const
7153{
7154 if (!ptr || list2.is_null())
7155 exception::throw_invalid("NULL input", __FILE__, __LINE__);
7156 auto saved_ctx = ctx();
7157 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7158 auto res = isl_id_list_concat(copy(), list2.release());
7159 if (!res)
7160 exception::throw_last_error(saved_ctx);
7161 return manage(res);
7162}
7163
7164isl::id_list id_list::drop(unsigned int first, unsigned int n) const
7165{
7166 if (!ptr)
7167 exception::throw_invalid("NULL input", __FILE__, __LINE__);
7168 auto saved_ctx = ctx();
7169 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7170 auto res = isl_id_list_drop(copy(), first, n);
7171 if (!res)
7172 exception::throw_last_error(saved_ctx);
7173 return manage(res);
7174}
7175
7176void id_list::foreach(const std::function<void(isl::id)> &fn) const
7177{
7178 if (!ptr)
7179 exception::throw_invalid("NULL input", __FILE__, __LINE__);
7180 auto saved_ctx = ctx();
7181 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7182 struct fn_data {
7183 std::function<void(isl::id)> func;
7184 std::exception_ptr eptr;
7185 } fn_data = { fn };
7186 auto fn_lambda = [](isl_id *arg_0, void *arg_1) -> isl_stat {
7187 auto *data = static_cast<struct fn_data *>(arg_1);
7188 ISL_CPP_TRY {
7189 (data->func)(manage(arg_0));
7190 return isl_stat_ok;
7191 } ISL_CPP_CATCH_ALL {
7192 data->eptr = std::current_exception();
7193 return isl_stat_error;
7194 }
7195 };
7196 auto res = isl_id_list_foreach(get(), fn_lambda, &fn_data);
7197 if (fn_data.eptr)
7198 std::rethrow_exception(fn_data.eptr);
7199 if (res < 0)
7200 exception::throw_last_error(saved_ctx);
7201 return;
7202}
7203
7204isl::id id_list::at(int index) const
7205{
7206 if (!ptr)
7207 exception::throw_invalid("NULL input", __FILE__, __LINE__);
7208 auto saved_ctx = ctx();
7209 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7210 auto res = isl_id_list_get_at(get(), index);
7211 if (!res)
7212 exception::throw_last_error(saved_ctx);
7213 return manage(res);
7214}
7215
7216isl::id id_list::get_at(int index) const
7217{
7218 return at(index);
7219}
7220
7221isl::id_list id_list::insert(unsigned int pos, isl::id el) const
7222{
7223 if (!ptr || el.is_null())
7224 exception::throw_invalid("NULL input", __FILE__, __LINE__);
7225 auto saved_ctx = ctx();
7226 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7227 auto res = isl_id_list_insert(copy(), pos, el.release());
7228 if (!res)
7229 exception::throw_last_error(saved_ctx);
7230 return manage(res);
7231}
7232
7233isl::id_list id_list::insert(unsigned int pos, const std::string &el) const
7234{
7235 if (!ptr)
7236 exception::throw_invalid("NULL input", __FILE__, __LINE__);
7237 return this->insert(pos, isl::id(ctx(), el));
7238}
7239
7240unsigned id_list::size() const
7241{
7242 if (!ptr)
7243 exception::throw_invalid("NULL input", __FILE__, __LINE__);
7244 auto saved_ctx = ctx();
7245 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7246 auto res = isl_id_list_size(get());
7247 if (res < 0)
7248 exception::throw_last_error(saved_ctx);
7249 return res;
7250}
7251
7252inline std::ostream &operator<<(std::ostream &os, const id_list &obj)
7253{
7254 if (!obj.get())
7255 exception::throw_invalid("NULL input", __FILE__, __LINE__);
7256 auto saved_ctx = isl_id_list_get_ctx(obj.get());
7257 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7258 char *str = isl_id_list_to_str(obj.get());
7259 if (!str)
7260 exception::throw_last_error(saved_ctx);
7261 os << str;
7262 free(str);
7263 return os;
7264}
7265
7266// implementations for isl::map
7267map manage(__isl_take isl_map *ptr) {
7268 if (!ptr)
7269 exception::throw_invalid("NULL input", __FILE__, __LINE__);
7270 return map(ptr);
7271}
7272map manage_copy(__isl_keep isl_map *ptr) {
7273 if (!ptr)
7274 exception::throw_invalid("NULL input", __FILE__, __LINE__);
7275 auto saved_ctx = isl_map_get_ctx(ptr);
7276 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7277 ptr = isl_map_copy(ptr);
7278 if (!ptr)
7279 exception::throw_last_error(saved_ctx);
7280 return map(ptr);
7281}
7282
7283map::map()
7284 : ptr(nullptr) {}
7285
7286map::map(const map &obj)
7287 : ptr(nullptr)
7288{
7289 if (!obj.ptr)
7290 exception::throw_invalid("NULL input", __FILE__, __LINE__);
7291 auto saved_ctx = isl_map_get_ctx(obj.ptr);
7292 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7293 ptr = obj.copy();
7294 if (!ptr)
7295 exception::throw_last_error(saved_ctx);
7296}
7297
7298map::map(__isl_take isl_map *ptr)
7299 : ptr(ptr) {}
7300
7301map::map(isl::basic_map bmap)
7302{
7303 if (bmap.is_null())
7304 exception::throw_invalid("NULL input", __FILE__, __LINE__);
7305 auto saved_ctx = bmap.ctx();
7306 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7307 auto res = isl_map_from_basic_map(bmap.release());
7308 if (!res)
7309 exception::throw_last_error(saved_ctx);
7310 ptr = res;
7311}
7312
7313map::map(isl::ctx ctx, const std::string &str)
7314{
7315 auto saved_ctx = ctx;
7316 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7317 auto res = isl_map_read_from_str(ctx.release(), str.c_str());
7318 if (!res)
7319 exception::throw_last_error(saved_ctx);
7320 ptr = res;
7321}
7322
7323map &map::operator=(map obj) {
7324 std::swap(this->ptr, obj.ptr);
7325 return *this;
7326}
7327
7328map::~map() {
7329 if (ptr)
7330 isl_map_free(ptr);
7331}
7332
7333__isl_give isl_map *map::copy() const & {
7334 return isl_map_copy(ptr);
7335}
7336
7337__isl_keep isl_map *map::get() const {
7338 return ptr;
7339}
7340
7341__isl_give isl_map *map::release() {
7342 isl_map *tmp = ptr;
7343 ptr = nullptr;
7344 return tmp;
7345}
7346
7347bool map::is_null() const {
7348 return ptr == nullptr;
7349}
7350
7351isl::ctx map::ctx() const {
7352 return isl::ctx(isl_map_get_ctx(ptr));
7353}
7354
7355isl::basic_map map::affine_hull() const
7356{
7357 if (!ptr)
7358 exception::throw_invalid("NULL input", __FILE__, __LINE__);
7359 auto saved_ctx = ctx();
7360 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7361 auto res = isl_map_affine_hull(copy());
7362 if (!res)
7363 exception::throw_last_error(saved_ctx);
7364 return manage(res);
7365}
7366
7367isl::map map::apply_domain(isl::map map2) const
7368{
7369 if (!ptr || map2.is_null())
7370 exception::throw_invalid("NULL input", __FILE__, __LINE__);
7371 auto saved_ctx = ctx();
7372 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7373 auto res = isl_map_apply_domain(copy(), map2.release());
7374 if (!res)
7375 exception::throw_last_error(saved_ctx);
7376 return manage(res);
7377}
7378
7379isl::map map::apply_range(isl::map map2) const
7380{
7381 if (!ptr || map2.is_null())
7382 exception::throw_invalid("NULL input", __FILE__, __LINE__);
7383 auto saved_ctx = ctx();
7384 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7385 auto res = isl_map_apply_range(copy(), map2.release());
7386 if (!res)
7387 exception::throw_last_error(saved_ctx);
7388 return manage(res);
7389}
7390
7391isl::set map::bind_domain(isl::multi_id tuple) const
7392{
7393 if (!ptr || tuple.is_null())
7394 exception::throw_invalid("NULL input", __FILE__, __LINE__);
7395 auto saved_ctx = ctx();
7396 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7397 auto res = isl_map_bind_domain(copy(), tuple.release());
7398 if (!res)
7399 exception::throw_last_error(saved_ctx);
7400 return manage(res);
7401}
7402
7403isl::set map::bind_range(isl::multi_id tuple) const
7404{
7405 if (!ptr || tuple.is_null())
7406 exception::throw_invalid("NULL input", __FILE__, __LINE__);
7407 auto saved_ctx = ctx();
7408 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7409 auto res = isl_map_bind_range(copy(), tuple.release());
7410 if (!res)
7411 exception::throw_last_error(saved_ctx);
7412 return manage(res);
7413}
7414
7415isl::map map::coalesce() const
7416{
7417 if (!ptr)
7418 exception::throw_invalid("NULL input", __FILE__, __LINE__);
7419 auto saved_ctx = ctx();
7420 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7421 auto res = isl_map_coalesce(copy());
7422 if (!res)
7423 exception::throw_last_error(saved_ctx);
7424 return manage(res);
7425}
7426
7427isl::map map::complement() const
7428{
7429 if (!ptr)
7430 exception::throw_invalid("NULL input", __FILE__, __LINE__);
7431 auto saved_ctx = ctx();
7432 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7433 auto res = isl_map_complement(copy());
7434 if (!res)
7435 exception::throw_last_error(saved_ctx);
7436 return manage(res);
7437}
7438
7439isl::map map::curry() const
7440{
7441 if (!ptr)
7442 exception::throw_invalid("NULL input", __FILE__, __LINE__);
7443 auto saved_ctx = ctx();
7444 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7445 auto res = isl_map_curry(copy());
7446 if (!res)
7447 exception::throw_last_error(saved_ctx);
7448 return manage(res);
7449}
7450
7451isl::set map::deltas() const
7452{
7453 if (!ptr)
7454 exception::throw_invalid("NULL input", __FILE__, __LINE__);
7455 auto saved_ctx = ctx();
7456 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7457 auto res = isl_map_deltas(copy());
7458 if (!res)
7459 exception::throw_last_error(saved_ctx);
7460 return manage(res);
7461}
7462
7463isl::map map::detect_equalities() const
7464{
7465 if (!ptr)
7466 exception::throw_invalid("NULL input", __FILE__, __LINE__);
7467 auto saved_ctx = ctx();
7468 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7469 auto res = isl_map_detect_equalities(copy());
7470 if (!res)
7471 exception::throw_last_error(saved_ctx);
7472 return manage(res);
7473}
7474
7475isl::set map::domain() const
7476{
7477 if (!ptr)
7478 exception::throw_invalid("NULL input", __FILE__, __LINE__);
7479 auto saved_ctx = ctx();
7480 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7481 auto res = isl_map_domain(copy());
7482 if (!res)
7483 exception::throw_last_error(saved_ctx);
7484 return manage(res);
7485}
7486
7487isl::map map::domain_factor_domain() const
7488{
7489 if (!ptr)
7490 exception::throw_invalid("NULL input", __FILE__, __LINE__);
7491 auto saved_ctx = ctx();
7492 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7493 auto res = isl_map_domain_factor_domain(copy());
7494 if (!res)
7495 exception::throw_last_error(saved_ctx);
7496 return manage(res);
7497}
7498
7499isl::map map::domain_factor_range() const
7500{
7501 if (!ptr)
7502 exception::throw_invalid("NULL input", __FILE__, __LINE__);
7503 auto saved_ctx = ctx();
7504 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7505 auto res = isl_map_domain_factor_range(copy());
7506 if (!res)
7507 exception::throw_last_error(saved_ctx);
7508 return manage(res);
7509}
7510
7511isl::map map::domain_product(isl::map map2) const
7512{
7513 if (!ptr || map2.is_null())
7514 exception::throw_invalid("NULL input", __FILE__, __LINE__);
7515 auto saved_ctx = ctx();
7516 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7517 auto res = isl_map_domain_product(copy(), map2.release());
7518 if (!res)
7519 exception::throw_last_error(saved_ctx);
7520 return manage(res);
7521}
7522
7523isl::map map::empty(isl::space space)
7524{
7525 if (space.is_null())
7526 exception::throw_invalid("NULL input", __FILE__, __LINE__);
7527 auto saved_ctx = space.ctx();
7528 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7529 auto res = isl_map_empty(space.release());
7530 if (!res)
7531 exception::throw_last_error(saved_ctx);
7532 return manage(res);
7533}
7534
7535isl::map map::eq_at(isl::multi_pw_aff mpa) const
7536{
7537 if (!ptr || mpa.is_null())
7538 exception::throw_invalid("NULL input", __FILE__, __LINE__);
7539 auto saved_ctx = ctx();
7540 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7541 auto res = isl_map_eq_at_multi_pw_aff(copy(), mpa.release());
7542 if (!res)
7543 exception::throw_last_error(saved_ctx);
7544 return manage(res);
7545}
7546
7547isl::map map::factor_domain() const
7548{
7549 if (!ptr)
7550 exception::throw_invalid("NULL input", __FILE__, __LINE__);
7551 auto saved_ctx = ctx();
7552 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7553 auto res = isl_map_factor_domain(copy());
7554 if (!res)
7555 exception::throw_last_error(saved_ctx);
7556 return manage(res);
7557}
7558
7559isl::map map::factor_range() const
7560{
7561 if (!ptr)
7562 exception::throw_invalid("NULL input", __FILE__, __LINE__);
7563 auto saved_ctx = ctx();
7564 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7565 auto res = isl_map_factor_range(copy());
7566 if (!res)
7567 exception::throw_last_error(saved_ctx);
7568 return manage(res);
7569}
7570
7571isl::map map::flatten() const
7572{
7573 if (!ptr)
7574 exception::throw_invalid("NULL input", __FILE__, __LINE__);
7575 auto saved_ctx = ctx();
7576 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7577 auto res = isl_map_flatten(copy());
7578 if (!res)
7579 exception::throw_last_error(saved_ctx);
7580 return manage(res);
7581}
7582
7583isl::map map::flatten_domain() const
7584{
7585 if (!ptr)
7586 exception::throw_invalid("NULL input", __FILE__, __LINE__);
7587 auto saved_ctx = ctx();
7588 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7589 auto res = isl_map_flatten_domain(copy());
7590 if (!res)
7591 exception::throw_last_error(saved_ctx);
7592 return manage(res);
7593}
7594
7595isl::map map::flatten_range() const
7596{
7597 if (!ptr)
7598 exception::throw_invalid("NULL input", __FILE__, __LINE__);
7599 auto saved_ctx = ctx();
7600 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7601 auto res = isl_map_flatten_range(copy());
7602 if (!res)
7603 exception::throw_last_error(saved_ctx);
7604 return manage(res);
7605}
7606
7607void map::foreach_basic_map(const std::function<void(isl::basic_map)> &fn) const
7608{
7609 if (!ptr)
7610 exception::throw_invalid("NULL input", __FILE__, __LINE__);
7611 auto saved_ctx = ctx();
7612 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7613 struct fn_data {
7614 std::function<void(isl::basic_map)> func;
7615 std::exception_ptr eptr;
7616 } fn_data = { fn };
7617 auto fn_lambda = [](isl_basic_map *arg_0, void *arg_1) -> isl_stat {
7618 auto *data = static_cast<struct fn_data *>(arg_1);
7619 ISL_CPP_TRY {
7620 (data->func)(manage(arg_0));
7621 return isl_stat_ok;
7622 } ISL_CPP_CATCH_ALL {
7623 data->eptr = std::current_exception();
7624 return isl_stat_error;
7625 }
7626 };
7627 auto res = isl_map_foreach_basic_map(get(), fn_lambda, &fn_data);
7628 if (fn_data.eptr)
7629 std::rethrow_exception(fn_data.eptr);
7630 if (res < 0)
7631 exception::throw_last_error(saved_ctx);
7632 return;
7633}
7634
7635isl::fixed_box map::range_simple_fixed_box_hull() const
7636{
7637 if (!ptr)
7638 exception::throw_invalid("NULL input", __FILE__, __LINE__);
7639 auto saved_ctx = ctx();
7640 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7641 auto res = isl_map_get_range_simple_fixed_box_hull(get());
7642 if (!res)
7643 exception::throw_last_error(saved_ctx);
7644 return manage(res);
7645}
7646
7647isl::fixed_box map::get_range_simple_fixed_box_hull() const
7648{
7649 return range_simple_fixed_box_hull();
7650}
7651
7652isl::space map::space() const
7653{
7654 if (!ptr)
7655 exception::throw_invalid("NULL input", __FILE__, __LINE__);
7656 auto saved_ctx = ctx();
7657 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7658 auto res = isl_map_get_space(get());
7659 if (!res)
7660 exception::throw_last_error(saved_ctx);
7661 return manage(res);
7662}
7663
7664isl::space map::get_space() const
7665{
7666 return space();
7667}
7668
7669isl::map map::gist(isl::map context) const
7670{
7671 if (!ptr || context.is_null())
7672 exception::throw_invalid("NULL input", __FILE__, __LINE__);
7673 auto saved_ctx = ctx();
7674 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7675 auto res = isl_map_gist(copy(), context.release());
7676 if (!res)
7677 exception::throw_last_error(saved_ctx);
7678 return manage(res);
7679}
7680
7681isl::map map::gist_domain(isl::set context) const
7682{
7683 if (!ptr || context.is_null())
7684 exception::throw_invalid("NULL input", __FILE__, __LINE__);
7685 auto saved_ctx = ctx();
7686 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7687 auto res = isl_map_gist_domain(copy(), context.release());
7688 if (!res)
7689 exception::throw_last_error(saved_ctx);
7690 return manage(res);
7691}
7692
7693isl::map map::intersect(isl::map map2) const
7694{
7695 if (!ptr || map2.is_null())
7696 exception::throw_invalid("NULL input", __FILE__, __LINE__);
7697 auto saved_ctx = ctx();
7698 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7699 auto res = isl_map_intersect(copy(), map2.release());
7700 if (!res)
7701 exception::throw_last_error(saved_ctx);
7702 return manage(res);
7703}
7704
7705isl::map map::intersect_domain(isl::set set) const
7706{
7707 if (!ptr || set.is_null())
7708 exception::throw_invalid("NULL input", __FILE__, __LINE__);
7709 auto saved_ctx = ctx();
7710 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7711 auto res = isl_map_intersect_domain(copy(), set.release());
7712 if (!res)
7713 exception::throw_last_error(saved_ctx);
7714 return manage(res);
7715}
7716
7717isl::map map::intersect_params(isl::set params) const
7718{
7719 if (!ptr || params.is_null())
7720 exception::throw_invalid("NULL input", __FILE__, __LINE__);
7721 auto saved_ctx = ctx();
7722 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7723 auto res = isl_map_intersect_params(copy(), params.release());
7724 if (!res)
7725 exception::throw_last_error(saved_ctx);
7726 return manage(res);
7727}
7728
7729isl::map map::intersect_range(isl::set set) const
7730{
7731 if (!ptr || set.is_null())
7732 exception::throw_invalid("NULL input", __FILE__, __LINE__);
7733 auto saved_ctx = ctx();
7734 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7735 auto res = isl_map_intersect_range(copy(), set.release());
7736 if (!res)
7737 exception::throw_last_error(saved_ctx);
7738 return manage(res);
7739}
7740
7741bool map::is_bijective() const
7742{
7743 if (!ptr)
7744 exception::throw_invalid("NULL input", __FILE__, __LINE__);
7745 auto saved_ctx = ctx();
7746 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7747 auto res = isl_map_is_bijective(get());
7748 if (res < 0)
7749 exception::throw_last_error(saved_ctx);
7750 return res;
7751}
7752
7753bool map::is_disjoint(const isl::map &map2) const
7754{
7755 if (!ptr || map2.is_null())
7756 exception::throw_invalid("NULL input", __FILE__, __LINE__);
7757 auto saved_ctx = ctx();
7758 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7759 auto res = isl_map_is_disjoint(get(), map2.get());
7760 if (res < 0)
7761 exception::throw_last_error(saved_ctx);
7762 return res;
7763}
7764
7765bool map::is_empty() const
7766{
7767 if (!ptr)
7768 exception::throw_invalid("NULL input", __FILE__, __LINE__);
7769 auto saved_ctx = ctx();
7770 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7771 auto res = isl_map_is_empty(get());
7772 if (res < 0)
7773 exception::throw_last_error(saved_ctx);
7774 return res;
7775}
7776
7777bool map::is_equal(const isl::map &map2) const
7778{
7779 if (!ptr || map2.is_null())
7780 exception::throw_invalid("NULL input", __FILE__, __LINE__);
7781 auto saved_ctx = ctx();
7782 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7783 auto res = isl_map_is_equal(get(), map2.get());
7784 if (res < 0)
7785 exception::throw_last_error(saved_ctx);
7786 return res;
7787}
7788
7789bool map::is_injective() const
7790{
7791 if (!ptr)
7792 exception::throw_invalid("NULL input", __FILE__, __LINE__);
7793 auto saved_ctx = ctx();
7794 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7795 auto res = isl_map_is_injective(get());
7796 if (res < 0)
7797 exception::throw_last_error(saved_ctx);
7798 return res;
7799}
7800
7801bool map::is_single_valued() const
7802{
7803 if (!ptr)
7804 exception::throw_invalid("NULL input", __FILE__, __LINE__);
7805 auto saved_ctx = ctx();
7806 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7807 auto res = isl_map_is_single_valued(get());
7808 if (res < 0)
7809 exception::throw_last_error(saved_ctx);
7810 return res;
7811}
7812
7813bool map::is_strict_subset(const isl::map &map2) const
7814{
7815 if (!ptr || map2.is_null())
7816 exception::throw_invalid("NULL input", __FILE__, __LINE__);
7817 auto saved_ctx = ctx();
7818 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7819 auto res = isl_map_is_strict_subset(get(), map2.get());
7820 if (res < 0)
7821 exception::throw_last_error(saved_ctx);
7822 return res;
7823}
7824
7825bool map::is_subset(const isl::map &map2) const
7826{
7827 if (!ptr || map2.is_null())
7828 exception::throw_invalid("NULL input", __FILE__, __LINE__);
7829 auto saved_ctx = ctx();
7830 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7831 auto res = isl_map_is_subset(get(), map2.get());
7832 if (res < 0)
7833 exception::throw_last_error(saved_ctx);
7834 return res;
7835}
7836
7837isl::map map::lex_ge_at(isl::multi_pw_aff mpa) const
7838{
7839 if (!ptr || mpa.is_null())
7840 exception::throw_invalid("NULL input", __FILE__, __LINE__);
7841 auto saved_ctx = ctx();
7842 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7843 auto res = isl_map_lex_ge_at_multi_pw_aff(copy(), mpa.release());
7844 if (!res)
7845 exception::throw_last_error(saved_ctx);
7846 return manage(res);
7847}
7848
7849isl::map map::lex_gt_at(isl::multi_pw_aff mpa) const
7850{
7851 if (!ptr || mpa.is_null())
7852 exception::throw_invalid("NULL input", __FILE__, __LINE__);
7853 auto saved_ctx = ctx();
7854 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7855 auto res = isl_map_lex_gt_at_multi_pw_aff(copy(), mpa.release());
7856 if (!res)
7857 exception::throw_last_error(saved_ctx);
7858 return manage(res);
7859}
7860
7861isl::map map::lex_le_at(isl::multi_pw_aff mpa) const
7862{
7863 if (!ptr || mpa.is_null())
7864 exception::throw_invalid("NULL input", __FILE__, __LINE__);
7865 auto saved_ctx = ctx();
7866 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7867 auto res = isl_map_lex_le_at_multi_pw_aff(copy(), mpa.release());
7868 if (!res)
7869 exception::throw_last_error(saved_ctx);
7870 return manage(res);
7871}
7872
7873isl::map map::lex_lt_at(isl::multi_pw_aff mpa) const
7874{
7875 if (!ptr || mpa.is_null())
7876 exception::throw_invalid("NULL input", __FILE__, __LINE__);
7877 auto saved_ctx = ctx();
7878 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7879 auto res = isl_map_lex_lt_at_multi_pw_aff(copy(), mpa.release());
7880 if (!res)
7881 exception::throw_last_error(saved_ctx);
7882 return manage(res);
7883}
7884
7885isl::map map::lexmax() const
7886{
7887 if (!ptr)
7888 exception::throw_invalid("NULL input", __FILE__, __LINE__);
7889 auto saved_ctx = ctx();
7890 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7891 auto res = isl_map_lexmax(copy());
7892 if (!res)
7893 exception::throw_last_error(saved_ctx);
7894 return manage(res);
7895}
7896
7897isl::pw_multi_aff map::lexmax_pw_multi_aff() const
7898{
7899 if (!ptr)
7900 exception::throw_invalid("NULL input", __FILE__, __LINE__);
7901 auto saved_ctx = ctx();
7902 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7903 auto res = isl_map_lexmax_pw_multi_aff(copy());
7904 if (!res)
7905 exception::throw_last_error(saved_ctx);
7906 return manage(res);
7907}
7908
7909isl::map map::lexmin() const
7910{
7911 if (!ptr)
7912 exception::throw_invalid("NULL input", __FILE__, __LINE__);
7913 auto saved_ctx = ctx();
7914 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7915 auto res = isl_map_lexmin(copy());
7916 if (!res)
7917 exception::throw_last_error(saved_ctx);
7918 return manage(res);
7919}
7920
7921isl::pw_multi_aff map::lexmin_pw_multi_aff() const
7922{
7923 if (!ptr)
7924 exception::throw_invalid("NULL input", __FILE__, __LINE__);
7925 auto saved_ctx = ctx();
7926 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7927 auto res = isl_map_lexmin_pw_multi_aff(copy());
7928 if (!res)
7929 exception::throw_last_error(saved_ctx);
7930 return manage(res);
7931}
7932
7933isl::map map::lower_bound(isl::multi_pw_aff lower) const
7934{
7935 if (!ptr || lower.is_null())
7936 exception::throw_invalid("NULL input", __FILE__, __LINE__);
7937 auto saved_ctx = ctx();
7938 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7939 auto res = isl_map_lower_bound_multi_pw_aff(copy(), lower.release());
7940 if (!res)
7941 exception::throw_last_error(saved_ctx);
7942 return manage(res);
7943}
7944
7945isl::map map::lower_bound(isl::multi_val lower) const
7946{
7947 if (!ptr || lower.is_null())
7948 exception::throw_invalid("NULL input", __FILE__, __LINE__);
7949 auto saved_ctx = ctx();
7950 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7951 auto res = isl_map_lower_bound_multi_val(copy(), lower.release());
7952 if (!res)
7953 exception::throw_last_error(saved_ctx);
7954 return manage(res);
7955}
7956
7957isl::multi_pw_aff map::max_multi_pw_aff() const
7958{
7959 if (!ptr)
7960 exception::throw_invalid("NULL input", __FILE__, __LINE__);
7961 auto saved_ctx = ctx();
7962 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7963 auto res = isl_map_max_multi_pw_aff(copy());
7964 if (!res)
7965 exception::throw_last_error(saved_ctx);
7966 return manage(res);
7967}
7968
7969isl::multi_pw_aff map::min_multi_pw_aff() const
7970{
7971 if (!ptr)
7972 exception::throw_invalid("NULL input", __FILE__, __LINE__);
7973 auto saved_ctx = ctx();
7974 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7975 auto res = isl_map_min_multi_pw_aff(copy());
7976 if (!res)
7977 exception::throw_last_error(saved_ctx);
7978 return manage(res);
7979}
7980
7981isl::basic_map map::polyhedral_hull() const
7982{
7983 if (!ptr)
7984 exception::throw_invalid("NULL input", __FILE__, __LINE__);
7985 auto saved_ctx = ctx();
7986 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7987 auto res = isl_map_polyhedral_hull(copy());
7988 if (!res)
7989 exception::throw_last_error(saved_ctx);
7990 return manage(res);
7991}
7992
7993isl::map map::preimage_domain(isl::multi_aff ma) const
7994{
7995 if (!ptr || ma.is_null())
7996 exception::throw_invalid("NULL input", __FILE__, __LINE__);
7997 auto saved_ctx = ctx();
7998 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7999 auto res = isl_map_preimage_domain_multi_aff(copy(), ma.release());
8000 if (!res)
8001 exception::throw_last_error(saved_ctx);
8002 return manage(res);
8003}
8004
8005isl::map map::preimage_domain(isl::multi_pw_aff mpa) const
8006{
8007 if (!ptr || mpa.is_null())
8008 exception::throw_invalid("NULL input", __FILE__, __LINE__);
8009 auto saved_ctx = ctx();
8010 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8011 auto res = isl_map_preimage_domain_multi_pw_aff(copy(), mpa.release());
8012 if (!res)
8013 exception::throw_last_error(saved_ctx);
8014 return manage(res);
8015}
8016
8017isl::map map::preimage_domain(isl::pw_multi_aff pma) const
8018{
8019 if (!ptr || pma.is_null())
8020 exception::throw_invalid("NULL input", __FILE__, __LINE__);
8021 auto saved_ctx = ctx();
8022 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8023 auto res = isl_map_preimage_domain_pw_multi_aff(copy(), pma.release());
8024 if (!res)
8025 exception::throw_last_error(saved_ctx);
8026 return manage(res);
8027}
8028
8029isl::map map::preimage_range(isl::multi_aff ma) const
8030{
8031 if (!ptr || ma.is_null())
8032 exception::throw_invalid("NULL input", __FILE__, __LINE__);
8033 auto saved_ctx = ctx();
8034 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8035 auto res = isl_map_preimage_range_multi_aff(copy(), ma.release());
8036 if (!res)
8037 exception::throw_last_error(saved_ctx);
8038 return manage(res);
8039}
8040
8041isl::map map::preimage_range(isl::pw_multi_aff pma) const
8042{
8043 if (!ptr || pma.is_null())
8044 exception::throw_invalid("NULL input", __FILE__, __LINE__);
8045 auto saved_ctx = ctx();
8046 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8047 auto res = isl_map_preimage_range_pw_multi_aff(copy(), pma.release());
8048 if (!res)
8049 exception::throw_last_error(saved_ctx);
8050 return manage(res);
8051}
8052
8053isl::map map::project_out_all_params() const
8054{
8055 if (!ptr)
8056 exception::throw_invalid("NULL input", __FILE__, __LINE__);
8057 auto saved_ctx = ctx();
8058 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8059 auto res = isl_map_project_out_all_params(copy());
8060 if (!res)
8061 exception::throw_last_error(saved_ctx);
8062 return manage(res);
8063}
8064
8065isl::set map::range() const
8066{
8067 if (!ptr)
8068 exception::throw_invalid("NULL input", __FILE__, __LINE__);
8069 auto saved_ctx = ctx();
8070 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8071 auto res = isl_map_range(copy());
8072 if (!res)
8073 exception::throw_last_error(saved_ctx);
8074 return manage(res);
8075}
8076
8077isl::map map::range_factor_domain() const
8078{
8079 if (!ptr)
8080 exception::throw_invalid("NULL input", __FILE__, __LINE__);
8081 auto saved_ctx = ctx();
8082 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8083 auto res = isl_map_range_factor_domain(copy());
8084 if (!res)
8085 exception::throw_last_error(saved_ctx);
8086 return manage(res);
8087}
8088
8089isl::map map::range_factor_range() const
8090{
8091 if (!ptr)
8092 exception::throw_invalid("NULL input", __FILE__, __LINE__);
8093 auto saved_ctx = ctx();
8094 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8095 auto res = isl_map_range_factor_range(copy());
8096 if (!res)
8097 exception::throw_last_error(saved_ctx);
8098 return manage(res);
8099}
8100
8101isl::map map::range_product(isl::map map2) const
8102{
8103 if (!ptr || map2.is_null())
8104 exception::throw_invalid("NULL input", __FILE__, __LINE__);
8105 auto saved_ctx = ctx();
8106 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8107 auto res = isl_map_range_product(copy(), map2.release());
8108 if (!res)
8109 exception::throw_last_error(saved_ctx);
8110 return manage(res);
8111}
8112
8113isl::map map::range_reverse() const
8114{
8115 if (!ptr)
8116 exception::throw_invalid("NULL input", __FILE__, __LINE__);
8117 auto saved_ctx = ctx();
8118 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8119 auto res = isl_map_range_reverse(copy());
8120 if (!res)
8121 exception::throw_last_error(saved_ctx);
8122 return manage(res);
8123}
8124
8125isl::map map::reverse() const
8126{
8127 if (!ptr)
8128 exception::throw_invalid("NULL input", __FILE__, __LINE__);
8129 auto saved_ctx = ctx();
8130 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8131 auto res = isl_map_reverse(copy());
8132 if (!res)
8133 exception::throw_last_error(saved_ctx);
8134 return manage(res);
8135}
8136
8137isl::basic_map map::sample() const
8138{
8139 if (!ptr)
8140 exception::throw_invalid("NULL input", __FILE__, __LINE__);
8141 auto saved_ctx = ctx();
8142 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8143 auto res = isl_map_sample(copy());
8144 if (!res)
8145 exception::throw_last_error(saved_ctx);
8146 return manage(res);
8147}
8148
8149isl::map map::subtract(isl::map map2) const
8150{
8151 if (!ptr || map2.is_null())
8152 exception::throw_invalid("NULL input", __FILE__, __LINE__);
8153 auto saved_ctx = ctx();
8154 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8155 auto res = isl_map_subtract(copy(), map2.release());
8156 if (!res)
8157 exception::throw_last_error(saved_ctx);
8158 return manage(res);
8159}
8160
8161isl::map map::uncurry() const
8162{
8163 if (!ptr)
8164 exception::throw_invalid("NULL input", __FILE__, __LINE__);
8165 auto saved_ctx = ctx();
8166 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8167 auto res = isl_map_uncurry(copy());
8168 if (!res)
8169 exception::throw_last_error(saved_ctx);
8170 return manage(res);
8171}
8172
8173isl::map map::unite(isl::map map2) const
8174{
8175 if (!ptr || map2.is_null())
8176 exception::throw_invalid("NULL input", __FILE__, __LINE__);
8177 auto saved_ctx = ctx();
8178 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8179 auto res = isl_map_union(copy(), map2.release());
8180 if (!res)
8181 exception::throw_last_error(saved_ctx);
8182 return manage(res);
8183}
8184
8185isl::map map::universe(isl::space space)
8186{
8187 if (space.is_null())
8188 exception::throw_invalid("NULL input", __FILE__, __LINE__);
8189 auto saved_ctx = space.ctx();
8190 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8191 auto res = isl_map_universe(space.release());
8192 if (!res)
8193 exception::throw_last_error(saved_ctx);
8194 return manage(res);
8195}
8196
8197isl::basic_map map::unshifted_simple_hull() const
8198{
8199 if (!ptr)
8200 exception::throw_invalid("NULL input", __FILE__, __LINE__);
8201 auto saved_ctx = ctx();
8202 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8203 auto res = isl_map_unshifted_simple_hull(copy());
8204 if (!res)
8205 exception::throw_last_error(saved_ctx);
8206 return manage(res);
8207}
8208
8209isl::map map::upper_bound(isl::multi_pw_aff upper) const
8210{
8211 if (!ptr || upper.is_null())
8212 exception::throw_invalid("NULL input", __FILE__, __LINE__);
8213 auto saved_ctx = ctx();
8214 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8215 auto res = isl_map_upper_bound_multi_pw_aff(copy(), upper.release());
8216 if (!res)
8217 exception::throw_last_error(saved_ctx);
8218 return manage(res);
8219}
8220
8221isl::map map::upper_bound(isl::multi_val upper) const
8222{
8223 if (!ptr || upper.is_null())
8224 exception::throw_invalid("NULL input", __FILE__, __LINE__);
8225 auto saved_ctx = ctx();
8226 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8227 auto res = isl_map_upper_bound_multi_val(copy(), upper.release());
8228 if (!res)
8229 exception::throw_last_error(saved_ctx);
8230 return manage(res);
8231}
8232
8233isl::set map::wrap() const
8234{
8235 if (!ptr)
8236 exception::throw_invalid("NULL input", __FILE__, __LINE__);
8237 auto saved_ctx = ctx();
8238 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8239 auto res = isl_map_wrap(copy());
8240 if (!res)
8241 exception::throw_last_error(saved_ctx);
8242 return manage(res);
8243}
8244
8245inline std::ostream &operator<<(std::ostream &os, const map &obj)
8246{
8247 if (!obj.get())
8248 exception::throw_invalid("NULL input", __FILE__, __LINE__);
8249 auto saved_ctx = isl_map_get_ctx(obj.get());
8250 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8251 char *str = isl_map_to_str(obj.get());
8252 if (!str)
8253 exception::throw_last_error(saved_ctx);
8254 os << str;
8255 free(str);
8256 return os;
8257}
8258
8259// implementations for isl::multi_aff
8260multi_aff manage(__isl_take isl_multi_aff *ptr) {
8261 if (!ptr)
8262 exception::throw_invalid("NULL input", __FILE__, __LINE__);
8263 return multi_aff(ptr);
8264}
8265multi_aff manage_copy(__isl_keep isl_multi_aff *ptr) {
8266 if (!ptr)
8267 exception::throw_invalid("NULL input", __FILE__, __LINE__);
8268 auto saved_ctx = isl_multi_aff_get_ctx(ptr);
8269 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8270 ptr = isl_multi_aff_copy(ptr);
8271 if (!ptr)
8272 exception::throw_last_error(saved_ctx);
8273 return multi_aff(ptr);
8274}
8275
8276multi_aff::multi_aff()
8277 : ptr(nullptr) {}
8278
8279multi_aff::multi_aff(const multi_aff &obj)
8280 : ptr(nullptr)
8281{
8282 if (!obj.ptr)
8283 exception::throw_invalid("NULL input", __FILE__, __LINE__);
8284 auto saved_ctx = isl_multi_aff_get_ctx(obj.ptr);
8285 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8286 ptr = obj.copy();
8287 if (!ptr)
8288 exception::throw_last_error(saved_ctx);
8289}
8290
8291multi_aff::multi_aff(__isl_take isl_multi_aff *ptr)
8292 : ptr(ptr) {}
8293
8294multi_aff::multi_aff(isl::aff aff)
8295{
8296 if (aff.is_null())
8297 exception::throw_invalid("NULL input", __FILE__, __LINE__);
8298 auto saved_ctx = aff.ctx();
8299 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8300 auto res = isl_multi_aff_from_aff(aff.release());
8301 if (!res)
8302 exception::throw_last_error(saved_ctx);
8303 ptr = res;
8304}
8305
8306multi_aff::multi_aff(isl::space space, isl::aff_list list)
8307{
8308 if (space.is_null() || list.is_null())
8309 exception::throw_invalid("NULL input", __FILE__, __LINE__);
8310 auto saved_ctx = space.ctx();
8311 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8312 auto res = isl_multi_aff_from_aff_list(space.release(), list.release());
8313 if (!res)
8314 exception::throw_last_error(saved_ctx);
8315 ptr = res;
8316}
8317
8318multi_aff::multi_aff(isl::ctx ctx, const std::string &str)
8319{
8320 auto saved_ctx = ctx;
8321 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8322 auto res = isl_multi_aff_read_from_str(ctx.release(), str.c_str());
8323 if (!res)
8324 exception::throw_last_error(saved_ctx);
8325 ptr = res;
8326}
8327
8328multi_aff &multi_aff::operator=(multi_aff obj) {
8329 std::swap(this->ptr, obj.ptr);
8330 return *this;
8331}
8332
8333multi_aff::~multi_aff() {
8334 if (ptr)
8335 isl_multi_aff_free(ptr);
8336}
8337
8338__isl_give isl_multi_aff *multi_aff::copy() const & {
8339 return isl_multi_aff_copy(ptr);
8340}
8341
8342__isl_keep isl_multi_aff *multi_aff::get() const {
8343 return ptr;
8344}
8345
8346__isl_give isl_multi_aff *multi_aff::release() {
8347 isl_multi_aff *tmp = ptr;
8348 ptr = nullptr;
8349 return tmp;
8350}
8351
8352bool multi_aff::is_null() const {
8353 return ptr == nullptr;
8354}
8355
8356isl::ctx multi_aff::ctx() const {
8357 return isl::ctx(isl_multi_aff_get_ctx(ptr));
8358}
8359
8360isl::multi_aff multi_aff::add(isl::multi_aff multi2) const
8361{
8362 if (!ptr || multi2.is_null())
8363 exception::throw_invalid("NULL input", __FILE__, __LINE__);
8364 auto saved_ctx = ctx();
8365 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8366 auto res = isl_multi_aff_add(copy(), multi2.release());
8367 if (!res)
8368 exception::throw_last_error(saved_ctx);
8369 return manage(res);
8370}
8371
8372isl::multi_aff multi_aff::add_constant(isl::multi_val mv) const
8373{
8374 if (!ptr || mv.is_null())
8375 exception::throw_invalid("NULL input", __FILE__, __LINE__);
8376 auto saved_ctx = ctx();
8377 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8378 auto res = isl_multi_aff_add_constant_multi_val(copy(), mv.release());
8379 if (!res)
8380 exception::throw_last_error(saved_ctx);
8381 return manage(res);
8382}
8383
8384isl::multi_aff multi_aff::add_constant(isl::val v) const
8385{
8386 if (!ptr || v.is_null())
8387 exception::throw_invalid("NULL input", __FILE__, __LINE__);
8388 auto saved_ctx = ctx();
8389 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8390 auto res = isl_multi_aff_add_constant_val(copy(), v.release());
8391 if (!res)
8392 exception::throw_last_error(saved_ctx);
8393 return manage(res);
8394}
8395
8396isl::multi_aff multi_aff::add_constant(long v) const
8397{
8398 if (!ptr)
8399 exception::throw_invalid("NULL input", __FILE__, __LINE__);
8400 return this->add_constant(isl::val(ctx(), v));
8401}
8402
8403isl::basic_set multi_aff::bind(isl::multi_id tuple) const
8404{
8405 if (!ptr || tuple.is_null())
8406 exception::throw_invalid("NULL input", __FILE__, __LINE__);
8407 auto saved_ctx = ctx();
8408 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8409 auto res = isl_multi_aff_bind(copy(), tuple.release());
8410 if (!res)
8411 exception::throw_last_error(saved_ctx);
8412 return manage(res);
8413}
8414
8415isl::multi_aff multi_aff::bind_domain(isl::multi_id tuple) const
8416{
8417 if (!ptr || tuple.is_null())
8418 exception::throw_invalid("NULL input", __FILE__, __LINE__);
8419 auto saved_ctx = ctx();
8420 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8421 auto res = isl_multi_aff_bind_domain(copy(), tuple.release());
8422 if (!res)
8423 exception::throw_last_error(saved_ctx);
8424 return manage(res);
8425}
8426
8427isl::multi_aff multi_aff::bind_domain_wrapped_domain(isl::multi_id tuple) const
8428{
8429 if (!ptr || tuple.is_null())
8430 exception::throw_invalid("NULL input", __FILE__, __LINE__);
8431 auto saved_ctx = ctx();
8432 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8433 auto res = isl_multi_aff_bind_domain_wrapped_domain(copy(), tuple.release());
8434 if (!res)
8435 exception::throw_last_error(saved_ctx);
8436 return manage(res);
8437}
8438
8439isl::multi_aff multi_aff::domain_map(isl::space space)
8440{
8441 if (space.is_null())
8442 exception::throw_invalid("NULL input", __FILE__, __LINE__);
8443 auto saved_ctx = space.ctx();
8444 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8445 auto res = isl_multi_aff_domain_map(space.release());
8446 if (!res)
8447 exception::throw_last_error(saved_ctx);
8448 return manage(res);
8449}
8450
8451isl::multi_aff multi_aff::flat_range_product(isl::multi_aff multi2) const
8452{
8453 if (!ptr || multi2.is_null())
8454 exception::throw_invalid("NULL input", __FILE__, __LINE__);
8455 auto saved_ctx = ctx();
8456 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8457 auto res = isl_multi_aff_flat_range_product(copy(), multi2.release());
8458 if (!res)
8459 exception::throw_last_error(saved_ctx);
8460 return manage(res);
8461}
8462
8463isl::multi_aff multi_aff::floor() const
8464{
8465 if (!ptr)
8466 exception::throw_invalid("NULL input", __FILE__, __LINE__);
8467 auto saved_ctx = ctx();
8468 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8469 auto res = isl_multi_aff_floor(copy());
8470 if (!res)
8471 exception::throw_last_error(saved_ctx);
8472 return manage(res);
8473}
8474
8475isl::aff multi_aff::at(int pos) const
8476{
8477 if (!ptr)
8478 exception::throw_invalid("NULL input", __FILE__, __LINE__);
8479 auto saved_ctx = ctx();
8480 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8481 auto res = isl_multi_aff_get_at(get(), pos);
8482 if (!res)
8483 exception::throw_last_error(saved_ctx);
8484 return manage(res);
8485}
8486
8487isl::aff multi_aff::get_at(int pos) const
8488{
8489 return at(pos);
8490}
8491
8492isl::multi_val multi_aff::constant_multi_val() const
8493{
8494 if (!ptr)
8495 exception::throw_invalid("NULL input", __FILE__, __LINE__);
8496 auto saved_ctx = ctx();
8497 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8498 auto res = isl_multi_aff_get_constant_multi_val(get());
8499 if (!res)
8500 exception::throw_last_error(saved_ctx);
8501 return manage(res);
8502}
8503
8504isl::multi_val multi_aff::get_constant_multi_val() const
8505{
8506 return constant_multi_val();
8507}
8508
8509isl::aff_list multi_aff::list() const
8510{
8511 if (!ptr)
8512 exception::throw_invalid("NULL input", __FILE__, __LINE__);
8513 auto saved_ctx = ctx();
8514 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8515 auto res = isl_multi_aff_get_list(get());
8516 if (!res)
8517 exception::throw_last_error(saved_ctx);
8518 return manage(res);
8519}
8520
8521isl::aff_list multi_aff::get_list() const
8522{
8523 return list();
8524}
8525
8526isl::space multi_aff::space() const
8527{
8528 if (!ptr)
8529 exception::throw_invalid("NULL input", __FILE__, __LINE__);
8530 auto saved_ctx = ctx();
8531 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8532 auto res = isl_multi_aff_get_space(get());
8533 if (!res)
8534 exception::throw_last_error(saved_ctx);
8535 return manage(res);
8536}
8537
8538isl::space multi_aff::get_space() const
8539{
8540 return space();
8541}
8542
8543isl::multi_aff multi_aff::gist(isl::set context) const
8544{
8545 if (!ptr || context.is_null())
8546 exception::throw_invalid("NULL input", __FILE__, __LINE__);
8547 auto saved_ctx = ctx();
8548 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8549 auto res = isl_multi_aff_gist(copy(), context.release());
8550 if (!res)
8551 exception::throw_last_error(saved_ctx);
8552 return manage(res);
8553}
8554
8555isl::multi_aff multi_aff::identity() const
8556{
8557 if (!ptr)
8558 exception::throw_invalid("NULL input", __FILE__, __LINE__);
8559 auto saved_ctx = ctx();
8560 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8561 auto res = isl_multi_aff_identity_multi_aff(copy());
8562 if (!res)
8563 exception::throw_last_error(saved_ctx);
8564 return manage(res);
8565}
8566
8567isl::multi_aff multi_aff::identity_on_domain(isl::space space)
8568{
8569 if (space.is_null())
8570 exception::throw_invalid("NULL input", __FILE__, __LINE__);
8571 auto saved_ctx = space.ctx();
8572 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8573 auto res = isl_multi_aff_identity_on_domain_space(space.release());
8574 if (!res)
8575 exception::throw_last_error(saved_ctx);
8576 return manage(res);
8577}
8578
8579isl::multi_aff multi_aff::insert_domain(isl::space domain) const
8580{
8581 if (!ptr || domain.is_null())
8582 exception::throw_invalid("NULL input", __FILE__, __LINE__);
8583 auto saved_ctx = ctx();
8584 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8585 auto res = isl_multi_aff_insert_domain(copy(), domain.release());
8586 if (!res)
8587 exception::throw_last_error(saved_ctx);
8588 return manage(res);
8589}
8590
8591bool multi_aff::involves_locals() const
8592{
8593 if (!ptr)
8594 exception::throw_invalid("NULL input", __FILE__, __LINE__);
8595 auto saved_ctx = ctx();
8596 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8597 auto res = isl_multi_aff_involves_locals(get());
8598 if (res < 0)
8599 exception::throw_last_error(saved_ctx);
8600 return res;
8601}
8602
8603isl::multi_aff multi_aff::neg() const
8604{
8605 if (!ptr)
8606 exception::throw_invalid("NULL input", __FILE__, __LINE__);
8607 auto saved_ctx = ctx();
8608 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8609 auto res = isl_multi_aff_neg(copy());
8610 if (!res)
8611 exception::throw_last_error(saved_ctx);
8612 return manage(res);
8613}
8614
8615bool multi_aff::plain_is_equal(const isl::multi_aff &multi2) const
8616{
8617 if (!ptr || multi2.is_null())
8618 exception::throw_invalid("NULL input", __FILE__, __LINE__);
8619 auto saved_ctx = ctx();
8620 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8621 auto res = isl_multi_aff_plain_is_equal(get(), multi2.get());
8622 if (res < 0)
8623 exception::throw_last_error(saved_ctx);
8624 return res;
8625}
8626
8627isl::multi_aff multi_aff::product(isl::multi_aff multi2) const
8628{
8629 if (!ptr || multi2.is_null())
8630 exception::throw_invalid("NULL input", __FILE__, __LINE__);
8631 auto saved_ctx = ctx();
8632 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8633 auto res = isl_multi_aff_product(copy(), multi2.release());
8634 if (!res)
8635 exception::throw_last_error(saved_ctx);
8636 return manage(res);
8637}
8638
8639isl::multi_aff multi_aff::pullback(isl::multi_aff ma2) const
8640{
8641 if (!ptr || ma2.is_null())
8642 exception::throw_invalid("NULL input", __FILE__, __LINE__);
8643 auto saved_ctx = ctx();
8644 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8645 auto res = isl_multi_aff_pullback_multi_aff(copy(), ma2.release());
8646 if (!res)
8647 exception::throw_last_error(saved_ctx);
8648 return manage(res);
8649}
8650
8651isl::multi_aff multi_aff::range_map(isl::space space)
8652{
8653 if (space.is_null())
8654 exception::throw_invalid("NULL input", __FILE__, __LINE__);
8655 auto saved_ctx = space.ctx();
8656 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8657 auto res = isl_multi_aff_range_map(space.release());
8658 if (!res)
8659 exception::throw_last_error(saved_ctx);
8660 return manage(res);
8661}
8662
8663isl::multi_aff multi_aff::range_product(isl::multi_aff multi2) const
8664{
8665 if (!ptr || multi2.is_null())
8666 exception::throw_invalid("NULL input", __FILE__, __LINE__);
8667 auto saved_ctx = ctx();
8668 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8669 auto res = isl_multi_aff_range_product(copy(), multi2.release());
8670 if (!res)
8671 exception::throw_last_error(saved_ctx);
8672 return manage(res);
8673}
8674
8675isl::multi_aff multi_aff::scale(isl::multi_val mv) const
8676{
8677 if (!ptr || mv.is_null())
8678 exception::throw_invalid("NULL input", __FILE__, __LINE__);
8679 auto saved_ctx = ctx();
8680 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8681 auto res = isl_multi_aff_scale_multi_val(copy(), mv.release());
8682 if (!res)
8683 exception::throw_last_error(saved_ctx);
8684 return manage(res);
8685}
8686
8687isl::multi_aff multi_aff::scale(isl::val v) const
8688{
8689 if (!ptr || v.is_null())
8690 exception::throw_invalid("NULL input", __FILE__, __LINE__);
8691 auto saved_ctx = ctx();
8692 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8693 auto res = isl_multi_aff_scale_val(copy(), v.release());
8694 if (!res)
8695 exception::throw_last_error(saved_ctx);
8696 return manage(res);
8697}
8698
8699isl::multi_aff multi_aff::scale(long v) const
8700{
8701 if (!ptr)
8702 exception::throw_invalid("NULL input", __FILE__, __LINE__);
8703 return this->scale(isl::val(ctx(), v));
8704}
8705
8706isl::multi_aff multi_aff::scale_down(isl::multi_val mv) const
8707{
8708 if (!ptr || mv.is_null())
8709 exception::throw_invalid("NULL input", __FILE__, __LINE__);
8710 auto saved_ctx = ctx();
8711 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8712 auto res = isl_multi_aff_scale_down_multi_val(copy(), mv.release());
8713 if (!res)
8714 exception::throw_last_error(saved_ctx);
8715 return manage(res);
8716}
8717
8718isl::multi_aff multi_aff::scale_down(isl::val v) const
8719{
8720 if (!ptr || v.is_null())
8721 exception::throw_invalid("NULL input", __FILE__, __LINE__);
8722 auto saved_ctx = ctx();
8723 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8724 auto res = isl_multi_aff_scale_down_val(copy(), v.release());
8725 if (!res)
8726 exception::throw_last_error(saved_ctx);
8727 return manage(res);
8728}
8729
8730isl::multi_aff multi_aff::scale_down(long v) const
8731{
8732 if (!ptr)
8733 exception::throw_invalid("NULL input", __FILE__, __LINE__);
8734 return this->scale_down(isl::val(ctx(), v));
8735}
8736
8737isl::multi_aff multi_aff::set_at(int pos, isl::aff el) const
8738{
8739 if (!ptr || el.is_null())
8740 exception::throw_invalid("NULL input", __FILE__, __LINE__);
8741 auto saved_ctx = ctx();
8742 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8743 auto res = isl_multi_aff_set_at(copy(), pos, el.release());
8744 if (!res)
8745 exception::throw_last_error(saved_ctx);
8746 return manage(res);
8747}
8748
8749unsigned multi_aff::size() const
8750{
8751 if (!ptr)
8752 exception::throw_invalid("NULL input", __FILE__, __LINE__);
8753 auto saved_ctx = ctx();
8754 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8755 auto res = isl_multi_aff_size(get());
8756 if (res < 0)
8757 exception::throw_last_error(saved_ctx);
8758 return res;
8759}
8760
8761isl::multi_aff multi_aff::sub(isl::multi_aff multi2) const
8762{
8763 if (!ptr || multi2.is_null())
8764 exception::throw_invalid("NULL input", __FILE__, __LINE__);
8765 auto saved_ctx = ctx();
8766 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8767 auto res = isl_multi_aff_sub(copy(), multi2.release());
8768 if (!res)
8769 exception::throw_last_error(saved_ctx);
8770 return manage(res);
8771}
8772
8773isl::multi_aff multi_aff::unbind_params_insert_domain(isl::multi_id domain) const
8774{
8775 if (!ptr || domain.is_null())
8776 exception::throw_invalid("NULL input", __FILE__, __LINE__);
8777 auto saved_ctx = ctx();
8778 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8779 auto res = isl_multi_aff_unbind_params_insert_domain(copy(), domain.release());
8780 if (!res)
8781 exception::throw_last_error(saved_ctx);
8782 return manage(res);
8783}
8784
8785isl::multi_aff multi_aff::zero(isl::space space)
8786{
8787 if (space.is_null())
8788 exception::throw_invalid("NULL input", __FILE__, __LINE__);
8789 auto saved_ctx = space.ctx();
8790 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8791 auto res = isl_multi_aff_zero(space.release());
8792 if (!res)
8793 exception::throw_last_error(saved_ctx);
8794 return manage(res);
8795}
8796
8797inline std::ostream &operator<<(std::ostream &os, const multi_aff &obj)
8798{
8799 if (!obj.get())
8800 exception::throw_invalid("NULL input", __FILE__, __LINE__);
8801 auto saved_ctx = isl_multi_aff_get_ctx(obj.get());
8802 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8803 char *str = isl_multi_aff_to_str(obj.get());
8804 if (!str)
8805 exception::throw_last_error(saved_ctx);
8806 os << str;
8807 free(str);
8808 return os;
8809}
8810
8811// implementations for isl::multi_id
8812multi_id manage(__isl_take isl_multi_id *ptr) {
8813 if (!ptr)
8814 exception::throw_invalid("NULL input", __FILE__, __LINE__);
8815 return multi_id(ptr);
8816}
8817multi_id manage_copy(__isl_keep isl_multi_id *ptr) {
8818 if (!ptr)
8819 exception::throw_invalid("NULL input", __FILE__, __LINE__);
8820 auto saved_ctx = isl_multi_id_get_ctx(ptr);
8821 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8822 ptr = isl_multi_id_copy(ptr);
8823 if (!ptr)
8824 exception::throw_last_error(saved_ctx);
8825 return multi_id(ptr);
8826}
8827
8828multi_id::multi_id()
8829 : ptr(nullptr) {}
8830
8831multi_id::multi_id(const multi_id &obj)
8832 : ptr(nullptr)
8833{
8834 if (!obj.ptr)
8835 exception::throw_invalid("NULL input", __FILE__, __LINE__);
8836 auto saved_ctx = isl_multi_id_get_ctx(obj.ptr);
8837 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8838 ptr = obj.copy();
8839 if (!ptr)
8840 exception::throw_last_error(saved_ctx);
8841}
8842
8843multi_id::multi_id(__isl_take isl_multi_id *ptr)
8844 : ptr(ptr) {}
8845
8846multi_id::multi_id(isl::space space, isl::id_list list)
8847{
8848 if (space.is_null() || list.is_null())
8849 exception::throw_invalid("NULL input", __FILE__, __LINE__);
8850 auto saved_ctx = space.ctx();
8851 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8852 auto res = isl_multi_id_from_id_list(space.release(), list.release());
8853 if (!res)
8854 exception::throw_last_error(saved_ctx);
8855 ptr = res;
8856}
8857
8858multi_id::multi_id(isl::ctx ctx, const std::string &str)
8859{
8860 auto saved_ctx = ctx;
8861 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8862 auto res = isl_multi_id_read_from_str(ctx.release(), str.c_str());
8863 if (!res)
8864 exception::throw_last_error(saved_ctx);
8865 ptr = res;
8866}
8867
8868multi_id &multi_id::operator=(multi_id obj) {
8869 std::swap(this->ptr, obj.ptr);
8870 return *this;
8871}
8872
8873multi_id::~multi_id() {
8874 if (ptr)
8875 isl_multi_id_free(ptr);
8876}
8877
8878__isl_give isl_multi_id *multi_id::copy() const & {
8879 return isl_multi_id_copy(ptr);
8880}
8881
8882__isl_keep isl_multi_id *multi_id::get() const {
8883 return ptr;
8884}
8885
8886__isl_give isl_multi_id *multi_id::release() {
8887 isl_multi_id *tmp = ptr;
8888 ptr = nullptr;
8889 return tmp;
8890}
8891
8892bool multi_id::is_null() const {
8893 return ptr == nullptr;
8894}
8895
8896isl::ctx multi_id::ctx() const {
8897 return isl::ctx(isl_multi_id_get_ctx(ptr));
8898}
8899
8900isl::multi_id multi_id::flat_range_product(isl::multi_id multi2) const
8901{
8902 if (!ptr || multi2.is_null())
8903 exception::throw_invalid("NULL input", __FILE__, __LINE__);
8904 auto saved_ctx = ctx();
8905 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8906 auto res = isl_multi_id_flat_range_product(copy(), multi2.release());
8907 if (!res)
8908 exception::throw_last_error(saved_ctx);
8909 return manage(res);
8910}
8911
8912isl::id multi_id::at(int pos) const
8913{
8914 if (!ptr)
8915 exception::throw_invalid("NULL input", __FILE__, __LINE__);
8916 auto saved_ctx = ctx();
8917 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8918 auto res = isl_multi_id_get_at(get(), pos);
8919 if (!res)
8920 exception::throw_last_error(saved_ctx);
8921 return manage(res);
8922}
8923
8924isl::id multi_id::get_at(int pos) const
8925{
8926 return at(pos);
8927}
8928
8929isl::id_list multi_id::list() const
8930{
8931 if (!ptr)
8932 exception::throw_invalid("NULL input", __FILE__, __LINE__);
8933 auto saved_ctx = ctx();
8934 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8935 auto res = isl_multi_id_get_list(get());
8936 if (!res)
8937 exception::throw_last_error(saved_ctx);
8938 return manage(res);
8939}
8940
8941isl::id_list multi_id::get_list() const
8942{
8943 return list();
8944}
8945
8946isl::space multi_id::space() const
8947{
8948 if (!ptr)
8949 exception::throw_invalid("NULL input", __FILE__, __LINE__);
8950 auto saved_ctx = ctx();
8951 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8952 auto res = isl_multi_id_get_space(get());
8953 if (!res)
8954 exception::throw_last_error(saved_ctx);
8955 return manage(res);
8956}
8957
8958isl::space multi_id::get_space() const
8959{
8960 return space();
8961}
8962
8963bool multi_id::plain_is_equal(const isl::multi_id &multi2) const
8964{
8965 if (!ptr || multi2.is_null())
8966 exception::throw_invalid("NULL input", __FILE__, __LINE__);
8967 auto saved_ctx = ctx();
8968 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8969 auto res = isl_multi_id_plain_is_equal(get(), multi2.get());
8970 if (res < 0)
8971 exception::throw_last_error(saved_ctx);
8972 return res;
8973}
8974
8975isl::multi_id multi_id::range_product(isl::multi_id multi2) const
8976{
8977 if (!ptr || multi2.is_null())
8978 exception::throw_invalid("NULL input", __FILE__, __LINE__);
8979 auto saved_ctx = ctx();
8980 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8981 auto res = isl_multi_id_range_product(copy(), multi2.release());
8982 if (!res)
8983 exception::throw_last_error(saved_ctx);
8984 return manage(res);
8985}
8986
8987isl::multi_id multi_id::set_at(int pos, isl::id el) const
8988{
8989 if (!ptr || el.is_null())
8990 exception::throw_invalid("NULL input", __FILE__, __LINE__);
8991 auto saved_ctx = ctx();
8992 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8993 auto res = isl_multi_id_set_at(copy(), pos, el.release());
8994 if (!res)
8995 exception::throw_last_error(saved_ctx);
8996 return manage(res);
8997}
8998
8999isl::multi_id multi_id::set_at(int pos, const std::string &el) const
9000{
9001 if (!ptr)
9002 exception::throw_invalid("NULL input", __FILE__, __LINE__);
9003 return this->set_at(pos, isl::id(ctx(), el));
9004}
9005
9006unsigned multi_id::size() const
9007{
9008 if (!ptr)
9009 exception::throw_invalid("NULL input", __FILE__, __LINE__);
9010 auto saved_ctx = ctx();
9011 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9012 auto res = isl_multi_id_size(get());
9013 if (res < 0)
9014 exception::throw_last_error(saved_ctx);
9015 return res;
9016}
9017
9018inline std::ostream &operator<<(std::ostream &os, const multi_id &obj)
9019{
9020 if (!obj.get())
9021 exception::throw_invalid("NULL input", __FILE__, __LINE__);
9022 auto saved_ctx = isl_multi_id_get_ctx(obj.get());
9023 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9024 char *str = isl_multi_id_to_str(obj.get());
9025 if (!str)
9026 exception::throw_last_error(saved_ctx);
9027 os << str;
9028 free(str);
9029 return os;
9030}
9031
9032// implementations for isl::multi_pw_aff
9033multi_pw_aff manage(__isl_take isl_multi_pw_aff *ptr) {
9034 if (!ptr)
9035 exception::throw_invalid("NULL input", __FILE__, __LINE__);
9036 return multi_pw_aff(ptr);
9037}
9038multi_pw_aff manage_copy(__isl_keep isl_multi_pw_aff *ptr) {
9039 if (!ptr)
9040 exception::throw_invalid("NULL input", __FILE__, __LINE__);
9041 auto saved_ctx = isl_multi_pw_aff_get_ctx(ptr);
9042 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9043 ptr = isl_multi_pw_aff_copy(ptr);
9044 if (!ptr)
9045 exception::throw_last_error(saved_ctx);
9046 return multi_pw_aff(ptr);
9047}
9048
9049multi_pw_aff::multi_pw_aff()
9050 : ptr(nullptr) {}
9051
9052multi_pw_aff::multi_pw_aff(const multi_pw_aff &obj)
9053 : ptr(nullptr)
9054{
9055 if (!obj.ptr)
9056 exception::throw_invalid("NULL input", __FILE__, __LINE__);
9057 auto saved_ctx = isl_multi_pw_aff_get_ctx(obj.ptr);
9058 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9059 ptr = obj.copy();
9060 if (!ptr)
9061 exception::throw_last_error(saved_ctx);
9062}
9063
9064multi_pw_aff::multi_pw_aff(__isl_take isl_multi_pw_aff *ptr)
9065 : ptr(ptr) {}
9066
9067multi_pw_aff::multi_pw_aff(isl::aff aff)
9068{
9069 if (aff.is_null())
9070 exception::throw_invalid("NULL input", __FILE__, __LINE__);
9071 auto saved_ctx = aff.ctx();
9072 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9073 auto res = isl_multi_pw_aff_from_aff(aff.release());
9074 if (!res)
9075 exception::throw_last_error(saved_ctx);
9076 ptr = res;
9077}
9078
9079multi_pw_aff::multi_pw_aff(isl::multi_aff ma)
9080{
9081 if (ma.is_null())
9082 exception::throw_invalid("NULL input", __FILE__, __LINE__);
9083 auto saved_ctx = ma.ctx();
9084 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9085 auto res = isl_multi_pw_aff_from_multi_aff(ma.release());
9086 if (!res)
9087 exception::throw_last_error(saved_ctx);
9088 ptr = res;
9089}
9090
9091multi_pw_aff::multi_pw_aff(isl::pw_aff pa)
9092{
9093 if (pa.is_null())
9094 exception::throw_invalid("NULL input", __FILE__, __LINE__);
9095 auto saved_ctx = pa.ctx();
9096 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9097 auto res = isl_multi_pw_aff_from_pw_aff(pa.release());
9098 if (!res)
9099 exception::throw_last_error(saved_ctx);
9100 ptr = res;
9101}
9102
9103multi_pw_aff::multi_pw_aff(isl::space space, isl::pw_aff_list list)
9104{
9105 if (space.is_null() || list.is_null())
9106 exception::throw_invalid("NULL input", __FILE__, __LINE__);
9107 auto saved_ctx = space.ctx();
9108 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9109 auto res = isl_multi_pw_aff_from_pw_aff_list(space.release(), list.release());
9110 if (!res)
9111 exception::throw_last_error(saved_ctx);
9112 ptr = res;
9113}
9114
9115multi_pw_aff::multi_pw_aff(isl::pw_multi_aff pma)
9116{
9117 if (pma.is_null())
9118 exception::throw_invalid("NULL input", __FILE__, __LINE__);
9119 auto saved_ctx = pma.ctx();
9120 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9121 auto res = isl_multi_pw_aff_from_pw_multi_aff(pma.release());
9122 if (!res)
9123 exception::throw_last_error(saved_ctx);
9124 ptr = res;
9125}
9126
9127multi_pw_aff::multi_pw_aff(isl::ctx ctx, const std::string &str)
9128{
9129 auto saved_ctx = ctx;
9130 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9131 auto res = isl_multi_pw_aff_read_from_str(ctx.release(), str.c_str());
9132 if (!res)
9133 exception::throw_last_error(saved_ctx);
9134 ptr = res;
9135}
9136
9137multi_pw_aff &multi_pw_aff::operator=(multi_pw_aff obj) {
9138 std::swap(this->ptr, obj.ptr);
9139 return *this;
9140}
9141
9142multi_pw_aff::~multi_pw_aff() {
9143 if (ptr)
9144 isl_multi_pw_aff_free(ptr);
9145}
9146
9147__isl_give isl_multi_pw_aff *multi_pw_aff::copy() const & {
9148 return isl_multi_pw_aff_copy(ptr);
9149}
9150
9151__isl_keep isl_multi_pw_aff *multi_pw_aff::get() const {
9152 return ptr;
9153}
9154
9155__isl_give isl_multi_pw_aff *multi_pw_aff::release() {
9156 isl_multi_pw_aff *tmp = ptr;
9157 ptr = nullptr;
9158 return tmp;
9159}
9160
9161bool multi_pw_aff::is_null() const {
9162 return ptr == nullptr;
9163}
9164
9165isl::ctx multi_pw_aff::ctx() const {
9166 return isl::ctx(isl_multi_pw_aff_get_ctx(ptr));
9167}
9168
9169isl::multi_pw_aff multi_pw_aff::add(isl::multi_pw_aff multi2) const
9170{
9171 if (!ptr || multi2.is_null())
9172 exception::throw_invalid("NULL input", __FILE__, __LINE__);
9173 auto saved_ctx = ctx();
9174 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9175 auto res = isl_multi_pw_aff_add(copy(), multi2.release());
9176 if (!res)
9177 exception::throw_last_error(saved_ctx);
9178 return manage(res);
9179}
9180
9181isl::multi_pw_aff multi_pw_aff::add_constant(isl::multi_val mv) const
9182{
9183 if (!ptr || mv.is_null())
9184 exception::throw_invalid("NULL input", __FILE__, __LINE__);
9185 auto saved_ctx = ctx();
9186 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9187 auto res = isl_multi_pw_aff_add_constant_multi_val(copy(), mv.release());
9188 if (!res)
9189 exception::throw_last_error(saved_ctx);
9190 return manage(res);
9191}
9192
9193isl::multi_pw_aff multi_pw_aff::add_constant(isl::val v) const
9194{
9195 if (!ptr || v.is_null())
9196 exception::throw_invalid("NULL input", __FILE__, __LINE__);
9197 auto saved_ctx = ctx();
9198 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9199 auto res = isl_multi_pw_aff_add_constant_val(copy(), v.release());
9200 if (!res)
9201 exception::throw_last_error(saved_ctx);
9202 return manage(res);
9203}
9204
9205isl::multi_pw_aff multi_pw_aff::add_constant(long v) const
9206{
9207 if (!ptr)
9208 exception::throw_invalid("NULL input", __FILE__, __LINE__);
9209 return this->add_constant(isl::val(ctx(), v));
9210}
9211
9212isl::set multi_pw_aff::bind(isl::multi_id tuple) const
9213{
9214 if (!ptr || tuple.is_null())
9215 exception::throw_invalid("NULL input", __FILE__, __LINE__);
9216 auto saved_ctx = ctx();
9217 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9218 auto res = isl_multi_pw_aff_bind(copy(), tuple.release());
9219 if (!res)
9220 exception::throw_last_error(saved_ctx);
9221 return manage(res);
9222}
9223
9224isl::multi_pw_aff multi_pw_aff::bind_domain(isl::multi_id tuple) const
9225{
9226 if (!ptr || tuple.is_null())
9227 exception::throw_invalid("NULL input", __FILE__, __LINE__);
9228 auto saved_ctx = ctx();
9229 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9230 auto res = isl_multi_pw_aff_bind_domain(copy(), tuple.release());
9231 if (!res)
9232 exception::throw_last_error(saved_ctx);
9233 return manage(res);
9234}
9235
9236isl::multi_pw_aff multi_pw_aff::bind_domain_wrapped_domain(isl::multi_id tuple) const
9237{
9238 if (!ptr || tuple.is_null())
9239 exception::throw_invalid("NULL input", __FILE__, __LINE__);
9240 auto saved_ctx = ctx();
9241 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9242 auto res = isl_multi_pw_aff_bind_domain_wrapped_domain(copy(), tuple.release());
9243 if (!res)
9244 exception::throw_last_error(saved_ctx);
9245 return manage(res);
9246}
9247
9248isl::multi_pw_aff multi_pw_aff::coalesce() const
9249{
9250 if (!ptr)
9251 exception::throw_invalid("NULL input", __FILE__, __LINE__);
9252 auto saved_ctx = ctx();
9253 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9254 auto res = isl_multi_pw_aff_coalesce(copy());
9255 if (!res)
9256 exception::throw_last_error(saved_ctx);
9257 return manage(res);
9258}
9259
9260isl::set multi_pw_aff::domain() const
9261{
9262 if (!ptr)
9263 exception::throw_invalid("NULL input", __FILE__, __LINE__);
9264 auto saved_ctx = ctx();
9265 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9266 auto res = isl_multi_pw_aff_domain(copy());
9267 if (!res)
9268 exception::throw_last_error(saved_ctx);
9269 return manage(res);
9270}
9271
9272isl::multi_pw_aff multi_pw_aff::flat_range_product(isl::multi_pw_aff multi2) const
9273{
9274 if (!ptr || multi2.is_null())
9275 exception::throw_invalid("NULL input", __FILE__, __LINE__);
9276 auto saved_ctx = ctx();
9277 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9278 auto res = isl_multi_pw_aff_flat_range_product(copy(), multi2.release());
9279 if (!res)
9280 exception::throw_last_error(saved_ctx);
9281 return manage(res);
9282}
9283
9284isl::pw_aff multi_pw_aff::at(int pos) const
9285{
9286 if (!ptr)
9287 exception::throw_invalid("NULL input", __FILE__, __LINE__);
9288 auto saved_ctx = ctx();
9289 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9290 auto res = isl_multi_pw_aff_get_at(get(), pos);
9291 if (!res)
9292 exception::throw_last_error(saved_ctx);
9293 return manage(res);
9294}
9295
9296isl::pw_aff multi_pw_aff::get_at(int pos) const
9297{
9298 return at(pos);
9299}
9300
9301isl::pw_aff_list multi_pw_aff::list() const
9302{
9303 if (!ptr)
9304 exception::throw_invalid("NULL input", __FILE__, __LINE__);
9305 auto saved_ctx = ctx();
9306 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9307 auto res = isl_multi_pw_aff_get_list(get());
9308 if (!res)
9309 exception::throw_last_error(saved_ctx);
9310 return manage(res);
9311}
9312
9313isl::pw_aff_list multi_pw_aff::get_list() const
9314{
9315 return list();
9316}
9317
9318isl::space multi_pw_aff::space() const
9319{
9320 if (!ptr)
9321 exception::throw_invalid("NULL input", __FILE__, __LINE__);
9322 auto saved_ctx = ctx();
9323 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9324 auto res = isl_multi_pw_aff_get_space(get());
9325 if (!res)
9326 exception::throw_last_error(saved_ctx);
9327 return manage(res);
9328}
9329
9330isl::space multi_pw_aff::get_space() const
9331{
9332 return space();
9333}
9334
9335isl::multi_pw_aff multi_pw_aff::gist(isl::set set) const
9336{
9337 if (!ptr || set.is_null())
9338 exception::throw_invalid("NULL input", __FILE__, __LINE__);
9339 auto saved_ctx = ctx();
9340 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9341 auto res = isl_multi_pw_aff_gist(copy(), set.release());
9342 if (!res)
9343 exception::throw_last_error(saved_ctx);
9344 return manage(res);
9345}
9346
9347isl::multi_pw_aff multi_pw_aff::identity() const
9348{
9349 if (!ptr)
9350 exception::throw_invalid("NULL input", __FILE__, __LINE__);
9351 auto saved_ctx = ctx();
9352 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9353 auto res = isl_multi_pw_aff_identity_multi_pw_aff(copy());
9354 if (!res)
9355 exception::throw_last_error(saved_ctx);
9356 return manage(res);
9357}
9358
9359isl::multi_pw_aff multi_pw_aff::identity_on_domain(isl::space space)
9360{
9361 if (space.is_null())
9362 exception::throw_invalid("NULL input", __FILE__, __LINE__);
9363 auto saved_ctx = space.ctx();
9364 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9365 auto res = isl_multi_pw_aff_identity_on_domain_space(space.release());
9366 if (!res)
9367 exception::throw_last_error(saved_ctx);
9368 return manage(res);
9369}
9370
9371isl::multi_pw_aff multi_pw_aff::insert_domain(isl::space domain) const
9372{
9373 if (!ptr || domain.is_null())
9374 exception::throw_invalid("NULL input", __FILE__, __LINE__);
9375 auto saved_ctx = ctx();
9376 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9377 auto res = isl_multi_pw_aff_insert_domain(copy(), domain.release());
9378 if (!res)
9379 exception::throw_last_error(saved_ctx);
9380 return manage(res);
9381}
9382
9383isl::multi_pw_aff multi_pw_aff::intersect_domain(isl::set domain) const
9384{
9385 if (!ptr || domain.is_null())
9386 exception::throw_invalid("NULL input", __FILE__, __LINE__);
9387 auto saved_ctx = ctx();
9388 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9389 auto res = isl_multi_pw_aff_intersect_domain(copy(), domain.release());
9390 if (!res)
9391 exception::throw_last_error(saved_ctx);
9392 return manage(res);
9393}
9394
9395isl::multi_pw_aff multi_pw_aff::intersect_params(isl::set set) const
9396{
9397 if (!ptr || set.is_null())
9398 exception::throw_invalid("NULL input", __FILE__, __LINE__);
9399 auto saved_ctx = ctx();
9400 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9401 auto res = isl_multi_pw_aff_intersect_params(copy(), set.release());
9402 if (!res)
9403 exception::throw_last_error(saved_ctx);
9404 return manage(res);
9405}
9406
9407bool multi_pw_aff::involves_param(const isl::id &id) const
9408{
9409 if (!ptr || id.is_null())
9410 exception::throw_invalid("NULL input", __FILE__, __LINE__);
9411 auto saved_ctx = ctx();
9412 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9413 auto res = isl_multi_pw_aff_involves_param_id(get(), id.get());
9414 if (res < 0)
9415 exception::throw_last_error(saved_ctx);
9416 return res;
9417}
9418
9419bool multi_pw_aff::involves_param(const std::string &id) const
9420{
9421 if (!ptr)
9422 exception::throw_invalid("NULL input", __FILE__, __LINE__);
9423 return this->involves_param(isl::id(ctx(), id));
9424}
9425
9426bool multi_pw_aff::involves_param(const isl::id_list &list) const
9427{
9428 if (!ptr || list.is_null())
9429 exception::throw_invalid("NULL input", __FILE__, __LINE__);
9430 auto saved_ctx = ctx();
9431 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9432 auto res = isl_multi_pw_aff_involves_param_id_list(get(), list.get());
9433 if (res < 0)
9434 exception::throw_last_error(saved_ctx);
9435 return res;
9436}
9437
9438isl::multi_pw_aff multi_pw_aff::max(isl::multi_pw_aff multi2) const
9439{
9440 if (!ptr || multi2.is_null())
9441 exception::throw_invalid("NULL input", __FILE__, __LINE__);
9442 auto saved_ctx = ctx();
9443 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9444 auto res = isl_multi_pw_aff_max(copy(), multi2.release());
9445 if (!res)
9446 exception::throw_last_error(saved_ctx);
9447 return manage(res);
9448}
9449
9450isl::multi_val multi_pw_aff::max_multi_val() const
9451{
9452 if (!ptr)
9453 exception::throw_invalid("NULL input", __FILE__, __LINE__);
9454 auto saved_ctx = ctx();
9455 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9456 auto res = isl_multi_pw_aff_max_multi_val(copy());
9457 if (!res)
9458 exception::throw_last_error(saved_ctx);
9459 return manage(res);
9460}
9461
9462isl::multi_pw_aff multi_pw_aff::min(isl::multi_pw_aff multi2) const
9463{
9464 if (!ptr || multi2.is_null())
9465 exception::throw_invalid("NULL input", __FILE__, __LINE__);
9466 auto saved_ctx = ctx();
9467 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9468 auto res = isl_multi_pw_aff_min(copy(), multi2.release());
9469 if (!res)
9470 exception::throw_last_error(saved_ctx);
9471 return manage(res);
9472}
9473
9474isl::multi_val multi_pw_aff::min_multi_val() const
9475{
9476 if (!ptr)
9477 exception::throw_invalid("NULL input", __FILE__, __LINE__);
9478 auto saved_ctx = ctx();
9479 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9480 auto res = isl_multi_pw_aff_min_multi_val(copy());
9481 if (!res)
9482 exception::throw_last_error(saved_ctx);
9483 return manage(res);
9484}
9485
9486isl::multi_pw_aff multi_pw_aff::neg() const
9487{
9488 if (!ptr)
9489 exception::throw_invalid("NULL input", __FILE__, __LINE__);
9490 auto saved_ctx = ctx();
9491 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9492 auto res = isl_multi_pw_aff_neg(copy());
9493 if (!res)
9494 exception::throw_last_error(saved_ctx);
9495 return manage(res);
9496}
9497
9498bool multi_pw_aff::plain_is_equal(const isl::multi_pw_aff &multi2) const
9499{
9500 if (!ptr || multi2.is_null())
9501 exception::throw_invalid("NULL input", __FILE__, __LINE__);
9502 auto saved_ctx = ctx();
9503 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9504 auto res = isl_multi_pw_aff_plain_is_equal(get(), multi2.get());
9505 if (res < 0)
9506 exception::throw_last_error(saved_ctx);
9507 return res;
9508}
9509
9510isl::multi_pw_aff multi_pw_aff::product(isl::multi_pw_aff multi2) const
9511{
9512 if (!ptr || multi2.is_null())
9513 exception::throw_invalid("NULL input", __FILE__, __LINE__);
9514 auto saved_ctx = ctx();
9515 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9516 auto res = isl_multi_pw_aff_product(copy(), multi2.release());
9517 if (!res)
9518 exception::throw_last_error(saved_ctx);
9519 return manage(res);
9520}
9521
9522isl::multi_pw_aff multi_pw_aff::pullback(isl::multi_aff ma) const
9523{
9524 if (!ptr || ma.is_null())
9525 exception::throw_invalid("NULL input", __FILE__, __LINE__);
9526 auto saved_ctx = ctx();
9527 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9528 auto res = isl_multi_pw_aff_pullback_multi_aff(copy(), ma.release());
9529 if (!res)
9530 exception::throw_last_error(saved_ctx);
9531 return manage(res);
9532}
9533
9534isl::multi_pw_aff multi_pw_aff::pullback(isl::multi_pw_aff mpa2) const
9535{
9536 if (!ptr || mpa2.is_null())
9537 exception::throw_invalid("NULL input", __FILE__, __LINE__);
9538 auto saved_ctx = ctx();
9539 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9540 auto res = isl_multi_pw_aff_pullback_multi_pw_aff(copy(), mpa2.release());
9541 if (!res)
9542 exception::throw_last_error(saved_ctx);
9543 return manage(res);
9544}
9545
9546isl::multi_pw_aff multi_pw_aff::pullback(isl::pw_multi_aff pma) const
9547{
9548 if (!ptr || pma.is_null())
9549 exception::throw_invalid("NULL input", __FILE__, __LINE__);
9550 auto saved_ctx = ctx();
9551 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9552 auto res = isl_multi_pw_aff_pullback_pw_multi_aff(copy(), pma.release());
9553 if (!res)
9554 exception::throw_last_error(saved_ctx);
9555 return manage(res);
9556}
9557
9558isl::multi_pw_aff multi_pw_aff::range_product(isl::multi_pw_aff multi2) const
9559{
9560 if (!ptr || multi2.is_null())
9561 exception::throw_invalid("NULL input", __FILE__, __LINE__);
9562 auto saved_ctx = ctx();
9563 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9564 auto res = isl_multi_pw_aff_range_product(copy(), multi2.release());
9565 if (!res)
9566 exception::throw_last_error(saved_ctx);
9567 return manage(res);
9568}
9569
9570isl::multi_pw_aff multi_pw_aff::scale(isl::multi_val mv) const
9571{
9572 if (!ptr || mv.is_null())
9573 exception::throw_invalid("NULL input", __FILE__, __LINE__);
9574 auto saved_ctx = ctx();
9575 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9576 auto res = isl_multi_pw_aff_scale_multi_val(copy(), mv.release());
9577 if (!res)
9578 exception::throw_last_error(saved_ctx);
9579 return manage(res);
9580}
9581
9582isl::multi_pw_aff multi_pw_aff::scale(isl::val v) const
9583{
9584 if (!ptr || v.is_null())
9585 exception::throw_invalid("NULL input", __FILE__, __LINE__);
9586 auto saved_ctx = ctx();
9587 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9588 auto res = isl_multi_pw_aff_scale_val(copy(), v.release());
9589 if (!res)
9590 exception::throw_last_error(saved_ctx);
9591 return manage(res);
9592}
9593
9594isl::multi_pw_aff multi_pw_aff::scale(long v) const
9595{
9596 if (!ptr)
9597 exception::throw_invalid("NULL input", __FILE__, __LINE__);
9598 return this->scale(isl::val(ctx(), v));
9599}
9600
9601isl::multi_pw_aff multi_pw_aff::scale_down(isl::multi_val mv) const
9602{
9603 if (!ptr || mv.is_null())
9604 exception::throw_invalid("NULL input", __FILE__, __LINE__);
9605 auto saved_ctx = ctx();
9606 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9607 auto res = isl_multi_pw_aff_scale_down_multi_val(copy(), mv.release());
9608 if (!res)
9609 exception::throw_last_error(saved_ctx);
9610 return manage(res);
9611}
9612
9613isl::multi_pw_aff multi_pw_aff::scale_down(isl::val v) const
9614{
9615 if (!ptr || v.is_null())
9616 exception::throw_invalid("NULL input", __FILE__, __LINE__);
9617 auto saved_ctx = ctx();
9618 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9619 auto res = isl_multi_pw_aff_scale_down_val(copy(), v.release());
9620 if (!res)
9621 exception::throw_last_error(saved_ctx);
9622 return manage(res);
9623}
9624
9625isl::multi_pw_aff multi_pw_aff::scale_down(long v) const
9626{
9627 if (!ptr)
9628 exception::throw_invalid("NULL input", __FILE__, __LINE__);
9629 return this->scale_down(isl::val(ctx(), v));
9630}
9631
9632isl::multi_pw_aff multi_pw_aff::set_at(int pos, isl::pw_aff el) const
9633{
9634 if (!ptr || el.is_null())
9635 exception::throw_invalid("NULL input", __FILE__, __LINE__);
9636 auto saved_ctx = ctx();
9637 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9638 auto res = isl_multi_pw_aff_set_at(copy(), pos, el.release());
9639 if (!res)
9640 exception::throw_last_error(saved_ctx);
9641 return manage(res);
9642}
9643
9644unsigned multi_pw_aff::size() const
9645{
9646 if (!ptr)
9647 exception::throw_invalid("NULL input", __FILE__, __LINE__);
9648 auto saved_ctx = ctx();
9649 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9650 auto res = isl_multi_pw_aff_size(get());
9651 if (res < 0)
9652 exception::throw_last_error(saved_ctx);
9653 return res;
9654}
9655
9656isl::multi_pw_aff multi_pw_aff::sub(isl::multi_pw_aff multi2) const
9657{
9658 if (!ptr || multi2.is_null())
9659 exception::throw_invalid("NULL input", __FILE__, __LINE__);
9660 auto saved_ctx = ctx();
9661 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9662 auto res = isl_multi_pw_aff_sub(copy(), multi2.release());
9663 if (!res)
9664 exception::throw_last_error(saved_ctx);
9665 return manage(res);
9666}
9667
9668isl::multi_pw_aff multi_pw_aff::unbind_params_insert_domain(isl::multi_id domain) const
9669{
9670 if (!ptr || domain.is_null())
9671 exception::throw_invalid("NULL input", __FILE__, __LINE__);
9672 auto saved_ctx = ctx();
9673 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9674 auto res = isl_multi_pw_aff_unbind_params_insert_domain(copy(), domain.release());
9675 if (!res)
9676 exception::throw_last_error(saved_ctx);
9677 return manage(res);
9678}
9679
9680isl::multi_pw_aff multi_pw_aff::union_add(isl::multi_pw_aff mpa2) const
9681{
9682 if (!ptr || mpa2.is_null())
9683 exception::throw_invalid("NULL input", __FILE__, __LINE__);
9684 auto saved_ctx = ctx();
9685 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9686 auto res = isl_multi_pw_aff_union_add(copy(), mpa2.release());
9687 if (!res)
9688 exception::throw_last_error(saved_ctx);
9689 return manage(res);
9690}
9691
9692isl::multi_pw_aff multi_pw_aff::zero(isl::space space)
9693{
9694 if (space.is_null())
9695 exception::throw_invalid("NULL input", __FILE__, __LINE__);
9696 auto saved_ctx = space.ctx();
9697 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9698 auto res = isl_multi_pw_aff_zero(space.release());
9699 if (!res)
9700 exception::throw_last_error(saved_ctx);
9701 return manage(res);
9702}
9703
9704inline std::ostream &operator<<(std::ostream &os, const multi_pw_aff &obj)
9705{
9706 if (!obj.get())
9707 exception::throw_invalid("NULL input", __FILE__, __LINE__);
9708 auto saved_ctx = isl_multi_pw_aff_get_ctx(obj.get());
9709 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9710 char *str = isl_multi_pw_aff_to_str(obj.get());
9711 if (!str)
9712 exception::throw_last_error(saved_ctx);
9713 os << str;
9714 free(str);
9715 return os;
9716}
9717
9718// implementations for isl::multi_union_pw_aff
9719multi_union_pw_aff manage(__isl_take isl_multi_union_pw_aff *ptr) {
9720 if (!ptr)
9721 exception::throw_invalid("NULL input", __FILE__, __LINE__);
9722 return multi_union_pw_aff(ptr);
9723}
9724multi_union_pw_aff manage_copy(__isl_keep isl_multi_union_pw_aff *ptr) {
9725 if (!ptr)
9726 exception::throw_invalid("NULL input", __FILE__, __LINE__);
9727 auto saved_ctx = isl_multi_union_pw_aff_get_ctx(ptr);
9728 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9729 ptr = isl_multi_union_pw_aff_copy(ptr);
9730 if (!ptr)
9731 exception::throw_last_error(saved_ctx);
9732 return multi_union_pw_aff(ptr);
9733}
9734
9735multi_union_pw_aff::multi_union_pw_aff()
9736 : ptr(nullptr) {}
9737
9738multi_union_pw_aff::multi_union_pw_aff(const multi_union_pw_aff &obj)
9739 : ptr(nullptr)
9740{
9741 if (!obj.ptr)
9742 exception::throw_invalid("NULL input", __FILE__, __LINE__);
9743 auto saved_ctx = isl_multi_union_pw_aff_get_ctx(obj.ptr);
9744 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9745 ptr = obj.copy();
9746 if (!ptr)
9747 exception::throw_last_error(saved_ctx);
9748}
9749
9750multi_union_pw_aff::multi_union_pw_aff(__isl_take isl_multi_union_pw_aff *ptr)
9751 : ptr(ptr) {}
9752
9753multi_union_pw_aff::multi_union_pw_aff(isl::multi_pw_aff mpa)
9754{
9755 if (mpa.is_null())
9756 exception::throw_invalid("NULL input", __FILE__, __LINE__);
9757 auto saved_ctx = mpa.ctx();
9758 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9759 auto res = isl_multi_union_pw_aff_from_multi_pw_aff(mpa.release());
9760 if (!res)
9761 exception::throw_last_error(saved_ctx);
9762 ptr = res;
9763}
9764
9765multi_union_pw_aff::multi_union_pw_aff(isl::union_pw_aff upa)
9766{
9767 if (upa.is_null())
9768 exception::throw_invalid("NULL input", __FILE__, __LINE__);
9769 auto saved_ctx = upa.ctx();
9770 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9771 auto res = isl_multi_union_pw_aff_from_union_pw_aff(upa.release());
9772 if (!res)
9773 exception::throw_last_error(saved_ctx);
9774 ptr = res;
9775}
9776
9777multi_union_pw_aff::multi_union_pw_aff(isl::space space, isl::union_pw_aff_list list)
9778{
9779 if (space.is_null() || list.is_null())
9780 exception::throw_invalid("NULL input", __FILE__, __LINE__);
9781 auto saved_ctx = space.ctx();
9782 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9783 auto res = isl_multi_union_pw_aff_from_union_pw_aff_list(space.release(), list.release());
9784 if (!res)
9785 exception::throw_last_error(saved_ctx);
9786 ptr = res;
9787}
9788
9789multi_union_pw_aff::multi_union_pw_aff(isl::ctx ctx, const std::string &str)
9790{
9791 auto saved_ctx = ctx;
9792 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9793 auto res = isl_multi_union_pw_aff_read_from_str(ctx.release(), str.c_str());
9794 if (!res)
9795 exception::throw_last_error(saved_ctx);
9796 ptr = res;
9797}
9798
9799multi_union_pw_aff &multi_union_pw_aff::operator=(multi_union_pw_aff obj) {
9800 std::swap(this->ptr, obj.ptr);
9801 return *this;
9802}
9803
9804multi_union_pw_aff::~multi_union_pw_aff() {
9805 if (ptr)
9806 isl_multi_union_pw_aff_free(ptr);
9807}
9808
9809__isl_give isl_multi_union_pw_aff *multi_union_pw_aff::copy() const & {
9810 return isl_multi_union_pw_aff_copy(ptr);
9811}
9812
9813__isl_keep isl_multi_union_pw_aff *multi_union_pw_aff::get() const {
9814 return ptr;
9815}
9816
9817__isl_give isl_multi_union_pw_aff *multi_union_pw_aff::release() {
9818 isl_multi_union_pw_aff *tmp = ptr;
9819 ptr = nullptr;
9820 return tmp;
9821}
9822
9823bool multi_union_pw_aff::is_null() const {
9824 return ptr == nullptr;
9825}
9826
9827isl::ctx multi_union_pw_aff::ctx() const {
9828 return isl::ctx(isl_multi_union_pw_aff_get_ctx(ptr));
9829}
9830
9831isl::multi_union_pw_aff multi_union_pw_aff::add(isl::multi_union_pw_aff multi2) const
9832{
9833 if (!ptr || multi2.is_null())
9834 exception::throw_invalid("NULL input", __FILE__, __LINE__);
9835 auto saved_ctx = ctx();
9836 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9837 auto res = isl_multi_union_pw_aff_add(copy(), multi2.release());
9838 if (!res)
9839 exception::throw_last_error(saved_ctx);
9840 return manage(res);
9841}
9842
9843isl::union_set multi_union_pw_aff::bind(isl::multi_id tuple) const
9844{
9845 if (!ptr || tuple.is_null())
9846 exception::throw_invalid("NULL input", __FILE__, __LINE__);
9847 auto saved_ctx = ctx();
9848 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9849 auto res = isl_multi_union_pw_aff_bind(copy(), tuple.release());
9850 if (!res)
9851 exception::throw_last_error(saved_ctx);
9852 return manage(res);
9853}
9854
9855isl::multi_union_pw_aff multi_union_pw_aff::coalesce() const
9856{
9857 if (!ptr)
9858 exception::throw_invalid("NULL input", __FILE__, __LINE__);
9859 auto saved_ctx = ctx();
9860 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9861 auto res = isl_multi_union_pw_aff_coalesce(copy());
9862 if (!res)
9863 exception::throw_last_error(saved_ctx);
9864 return manage(res);
9865}
9866
9867isl::union_set multi_union_pw_aff::domain() const
9868{
9869 if (!ptr)
9870 exception::throw_invalid("NULL input", __FILE__, __LINE__);
9871 auto saved_ctx = ctx();
9872 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9873 auto res = isl_multi_union_pw_aff_domain(copy());
9874 if (!res)
9875 exception::throw_last_error(saved_ctx);
9876 return manage(res);
9877}
9878
9879isl::multi_union_pw_aff multi_union_pw_aff::flat_range_product(isl::multi_union_pw_aff multi2) const
9880{
9881 if (!ptr || multi2.is_null())
9882 exception::throw_invalid("NULL input", __FILE__, __LINE__);
9883 auto saved_ctx = ctx();
9884 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9885 auto res = isl_multi_union_pw_aff_flat_range_product(copy(), multi2.release());
9886 if (!res)
9887 exception::throw_last_error(saved_ctx);
9888 return manage(res);
9889}
9890
9891isl::union_pw_aff multi_union_pw_aff::at(int pos) const
9892{
9893 if (!ptr)
9894 exception::throw_invalid("NULL input", __FILE__, __LINE__);
9895 auto saved_ctx = ctx();
9896 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9897 auto res = isl_multi_union_pw_aff_get_at(get(), pos);
9898 if (!res)
9899 exception::throw_last_error(saved_ctx);
9900 return manage(res);
9901}
9902
9903isl::union_pw_aff multi_union_pw_aff::get_at(int pos) const
9904{
9905 return at(pos);
9906}
9907
9908isl::union_pw_aff_list multi_union_pw_aff::list() const
9909{
9910 if (!ptr)
9911 exception::throw_invalid("NULL input", __FILE__, __LINE__);
9912 auto saved_ctx = ctx();
9913 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9914 auto res = isl_multi_union_pw_aff_get_list(get());
9915 if (!res)
9916 exception::throw_last_error(saved_ctx);
9917 return manage(res);
9918}
9919
9920isl::union_pw_aff_list multi_union_pw_aff::get_list() const
9921{
9922 return list();
9923}
9924
9925isl::space multi_union_pw_aff::space() const
9926{
9927 if (!ptr)
9928 exception::throw_invalid("NULL input", __FILE__, __LINE__);
9929 auto saved_ctx = ctx();
9930 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9931 auto res = isl_multi_union_pw_aff_get_space(get());
9932 if (!res)
9933 exception::throw_last_error(saved_ctx);
9934 return manage(res);
9935}
9936
9937isl::space multi_union_pw_aff::get_space() const
9938{
9939 return space();
9940}
9941
9942isl::multi_union_pw_aff multi_union_pw_aff::gist(isl::union_set context) const
9943{
9944 if (!ptr || context.is_null())
9945 exception::throw_invalid("NULL input", __FILE__, __LINE__);
9946 auto saved_ctx = ctx();
9947 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9948 auto res = isl_multi_union_pw_aff_gist(copy(), context.release());
9949 if (!res)
9950 exception::throw_last_error(saved_ctx);
9951 return manage(res);
9952}
9953
9954isl::multi_union_pw_aff multi_union_pw_aff::intersect_domain(isl::union_set uset) const
9955{
9956 if (!ptr || uset.is_null())
9957 exception::throw_invalid("NULL input", __FILE__, __LINE__);
9958 auto saved_ctx = ctx();
9959 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9960 auto res = isl_multi_union_pw_aff_intersect_domain(copy(), uset.release());
9961 if (!res)
9962 exception::throw_last_error(saved_ctx);
9963 return manage(res);
9964}
9965
9966isl::multi_union_pw_aff multi_union_pw_aff::intersect_params(isl::set params) const
9967{
9968 if (!ptr || params.is_null())
9969 exception::throw_invalid("NULL input", __FILE__, __LINE__);
9970 auto saved_ctx = ctx();
9971 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9972 auto res = isl_multi_union_pw_aff_intersect_params(copy(), params.release());
9973 if (!res)
9974 exception::throw_last_error(saved_ctx);
9975 return manage(res);
9976}
9977
9978isl::multi_union_pw_aff multi_union_pw_aff::neg() const
9979{
9980 if (!ptr)
9981 exception::throw_invalid("NULL input", __FILE__, __LINE__);
9982 auto saved_ctx = ctx();
9983 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9984 auto res = isl_multi_union_pw_aff_neg(copy());
9985 if (!res)
9986 exception::throw_last_error(saved_ctx);
9987 return manage(res);
9988}
9989
9990bool multi_union_pw_aff::plain_is_equal(const isl::multi_union_pw_aff &multi2) const
9991{
9992 if (!ptr || multi2.is_null())
9993 exception::throw_invalid("NULL input", __FILE__, __LINE__);
9994 auto saved_ctx = ctx();
9995 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9996 auto res = isl_multi_union_pw_aff_plain_is_equal(get(), multi2.get());
9997 if (res < 0)
9998 exception::throw_last_error(saved_ctx);
9999 return res;
10000}
10001
10002isl::multi_union_pw_aff multi_union_pw_aff::pullback(isl::union_pw_multi_aff upma) const
10003{
10004 if (!ptr || upma.is_null())
10005 exception::throw_invalid("NULL input", __FILE__, __LINE__);
10006 auto saved_ctx = ctx();
10007 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10008 auto res = isl_multi_union_pw_aff_pullback_union_pw_multi_aff(copy(), upma.release());
10009 if (!res)
10010 exception::throw_last_error(saved_ctx);
10011 return manage(res);
10012}
10013
10014isl::multi_union_pw_aff multi_union_pw_aff::range_product(isl::multi_union_pw_aff multi2) const
10015{
10016 if (!ptr || multi2.is_null())
10017 exception::throw_invalid("NULL input", __FILE__, __LINE__);
10018 auto saved_ctx = ctx();
10019 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10020 auto res = isl_multi_union_pw_aff_range_product(copy(), multi2.release());
10021 if (!res)
10022 exception::throw_last_error(saved_ctx);
10023 return manage(res);
10024}
10025
10026isl::multi_union_pw_aff multi_union_pw_aff::scale(isl::multi_val mv) const
10027{
10028 if (!ptr || mv.is_null())
10029 exception::throw_invalid("NULL input", __FILE__, __LINE__);
10030 auto saved_ctx = ctx();
10031 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10032 auto res = isl_multi_union_pw_aff_scale_multi_val(copy(), mv.release());
10033 if (!res)
10034 exception::throw_last_error(saved_ctx);
10035 return manage(res);
10036}
10037
10038isl::multi_union_pw_aff multi_union_pw_aff::scale(isl::val v) const
10039{
10040 if (!ptr || v.is_null())
10041 exception::throw_invalid("NULL input", __FILE__, __LINE__);
10042 auto saved_ctx = ctx();
10043 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10044 auto res = isl_multi_union_pw_aff_scale_val(copy(), v.release());
10045 if (!res)
10046 exception::throw_last_error(saved_ctx);
10047 return manage(res);
10048}
10049
10050isl::multi_union_pw_aff multi_union_pw_aff::scale(long v) const
10051{
10052 if (!ptr)
10053 exception::throw_invalid("NULL input", __FILE__, __LINE__);
10054 return this->scale(isl::val(ctx(), v));
10055}
10056
10057isl::multi_union_pw_aff multi_union_pw_aff::scale_down(isl::multi_val mv) const
10058{
10059 if (!ptr || mv.is_null())
10060 exception::throw_invalid("NULL input", __FILE__, __LINE__);
10061 auto saved_ctx = ctx();
10062 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10063 auto res = isl_multi_union_pw_aff_scale_down_multi_val(copy(), mv.release());
10064 if (!res)
10065 exception::throw_last_error(saved_ctx);
10066 return manage(res);
10067}
10068
10069isl::multi_union_pw_aff multi_union_pw_aff::scale_down(isl::val v) const
10070{
10071 if (!ptr || v.is_null())
10072 exception::throw_invalid("NULL input", __FILE__, __LINE__);
10073 auto saved_ctx = ctx();
10074 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10075 auto res = isl_multi_union_pw_aff_scale_down_val(copy(), v.release());
10076 if (!res)
10077 exception::throw_last_error(saved_ctx);
10078 return manage(res);
10079}
10080
10081isl::multi_union_pw_aff multi_union_pw_aff::scale_down(long v) const
10082{
10083 if (!ptr)
10084 exception::throw_invalid("NULL input", __FILE__, __LINE__);
10085 return this->scale_down(isl::val(ctx(), v));
10086}
10087
10088isl::multi_union_pw_aff multi_union_pw_aff::set_at(int pos, isl::union_pw_aff el) const
10089{
10090 if (!ptr || el.is_null())
10091 exception::throw_invalid("NULL input", __FILE__, __LINE__);
10092 auto saved_ctx = ctx();
10093 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10094 auto res = isl_multi_union_pw_aff_set_at(copy(), pos, el.release());
10095 if (!res)
10096 exception::throw_last_error(saved_ctx);
10097 return manage(res);
10098}
10099
10100unsigned multi_union_pw_aff::size() const
10101{
10102 if (!ptr)
10103 exception::throw_invalid("NULL input", __FILE__, __LINE__);
10104 auto saved_ctx = ctx();
10105 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10106 auto res = isl_multi_union_pw_aff_size(get());
10107 if (res < 0)
10108 exception::throw_last_error(saved_ctx);
10109 return res;
10110}
10111
10112isl::multi_union_pw_aff multi_union_pw_aff::sub(isl::multi_union_pw_aff multi2) const
10113{
10114 if (!ptr || multi2.is_null())
10115 exception::throw_invalid("NULL input", __FILE__, __LINE__);
10116 auto saved_ctx = ctx();
10117 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10118 auto res = isl_multi_union_pw_aff_sub(copy(), multi2.release());
10119 if (!res)
10120 exception::throw_last_error(saved_ctx);
10121 return manage(res);
10122}
10123
10124isl::multi_union_pw_aff multi_union_pw_aff::union_add(isl::multi_union_pw_aff mupa2) const
10125{
10126 if (!ptr || mupa2.is_null())
10127 exception::throw_invalid("NULL input", __FILE__, __LINE__);
10128 auto saved_ctx = ctx();
10129 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10130 auto res = isl_multi_union_pw_aff_union_add(copy(), mupa2.release());
10131 if (!res)
10132 exception::throw_last_error(saved_ctx);
10133 return manage(res);
10134}
10135
10136isl::multi_union_pw_aff multi_union_pw_aff::zero(isl::space space)
10137{
10138 if (space.is_null())
10139 exception::throw_invalid("NULL input", __FILE__, __LINE__);
10140 auto saved_ctx = space.ctx();
10141 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10142 auto res = isl_multi_union_pw_aff_zero(space.release());
10143 if (!res)
10144 exception::throw_last_error(saved_ctx);
10145 return manage(res);
10146}
10147
10148inline std::ostream &operator<<(std::ostream &os, const multi_union_pw_aff &obj)
10149{
10150 if (!obj.get())
10151 exception::throw_invalid("NULL input", __FILE__, __LINE__);
10152 auto saved_ctx = isl_multi_union_pw_aff_get_ctx(obj.get());
10153 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10154 char *str = isl_multi_union_pw_aff_to_str(obj.get());
10155 if (!str)
10156 exception::throw_last_error(saved_ctx);
10157 os << str;
10158 free(str);
10159 return os;
10160}
10161
10162// implementations for isl::multi_val
10163multi_val manage(__isl_take isl_multi_val *ptr) {
10164 if (!ptr)
10165 exception::throw_invalid("NULL input", __FILE__, __LINE__);
10166 return multi_val(ptr);
10167}
10168multi_val manage_copy(__isl_keep isl_multi_val *ptr) {
10169 if (!ptr)
10170 exception::throw_invalid("NULL input", __FILE__, __LINE__);
10171 auto saved_ctx = isl_multi_val_get_ctx(ptr);
10172 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10173 ptr = isl_multi_val_copy(ptr);
10174 if (!ptr)
10175 exception::throw_last_error(saved_ctx);
10176 return multi_val(ptr);
10177}
10178
10179multi_val::multi_val()
10180 : ptr(nullptr) {}
10181
10182multi_val::multi_val(const multi_val &obj)
10183 : ptr(nullptr)
10184{
10185 if (!obj.ptr)
10186 exception::throw_invalid("NULL input", __FILE__, __LINE__);
10187 auto saved_ctx = isl_multi_val_get_ctx(obj.ptr);
10188 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10189 ptr = obj.copy();
10190 if (!ptr)
10191 exception::throw_last_error(saved_ctx);
10192}
10193
10194multi_val::multi_val(__isl_take isl_multi_val *ptr)
10195 : ptr(ptr) {}
10196
10197multi_val::multi_val(isl::space space, isl::val_list list)
10198{
10199 if (space.is_null() || list.is_null())
10200 exception::throw_invalid("NULL input", __FILE__, __LINE__);
10201 auto saved_ctx = space.ctx();
10202 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10203 auto res = isl_multi_val_from_val_list(space.release(), list.release());
10204 if (!res)
10205 exception::throw_last_error(saved_ctx);
10206 ptr = res;
10207}
10208
10209multi_val::multi_val(isl::ctx ctx, const std::string &str)
10210{
10211 auto saved_ctx = ctx;
10212 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10213 auto res = isl_multi_val_read_from_str(ctx.release(), str.c_str());
10214 if (!res)
10215 exception::throw_last_error(saved_ctx);
10216 ptr = res;
10217}
10218
10219multi_val &multi_val::operator=(multi_val obj) {
10220 std::swap(this->ptr, obj.ptr);
10221 return *this;
10222}
10223
10224multi_val::~multi_val() {
10225 if (ptr)
10226 isl_multi_val_free(ptr);
10227}
10228
10229__isl_give isl_multi_val *multi_val::copy() const & {
10230 return isl_multi_val_copy(ptr);
10231}
10232
10233__isl_keep isl_multi_val *multi_val::get() const {
10234 return ptr;
10235}
10236
10237__isl_give isl_multi_val *multi_val::release() {
10238 isl_multi_val *tmp = ptr;
10239 ptr = nullptr;
10240 return tmp;
10241}
10242
10243bool multi_val::is_null() const {
10244 return ptr == nullptr;
10245}
10246
10247isl::ctx multi_val::ctx() const {
10248 return isl::ctx(isl_multi_val_get_ctx(ptr));
10249}
10250
10251isl::multi_val multi_val::add(isl::multi_val multi2) const
10252{
10253 if (!ptr || multi2.is_null())
10254 exception::throw_invalid("NULL input", __FILE__, __LINE__);
10255 auto saved_ctx = ctx();
10256 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10257 auto res = isl_multi_val_add(copy(), multi2.release());
10258 if (!res)
10259 exception::throw_last_error(saved_ctx);
10260 return manage(res);
10261}
10262
10263isl::multi_val multi_val::add(isl::val v) const
10264{
10265 if (!ptr || v.is_null())
10266 exception::throw_invalid("NULL input", __FILE__, __LINE__);
10267 auto saved_ctx = ctx();
10268 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10269 auto res = isl_multi_val_add_val(copy(), v.release());
10270 if (!res)
10271 exception::throw_last_error(saved_ctx);
10272 return manage(res);
10273}
10274
10275isl::multi_val multi_val::add(long v) const
10276{
10277 if (!ptr)
10278 exception::throw_invalid("NULL input", __FILE__, __LINE__);
10279 return this->add(isl::val(ctx(), v));
10280}
10281
10282isl::multi_val multi_val::flat_range_product(isl::multi_val multi2) const
10283{
10284 if (!ptr || multi2.is_null())
10285 exception::throw_invalid("NULL input", __FILE__, __LINE__);
10286 auto saved_ctx = ctx();
10287 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10288 auto res = isl_multi_val_flat_range_product(copy(), multi2.release());
10289 if (!res)
10290 exception::throw_last_error(saved_ctx);
10291 return manage(res);
10292}
10293
10294isl::val multi_val::at(int pos) const
10295{
10296 if (!ptr)
10297 exception::throw_invalid("NULL input", __FILE__, __LINE__);
10298 auto saved_ctx = ctx();
10299 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10300 auto res = isl_multi_val_get_at(get(), pos);
10301 if (!res)
10302 exception::throw_last_error(saved_ctx);
10303 return manage(res);
10304}
10305
10306isl::val multi_val::get_at(int pos) const
10307{
10308 return at(pos);
10309}
10310
10311isl::val_list multi_val::list() const
10312{
10313 if (!ptr)
10314 exception::throw_invalid("NULL input", __FILE__, __LINE__);
10315 auto saved_ctx = ctx();
10316 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10317 auto res = isl_multi_val_get_list(get());
10318 if (!res)
10319 exception::throw_last_error(saved_ctx);
10320 return manage(res);
10321}
10322
10323isl::val_list multi_val::get_list() const
10324{
10325 return list();
10326}
10327
10328isl::space multi_val::space() const
10329{
10330 if (!ptr)
10331 exception::throw_invalid("NULL input", __FILE__, __LINE__);
10332 auto saved_ctx = ctx();
10333 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10334 auto res = isl_multi_val_get_space(get());
10335 if (!res)
10336 exception::throw_last_error(saved_ctx);
10337 return manage(res);
10338}
10339
10340isl::space multi_val::get_space() const
10341{
10342 return space();
10343}
10344
10345isl::multi_val multi_val::max(isl::multi_val multi2) const
10346{
10347 if (!ptr || multi2.is_null())
10348 exception::throw_invalid("NULL input", __FILE__, __LINE__);
10349 auto saved_ctx = ctx();
10350 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10351 auto res = isl_multi_val_max(copy(), multi2.release());
10352 if (!res)
10353 exception::throw_last_error(saved_ctx);
10354 return manage(res);
10355}
10356
10357isl::multi_val multi_val::min(isl::multi_val multi2) const
10358{
10359 if (!ptr || multi2.is_null())
10360 exception::throw_invalid("NULL input", __FILE__, __LINE__);
10361 auto saved_ctx = ctx();
10362 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10363 auto res = isl_multi_val_min(copy(), multi2.release());
10364 if (!res)
10365 exception::throw_last_error(saved_ctx);
10366 return manage(res);
10367}
10368
10369isl::multi_val multi_val::neg() const
10370{
10371 if (!ptr)
10372 exception::throw_invalid("NULL input", __FILE__, __LINE__);
10373 auto saved_ctx = ctx();
10374 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10375 auto res = isl_multi_val_neg(copy());
10376 if (!res)
10377 exception::throw_last_error(saved_ctx);
10378 return manage(res);
10379}
10380
10381bool multi_val::plain_is_equal(const isl::multi_val &multi2) const
10382{
10383 if (!ptr || multi2.is_null())
10384 exception::throw_invalid("NULL input", __FILE__, __LINE__);
10385 auto saved_ctx = ctx();
10386 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10387 auto res = isl_multi_val_plain_is_equal(get(), multi2.get());
10388 if (res < 0)
10389 exception::throw_last_error(saved_ctx);
10390 return res;
10391}
10392
10393isl::multi_val multi_val::product(isl::multi_val multi2) const
10394{
10395 if (!ptr || multi2.is_null())
10396 exception::throw_invalid("NULL input", __FILE__, __LINE__);
10397 auto saved_ctx = ctx();
10398 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10399 auto res = isl_multi_val_product(copy(), multi2.release());
10400 if (!res)
10401 exception::throw_last_error(saved_ctx);
10402 return manage(res);
10403}
10404
10405isl::multi_val multi_val::range_product(isl::multi_val multi2) const
10406{
10407 if (!ptr || multi2.is_null())
10408 exception::throw_invalid("NULL input", __FILE__, __LINE__);
10409 auto saved_ctx = ctx();
10410 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10411 auto res = isl_multi_val_range_product(copy(), multi2.release());
10412 if (!res)
10413 exception::throw_last_error(saved_ctx);
10414 return manage(res);
10415}
10416
10417isl::multi_val multi_val::scale(isl::multi_val mv) const
10418{
10419 if (!ptr || mv.is_null())
10420 exception::throw_invalid("NULL input", __FILE__, __LINE__);
10421 auto saved_ctx = ctx();
10422 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10423 auto res = isl_multi_val_scale_multi_val(copy(), mv.release());
10424 if (!res)
10425 exception::throw_last_error(saved_ctx);
10426 return manage(res);
10427}
10428
10429isl::multi_val multi_val::scale(isl::val v) const
10430{
10431 if (!ptr || v.is_null())
10432 exception::throw_invalid("NULL input", __FILE__, __LINE__);
10433 auto saved_ctx = ctx();
10434 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10435 auto res = isl_multi_val_scale_val(copy(), v.release());
10436 if (!res)
10437 exception::throw_last_error(saved_ctx);
10438 return manage(res);
10439}
10440
10441isl::multi_val multi_val::scale(long v) const
10442{
10443 if (!ptr)
10444 exception::throw_invalid("NULL input", __FILE__, __LINE__);
10445 return this->scale(isl::val(ctx(), v));
10446}
10447
10448isl::multi_val multi_val::scale_down(isl::multi_val mv) const
10449{
10450 if (!ptr || mv.is_null())
10451 exception::throw_invalid("NULL input", __FILE__, __LINE__);
10452 auto saved_ctx = ctx();
10453 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10454 auto res = isl_multi_val_scale_down_multi_val(copy(), mv.release());
10455 if (!res)
10456 exception::throw_last_error(saved_ctx);
10457 return manage(res);
10458}
10459
10460isl::multi_val multi_val::scale_down(isl::val v) const
10461{
10462 if (!ptr || v.is_null())
10463 exception::throw_invalid("NULL input", __FILE__, __LINE__);
10464 auto saved_ctx = ctx();
10465 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10466 auto res = isl_multi_val_scale_down_val(copy(), v.release());
10467 if (!res)
10468 exception::throw_last_error(saved_ctx);
10469 return manage(res);
10470}
10471
10472isl::multi_val multi_val::scale_down(long v) const
10473{
10474 if (!ptr)
10475 exception::throw_invalid("NULL input", __FILE__, __LINE__);
10476 return this->scale_down(isl::val(ctx(), v));
10477}
10478
10479isl::multi_val multi_val::set_at(int pos, isl::val el) const
10480{
10481 if (!ptr || el.is_null())
10482 exception::throw_invalid("NULL input", __FILE__, __LINE__);
10483 auto saved_ctx = ctx();
10484 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10485 auto res = isl_multi_val_set_at(copy(), pos, el.release());
10486 if (!res)
10487 exception::throw_last_error(saved_ctx);
10488 return manage(res);
10489}
10490
10491isl::multi_val multi_val::set_at(int pos, long el) const
10492{
10493 if (!ptr)
10494 exception::throw_invalid("NULL input", __FILE__, __LINE__);
10495 return this->set_at(pos, isl::val(ctx(), el));
10496}
10497
10498unsigned multi_val::size() const
10499{
10500 if (!ptr)
10501 exception::throw_invalid("NULL input", __FILE__, __LINE__);
10502 auto saved_ctx = ctx();
10503 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10504 auto res = isl_multi_val_size(get());
10505 if (res < 0)
10506 exception::throw_last_error(saved_ctx);
10507 return res;
10508}
10509
10510isl::multi_val multi_val::sub(isl::multi_val multi2) const
10511{
10512 if (!ptr || multi2.is_null())
10513 exception::throw_invalid("NULL input", __FILE__, __LINE__);
10514 auto saved_ctx = ctx();
10515 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10516 auto res = isl_multi_val_sub(copy(), multi2.release());
10517 if (!res)
10518 exception::throw_last_error(saved_ctx);
10519 return manage(res);
10520}
10521
10522isl::multi_val multi_val::zero(isl::space space)
10523{
10524 if (space.is_null())
10525 exception::throw_invalid("NULL input", __FILE__, __LINE__);
10526 auto saved_ctx = space.ctx();
10527 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10528 auto res = isl_multi_val_zero(space.release());
10529 if (!res)
10530 exception::throw_last_error(saved_ctx);
10531 return manage(res);
10532}
10533
10534inline std::ostream &operator<<(std::ostream &os, const multi_val &obj)
10535{
10536 if (!obj.get())
10537 exception::throw_invalid("NULL input", __FILE__, __LINE__);
10538 auto saved_ctx = isl_multi_val_get_ctx(obj.get());
10539 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10540 char *str = isl_multi_val_to_str(obj.get());
10541 if (!str)
10542 exception::throw_last_error(saved_ctx);
10543 os << str;
10544 free(str);
10545 return os;
10546}
10547
10548// implementations for isl::point
10549point manage(__isl_take isl_point *ptr) {
10550 if (!ptr)
10551 exception::throw_invalid("NULL input", __FILE__, __LINE__);
10552 return point(ptr);
10553}
10554point manage_copy(__isl_keep isl_point *ptr) {
10555 if (!ptr)
10556 exception::throw_invalid("NULL input", __FILE__, __LINE__);
10557 auto saved_ctx = isl_point_get_ctx(ptr);
10558 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10559 ptr = isl_point_copy(ptr);
10560 if (!ptr)
10561 exception::throw_last_error(saved_ctx);
10562 return point(ptr);
10563}
10564
10565point::point()
10566 : ptr(nullptr) {}
10567
10568point::point(const point &obj)
10569 : ptr(nullptr)
10570{
10571 if (!obj.ptr)
10572 exception::throw_invalid("NULL input", __FILE__, __LINE__);
10573 auto saved_ctx = isl_point_get_ctx(obj.ptr);
10574 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10575 ptr = obj.copy();
10576 if (!ptr)
10577 exception::throw_last_error(saved_ctx);
10578}
10579
10580point::point(__isl_take isl_point *ptr)
10581 : ptr(ptr) {}
10582
10583point &point::operator=(point obj) {
10584 std::swap(this->ptr, obj.ptr);
10585 return *this;
10586}
10587
10588point::~point() {
10589 if (ptr)
10590 isl_point_free(ptr);
10591}
10592
10593__isl_give isl_point *point::copy() const & {
10594 return isl_point_copy(ptr);
10595}
10596
10597__isl_keep isl_point *point::get() const {
10598 return ptr;
10599}
10600
10601__isl_give isl_point *point::release() {
10602 isl_point *tmp = ptr;
10603 ptr = nullptr;
10604 return tmp;
10605}
10606
10607bool point::is_null() const {
10608 return ptr == nullptr;
10609}
10610
10611isl::ctx point::ctx() const {
10612 return isl::ctx(isl_point_get_ctx(ptr));
10613}
10614
10615isl::multi_val point::multi_val() const
10616{
10617 if (!ptr)
10618 exception::throw_invalid("NULL input", __FILE__, __LINE__);
10619 auto saved_ctx = ctx();
10620 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10621 auto res = isl_point_get_multi_val(get());
10622 if (!res)
10623 exception::throw_last_error(saved_ctx);
10624 return manage(res);
10625}
10626
10627isl::multi_val point::get_multi_val() const
10628{
10629 return multi_val();
10630}
10631
10632inline std::ostream &operator<<(std::ostream &os, const point &obj)
10633{
10634 if (!obj.get())
10635 exception::throw_invalid("NULL input", __FILE__, __LINE__);
10636 auto saved_ctx = isl_point_get_ctx(obj.get());
10637 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10638 char *str = isl_point_to_str(obj.get());
10639 if (!str)
10640 exception::throw_last_error(saved_ctx);
10641 os << str;
10642 free(str);
10643 return os;
10644}
10645
10646// implementations for isl::pw_aff
10647pw_aff manage(__isl_take isl_pw_aff *ptr) {
10648 if (!ptr)
10649 exception::throw_invalid("NULL input", __FILE__, __LINE__);
10650 return pw_aff(ptr);
10651}
10652pw_aff manage_copy(__isl_keep isl_pw_aff *ptr) {
10653 if (!ptr)
10654 exception::throw_invalid("NULL input", __FILE__, __LINE__);
10655 auto saved_ctx = isl_pw_aff_get_ctx(ptr);
10656 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10657 ptr = isl_pw_aff_copy(ptr);
10658 if (!ptr)
10659 exception::throw_last_error(saved_ctx);
10660 return pw_aff(ptr);
10661}
10662
10663pw_aff::pw_aff()
10664 : ptr(nullptr) {}
10665
10666pw_aff::pw_aff(const pw_aff &obj)
10667 : ptr(nullptr)
10668{
10669 if (!obj.ptr)
10670 exception::throw_invalid("NULL input", __FILE__, __LINE__);
10671 auto saved_ctx = isl_pw_aff_get_ctx(obj.ptr);
10672 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10673 ptr = obj.copy();
10674 if (!ptr)
10675 exception::throw_last_error(saved_ctx);
10676}
10677
10678pw_aff::pw_aff(__isl_take isl_pw_aff *ptr)
10679 : ptr(ptr) {}
10680
10681pw_aff::pw_aff(isl::aff aff)
10682{
10683 if (aff.is_null())
10684 exception::throw_invalid("NULL input", __FILE__, __LINE__);
10685 auto saved_ctx = aff.ctx();
10686 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10687 auto res = isl_pw_aff_from_aff(aff.release());
10688 if (!res)
10689 exception::throw_last_error(saved_ctx);
10690 ptr = res;
10691}
10692
10693pw_aff::pw_aff(isl::ctx ctx, const std::string &str)
10694{
10695 auto saved_ctx = ctx;
10696 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10697 auto res = isl_pw_aff_read_from_str(ctx.release(), str.c_str());
10698 if (!res)
10699 exception::throw_last_error(saved_ctx);
10700 ptr = res;
10701}
10702
10703pw_aff &pw_aff::operator=(pw_aff obj) {
10704 std::swap(this->ptr, obj.ptr);
10705 return *this;
10706}
10707
10708pw_aff::~pw_aff() {
10709 if (ptr)
10710 isl_pw_aff_free(ptr);
10711}
10712
10713__isl_give isl_pw_aff *pw_aff::copy() const & {
10714 return isl_pw_aff_copy(ptr);
10715}
10716
10717__isl_keep isl_pw_aff *pw_aff::get() const {
10718 return ptr;
10719}
10720
10721__isl_give isl_pw_aff *pw_aff::release() {
10722 isl_pw_aff *tmp = ptr;
10723 ptr = nullptr;
10724 return tmp;
10725}
10726
10727bool pw_aff::is_null() const {
10728 return ptr == nullptr;
10729}
10730
10731isl::ctx pw_aff::ctx() const {
10732 return isl::ctx(isl_pw_aff_get_ctx(ptr));
10733}
10734
10735isl::pw_aff pw_aff::add(isl::pw_aff pwaff2) const
10736{
10737 if (!ptr || pwaff2.is_null())
10738 exception::throw_invalid("NULL input", __FILE__, __LINE__);
10739 auto saved_ctx = ctx();
10740 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10741 auto res = isl_pw_aff_add(copy(), pwaff2.release());
10742 if (!res)
10743 exception::throw_last_error(saved_ctx);
10744 return manage(res);
10745}
10746
10747isl::pw_aff pw_aff::add_constant(isl::val v) const
10748{
10749 if (!ptr || v.is_null())
10750 exception::throw_invalid("NULL input", __FILE__, __LINE__);
10751 auto saved_ctx = ctx();
10752 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10753 auto res = isl_pw_aff_add_constant_val(copy(), v.release());
10754 if (!res)
10755 exception::throw_last_error(saved_ctx);
10756 return manage(res);
10757}
10758
10759isl::pw_aff pw_aff::add_constant(long v) const
10760{
10761 if (!ptr)
10762 exception::throw_invalid("NULL input", __FILE__, __LINE__);
10763 return this->add_constant(isl::val(ctx(), v));
10764}
10765
10766isl::aff pw_aff::as_aff() const
10767{
10768 if (!ptr)
10769 exception::throw_invalid("NULL input", __FILE__, __LINE__);
10770 auto saved_ctx = ctx();
10771 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10772 auto res = isl_pw_aff_as_aff(copy());
10773 if (!res)
10774 exception::throw_last_error(saved_ctx);
10775 return manage(res);
10776}
10777
10778isl::set pw_aff::bind(isl::id id) const
10779{
10780 if (!ptr || id.is_null())
10781 exception::throw_invalid("NULL input", __FILE__, __LINE__);
10782 auto saved_ctx = ctx();
10783 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10784 auto res = isl_pw_aff_bind_id(copy(), id.release());
10785 if (!res)
10786 exception::throw_last_error(saved_ctx);
10787 return manage(res);
10788}
10789
10790isl::set pw_aff::bind(const std::string &id) const
10791{
10792 if (!ptr)
10793 exception::throw_invalid("NULL input", __FILE__, __LINE__);
10794 return this->bind(isl::id(ctx(), id));
10795}
10796
10797isl::pw_aff pw_aff::bind_domain(isl::multi_id tuple) const
10798{
10799 if (!ptr || tuple.is_null())
10800 exception::throw_invalid("NULL input", __FILE__, __LINE__);
10801 auto saved_ctx = ctx();
10802 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10803 auto res = isl_pw_aff_bind_domain(copy(), tuple.release());
10804 if (!res)
10805 exception::throw_last_error(saved_ctx);
10806 return manage(res);
10807}
10808
10809isl::pw_aff pw_aff::bind_domain_wrapped_domain(isl::multi_id tuple) const
10810{
10811 if (!ptr || tuple.is_null())
10812 exception::throw_invalid("NULL input", __FILE__, __LINE__);
10813 auto saved_ctx = ctx();
10814 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10815 auto res = isl_pw_aff_bind_domain_wrapped_domain(copy(), tuple.release());
10816 if (!res)
10817 exception::throw_last_error(saved_ctx);
10818 return manage(res);
10819}
10820
10821isl::pw_aff pw_aff::ceil() const
10822{
10823 if (!ptr)
10824 exception::throw_invalid("NULL input", __FILE__, __LINE__);
10825 auto saved_ctx = ctx();
10826 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10827 auto res = isl_pw_aff_ceil(copy());
10828 if (!res)
10829 exception::throw_last_error(saved_ctx);
10830 return manage(res);
10831}
10832
10833isl::pw_aff pw_aff::coalesce() const
10834{
10835 if (!ptr)
10836 exception::throw_invalid("NULL input", __FILE__, __LINE__);
10837 auto saved_ctx = ctx();
10838 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10839 auto res = isl_pw_aff_coalesce(copy());
10840 if (!res)
10841 exception::throw_last_error(saved_ctx);
10842 return manage(res);
10843}
10844
10845isl::pw_aff pw_aff::cond(isl::pw_aff pwaff_true, isl::pw_aff pwaff_false) const
10846{
10847 if (!ptr || pwaff_true.is_null() || pwaff_false.is_null())
10848 exception::throw_invalid("NULL input", __FILE__, __LINE__);
10849 auto saved_ctx = ctx();
10850 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10851 auto res = isl_pw_aff_cond(copy(), pwaff_true.release(), pwaff_false.release());
10852 if (!res)
10853 exception::throw_last_error(saved_ctx);
10854 return manage(res);
10855}
10856
10857isl::pw_aff pw_aff::div(isl::pw_aff pa2) const
10858{
10859 if (!ptr || pa2.is_null())
10860 exception::throw_invalid("NULL input", __FILE__, __LINE__);
10861 auto saved_ctx = ctx();
10862 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10863 auto res = isl_pw_aff_div(copy(), pa2.release());
10864 if (!res)
10865 exception::throw_last_error(saved_ctx);
10866 return manage(res);
10867}
10868
10869isl::set pw_aff::domain() const
10870{
10871 if (!ptr)
10872 exception::throw_invalid("NULL input", __FILE__, __LINE__);
10873 auto saved_ctx = ctx();
10874 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10875 auto res = isl_pw_aff_domain(copy());
10876 if (!res)
10877 exception::throw_last_error(saved_ctx);
10878 return manage(res);
10879}
10880
10881isl::set pw_aff::eq_set(isl::pw_aff pwaff2) const
10882{
10883 if (!ptr || pwaff2.is_null())
10884 exception::throw_invalid("NULL input", __FILE__, __LINE__);
10885 auto saved_ctx = ctx();
10886 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10887 auto res = isl_pw_aff_eq_set(copy(), pwaff2.release());
10888 if (!res)
10889 exception::throw_last_error(saved_ctx);
10890 return manage(res);
10891}
10892
10893isl::val pw_aff::eval(isl::point pnt) const
10894{
10895 if (!ptr || pnt.is_null())
10896 exception::throw_invalid("NULL input", __FILE__, __LINE__);
10897 auto saved_ctx = ctx();
10898 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10899 auto res = isl_pw_aff_eval(copy(), pnt.release());
10900 if (!res)
10901 exception::throw_last_error(saved_ctx);
10902 return manage(res);
10903}
10904
10905isl::pw_aff pw_aff::floor() const
10906{
10907 if (!ptr)
10908 exception::throw_invalid("NULL input", __FILE__, __LINE__);
10909 auto saved_ctx = ctx();
10910 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10911 auto res = isl_pw_aff_floor(copy());
10912 if (!res)
10913 exception::throw_last_error(saved_ctx);
10914 return manage(res);
10915}
10916
10917isl::set pw_aff::ge_set(isl::pw_aff pwaff2) const
10918{
10919 if (!ptr || pwaff2.is_null())
10920 exception::throw_invalid("NULL input", __FILE__, __LINE__);
10921 auto saved_ctx = ctx();
10922 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10923 auto res = isl_pw_aff_ge_set(copy(), pwaff2.release());
10924 if (!res)
10925 exception::throw_last_error(saved_ctx);
10926 return manage(res);
10927}
10928
10929isl::pw_aff pw_aff::gist(isl::set context) const
10930{
10931 if (!ptr || context.is_null())
10932 exception::throw_invalid("NULL input", __FILE__, __LINE__);
10933 auto saved_ctx = ctx();
10934 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10935 auto res = isl_pw_aff_gist(copy(), context.release());
10936 if (!res)
10937 exception::throw_last_error(saved_ctx);
10938 return manage(res);
10939}
10940
10941isl::set pw_aff::gt_set(isl::pw_aff pwaff2) const
10942{
10943 if (!ptr || pwaff2.is_null())
10944 exception::throw_invalid("NULL input", __FILE__, __LINE__);
10945 auto saved_ctx = ctx();
10946 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10947 auto res = isl_pw_aff_gt_set(copy(), pwaff2.release());
10948 if (!res)
10949 exception::throw_last_error(saved_ctx);
10950 return manage(res);
10951}
10952
10953isl::pw_aff pw_aff::insert_domain(isl::space domain) const
10954{
10955 if (!ptr || domain.is_null())
10956 exception::throw_invalid("NULL input", __FILE__, __LINE__);
10957 auto saved_ctx = ctx();
10958 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10959 auto res = isl_pw_aff_insert_domain(copy(), domain.release());
10960 if (!res)
10961 exception::throw_last_error(saved_ctx);
10962 return manage(res);
10963}
10964
10965isl::pw_aff pw_aff::intersect_domain(isl::set set) const
10966{
10967 if (!ptr || set.is_null())
10968 exception::throw_invalid("NULL input", __FILE__, __LINE__);
10969 auto saved_ctx = ctx();
10970 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10971 auto res = isl_pw_aff_intersect_domain(copy(), set.release());
10972 if (!res)
10973 exception::throw_last_error(saved_ctx);
10974 return manage(res);
10975}
10976
10977isl::pw_aff pw_aff::intersect_params(isl::set set) const
10978{
10979 if (!ptr || set.is_null())
10980 exception::throw_invalid("NULL input", __FILE__, __LINE__);
10981 auto saved_ctx = ctx();
10982 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10983 auto res = isl_pw_aff_intersect_params(copy(), set.release());
10984 if (!res)
10985 exception::throw_last_error(saved_ctx);
10986 return manage(res);
10987}
10988
10989bool pw_aff::isa_aff() const
10990{
10991 if (!ptr)
10992 exception::throw_invalid("NULL input", __FILE__, __LINE__);
10993 auto saved_ctx = ctx();
10994 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10995 auto res = isl_pw_aff_isa_aff(get());
10996 if (res < 0)
10997 exception::throw_last_error(saved_ctx);
10998 return res;
10999}
11000
11001isl::set pw_aff::le_set(isl::pw_aff pwaff2) const
11002{
11003 if (!ptr || pwaff2.is_null())
11004 exception::throw_invalid("NULL input", __FILE__, __LINE__);
11005 auto saved_ctx = ctx();
11006 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11007 auto res = isl_pw_aff_le_set(copy(), pwaff2.release());
11008 if (!res)
11009 exception::throw_last_error(saved_ctx);
11010 return manage(res);
11011}
11012
11013isl::set pw_aff::lt_set(isl::pw_aff pwaff2) const
11014{
11015 if (!ptr || pwaff2.is_null())
11016 exception::throw_invalid("NULL input", __FILE__, __LINE__);
11017 auto saved_ctx = ctx();
11018 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11019 auto res = isl_pw_aff_lt_set(copy(), pwaff2.release());
11020 if (!res)
11021 exception::throw_last_error(saved_ctx);
11022 return manage(res);
11023}
11024
11025isl::pw_aff pw_aff::max(isl::pw_aff pwaff2) const
11026{
11027 if (!ptr || pwaff2.is_null())
11028 exception::throw_invalid("NULL input", __FILE__, __LINE__);
11029 auto saved_ctx = ctx();
11030 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11031 auto res = isl_pw_aff_max(copy(), pwaff2.release());
11032 if (!res)
11033 exception::throw_last_error(saved_ctx);
11034 return manage(res);
11035}
11036
11037isl::pw_aff pw_aff::min(isl::pw_aff pwaff2) const
11038{
11039 if (!ptr || pwaff2.is_null())
11040 exception::throw_invalid("NULL input", __FILE__, __LINE__);
11041 auto saved_ctx = ctx();
11042 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11043 auto res = isl_pw_aff_min(copy(), pwaff2.release());
11044 if (!res)
11045 exception::throw_last_error(saved_ctx);
11046 return manage(res);
11047}
11048
11049isl::pw_aff pw_aff::mod(isl::val mod) const
11050{
11051 if (!ptr || mod.is_null())
11052 exception::throw_invalid("NULL input", __FILE__, __LINE__);
11053 auto saved_ctx = ctx();
11054 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11055 auto res = isl_pw_aff_mod_val(copy(), mod.release());
11056 if (!res)
11057 exception::throw_last_error(saved_ctx);
11058 return manage(res);
11059}
11060
11061isl::pw_aff pw_aff::mod(long mod) const
11062{
11063 if (!ptr)
11064 exception::throw_invalid("NULL input", __FILE__, __LINE__);
11065 return this->mod(isl::val(ctx(), mod));
11066}
11067
11068isl::pw_aff pw_aff::mul(isl::pw_aff pwaff2) const
11069{
11070 if (!ptr || pwaff2.is_null())
11071 exception::throw_invalid("NULL input", __FILE__, __LINE__);
11072 auto saved_ctx = ctx();
11073 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11074 auto res = isl_pw_aff_mul(copy(), pwaff2.release());
11075 if (!res)
11076 exception::throw_last_error(saved_ctx);
11077 return manage(res);
11078}
11079
11080isl::set pw_aff::ne_set(isl::pw_aff pwaff2) const
11081{
11082 if (!ptr || pwaff2.is_null())
11083 exception::throw_invalid("NULL input", __FILE__, __LINE__);
11084 auto saved_ctx = ctx();
11085 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11086 auto res = isl_pw_aff_ne_set(copy(), pwaff2.release());
11087 if (!res)
11088 exception::throw_last_error(saved_ctx);
11089 return manage(res);
11090}
11091
11092isl::pw_aff pw_aff::neg() const
11093{
11094 if (!ptr)
11095 exception::throw_invalid("NULL input", __FILE__, __LINE__);
11096 auto saved_ctx = ctx();
11097 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11098 auto res = isl_pw_aff_neg(copy());
11099 if (!res)
11100 exception::throw_last_error(saved_ctx);
11101 return manage(res);
11102}
11103
11104isl::pw_aff pw_aff::param_on_domain(isl::set domain, isl::id id)
11105{
11106 if (domain.is_null() || id.is_null())
11107 exception::throw_invalid("NULL input", __FILE__, __LINE__);
11108 auto saved_ctx = domain.ctx();
11109 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11110 auto res = isl_pw_aff_param_on_domain_id(domain.release(), id.release());
11111 if (!res)
11112 exception::throw_last_error(saved_ctx);
11113 return manage(res);
11114}
11115
11116isl::pw_aff pw_aff::pullback(isl::multi_aff ma) const
11117{
11118 if (!ptr || ma.is_null())
11119 exception::throw_invalid("NULL input", __FILE__, __LINE__);
11120 auto saved_ctx = ctx();
11121 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11122 auto res = isl_pw_aff_pullback_multi_aff(copy(), ma.release());
11123 if (!res)
11124 exception::throw_last_error(saved_ctx);
11125 return manage(res);
11126}
11127
11128isl::pw_aff pw_aff::pullback(isl::multi_pw_aff mpa) const
11129{
11130 if (!ptr || mpa.is_null())
11131 exception::throw_invalid("NULL input", __FILE__, __LINE__);
11132 auto saved_ctx = ctx();
11133 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11134 auto res = isl_pw_aff_pullback_multi_pw_aff(copy(), mpa.release());
11135 if (!res)
11136 exception::throw_last_error(saved_ctx);
11137 return manage(res);
11138}
11139
11140isl::pw_aff pw_aff::pullback(isl::pw_multi_aff pma) const
11141{
11142 if (!ptr || pma.is_null())
11143 exception::throw_invalid("NULL input", __FILE__, __LINE__);
11144 auto saved_ctx = ctx();
11145 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11146 auto res = isl_pw_aff_pullback_pw_multi_aff(copy(), pma.release());
11147 if (!res)
11148 exception::throw_last_error(saved_ctx);
11149 return manage(res);
11150}
11151
11152isl::pw_aff pw_aff::scale(isl::val v) const
11153{
11154 if (!ptr || v.is_null())
11155 exception::throw_invalid("NULL input", __FILE__, __LINE__);
11156 auto saved_ctx = ctx();
11157 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11158 auto res = isl_pw_aff_scale_val(copy(), v.release());
11159 if (!res)
11160 exception::throw_last_error(saved_ctx);
11161 return manage(res);
11162}
11163
11164isl::pw_aff pw_aff::scale(long v) const
11165{
11166 if (!ptr)
11167 exception::throw_invalid("NULL input", __FILE__, __LINE__);
11168 return this->scale(isl::val(ctx(), v));
11169}
11170
11171isl::pw_aff pw_aff::scale_down(isl::val f) const
11172{
11173 if (!ptr || f.is_null())
11174 exception::throw_invalid("NULL input", __FILE__, __LINE__);
11175 auto saved_ctx = ctx();
11176 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11177 auto res = isl_pw_aff_scale_down_val(copy(), f.release());
11178 if (!res)
11179 exception::throw_last_error(saved_ctx);
11180 return manage(res);
11181}
11182
11183isl::pw_aff pw_aff::scale_down(long f) const
11184{
11185 if (!ptr)
11186 exception::throw_invalid("NULL input", __FILE__, __LINE__);
11187 return this->scale_down(isl::val(ctx(), f));
11188}
11189
11190isl::pw_aff pw_aff::sub(isl::pw_aff pwaff2) const
11191{
11192 if (!ptr || pwaff2.is_null())
11193 exception::throw_invalid("NULL input", __FILE__, __LINE__);
11194 auto saved_ctx = ctx();
11195 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11196 auto res = isl_pw_aff_sub(copy(), pwaff2.release());
11197 if (!res)
11198 exception::throw_last_error(saved_ctx);
11199 return manage(res);
11200}
11201
11202isl::pw_aff pw_aff::subtract_domain(isl::set set) const
11203{
11204 if (!ptr || set.is_null())
11205 exception::throw_invalid("NULL input", __FILE__, __LINE__);
11206 auto saved_ctx = ctx();
11207 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11208 auto res = isl_pw_aff_subtract_domain(copy(), set.release());
11209 if (!res)
11210 exception::throw_last_error(saved_ctx);
11211 return manage(res);
11212}
11213
11214isl::pw_aff pw_aff::tdiv_q(isl::pw_aff pa2) const
11215{
11216 if (!ptr || pa2.is_null())
11217 exception::throw_invalid("NULL input", __FILE__, __LINE__);
11218 auto saved_ctx = ctx();
11219 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11220 auto res = isl_pw_aff_tdiv_q(copy(), pa2.release());
11221 if (!res)
11222 exception::throw_last_error(saved_ctx);
11223 return manage(res);
11224}
11225
11226isl::pw_aff pw_aff::tdiv_r(isl::pw_aff pa2) const
11227{
11228 if (!ptr || pa2.is_null())
11229 exception::throw_invalid("NULL input", __FILE__, __LINE__);
11230 auto saved_ctx = ctx();
11231 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11232 auto res = isl_pw_aff_tdiv_r(copy(), pa2.release());
11233 if (!res)
11234 exception::throw_last_error(saved_ctx);
11235 return manage(res);
11236}
11237
11238isl::pw_aff pw_aff::union_add(isl::pw_aff pwaff2) const
11239{
11240 if (!ptr || pwaff2.is_null())
11241 exception::throw_invalid("NULL input", __FILE__, __LINE__);
11242 auto saved_ctx = ctx();
11243 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11244 auto res = isl_pw_aff_union_add(copy(), pwaff2.release());
11245 if (!res)
11246 exception::throw_last_error(saved_ctx);
11247 return manage(res);
11248}
11249
11250inline std::ostream &operator<<(std::ostream &os, const pw_aff &obj)
11251{
11252 if (!obj.get())
11253 exception::throw_invalid("NULL input", __FILE__, __LINE__);
11254 auto saved_ctx = isl_pw_aff_get_ctx(obj.get());
11255 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11256 char *str = isl_pw_aff_to_str(obj.get());
11257 if (!str)
11258 exception::throw_last_error(saved_ctx);
11259 os << str;
11260 free(str);
11261 return os;
11262}
11263
11264// implementations for isl::pw_aff_list
11265pw_aff_list manage(__isl_take isl_pw_aff_list *ptr) {
11266 if (!ptr)
11267 exception::throw_invalid("NULL input", __FILE__, __LINE__);
11268 return pw_aff_list(ptr);
11269}
11270pw_aff_list manage_copy(__isl_keep isl_pw_aff_list *ptr) {
11271 if (!ptr)
11272 exception::throw_invalid("NULL input", __FILE__, __LINE__);
11273 auto saved_ctx = isl_pw_aff_list_get_ctx(ptr);
11274 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11275 ptr = isl_pw_aff_list_copy(ptr);
11276 if (!ptr)
11277 exception::throw_last_error(saved_ctx);
11278 return pw_aff_list(ptr);
11279}
11280
11281pw_aff_list::pw_aff_list()
11282 : ptr(nullptr) {}
11283
11284pw_aff_list::pw_aff_list(const pw_aff_list &obj)
11285 : ptr(nullptr)
11286{
11287 if (!obj.ptr)
11288 exception::throw_invalid("NULL input", __FILE__, __LINE__);
11289 auto saved_ctx = isl_pw_aff_list_get_ctx(obj.ptr);
11290 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11291 ptr = obj.copy();
11292 if (!ptr)
11293 exception::throw_last_error(saved_ctx);
11294}
11295
11296pw_aff_list::pw_aff_list(__isl_take isl_pw_aff_list *ptr)
11297 : ptr(ptr) {}
11298
11299pw_aff_list::pw_aff_list(isl::ctx ctx, int n)
11300{
11301 auto saved_ctx = ctx;
11302 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11303 auto res = isl_pw_aff_list_alloc(ctx.release(), n);
11304 if (!res)
11305 exception::throw_last_error(saved_ctx);
11306 ptr = res;
11307}
11308
11309pw_aff_list::pw_aff_list(isl::pw_aff el)
11310{
11311 if (el.is_null())
11312 exception::throw_invalid("NULL input", __FILE__, __LINE__);
11313 auto saved_ctx = el.ctx();
11314 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11315 auto res = isl_pw_aff_list_from_pw_aff(el.release());
11316 if (!res)
11317 exception::throw_last_error(saved_ctx);
11318 ptr = res;
11319}
11320
11321pw_aff_list &pw_aff_list::operator=(pw_aff_list obj) {
11322 std::swap(this->ptr, obj.ptr);
11323 return *this;
11324}
11325
11326pw_aff_list::~pw_aff_list() {
11327 if (ptr)
11328 isl_pw_aff_list_free(ptr);
11329}
11330
11331__isl_give isl_pw_aff_list *pw_aff_list::copy() const & {
11332 return isl_pw_aff_list_copy(ptr);
11333}
11334
11335__isl_keep isl_pw_aff_list *pw_aff_list::get() const {
11336 return ptr;
11337}
11338
11339__isl_give isl_pw_aff_list *pw_aff_list::release() {
11340 isl_pw_aff_list *tmp = ptr;
11341 ptr = nullptr;
11342 return tmp;
11343}
11344
11345bool pw_aff_list::is_null() const {
11346 return ptr == nullptr;
11347}
11348
11349isl::ctx pw_aff_list::ctx() const {
11350 return isl::ctx(isl_pw_aff_list_get_ctx(ptr));
11351}
11352
11353isl::pw_aff_list pw_aff_list::add(isl::pw_aff el) const
11354{
11355 if (!ptr || el.is_null())
11356 exception::throw_invalid("NULL input", __FILE__, __LINE__);
11357 auto saved_ctx = ctx();
11358 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11359 auto res = isl_pw_aff_list_add(copy(), el.release());
11360 if (!res)
11361 exception::throw_last_error(saved_ctx);
11362 return manage(res);
11363}
11364
11365isl::pw_aff_list pw_aff_list::clear() const
11366{
11367 if (!ptr)
11368 exception::throw_invalid("NULL input", __FILE__, __LINE__);
11369 auto saved_ctx = ctx();
11370 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11371 auto res = isl_pw_aff_list_clear(copy());
11372 if (!res)
11373 exception::throw_last_error(saved_ctx);
11374 return manage(res);
11375}
11376
11377isl::pw_aff_list pw_aff_list::concat(isl::pw_aff_list list2) const
11378{
11379 if (!ptr || list2.is_null())
11380 exception::throw_invalid("NULL input", __FILE__, __LINE__);
11381 auto saved_ctx = ctx();
11382 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11383 auto res = isl_pw_aff_list_concat(copy(), list2.release());
11384 if (!res)
11385 exception::throw_last_error(saved_ctx);
11386 return manage(res);
11387}
11388
11389isl::pw_aff_list pw_aff_list::drop(unsigned int first, unsigned int n) const
11390{
11391 if (!ptr)
11392 exception::throw_invalid("NULL input", __FILE__, __LINE__);
11393 auto saved_ctx = ctx();
11394 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11395 auto res = isl_pw_aff_list_drop(copy(), first, n);
11396 if (!res)
11397 exception::throw_last_error(saved_ctx);
11398 return manage(res);
11399}
11400
11401void pw_aff_list::foreach(const std::function<void(isl::pw_aff)> &fn) const
11402{
11403 if (!ptr)
11404 exception::throw_invalid("NULL input", __FILE__, __LINE__);
11405 auto saved_ctx = ctx();
11406 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11407 struct fn_data {
11408 std::function<void(isl::pw_aff)> func;
11409 std::exception_ptr eptr;
11410 } fn_data = { fn };
11411 auto fn_lambda = [](isl_pw_aff *arg_0, void *arg_1) -> isl_stat {
11412 auto *data = static_cast<struct fn_data *>(arg_1);
11413 ISL_CPP_TRY {
11414 (data->func)(manage(arg_0));
11415 return isl_stat_ok;
11416 } ISL_CPP_CATCH_ALL {
11417 data->eptr = std::current_exception();
11418 return isl_stat_error;
11419 }
11420 };
11421 auto res = isl_pw_aff_list_foreach(get(), fn_lambda, &fn_data);
11422 if (fn_data.eptr)
11423 std::rethrow_exception(fn_data.eptr);
11424 if (res < 0)
11425 exception::throw_last_error(saved_ctx);
11426 return;
11427}
11428
11429isl::pw_aff pw_aff_list::at(int index) const
11430{
11431 if (!ptr)
11432 exception::throw_invalid("NULL input", __FILE__, __LINE__);
11433 auto saved_ctx = ctx();
11434 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11435 auto res = isl_pw_aff_list_get_at(get(), index);
11436 if (!res)
11437 exception::throw_last_error(saved_ctx);
11438 return manage(res);
11439}
11440
11441isl::pw_aff pw_aff_list::get_at(int index) const
11442{
11443 return at(index);
11444}
11445
11446isl::pw_aff_list pw_aff_list::insert(unsigned int pos, isl::pw_aff el) const
11447{
11448 if (!ptr || el.is_null())
11449 exception::throw_invalid("NULL input", __FILE__, __LINE__);
11450 auto saved_ctx = ctx();
11451 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11452 auto res = isl_pw_aff_list_insert(copy(), pos, el.release());
11453 if (!res)
11454 exception::throw_last_error(saved_ctx);
11455 return manage(res);
11456}
11457
11458unsigned pw_aff_list::size() const
11459{
11460 if (!ptr)
11461 exception::throw_invalid("NULL input", __FILE__, __LINE__);
11462 auto saved_ctx = ctx();
11463 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11464 auto res = isl_pw_aff_list_size(get());
11465 if (res < 0)
11466 exception::throw_last_error(saved_ctx);
11467 return res;
11468}
11469
11470inline std::ostream &operator<<(std::ostream &os, const pw_aff_list &obj)
11471{
11472 if (!obj.get())
11473 exception::throw_invalid("NULL input", __FILE__, __LINE__);
11474 auto saved_ctx = isl_pw_aff_list_get_ctx(obj.get());
11475 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11476 char *str = isl_pw_aff_list_to_str(obj.get());
11477 if (!str)
11478 exception::throw_last_error(saved_ctx);
11479 os << str;
11480 free(str);
11481 return os;
11482}
11483
11484// implementations for isl::pw_multi_aff
11485pw_multi_aff manage(__isl_take isl_pw_multi_aff *ptr) {
11486 if (!ptr)
11487 exception::throw_invalid("NULL input", __FILE__, __LINE__);
11488 return pw_multi_aff(ptr);
11489}
11490pw_multi_aff manage_copy(__isl_keep isl_pw_multi_aff *ptr) {
11491 if (!ptr)
11492 exception::throw_invalid("NULL input", __FILE__, __LINE__);
11493 auto saved_ctx = isl_pw_multi_aff_get_ctx(ptr);
11494 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11495 ptr = isl_pw_multi_aff_copy(ptr);
11496 if (!ptr)
11497 exception::throw_last_error(saved_ctx);
11498 return pw_multi_aff(ptr);
11499}
11500
11501pw_multi_aff::pw_multi_aff()
11502 : ptr(nullptr) {}
11503
11504pw_multi_aff::pw_multi_aff(const pw_multi_aff &obj)
11505 : ptr(nullptr)
11506{
11507 if (!obj.ptr)
11508 exception::throw_invalid("NULL input", __FILE__, __LINE__);
11509 auto saved_ctx = isl_pw_multi_aff_get_ctx(obj.ptr);
11510 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11511 ptr = obj.copy();
11512 if (!ptr)
11513 exception::throw_last_error(saved_ctx);
11514}
11515
11516pw_multi_aff::pw_multi_aff(__isl_take isl_pw_multi_aff *ptr)
11517 : ptr(ptr) {}
11518
11519pw_multi_aff::pw_multi_aff(isl::multi_aff ma)
11520{
11521 if (ma.is_null())
11522 exception::throw_invalid("NULL input", __FILE__, __LINE__);
11523 auto saved_ctx = ma.ctx();
11524 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11525 auto res = isl_pw_multi_aff_from_multi_aff(ma.release());
11526 if (!res)
11527 exception::throw_last_error(saved_ctx);
11528 ptr = res;
11529}
11530
11531pw_multi_aff::pw_multi_aff(isl::pw_aff pa)
11532{
11533 if (pa.is_null())
11534 exception::throw_invalid("NULL input", __FILE__, __LINE__);
11535 auto saved_ctx = pa.ctx();
11536 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11537 auto res = isl_pw_multi_aff_from_pw_aff(pa.release());
11538 if (!res)
11539 exception::throw_last_error(saved_ctx);
11540 ptr = res;
11541}
11542
11543pw_multi_aff::pw_multi_aff(isl::ctx ctx, const std::string &str)
11544{
11545 auto saved_ctx = ctx;
11546 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11547 auto res = isl_pw_multi_aff_read_from_str(ctx.release(), str.c_str());
11548 if (!res)
11549 exception::throw_last_error(saved_ctx);
11550 ptr = res;
11551}
11552
11553pw_multi_aff &pw_multi_aff::operator=(pw_multi_aff obj) {
11554 std::swap(this->ptr, obj.ptr);
11555 return *this;
11556}
11557
11558pw_multi_aff::~pw_multi_aff() {
11559 if (ptr)
11560 isl_pw_multi_aff_free(ptr);
11561}
11562
11563__isl_give isl_pw_multi_aff *pw_multi_aff::copy() const & {
11564 return isl_pw_multi_aff_copy(ptr);
11565}
11566
11567__isl_keep isl_pw_multi_aff *pw_multi_aff::get() const {
11568 return ptr;
11569}
11570
11571__isl_give isl_pw_multi_aff *pw_multi_aff::release() {
11572 isl_pw_multi_aff *tmp = ptr;
11573 ptr = nullptr;
11574 return tmp;
11575}
11576
11577bool pw_multi_aff::is_null() const {
11578 return ptr == nullptr;
11579}
11580
11581isl::ctx pw_multi_aff::ctx() const {
11582 return isl::ctx(isl_pw_multi_aff_get_ctx(ptr));
11583}
11584
11585isl::pw_multi_aff pw_multi_aff::add(isl::pw_multi_aff pma2) const
11586{
11587 if (!ptr || pma2.is_null())
11588 exception::throw_invalid("NULL input", __FILE__, __LINE__);
11589 auto saved_ctx = ctx();
11590 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11591 auto res = isl_pw_multi_aff_add(copy(), pma2.release());
11592 if (!res)
11593 exception::throw_last_error(saved_ctx);
11594 return manage(res);
11595}
11596
11597isl::pw_multi_aff pw_multi_aff::add_constant(isl::multi_val mv) const
11598{
11599 if (!ptr || mv.is_null())
11600 exception::throw_invalid("NULL input", __FILE__, __LINE__);
11601 auto saved_ctx = ctx();
11602 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11603 auto res = isl_pw_multi_aff_add_constant_multi_val(copy(), mv.release());
11604 if (!res)
11605 exception::throw_last_error(saved_ctx);
11606 return manage(res);
11607}
11608
11609isl::pw_multi_aff pw_multi_aff::add_constant(isl::val v) const
11610{
11611 if (!ptr || v.is_null())
11612 exception::throw_invalid("NULL input", __FILE__, __LINE__);
11613 auto saved_ctx = ctx();
11614 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11615 auto res = isl_pw_multi_aff_add_constant_val(copy(), v.release());
11616 if (!res)
11617 exception::throw_last_error(saved_ctx);
11618 return manage(res);
11619}
11620
11621isl::pw_multi_aff pw_multi_aff::add_constant(long v) const
11622{
11623 if (!ptr)
11624 exception::throw_invalid("NULL input", __FILE__, __LINE__);
11625 return this->add_constant(isl::val(ctx(), v));
11626}
11627
11628isl::multi_aff pw_multi_aff::as_multi_aff() const
11629{
11630 if (!ptr)
11631 exception::throw_invalid("NULL input", __FILE__, __LINE__);
11632 auto saved_ctx = ctx();
11633 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11634 auto res = isl_pw_multi_aff_as_multi_aff(copy());
11635 if (!res)
11636 exception::throw_last_error(saved_ctx);
11637 return manage(res);
11638}
11639
11640isl::pw_multi_aff pw_multi_aff::bind_domain(isl::multi_id tuple) const
11641{
11642 if (!ptr || tuple.is_null())
11643 exception::throw_invalid("NULL input", __FILE__, __LINE__);
11644 auto saved_ctx = ctx();
11645 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11646 auto res = isl_pw_multi_aff_bind_domain(copy(), tuple.release());
11647 if (!res)
11648 exception::throw_last_error(saved_ctx);
11649 return manage(res);
11650}
11651
11652isl::pw_multi_aff pw_multi_aff::bind_domain_wrapped_domain(isl::multi_id tuple) const
11653{
11654 if (!ptr || tuple.is_null())
11655 exception::throw_invalid("NULL input", __FILE__, __LINE__);
11656 auto saved_ctx = ctx();
11657 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11658 auto res = isl_pw_multi_aff_bind_domain_wrapped_domain(copy(), tuple.release());
11659 if (!res)
11660 exception::throw_last_error(saved_ctx);
11661 return manage(res);
11662}
11663
11664isl::pw_multi_aff pw_multi_aff::coalesce() const
11665{
11666 if (!ptr)
11667 exception::throw_invalid("NULL input", __FILE__, __LINE__);
11668 auto saved_ctx = ctx();
11669 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11670 auto res = isl_pw_multi_aff_coalesce(copy());
11671 if (!res)
11672 exception::throw_last_error(saved_ctx);
11673 return manage(res);
11674}
11675
11676isl::set pw_multi_aff::domain() const
11677{
11678 if (!ptr)
11679 exception::throw_invalid("NULL input", __FILE__, __LINE__);
11680 auto saved_ctx = ctx();
11681 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11682 auto res = isl_pw_multi_aff_domain(copy());
11683 if (!res)
11684 exception::throw_last_error(saved_ctx);
11685 return manage(res);
11686}
11687
11688isl::pw_multi_aff pw_multi_aff::domain_map(isl::space space)
11689{
11690 if (space.is_null())
11691 exception::throw_invalid("NULL input", __FILE__, __LINE__);
11692 auto saved_ctx = space.ctx();
11693 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11694 auto res = isl_pw_multi_aff_domain_map(space.release());
11695 if (!res)
11696 exception::throw_last_error(saved_ctx);
11697 return manage(res);
11698}
11699
11700isl::pw_multi_aff pw_multi_aff::flat_range_product(isl::pw_multi_aff pma2) const
11701{
11702 if (!ptr || pma2.is_null())
11703 exception::throw_invalid("NULL input", __FILE__, __LINE__);
11704 auto saved_ctx = ctx();
11705 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11706 auto res = isl_pw_multi_aff_flat_range_product(copy(), pma2.release());
11707 if (!res)
11708 exception::throw_last_error(saved_ctx);
11709 return manage(res);
11710}
11711
11712void pw_multi_aff::foreach_piece(const std::function<void(isl::set, isl::multi_aff)> &fn) const
11713{
11714 if (!ptr)
11715 exception::throw_invalid("NULL input", __FILE__, __LINE__);
11716 auto saved_ctx = ctx();
11717 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11718 struct fn_data {
11719 std::function<void(isl::set, isl::multi_aff)> func;
11720 std::exception_ptr eptr;
11721 } fn_data = { fn };
11722 auto fn_lambda = [](isl_set *arg_0, isl_multi_aff *arg_1, void *arg_2) -> isl_stat {
11723 auto *data = static_cast<struct fn_data *>(arg_2);
11724 ISL_CPP_TRY {
11725 (data->func)(manage(arg_0), manage(arg_1));
11726 return isl_stat_ok;
11727 } ISL_CPP_CATCH_ALL {
11728 data->eptr = std::current_exception();
11729 return isl_stat_error;
11730 }
11731 };
11732 auto res = isl_pw_multi_aff_foreach_piece(get(), fn_lambda, &fn_data);
11733 if (fn_data.eptr)
11734 std::rethrow_exception(fn_data.eptr);
11735 if (res < 0)
11736 exception::throw_last_error(saved_ctx);
11737 return;
11738}
11739
11740isl::space pw_multi_aff::space() const
11741{
11742 if (!ptr)
11743 exception::throw_invalid("NULL input", __FILE__, __LINE__);
11744 auto saved_ctx = ctx();
11745 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11746 auto res = isl_pw_multi_aff_get_space(get());
11747 if (!res)
11748 exception::throw_last_error(saved_ctx);
11749 return manage(res);
11750}
11751
11752isl::space pw_multi_aff::get_space() const
11753{
11754 return space();
11755}
11756
11757isl::pw_multi_aff pw_multi_aff::gist(isl::set set) const
11758{
11759 if (!ptr || set.is_null())
11760 exception::throw_invalid("NULL input", __FILE__, __LINE__);
11761 auto saved_ctx = ctx();
11762 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11763 auto res = isl_pw_multi_aff_gist(copy(), set.release());
11764 if (!res)
11765 exception::throw_last_error(saved_ctx);
11766 return manage(res);
11767}
11768
11769isl::pw_multi_aff pw_multi_aff::insert_domain(isl::space domain) const
11770{
11771 if (!ptr || domain.is_null())
11772 exception::throw_invalid("NULL input", __FILE__, __LINE__);
11773 auto saved_ctx = ctx();
11774 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11775 auto res = isl_pw_multi_aff_insert_domain(copy(), domain.release());
11776 if (!res)
11777 exception::throw_last_error(saved_ctx);
11778 return manage(res);
11779}
11780
11781isl::pw_multi_aff pw_multi_aff::intersect_domain(isl::set set) const
11782{
11783 if (!ptr || set.is_null())
11784 exception::throw_invalid("NULL input", __FILE__, __LINE__);
11785 auto saved_ctx = ctx();
11786 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11787 auto res = isl_pw_multi_aff_intersect_domain(copy(), set.release());
11788 if (!res)
11789 exception::throw_last_error(saved_ctx);
11790 return manage(res);
11791}
11792
11793isl::pw_multi_aff pw_multi_aff::intersect_params(isl::set set) const
11794{
11795 if (!ptr || set.is_null())
11796 exception::throw_invalid("NULL input", __FILE__, __LINE__);
11797 auto saved_ctx = ctx();
11798 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11799 auto res = isl_pw_multi_aff_intersect_params(copy(), set.release());
11800 if (!res)
11801 exception::throw_last_error(saved_ctx);
11802 return manage(res);
11803}
11804
11805bool pw_multi_aff::involves_locals() const
11806{
11807 if (!ptr)
11808 exception::throw_invalid("NULL input", __FILE__, __LINE__);
11809 auto saved_ctx = ctx();
11810 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11811 auto res = isl_pw_multi_aff_involves_locals(get());
11812 if (res < 0)
11813 exception::throw_last_error(saved_ctx);
11814 return res;
11815}
11816
11817bool pw_multi_aff::isa_multi_aff() const
11818{
11819 if (!ptr)
11820 exception::throw_invalid("NULL input", __FILE__, __LINE__);
11821 auto saved_ctx = ctx();
11822 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11823 auto res = isl_pw_multi_aff_isa_multi_aff(get());
11824 if (res < 0)
11825 exception::throw_last_error(saved_ctx);
11826 return res;
11827}
11828
11829isl::multi_val pw_multi_aff::max_multi_val() const
11830{
11831 if (!ptr)
11832 exception::throw_invalid("NULL input", __FILE__, __LINE__);
11833 auto saved_ctx = ctx();
11834 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11835 auto res = isl_pw_multi_aff_max_multi_val(copy());
11836 if (!res)
11837 exception::throw_last_error(saved_ctx);
11838 return manage(res);
11839}
11840
11841isl::multi_val pw_multi_aff::min_multi_val() const
11842{
11843 if (!ptr)
11844 exception::throw_invalid("NULL input", __FILE__, __LINE__);
11845 auto saved_ctx = ctx();
11846 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11847 auto res = isl_pw_multi_aff_min_multi_val(copy());
11848 if (!res)
11849 exception::throw_last_error(saved_ctx);
11850 return manage(res);
11851}
11852
11853unsigned pw_multi_aff::n_piece() const
11854{
11855 if (!ptr)
11856 exception::throw_invalid("NULL input", __FILE__, __LINE__);
11857 auto saved_ctx = ctx();
11858 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11859 auto res = isl_pw_multi_aff_n_piece(get());
11860 if (res < 0)
11861 exception::throw_last_error(saved_ctx);
11862 return res;
11863}
11864
11865isl::pw_multi_aff pw_multi_aff::product(isl::pw_multi_aff pma2) const
11866{
11867 if (!ptr || pma2.is_null())
11868 exception::throw_invalid("NULL input", __FILE__, __LINE__);
11869 auto saved_ctx = ctx();
11870 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11871 auto res = isl_pw_multi_aff_product(copy(), pma2.release());
11872 if (!res)
11873 exception::throw_last_error(saved_ctx);
11874 return manage(res);
11875}
11876
11877isl::pw_multi_aff pw_multi_aff::pullback(isl::multi_aff ma) const
11878{
11879 if (!ptr || ma.is_null())
11880 exception::throw_invalid("NULL input", __FILE__, __LINE__);
11881 auto saved_ctx = ctx();
11882 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11883 auto res = isl_pw_multi_aff_pullback_multi_aff(copy(), ma.release());
11884 if (!res)
11885 exception::throw_last_error(saved_ctx);
11886 return manage(res);
11887}
11888
11889isl::pw_multi_aff pw_multi_aff::pullback(isl::pw_multi_aff pma2) const
11890{
11891 if (!ptr || pma2.is_null())
11892 exception::throw_invalid("NULL input", __FILE__, __LINE__);
11893 auto saved_ctx = ctx();
11894 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11895 auto res = isl_pw_multi_aff_pullback_pw_multi_aff(copy(), pma2.release());
11896 if (!res)
11897 exception::throw_last_error(saved_ctx);
11898 return manage(res);
11899}
11900
11901isl::pw_multi_aff pw_multi_aff::range_factor_domain() const
11902{
11903 if (!ptr)
11904 exception::throw_invalid("NULL input", __FILE__, __LINE__);
11905 auto saved_ctx = ctx();
11906 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11907 auto res = isl_pw_multi_aff_range_factor_domain(copy());
11908 if (!res)
11909 exception::throw_last_error(saved_ctx);
11910 return manage(res);
11911}
11912
11913isl::pw_multi_aff pw_multi_aff::range_factor_range() const
11914{
11915 if (!ptr)
11916 exception::throw_invalid("NULL input", __FILE__, __LINE__);
11917 auto saved_ctx = ctx();
11918 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11919 auto res = isl_pw_multi_aff_range_factor_range(copy());
11920 if (!res)
11921 exception::throw_last_error(saved_ctx);
11922 return manage(res);
11923}
11924
11925isl::pw_multi_aff pw_multi_aff::range_map(isl::space space)
11926{
11927 if (space.is_null())
11928 exception::throw_invalid("NULL input", __FILE__, __LINE__);
11929 auto saved_ctx = space.ctx();
11930 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11931 auto res = isl_pw_multi_aff_range_map(space.release());
11932 if (!res)
11933 exception::throw_last_error(saved_ctx);
11934 return manage(res);
11935}
11936
11937isl::pw_multi_aff pw_multi_aff::range_product(isl::pw_multi_aff pma2) const
11938{
11939 if (!ptr || pma2.is_null())
11940 exception::throw_invalid("NULL input", __FILE__, __LINE__);
11941 auto saved_ctx = ctx();
11942 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11943 auto res = isl_pw_multi_aff_range_product(copy(), pma2.release());
11944 if (!res)
11945 exception::throw_last_error(saved_ctx);
11946 return manage(res);
11947}
11948
11949isl::pw_multi_aff pw_multi_aff::scale(isl::val v) const
11950{
11951 if (!ptr || v.is_null())
11952 exception::throw_invalid("NULL input", __FILE__, __LINE__);
11953 auto saved_ctx = ctx();
11954 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11955 auto res = isl_pw_multi_aff_scale_val(copy(), v.release());
11956 if (!res)
11957 exception::throw_last_error(saved_ctx);
11958 return manage(res);
11959}
11960
11961isl::pw_multi_aff pw_multi_aff::scale(long v) const
11962{
11963 if (!ptr)
11964 exception::throw_invalid("NULL input", __FILE__, __LINE__);
11965 return this->scale(isl::val(ctx(), v));
11966}
11967
11968isl::pw_multi_aff pw_multi_aff::scale_down(isl::val v) const
11969{
11970 if (!ptr || v.is_null())
11971 exception::throw_invalid("NULL input", __FILE__, __LINE__);
11972 auto saved_ctx = ctx();
11973 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11974 auto res = isl_pw_multi_aff_scale_down_val(copy(), v.release());
11975 if (!res)
11976 exception::throw_last_error(saved_ctx);
11977 return manage(res);
11978}
11979
11980isl::pw_multi_aff pw_multi_aff::scale_down(long v) const
11981{
11982 if (!ptr)
11983 exception::throw_invalid("NULL input", __FILE__, __LINE__);
11984 return this->scale_down(isl::val(ctx(), v));
11985}
11986
11987isl::pw_multi_aff pw_multi_aff::sub(isl::pw_multi_aff pma2) const
11988{
11989 if (!ptr || pma2.is_null())
11990 exception::throw_invalid("NULL input", __FILE__, __LINE__);
11991 auto saved_ctx = ctx();
11992 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11993 auto res = isl_pw_multi_aff_sub(copy(), pma2.release());
11994 if (!res)
11995 exception::throw_last_error(saved_ctx);
11996 return manage(res);
11997}
11998
11999isl::pw_multi_aff pw_multi_aff::subtract_domain(isl::set set) const
12000{
12001 if (!ptr || set.is_null())
12002 exception::throw_invalid("NULL input", __FILE__, __LINE__);
12003 auto saved_ctx = ctx();
12004 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12005 auto res = isl_pw_multi_aff_subtract_domain(copy(), set.release());
12006 if (!res)
12007 exception::throw_last_error(saved_ctx);
12008 return manage(res);
12009}
12010
12011isl::pw_multi_aff pw_multi_aff::union_add(isl::pw_multi_aff pma2) const
12012{
12013 if (!ptr || pma2.is_null())
12014 exception::throw_invalid("NULL input", __FILE__, __LINE__);
12015 auto saved_ctx = ctx();
12016 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12017 auto res = isl_pw_multi_aff_union_add(copy(), pma2.release());
12018 if (!res)
12019 exception::throw_last_error(saved_ctx);
12020 return manage(res);
12021}
12022
12023isl::pw_multi_aff pw_multi_aff::zero(isl::space space)
12024{
12025 if (space.is_null())
12026 exception::throw_invalid("NULL input", __FILE__, __LINE__);
12027 auto saved_ctx = space.ctx();
12028 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12029 auto res = isl_pw_multi_aff_zero(space.release());
12030 if (!res)
12031 exception::throw_last_error(saved_ctx);
12032 return manage(res);
12033}
12034
12035inline std::ostream &operator<<(std::ostream &os, const pw_multi_aff &obj)
12036{
12037 if (!obj.get())
12038 exception::throw_invalid("NULL input", __FILE__, __LINE__);
12039 auto saved_ctx = isl_pw_multi_aff_get_ctx(obj.get());
12040 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12041 char *str = isl_pw_multi_aff_to_str(obj.get());
12042 if (!str)
12043 exception::throw_last_error(saved_ctx);
12044 os << str;
12045 free(str);
12046 return os;
12047}
12048
12049// implementations for isl::pw_multi_aff_list
12050pw_multi_aff_list manage(__isl_take isl_pw_multi_aff_list *ptr) {
12051 if (!ptr)
12052 exception::throw_invalid("NULL input", __FILE__, __LINE__);
12053 return pw_multi_aff_list(ptr);
12054}
12055pw_multi_aff_list manage_copy(__isl_keep isl_pw_multi_aff_list *ptr) {
12056 if (!ptr)
12057 exception::throw_invalid("NULL input", __FILE__, __LINE__);
12058 auto saved_ctx = isl_pw_multi_aff_list_get_ctx(ptr);
12059 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12060 ptr = isl_pw_multi_aff_list_copy(ptr);
12061 if (!ptr)
12062 exception::throw_last_error(saved_ctx);
12063 return pw_multi_aff_list(ptr);
12064}
12065
12066pw_multi_aff_list::pw_multi_aff_list()
12067 : ptr(nullptr) {}
12068
12069pw_multi_aff_list::pw_multi_aff_list(const pw_multi_aff_list &obj)
12070 : ptr(nullptr)
12071{
12072 if (!obj.ptr)
12073 exception::throw_invalid("NULL input", __FILE__, __LINE__);
12074 auto saved_ctx = isl_pw_multi_aff_list_get_ctx(obj.ptr);
12075 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12076 ptr = obj.copy();
12077 if (!ptr)
12078 exception::throw_last_error(saved_ctx);
12079}
12080
12081pw_multi_aff_list::pw_multi_aff_list(__isl_take isl_pw_multi_aff_list *ptr)
12082 : ptr(ptr) {}
12083
12084pw_multi_aff_list::pw_multi_aff_list(isl::ctx ctx, int n)
12085{
12086 auto saved_ctx = ctx;
12087 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12088 auto res = isl_pw_multi_aff_list_alloc(ctx.release(), n);
12089 if (!res)
12090 exception::throw_last_error(saved_ctx);
12091 ptr = res;
12092}
12093
12094pw_multi_aff_list::pw_multi_aff_list(isl::pw_multi_aff el)
12095{
12096 if (el.is_null())
12097 exception::throw_invalid("NULL input", __FILE__, __LINE__);
12098 auto saved_ctx = el.ctx();
12099 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12100 auto res = isl_pw_multi_aff_list_from_pw_multi_aff(el.release());
12101 if (!res)
12102 exception::throw_last_error(saved_ctx);
12103 ptr = res;
12104}
12105
12106pw_multi_aff_list &pw_multi_aff_list::operator=(pw_multi_aff_list obj) {
12107 std::swap(this->ptr, obj.ptr);
12108 return *this;
12109}
12110
12111pw_multi_aff_list::~pw_multi_aff_list() {
12112 if (ptr)
12113 isl_pw_multi_aff_list_free(ptr);
12114}
12115
12116__isl_give isl_pw_multi_aff_list *pw_multi_aff_list::copy() const & {
12117 return isl_pw_multi_aff_list_copy(ptr);
12118}
12119
12120__isl_keep isl_pw_multi_aff_list *pw_multi_aff_list::get() const {
12121 return ptr;
12122}
12123
12124__isl_give isl_pw_multi_aff_list *pw_multi_aff_list::release() {
12125 isl_pw_multi_aff_list *tmp = ptr;
12126 ptr = nullptr;
12127 return tmp;
12128}
12129
12130bool pw_multi_aff_list::is_null() const {
12131 return ptr == nullptr;
12132}
12133
12134isl::ctx pw_multi_aff_list::ctx() const {
12135 return isl::ctx(isl_pw_multi_aff_list_get_ctx(ptr));
12136}
12137
12138isl::pw_multi_aff_list pw_multi_aff_list::add(isl::pw_multi_aff el) const
12139{
12140 if (!ptr || el.is_null())
12141 exception::throw_invalid("NULL input", __FILE__, __LINE__);
12142 auto saved_ctx = ctx();
12143 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12144 auto res = isl_pw_multi_aff_list_add(copy(), el.release());
12145 if (!res)
12146 exception::throw_last_error(saved_ctx);
12147 return manage(res);
12148}
12149
12150isl::pw_multi_aff_list pw_multi_aff_list::clear() const
12151{
12152 if (!ptr)
12153 exception::throw_invalid("NULL input", __FILE__, __LINE__);
12154 auto saved_ctx = ctx();
12155 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12156 auto res = isl_pw_multi_aff_list_clear(copy());
12157 if (!res)
12158 exception::throw_last_error(saved_ctx);
12159 return manage(res);
12160}
12161
12162isl::pw_multi_aff_list pw_multi_aff_list::concat(isl::pw_multi_aff_list list2) const
12163{
12164 if (!ptr || list2.is_null())
12165 exception::throw_invalid("NULL input", __FILE__, __LINE__);
12166 auto saved_ctx = ctx();
12167 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12168 auto res = isl_pw_multi_aff_list_concat(copy(), list2.release());
12169 if (!res)
12170 exception::throw_last_error(saved_ctx);
12171 return manage(res);
12172}
12173
12174isl::pw_multi_aff_list pw_multi_aff_list::drop(unsigned int first, unsigned int n) const
12175{
12176 if (!ptr)
12177 exception::throw_invalid("NULL input", __FILE__, __LINE__);
12178 auto saved_ctx = ctx();
12179 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12180 auto res = isl_pw_multi_aff_list_drop(copy(), first, n);
12181 if (!res)
12182 exception::throw_last_error(saved_ctx);
12183 return manage(res);
12184}
12185
12186void pw_multi_aff_list::foreach(const std::function<void(isl::pw_multi_aff)> &fn) const
12187{
12188 if (!ptr)
12189 exception::throw_invalid("NULL input", __FILE__, __LINE__);
12190 auto saved_ctx = ctx();
12191 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12192 struct fn_data {
12193 std::function<void(isl::pw_multi_aff)> func;
12194 std::exception_ptr eptr;
12195 } fn_data = { fn };
12196 auto fn_lambda = [](isl_pw_multi_aff *arg_0, void *arg_1) -> isl_stat {
12197 auto *data = static_cast<struct fn_data *>(arg_1);
12198 ISL_CPP_TRY {
12199 (data->func)(manage(arg_0));
12200 return isl_stat_ok;
12201 } ISL_CPP_CATCH_ALL {
12202 data->eptr = std::current_exception();
12203 return isl_stat_error;
12204 }
12205 };
12206 auto res = isl_pw_multi_aff_list_foreach(get(), fn_lambda, &fn_data);
12207 if (fn_data.eptr)
12208 std::rethrow_exception(fn_data.eptr);
12209 if (res < 0)
12210 exception::throw_last_error(saved_ctx);
12211 return;
12212}
12213
12214isl::pw_multi_aff pw_multi_aff_list::at(int index) const
12215{
12216 if (!ptr)
12217 exception::throw_invalid("NULL input", __FILE__, __LINE__);
12218 auto saved_ctx = ctx();
12219 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12220 auto res = isl_pw_multi_aff_list_get_at(get(), index);
12221 if (!res)
12222 exception::throw_last_error(saved_ctx);
12223 return manage(res);
12224}
12225
12226isl::pw_multi_aff pw_multi_aff_list::get_at(int index) const
12227{
12228 return at(index);
12229}
12230
12231isl::pw_multi_aff_list pw_multi_aff_list::insert(unsigned int pos, isl::pw_multi_aff el) const
12232{
12233 if (!ptr || el.is_null())
12234 exception::throw_invalid("NULL input", __FILE__, __LINE__);
12235 auto saved_ctx = ctx();
12236 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12237 auto res = isl_pw_multi_aff_list_insert(copy(), pos, el.release());
12238 if (!res)
12239 exception::throw_last_error(saved_ctx);
12240 return manage(res);
12241}
12242
12243unsigned pw_multi_aff_list::size() const
12244{
12245 if (!ptr)
12246 exception::throw_invalid("NULL input", __FILE__, __LINE__);
12247 auto saved_ctx = ctx();
12248 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12249 auto res = isl_pw_multi_aff_list_size(get());
12250 if (res < 0)
12251 exception::throw_last_error(saved_ctx);
12252 return res;
12253}
12254
12255inline std::ostream &operator<<(std::ostream &os, const pw_multi_aff_list &obj)
12256{
12257 if (!obj.get())
12258 exception::throw_invalid("NULL input", __FILE__, __LINE__);
12259 auto saved_ctx = isl_pw_multi_aff_list_get_ctx(obj.get());
12260 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12261 char *str = isl_pw_multi_aff_list_to_str(obj.get());
12262 if (!str)
12263 exception::throw_last_error(saved_ctx);
12264 os << str;
12265 free(str);
12266 return os;
12267}
12268
12269// implementations for isl::schedule
12270schedule manage(__isl_take isl_schedule *ptr) {
12271 if (!ptr)
12272 exception::throw_invalid("NULL input", __FILE__, __LINE__);
12273 return schedule(ptr);
12274}
12275schedule manage_copy(__isl_keep isl_schedule *ptr) {
12276 if (!ptr)
12277 exception::throw_invalid("NULL input", __FILE__, __LINE__);
12278 auto saved_ctx = isl_schedule_get_ctx(ptr);
12279 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12280 ptr = isl_schedule_copy(ptr);
12281 if (!ptr)
12282 exception::throw_last_error(saved_ctx);
12283 return schedule(ptr);
12284}
12285
12286schedule::schedule()
12287 : ptr(nullptr) {}
12288
12289schedule::schedule(const schedule &obj)
12290 : ptr(nullptr)
12291{
12292 if (!obj.ptr)
12293 exception::throw_invalid("NULL input", __FILE__, __LINE__);
12294 auto saved_ctx = isl_schedule_get_ctx(obj.ptr);
12295 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12296 ptr = obj.copy();
12297 if (!ptr)
12298 exception::throw_last_error(saved_ctx);
12299}
12300
12301schedule::schedule(__isl_take isl_schedule *ptr)
12302 : ptr(ptr) {}
12303
12304schedule::schedule(isl::ctx ctx, const std::string &str)
12305{
12306 auto saved_ctx = ctx;
12307 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12308 auto res = isl_schedule_read_from_str(ctx.release(), str.c_str());
12309 if (!res)
12310 exception::throw_last_error(saved_ctx);
12311 ptr = res;
12312}
12313
12314schedule &schedule::operator=(schedule obj) {
12315 std::swap(this->ptr, obj.ptr);
12316 return *this;
12317}
12318
12319schedule::~schedule() {
12320 if (ptr)
12321 isl_schedule_free(ptr);
12322}
12323
12324__isl_give isl_schedule *schedule::copy() const & {
12325 return isl_schedule_copy(ptr);
12326}
12327
12328__isl_keep isl_schedule *schedule::get() const {
12329 return ptr;
12330}
12331
12332__isl_give isl_schedule *schedule::release() {
12333 isl_schedule *tmp = ptr;
12334 ptr = nullptr;
12335 return tmp;
12336}
12337
12338bool schedule::is_null() const {
12339 return ptr == nullptr;
12340}
12341
12342isl::ctx schedule::ctx() const {
12343 return isl::ctx(isl_schedule_get_ctx(ptr));
12344}
12345
12346isl::schedule schedule::from_domain(isl::union_set domain)
12347{
12348 if (domain.is_null())
12349 exception::throw_invalid("NULL input", __FILE__, __LINE__);
12350 auto saved_ctx = domain.ctx();
12351 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12352 auto res = isl_schedule_from_domain(domain.release());
12353 if (!res)
12354 exception::throw_last_error(saved_ctx);
12355 return manage(res);
12356}
12357
12358isl::union_map schedule::map() const
12359{
12360 if (!ptr)
12361 exception::throw_invalid("NULL input", __FILE__, __LINE__);
12362 auto saved_ctx = ctx();
12363 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12364 auto res = isl_schedule_get_map(get());
12365 if (!res)
12366 exception::throw_last_error(saved_ctx);
12367 return manage(res);
12368}
12369
12370isl::union_map schedule::get_map() const
12371{
12372 return map();
12373}
12374
12375isl::schedule_node schedule::root() const
12376{
12377 if (!ptr)
12378 exception::throw_invalid("NULL input", __FILE__, __LINE__);
12379 auto saved_ctx = ctx();
12380 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12381 auto res = isl_schedule_get_root(get());
12382 if (!res)
12383 exception::throw_last_error(saved_ctx);
12384 return manage(res);
12385}
12386
12387isl::schedule_node schedule::get_root() const
12388{
12389 return root();
12390}
12391
12392isl::schedule schedule::pullback(isl::union_pw_multi_aff upma) const
12393{
12394 if (!ptr || upma.is_null())
12395 exception::throw_invalid("NULL input", __FILE__, __LINE__);
12396 auto saved_ctx = ctx();
12397 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12398 auto res = isl_schedule_pullback_union_pw_multi_aff(copy(), upma.release());
12399 if (!res)
12400 exception::throw_last_error(saved_ctx);
12401 return manage(res);
12402}
12403
12404inline std::ostream &operator<<(std::ostream &os, const schedule &obj)
12405{
12406 if (!obj.get())
12407 exception::throw_invalid("NULL input", __FILE__, __LINE__);
12408 auto saved_ctx = isl_schedule_get_ctx(obj.get());
12409 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12410 char *str = isl_schedule_to_str(obj.get());
12411 if (!str)
12412 exception::throw_last_error(saved_ctx);
12413 os << str;
12414 free(str);
12415 return os;
12416}
12417
12418// implementations for isl::schedule_constraints
12419schedule_constraints manage(__isl_take isl_schedule_constraints *ptr) {
12420 if (!ptr)
12421 exception::throw_invalid("NULL input", __FILE__, __LINE__);
12422 return schedule_constraints(ptr);
12423}
12424schedule_constraints manage_copy(__isl_keep isl_schedule_constraints *ptr) {
12425 if (!ptr)
12426 exception::throw_invalid("NULL input", __FILE__, __LINE__);
12427 auto saved_ctx = isl_schedule_constraints_get_ctx(ptr);
12428 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12429 ptr = isl_schedule_constraints_copy(ptr);
12430 if (!ptr)
12431 exception::throw_last_error(saved_ctx);
12432 return schedule_constraints(ptr);
12433}
12434
12435schedule_constraints::schedule_constraints()
12436 : ptr(nullptr) {}
12437
12438schedule_constraints::schedule_constraints(const schedule_constraints &obj)
12439 : ptr(nullptr)
12440{
12441 if (!obj.ptr)
12442 exception::throw_invalid("NULL input", __FILE__, __LINE__);
12443 auto saved_ctx = isl_schedule_constraints_get_ctx(obj.ptr);
12444 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12445 ptr = obj.copy();
12446 if (!ptr)
12447 exception::throw_last_error(saved_ctx);
12448}
12449
12450schedule_constraints::schedule_constraints(__isl_take isl_schedule_constraints *ptr)
12451 : ptr(ptr) {}
12452
12453schedule_constraints::schedule_constraints(isl::ctx ctx, const std::string &str)
12454{
12455 auto saved_ctx = ctx;
12456 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12457 auto res = isl_schedule_constraints_read_from_str(ctx.release(), str.c_str());
12458 if (!res)
12459 exception::throw_last_error(saved_ctx);
12460 ptr = res;
12461}
12462
12463schedule_constraints &schedule_constraints::operator=(schedule_constraints obj) {
12464 std::swap(this->ptr, obj.ptr);
12465 return *this;
12466}
12467
12468schedule_constraints::~schedule_constraints() {
12469 if (ptr)
12470 isl_schedule_constraints_free(ptr);
12471}
12472
12473__isl_give isl_schedule_constraints *schedule_constraints::copy() const & {
12474 return isl_schedule_constraints_copy(ptr);
12475}
12476
12477__isl_keep isl_schedule_constraints *schedule_constraints::get() const {
12478 return ptr;
12479}
12480
12481__isl_give isl_schedule_constraints *schedule_constraints::release() {
12482 isl_schedule_constraints *tmp = ptr;
12483 ptr = nullptr;
12484 return tmp;
12485}
12486
12487bool schedule_constraints::is_null() const {
12488 return ptr == nullptr;
12489}
12490
12491isl::ctx schedule_constraints::ctx() const {
12492 return isl::ctx(isl_schedule_constraints_get_ctx(ptr));
12493}
12494
12495isl::schedule schedule_constraints::compute_schedule() const
12496{
12497 if (!ptr)
12498 exception::throw_invalid("NULL input", __FILE__, __LINE__);
12499 auto saved_ctx = ctx();
12500 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12501 auto res = isl_schedule_constraints_compute_schedule(copy());
12502 if (!res)
12503 exception::throw_last_error(saved_ctx);
12504 return manage(res);
12505}
12506
12507isl::union_map schedule_constraints::coincidence() const
12508{
12509 if (!ptr)
12510 exception::throw_invalid("NULL input", __FILE__, __LINE__);
12511 auto saved_ctx = ctx();
12512 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12513 auto res = isl_schedule_constraints_get_coincidence(get());
12514 if (!res)
12515 exception::throw_last_error(saved_ctx);
12516 return manage(res);
12517}
12518
12519isl::union_map schedule_constraints::get_coincidence() const
12520{
12521 return coincidence();
12522}
12523
12524isl::union_map schedule_constraints::conditional_validity() const
12525{
12526 if (!ptr)
12527 exception::throw_invalid("NULL input", __FILE__, __LINE__);
12528 auto saved_ctx = ctx();
12529 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12530 auto res = isl_schedule_constraints_get_conditional_validity(get());
12531 if (!res)
12532 exception::throw_last_error(saved_ctx);
12533 return manage(res);
12534}
12535
12536isl::union_map schedule_constraints::get_conditional_validity() const
12537{
12538 return conditional_validity();
12539}
12540
12541isl::union_map schedule_constraints::conditional_validity_condition() const
12542{
12543 if (!ptr)
12544 exception::throw_invalid("NULL input", __FILE__, __LINE__);
12545 auto saved_ctx = ctx();
12546 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12547 auto res = isl_schedule_constraints_get_conditional_validity_condition(get());
12548 if (!res)
12549 exception::throw_last_error(saved_ctx);
12550 return manage(res);
12551}
12552
12553isl::union_map schedule_constraints::get_conditional_validity_condition() const
12554{
12555 return conditional_validity_condition();
12556}
12557
12558isl::set schedule_constraints::context() const
12559{
12560 if (!ptr)
12561 exception::throw_invalid("NULL input", __FILE__, __LINE__);
12562 auto saved_ctx = ctx();
12563 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12564 auto res = isl_schedule_constraints_get_context(get());
12565 if (!res)
12566 exception::throw_last_error(saved_ctx);
12567 return manage(res);
12568}
12569
12570isl::set schedule_constraints::get_context() const
12571{
12572 return context();
12573}
12574
12575isl::union_set schedule_constraints::domain() const
12576{
12577 if (!ptr)
12578 exception::throw_invalid("NULL input", __FILE__, __LINE__);
12579 auto saved_ctx = ctx();
12580 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12581 auto res = isl_schedule_constraints_get_domain(get());
12582 if (!res)
12583 exception::throw_last_error(saved_ctx);
12584 return manage(res);
12585}
12586
12587isl::union_set schedule_constraints::get_domain() const
12588{
12589 return domain();
12590}
12591
12592isl::union_map schedule_constraints::proximity() const
12593{
12594 if (!ptr)
12595 exception::throw_invalid("NULL input", __FILE__, __LINE__);
12596 auto saved_ctx = ctx();
12597 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12598 auto res = isl_schedule_constraints_get_proximity(get());
12599 if (!res)
12600 exception::throw_last_error(saved_ctx);
12601 return manage(res);
12602}
12603
12604isl::union_map schedule_constraints::get_proximity() const
12605{
12606 return proximity();
12607}
12608
12609isl::union_map schedule_constraints::validity() const
12610{
12611 if (!ptr)
12612 exception::throw_invalid("NULL input", __FILE__, __LINE__);
12613 auto saved_ctx = ctx();
12614 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12615 auto res = isl_schedule_constraints_get_validity(get());
12616 if (!res)
12617 exception::throw_last_error(saved_ctx);
12618 return manage(res);
12619}
12620
12621isl::union_map schedule_constraints::get_validity() const
12622{
12623 return validity();
12624}
12625
12626isl::schedule_constraints schedule_constraints::on_domain(isl::union_set domain)
12627{
12628 if (domain.is_null())
12629 exception::throw_invalid("NULL input", __FILE__, __LINE__);
12630 auto saved_ctx = domain.ctx();
12631 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12632 auto res = isl_schedule_constraints_on_domain(domain.release());
12633 if (!res)
12634 exception::throw_last_error(saved_ctx);
12635 return manage(res);
12636}
12637
12638isl::schedule_constraints schedule_constraints::set_coincidence(isl::union_map coincidence) const
12639{
12640 if (!ptr || coincidence.is_null())
12641 exception::throw_invalid("NULL input", __FILE__, __LINE__);
12642 auto saved_ctx = ctx();
12643 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12644 auto res = isl_schedule_constraints_set_coincidence(copy(), coincidence.release());
12645 if (!res)
12646 exception::throw_last_error(saved_ctx);
12647 return manage(res);
12648}
12649
12650isl::schedule_constraints schedule_constraints::set_conditional_validity(isl::union_map condition, isl::union_map validity) const
12651{
12652 if (!ptr || condition.is_null() || validity.is_null())
12653 exception::throw_invalid("NULL input", __FILE__, __LINE__);
12654 auto saved_ctx = ctx();
12655 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12656 auto res = isl_schedule_constraints_set_conditional_validity(copy(), condition.release(), validity.release());
12657 if (!res)
12658 exception::throw_last_error(saved_ctx);
12659 return manage(res);
12660}
12661
12662isl::schedule_constraints schedule_constraints::set_context(isl::set context) const
12663{
12664 if (!ptr || context.is_null())
12665 exception::throw_invalid("NULL input", __FILE__, __LINE__);
12666 auto saved_ctx = ctx();
12667 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12668 auto res = isl_schedule_constraints_set_context(copy(), context.release());
12669 if (!res)
12670 exception::throw_last_error(saved_ctx);
12671 return manage(res);
12672}
12673
12674isl::schedule_constraints schedule_constraints::set_proximity(isl::union_map proximity) const
12675{
12676 if (!ptr || proximity.is_null())
12677 exception::throw_invalid("NULL input", __FILE__, __LINE__);
12678 auto saved_ctx = ctx();
12679 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12680 auto res = isl_schedule_constraints_set_proximity(copy(), proximity.release());
12681 if (!res)
12682 exception::throw_last_error(saved_ctx);
12683 return manage(res);
12684}
12685
12686isl::schedule_constraints schedule_constraints::set_validity(isl::union_map validity) const
12687{
12688 if (!ptr || validity.is_null())
12689 exception::throw_invalid("NULL input", __FILE__, __LINE__);
12690 auto saved_ctx = ctx();
12691 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12692 auto res = isl_schedule_constraints_set_validity(copy(), validity.release());
12693 if (!res)
12694 exception::throw_last_error(saved_ctx);
12695 return manage(res);
12696}
12697
12698inline std::ostream &operator<<(std::ostream &os, const schedule_constraints &obj)
12699{
12700 if (!obj.get())
12701 exception::throw_invalid("NULL input", __FILE__, __LINE__);
12702 auto saved_ctx = isl_schedule_constraints_get_ctx(obj.get());
12703 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12704 char *str = isl_schedule_constraints_to_str(obj.get());
12705 if (!str)
12706 exception::throw_last_error(saved_ctx);
12707 os << str;
12708 free(str);
12709 return os;
12710}
12711
12712// implementations for isl::schedule_node
12713schedule_node manage(__isl_take isl_schedule_node *ptr) {
12714 if (!ptr)
12715 exception::throw_invalid("NULL input", __FILE__, __LINE__);
12716 return schedule_node(ptr);
12717}
12718schedule_node manage_copy(__isl_keep isl_schedule_node *ptr) {
12719 if (!ptr)
12720 exception::throw_invalid("NULL input", __FILE__, __LINE__);
12721 auto saved_ctx = isl_schedule_node_get_ctx(ptr);
12722 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12723 ptr = isl_schedule_node_copy(ptr);
12724 if (!ptr)
12725 exception::throw_last_error(saved_ctx);
12726 return schedule_node(ptr);
12727}
12728
12729schedule_node::schedule_node()
12730 : ptr(nullptr) {}
12731
12732schedule_node::schedule_node(const schedule_node &obj)
12733 : ptr(nullptr)
12734{
12735 if (!obj.ptr)
12736 exception::throw_invalid("NULL input", __FILE__, __LINE__);
12737 auto saved_ctx = isl_schedule_node_get_ctx(obj.ptr);
12738 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12739 ptr = obj.copy();
12740 if (!ptr)
12741 exception::throw_last_error(saved_ctx);
12742}
12743
12744schedule_node::schedule_node(__isl_take isl_schedule_node *ptr)
12745 : ptr(ptr) {}
12746
12747schedule_node &schedule_node::operator=(schedule_node obj) {
12748 std::swap(this->ptr, obj.ptr);
12749 return *this;
12750}
12751
12752schedule_node::~schedule_node() {
12753 if (ptr)
12754 isl_schedule_node_free(ptr);
12755}
12756
12757__isl_give isl_schedule_node *schedule_node::copy() const & {
12758 return isl_schedule_node_copy(ptr);
12759}
12760
12761__isl_keep isl_schedule_node *schedule_node::get() const {
12762 return ptr;
12763}
12764
12765__isl_give isl_schedule_node *schedule_node::release() {
12766 isl_schedule_node *tmp = ptr;
12767 ptr = nullptr;
12768 return tmp;
12769}
12770
12771bool schedule_node::is_null() const {
12772 return ptr == nullptr;
12773}
12774
12775template <typename T, typename>
12776bool schedule_node::isa_type(T subtype) const
12777{
12778 if (is_null())
12779 exception::throw_invalid("NULL input", __FILE__, __LINE__);
12780 return isl_schedule_node_get_type(get()) == subtype;
12781}
12782template <class T>
12783bool schedule_node::isa() const
12784{
12785 return isa_type<decltype(T::type)>(T::type);
12786}
12787template <class T>
12788T schedule_node::as() const
12789{
12790 if (!isa<T>())
12791 exception::throw_invalid("not an object of the requested subtype", __FILE__, __LINE__);
12792 return T(copy());
12793}
12794
12795isl::ctx schedule_node::ctx() const {
12796 return isl::ctx(isl_schedule_node_get_ctx(ptr));
12797}
12798
12799isl::schedule_node schedule_node::ancestor(int generation) const
12800{
12801 if (!ptr)
12802 exception::throw_invalid("NULL input", __FILE__, __LINE__);
12803 auto saved_ctx = ctx();
12804 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12805 auto res = isl_schedule_node_ancestor(copy(), generation);
12806 if (!res)
12807 exception::throw_last_error(saved_ctx);
12808 return manage(res);
12809}
12810
12811isl::schedule_node schedule_node::child(int pos) const
12812{
12813 if (!ptr)
12814 exception::throw_invalid("NULL input", __FILE__, __LINE__);
12815 auto saved_ctx = ctx();
12816 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12817 auto res = isl_schedule_node_child(copy(), pos);
12818 if (!res)
12819 exception::throw_last_error(saved_ctx);
12820 return manage(res);
12821}
12822
12823bool schedule_node::every_descendant(const std::function<bool(isl::schedule_node)> &test) const
12824{
12825 if (!ptr)
12826 exception::throw_invalid("NULL input", __FILE__, __LINE__);
12827 auto saved_ctx = ctx();
12828 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12829 struct test_data {
12830 std::function<bool(isl::schedule_node)> func;
12831 std::exception_ptr eptr;
12832 } test_data = { test };
12833 auto test_lambda = [](isl_schedule_node *arg_0, void *arg_1) -> isl_bool {
12834 auto *data = static_cast<struct test_data *>(arg_1);
12835 ISL_CPP_TRY {
12836 auto ret = (data->func)(manage_copy(arg_0));
12837 return ret ? isl_bool_true : isl_bool_false;
12838 } ISL_CPP_CATCH_ALL {
12839 data->eptr = std::current_exception();
12840 return isl_bool_error;
12841 }
12842 };
12843 auto res = isl_schedule_node_every_descendant(get(), test_lambda, &test_data);
12844 if (test_data.eptr)
12845 std::rethrow_exception(test_data.eptr);
12846 if (res < 0)
12847 exception::throw_last_error(saved_ctx);
12848 return res;
12849}
12850
12851isl::schedule_node schedule_node::first_child() const
12852{
12853 if (!ptr)
12854 exception::throw_invalid("NULL input", __FILE__, __LINE__);
12855 auto saved_ctx = ctx();
12856 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12857 auto res = isl_schedule_node_first_child(copy());
12858 if (!res)
12859 exception::throw_last_error(saved_ctx);
12860 return manage(res);
12861}
12862
12863void schedule_node::foreach_ancestor_top_down(const std::function<void(isl::schedule_node)> &fn) const
12864{
12865 if (!ptr)
12866 exception::throw_invalid("NULL input", __FILE__, __LINE__);
12867 auto saved_ctx = ctx();
12868 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12869 struct fn_data {
12870 std::function<void(isl::schedule_node)> func;
12871 std::exception_ptr eptr;
12872 } fn_data = { fn };
12873 auto fn_lambda = [](isl_schedule_node *arg_0, void *arg_1) -> isl_stat {
12874 auto *data = static_cast<struct fn_data *>(arg_1);
12875 ISL_CPP_TRY {
12876 (data->func)(manage_copy(arg_0));
12877 return isl_stat_ok;
12878 } ISL_CPP_CATCH_ALL {
12879 data->eptr = std::current_exception();
12880 return isl_stat_error;
12881 }
12882 };
12883 auto res = isl_schedule_node_foreach_ancestor_top_down(get(), fn_lambda, &fn_data);
12884 if (fn_data.eptr)
12885 std::rethrow_exception(fn_data.eptr);
12886 if (res < 0)
12887 exception::throw_last_error(saved_ctx);
12888 return;
12889}
12890
12891void schedule_node::foreach_descendant_top_down(const std::function<bool(isl::schedule_node)> &fn) const
12892{
12893 if (!ptr)
12894 exception::throw_invalid("NULL input", __FILE__, __LINE__);
12895 auto saved_ctx = ctx();
12896 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12897 struct fn_data {
12898 std::function<bool(isl::schedule_node)> func;
12899 std::exception_ptr eptr;
12900 } fn_data = { fn };
12901 auto fn_lambda = [](isl_schedule_node *arg_0, void *arg_1) -> isl_bool {
12902 auto *data = static_cast<struct fn_data *>(arg_1);
12903 ISL_CPP_TRY {
12904 auto ret = (data->func)(manage_copy(arg_0));
12905 return ret ? isl_bool_true : isl_bool_false;
12906 } ISL_CPP_CATCH_ALL {
12907 data->eptr = std::current_exception();
12908 return isl_bool_error;
12909 }
12910 };
12911 auto res = isl_schedule_node_foreach_descendant_top_down(get(), fn_lambda, &fn_data);
12912 if (fn_data.eptr)
12913 std::rethrow_exception(fn_data.eptr);
12914 if (res < 0)
12915 exception::throw_last_error(saved_ctx);
12916 return;
12917}
12918
12919isl::schedule_node schedule_node::from_domain(isl::union_set domain)
12920{
12921 if (domain.is_null())
12922 exception::throw_invalid("NULL input", __FILE__, __LINE__);
12923 auto saved_ctx = domain.ctx();
12924 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12925 auto res = isl_schedule_node_from_domain(domain.release());
12926 if (!res)
12927 exception::throw_last_error(saved_ctx);
12928 return manage(res);
12929}
12930
12931isl::schedule_node schedule_node::from_extension(isl::union_map extension)
12932{
12933 if (extension.is_null())
12934 exception::throw_invalid("NULL input", __FILE__, __LINE__);
12935 auto saved_ctx = extension.ctx();
12936 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12937 auto res = isl_schedule_node_from_extension(extension.release());
12938 if (!res)
12939 exception::throw_last_error(saved_ctx);
12940 return manage(res);
12941}
12942
12943unsigned schedule_node::ancestor_child_position(const isl::schedule_node &ancestor) const
12944{
12945 if (!ptr || ancestor.is_null())
12946 exception::throw_invalid("NULL input", __FILE__, __LINE__);
12947 auto saved_ctx = ctx();
12948 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12949 auto res = isl_schedule_node_get_ancestor_child_position(get(), ancestor.get());
12950 if (res < 0)
12951 exception::throw_last_error(saved_ctx);
12952 return res;
12953}
12954
12955unsigned schedule_node::get_ancestor_child_position(const isl::schedule_node &ancestor) const
12956{
12957 return ancestor_child_position(ancestor);
12958}
12959
12960unsigned schedule_node::child_position() const
12961{
12962 if (!ptr)
12963 exception::throw_invalid("NULL input", __FILE__, __LINE__);
12964 auto saved_ctx = ctx();
12965 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12966 auto res = isl_schedule_node_get_child_position(get());
12967 if (res < 0)
12968 exception::throw_last_error(saved_ctx);
12969 return res;
12970}
12971
12972unsigned schedule_node::get_child_position() const
12973{
12974 return child_position();
12975}
12976
12977isl::multi_union_pw_aff schedule_node::prefix_schedule_multi_union_pw_aff() const
12978{
12979 if (!ptr)
12980 exception::throw_invalid("NULL input", __FILE__, __LINE__);
12981 auto saved_ctx = ctx();
12982 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12983 auto res = isl_schedule_node_get_prefix_schedule_multi_union_pw_aff(get());
12984 if (!res)
12985 exception::throw_last_error(saved_ctx);
12986 return manage(res);
12987}
12988
12989isl::multi_union_pw_aff schedule_node::get_prefix_schedule_multi_union_pw_aff() const
12990{
12991 return prefix_schedule_multi_union_pw_aff();
12992}
12993
12994isl::union_map schedule_node::prefix_schedule_union_map() const
12995{
12996 if (!ptr)
12997 exception::throw_invalid("NULL input", __FILE__, __LINE__);
12998 auto saved_ctx = ctx();
12999 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13000 auto res = isl_schedule_node_get_prefix_schedule_union_map(get());
13001 if (!res)
13002 exception::throw_last_error(saved_ctx);
13003 return manage(res);
13004}
13005
13006isl::union_map schedule_node::get_prefix_schedule_union_map() const
13007{
13008 return prefix_schedule_union_map();
13009}
13010
13011isl::union_pw_multi_aff schedule_node::prefix_schedule_union_pw_multi_aff() const
13012{
13013 if (!ptr)
13014 exception::throw_invalid("NULL input", __FILE__, __LINE__);
13015 auto saved_ctx = ctx();
13016 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13017 auto res = isl_schedule_node_get_prefix_schedule_union_pw_multi_aff(get());
13018 if (!res)
13019 exception::throw_last_error(saved_ctx);
13020 return manage(res);
13021}
13022
13023isl::union_pw_multi_aff schedule_node::get_prefix_schedule_union_pw_multi_aff() const
13024{
13025 return prefix_schedule_union_pw_multi_aff();
13026}
13027
13028isl::schedule schedule_node::schedule() const
13029{
13030 if (!ptr)
13031 exception::throw_invalid("NULL input", __FILE__, __LINE__);
13032 auto saved_ctx = ctx();
13033 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13034 auto res = isl_schedule_node_get_schedule(get());
13035 if (!res)
13036 exception::throw_last_error(saved_ctx);
13037 return manage(res);
13038}
13039
13040isl::schedule schedule_node::get_schedule() const
13041{
13042 return schedule();
13043}
13044
13045isl::schedule_node schedule_node::shared_ancestor(const isl::schedule_node &node2) const
13046{
13047 if (!ptr || node2.is_null())
13048 exception::throw_invalid("NULL input", __FILE__, __LINE__);
13049 auto saved_ctx = ctx();
13050 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13051 auto res = isl_schedule_node_get_shared_ancestor(get(), node2.get());
13052 if (!res)
13053 exception::throw_last_error(saved_ctx);
13054 return manage(res);
13055}
13056
13057isl::schedule_node schedule_node::get_shared_ancestor(const isl::schedule_node &node2) const
13058{
13059 return shared_ancestor(node2);
13060}
13061
13062unsigned schedule_node::tree_depth() const
13063{
13064 if (!ptr)
13065 exception::throw_invalid("NULL input", __FILE__, __LINE__);
13066 auto saved_ctx = ctx();
13067 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13068 auto res = isl_schedule_node_get_tree_depth(get());
13069 if (res < 0)
13070 exception::throw_last_error(saved_ctx);
13071 return res;
13072}
13073
13074unsigned schedule_node::get_tree_depth() const
13075{
13076 return tree_depth();
13077}
13078
13079isl::schedule_node schedule_node::graft_after(isl::schedule_node graft) const
13080{
13081 if (!ptr || graft.is_null())
13082 exception::throw_invalid("NULL input", __FILE__, __LINE__);
13083 auto saved_ctx = ctx();
13084 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13085 auto res = isl_schedule_node_graft_after(copy(), graft.release());
13086 if (!res)
13087 exception::throw_last_error(saved_ctx);
13088 return manage(res);
13089}
13090
13091isl::schedule_node schedule_node::graft_before(isl::schedule_node graft) const
13092{
13093 if (!ptr || graft.is_null())
13094 exception::throw_invalid("NULL input", __FILE__, __LINE__);
13095 auto saved_ctx = ctx();
13096 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13097 auto res = isl_schedule_node_graft_before(copy(), graft.release());
13098 if (!res)
13099 exception::throw_last_error(saved_ctx);
13100 return manage(res);
13101}
13102
13103bool schedule_node::has_children() const
13104{
13105 if (!ptr)
13106 exception::throw_invalid("NULL input", __FILE__, __LINE__);
13107 auto saved_ctx = ctx();
13108 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13109 auto res = isl_schedule_node_has_children(get());
13110 if (res < 0)
13111 exception::throw_last_error(saved_ctx);
13112 return res;
13113}
13114
13115bool schedule_node::has_next_sibling() const
13116{
13117 if (!ptr)
13118 exception::throw_invalid("NULL input", __FILE__, __LINE__);
13119 auto saved_ctx = ctx();
13120 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13121 auto res = isl_schedule_node_has_next_sibling(get());
13122 if (res < 0)
13123 exception::throw_last_error(saved_ctx);
13124 return res;
13125}
13126
13127bool schedule_node::has_parent() const
13128{
13129 if (!ptr)
13130 exception::throw_invalid("NULL input", __FILE__, __LINE__);
13131 auto saved_ctx = ctx();
13132 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13133 auto res = isl_schedule_node_has_parent(get());
13134 if (res < 0)
13135 exception::throw_last_error(saved_ctx);
13136 return res;
13137}
13138
13139bool schedule_node::has_previous_sibling() const
13140{
13141 if (!ptr)
13142 exception::throw_invalid("NULL input", __FILE__, __LINE__);
13143 auto saved_ctx = ctx();
13144 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13145 auto res = isl_schedule_node_has_previous_sibling(get());
13146 if (res < 0)
13147 exception::throw_last_error(saved_ctx);
13148 return res;
13149}
13150
13151isl::schedule_node schedule_node::insert_context(isl::set context) const
13152{
13153 if (!ptr || context.is_null())
13154 exception::throw_invalid("NULL input", __FILE__, __LINE__);
13155 auto saved_ctx = ctx();
13156 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13157 auto res = isl_schedule_node_insert_context(copy(), context.release());
13158 if (!res)
13159 exception::throw_last_error(saved_ctx);
13160 return manage(res);
13161}
13162
13163isl::schedule_node schedule_node::insert_filter(isl::union_set filter) const
13164{
13165 if (!ptr || filter.is_null())
13166 exception::throw_invalid("NULL input", __FILE__, __LINE__);
13167 auto saved_ctx = ctx();
13168 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13169 auto res = isl_schedule_node_insert_filter(copy(), filter.release());
13170 if (!res)
13171 exception::throw_last_error(saved_ctx);
13172 return manage(res);
13173}
13174
13175isl::schedule_node schedule_node::insert_guard(isl::set context) const
13176{
13177 if (!ptr || context.is_null())
13178 exception::throw_invalid("NULL input", __FILE__, __LINE__);
13179 auto saved_ctx = ctx();
13180 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13181 auto res = isl_schedule_node_insert_guard(copy(), context.release());
13182 if (!res)
13183 exception::throw_last_error(saved_ctx);
13184 return manage(res);
13185}
13186
13187isl::schedule_node schedule_node::insert_mark(isl::id mark) const
13188{
13189 if (!ptr || mark.is_null())
13190 exception::throw_invalid("NULL input", __FILE__, __LINE__);
13191 auto saved_ctx = ctx();
13192 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13193 auto res = isl_schedule_node_insert_mark(copy(), mark.release());
13194 if (!res)
13195 exception::throw_last_error(saved_ctx);
13196 return manage(res);
13197}
13198
13199isl::schedule_node schedule_node::insert_mark(const std::string &mark) const
13200{
13201 if (!ptr)
13202 exception::throw_invalid("NULL input", __FILE__, __LINE__);
13203 return this->insert_mark(isl::id(ctx(), mark));
13204}
13205
13206isl::schedule_node schedule_node::insert_partial_schedule(isl::multi_union_pw_aff schedule) const
13207{
13208 if (!ptr || schedule.is_null())
13209 exception::throw_invalid("NULL input", __FILE__, __LINE__);
13210 auto saved_ctx = ctx();
13211 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13212 auto res = isl_schedule_node_insert_partial_schedule(copy(), schedule.release());
13213 if (!res)
13214 exception::throw_last_error(saved_ctx);
13215 return manage(res);
13216}
13217
13218isl::schedule_node schedule_node::insert_sequence(isl::union_set_list filters) const
13219{
13220 if (!ptr || filters.is_null())
13221 exception::throw_invalid("NULL input", __FILE__, __LINE__);
13222 auto saved_ctx = ctx();
13223 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13224 auto res = isl_schedule_node_insert_sequence(copy(), filters.release());
13225 if (!res)
13226 exception::throw_last_error(saved_ctx);
13227 return manage(res);
13228}
13229
13230isl::schedule_node schedule_node::insert_set(isl::union_set_list filters) const
13231{
13232 if (!ptr || filters.is_null())
13233 exception::throw_invalid("NULL input", __FILE__, __LINE__);
13234 auto saved_ctx = ctx();
13235 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13236 auto res = isl_schedule_node_insert_set(copy(), filters.release());
13237 if (!res)
13238 exception::throw_last_error(saved_ctx);
13239 return manage(res);
13240}
13241
13242bool schedule_node::is_equal(const isl::schedule_node &node2) const
13243{
13244 if (!ptr || node2.is_null())
13245 exception::throw_invalid("NULL input", __FILE__, __LINE__);
13246 auto saved_ctx = ctx();
13247 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13248 auto res = isl_schedule_node_is_equal(get(), node2.get());
13249 if (res < 0)
13250 exception::throw_last_error(saved_ctx);
13251 return res;
13252}
13253
13254bool schedule_node::is_subtree_anchored() const
13255{
13256 if (!ptr)
13257 exception::throw_invalid("NULL input", __FILE__, __LINE__);
13258 auto saved_ctx = ctx();
13259 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13260 auto res = isl_schedule_node_is_subtree_anchored(get());
13261 if (res < 0)
13262 exception::throw_last_error(saved_ctx);
13263 return res;
13264}
13265
13266isl::schedule_node schedule_node::map_descendant_bottom_up(const std::function<isl::schedule_node(isl::schedule_node)> &fn) const
13267{
13268 if (!ptr)
13269 exception::throw_invalid("NULL input", __FILE__, __LINE__);
13270 auto saved_ctx = ctx();
13271 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13272 struct fn_data {
13273 std::function<isl::schedule_node(isl::schedule_node)> func;
13274 std::exception_ptr eptr;
13275 } fn_data = { fn };
13276 auto fn_lambda = [](isl_schedule_node *arg_0, void *arg_1) -> isl_schedule_node * {
13277 auto *data = static_cast<struct fn_data *>(arg_1);
13278 ISL_CPP_TRY {
13279 auto ret = (data->func)(manage(arg_0));
13280 return ret.release();
13281 } ISL_CPP_CATCH_ALL {
13282 data->eptr = std::current_exception();
13283 return NULL;
13284 }
13285 };
13286 auto res = isl_schedule_node_map_descendant_bottom_up(copy(), fn_lambda, &fn_data);
13287 if (fn_data.eptr)
13288 std::rethrow_exception(fn_data.eptr);
13289 if (!res)
13290 exception::throw_last_error(saved_ctx);
13291 return manage(res);
13292}
13293
13294unsigned schedule_node::n_children() const
13295{
13296 if (!ptr)
13297 exception::throw_invalid("NULL input", __FILE__, __LINE__);
13298 auto saved_ctx = ctx();
13299 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13300 auto res = isl_schedule_node_n_children(get());
13301 if (res < 0)
13302 exception::throw_last_error(saved_ctx);
13303 return res;
13304}
13305
13306isl::schedule_node schedule_node::next_sibling() const
13307{
13308 if (!ptr)
13309 exception::throw_invalid("NULL input", __FILE__, __LINE__);
13310 auto saved_ctx = ctx();
13311 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13312 auto res = isl_schedule_node_next_sibling(copy());
13313 if (!res)
13314 exception::throw_last_error(saved_ctx);
13315 return manage(res);
13316}
13317
13318isl::schedule_node schedule_node::order_after(isl::union_set filter) const
13319{
13320 if (!ptr || filter.is_null())
13321 exception::throw_invalid("NULL input", __FILE__, __LINE__);
13322 auto saved_ctx = ctx();
13323 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13324 auto res = isl_schedule_node_order_after(copy(), filter.release());
13325 if (!res)
13326 exception::throw_last_error(saved_ctx);
13327 return manage(res);
13328}
13329
13330isl::schedule_node schedule_node::order_before(isl::union_set filter) const
13331{
13332 if (!ptr || filter.is_null())
13333 exception::throw_invalid("NULL input", __FILE__, __LINE__);
13334 auto saved_ctx = ctx();
13335 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13336 auto res = isl_schedule_node_order_before(copy(), filter.release());
13337 if (!res)
13338 exception::throw_last_error(saved_ctx);
13339 return manage(res);
13340}
13341
13342isl::schedule_node schedule_node::parent() const
13343{
13344 if (!ptr)
13345 exception::throw_invalid("NULL input", __FILE__, __LINE__);
13346 auto saved_ctx = ctx();
13347 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13348 auto res = isl_schedule_node_parent(copy());
13349 if (!res)
13350 exception::throw_last_error(saved_ctx);
13351 return manage(res);
13352}
13353
13354isl::schedule_node schedule_node::previous_sibling() const
13355{
13356 if (!ptr)
13357 exception::throw_invalid("NULL input", __FILE__, __LINE__);
13358 auto saved_ctx = ctx();
13359 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13360 auto res = isl_schedule_node_previous_sibling(copy());
13361 if (!res)
13362 exception::throw_last_error(saved_ctx);
13363 return manage(res);
13364}
13365
13366isl::schedule_node schedule_node::root() const
13367{
13368 if (!ptr)
13369 exception::throw_invalid("NULL input", __FILE__, __LINE__);
13370 auto saved_ctx = ctx();
13371 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13372 auto res = isl_schedule_node_root(copy());
13373 if (!res)
13374 exception::throw_last_error(saved_ctx);
13375 return manage(res);
13376}
13377
13378inline std::ostream &operator<<(std::ostream &os, const schedule_node &obj)
13379{
13380 if (!obj.get())
13381 exception::throw_invalid("NULL input", __FILE__, __LINE__);
13382 auto saved_ctx = isl_schedule_node_get_ctx(obj.get());
13383 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13384 char *str = isl_schedule_node_to_str(obj.get());
13385 if (!str)
13386 exception::throw_last_error(saved_ctx);
13387 os << str;
13388 free(str);
13389 return os;
13390}
13391
13392// implementations for isl::schedule_node_band
13393schedule_node_band::schedule_node_band()
13394 : schedule_node() {}
13395
13396schedule_node_band::schedule_node_band(const schedule_node_band &obj)
13397 : schedule_node(obj)
13398{
13399}
13400
13401schedule_node_band::schedule_node_band(__isl_take isl_schedule_node *ptr)
13402 : schedule_node(ptr) {}
13403
13404schedule_node_band &schedule_node_band::operator=(schedule_node_band obj) {
13405 std::swap(this->ptr, obj.ptr);
13406 return *this;
13407}
13408
13409isl::ctx schedule_node_band::ctx() const {
13410 return isl::ctx(isl_schedule_node_get_ctx(ptr));
13411}
13412
13413isl::union_set schedule_node_band::ast_build_options() const
13414{
13415 if (!ptr)
13416 exception::throw_invalid("NULL input", __FILE__, __LINE__);
13417 auto saved_ctx = ctx();
13418 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13419 auto res = isl_schedule_node_band_get_ast_build_options(get());
13420 if (!res)
13421 exception::throw_last_error(saved_ctx);
13422 return manage(res);
13423}
13424
13425isl::union_set schedule_node_band::get_ast_build_options() const
13426{
13427 return ast_build_options();
13428}
13429
13430isl::set schedule_node_band::ast_isolate_option() const
13431{
13432 if (!ptr)
13433 exception::throw_invalid("NULL input", __FILE__, __LINE__);
13434 auto saved_ctx = ctx();
13435 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13436 auto res = isl_schedule_node_band_get_ast_isolate_option(get());
13437 if (!res)
13438 exception::throw_last_error(saved_ctx);
13439 return manage(res);
13440}
13441
13442isl::set schedule_node_band::get_ast_isolate_option() const
13443{
13444 return ast_isolate_option();
13445}
13446
13447isl::multi_union_pw_aff schedule_node_band::partial_schedule() const
13448{
13449 if (!ptr)
13450 exception::throw_invalid("NULL input", __FILE__, __LINE__);
13451 auto saved_ctx = ctx();
13452 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13453 auto res = isl_schedule_node_band_get_partial_schedule(get());
13454 if (!res)
13455 exception::throw_last_error(saved_ctx);
13456 return manage(res);
13457}
13458
13459isl::multi_union_pw_aff schedule_node_band::get_partial_schedule() const
13460{
13461 return partial_schedule();
13462}
13463
13464bool schedule_node_band::permutable() const
13465{
13466 if (!ptr)
13467 exception::throw_invalid("NULL input", __FILE__, __LINE__);
13468 auto saved_ctx = ctx();
13469 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13470 auto res = isl_schedule_node_band_get_permutable(get());
13471 if (res < 0)
13472 exception::throw_last_error(saved_ctx);
13473 return res;
13474}
13475
13476bool schedule_node_band::get_permutable() const
13477{
13478 return permutable();
13479}
13480
13481bool schedule_node_band::member_get_coincident(int pos) const
13482{
13483 if (!ptr)
13484 exception::throw_invalid("NULL input", __FILE__, __LINE__);
13485 auto saved_ctx = ctx();
13486 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13487 auto res = isl_schedule_node_band_member_get_coincident(get(), pos);
13488 if (res < 0)
13489 exception::throw_last_error(saved_ctx);
13490 return res;
13491}
13492
13493schedule_node_band schedule_node_band::member_set_coincident(int pos, int coincident) const
13494{
13495 if (!ptr)
13496 exception::throw_invalid("NULL input", __FILE__, __LINE__);
13497 auto saved_ctx = ctx();
13498 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13499 auto res = isl_schedule_node_band_member_set_coincident(copy(), pos, coincident);
13500 if (!res)
13501 exception::throw_last_error(saved_ctx);
13502 return manage(res).as<schedule_node_band>();
13503}
13504
13505schedule_node_band schedule_node_band::mod(isl::multi_val mv) const
13506{
13507 if (!ptr || mv.is_null())
13508 exception::throw_invalid("NULL input", __FILE__, __LINE__);
13509 auto saved_ctx = ctx();
13510 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13511 auto res = isl_schedule_node_band_mod(copy(), mv.release());
13512 if (!res)
13513 exception::throw_last_error(saved_ctx);
13514 return manage(res).as<schedule_node_band>();
13515}
13516
13517unsigned schedule_node_band::n_member() const
13518{
13519 if (!ptr)
13520 exception::throw_invalid("NULL input", __FILE__, __LINE__);
13521 auto saved_ctx = ctx();
13522 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13523 auto res = isl_schedule_node_band_n_member(get());
13524 if (res < 0)
13525 exception::throw_last_error(saved_ctx);
13526 return res;
13527}
13528
13529schedule_node_band schedule_node_band::scale(isl::multi_val mv) const
13530{
13531 if (!ptr || mv.is_null())
13532 exception::throw_invalid("NULL input", __FILE__, __LINE__);
13533 auto saved_ctx = ctx();
13534 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13535 auto res = isl_schedule_node_band_scale(copy(), mv.release());
13536 if (!res)
13537 exception::throw_last_error(saved_ctx);
13538 return manage(res).as<schedule_node_band>();
13539}
13540
13541schedule_node_band schedule_node_band::scale_down(isl::multi_val mv) const
13542{
13543 if (!ptr || mv.is_null())
13544 exception::throw_invalid("NULL input", __FILE__, __LINE__);
13545 auto saved_ctx = ctx();
13546 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13547 auto res = isl_schedule_node_band_scale_down(copy(), mv.release());
13548 if (!res)
13549 exception::throw_last_error(saved_ctx);
13550 return manage(res).as<schedule_node_band>();
13551}
13552
13553schedule_node_band schedule_node_band::set_ast_build_options(isl::union_set options) const
13554{
13555 if (!ptr || options.is_null())
13556 exception::throw_invalid("NULL input", __FILE__, __LINE__);
13557 auto saved_ctx = ctx();
13558 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13559 auto res = isl_schedule_node_band_set_ast_build_options(copy(), options.release());
13560 if (!res)
13561 exception::throw_last_error(saved_ctx);
13562 return manage(res).as<schedule_node_band>();
13563}
13564
13565schedule_node_band schedule_node_band::set_permutable(int permutable) const
13566{
13567 if (!ptr)
13568 exception::throw_invalid("NULL input", __FILE__, __LINE__);
13569 auto saved_ctx = ctx();
13570 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13571 auto res = isl_schedule_node_band_set_permutable(copy(), permutable);
13572 if (!res)
13573 exception::throw_last_error(saved_ctx);
13574 return manage(res).as<schedule_node_band>();
13575}
13576
13577schedule_node_band schedule_node_band::shift(isl::multi_union_pw_aff shift) const
13578{
13579 if (!ptr || shift.is_null())
13580 exception::throw_invalid("NULL input", __FILE__, __LINE__);
13581 auto saved_ctx = ctx();
13582 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13583 auto res = isl_schedule_node_band_shift(copy(), shift.release());
13584 if (!res)
13585 exception::throw_last_error(saved_ctx);
13586 return manage(res).as<schedule_node_band>();
13587}
13588
13589schedule_node_band schedule_node_band::split(int pos) const
13590{
13591 if (!ptr)
13592 exception::throw_invalid("NULL input", __FILE__, __LINE__);
13593 auto saved_ctx = ctx();
13594 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13595 auto res = isl_schedule_node_band_split(copy(), pos);
13596 if (!res)
13597 exception::throw_last_error(saved_ctx);
13598 return manage(res).as<schedule_node_band>();
13599}
13600
13601schedule_node_band schedule_node_band::tile(isl::multi_val sizes) const
13602{
13603 if (!ptr || sizes.is_null())
13604 exception::throw_invalid("NULL input", __FILE__, __LINE__);
13605 auto saved_ctx = ctx();
13606 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13607 auto res = isl_schedule_node_band_tile(copy(), sizes.release());
13608 if (!res)
13609 exception::throw_last_error(saved_ctx);
13610 return manage(res).as<schedule_node_band>();
13611}
13612
13613
13614schedule_node_band schedule_node_band::member_set_ast_loop_default(int pos) const
13615{
13616 if (!ptr)
13617 exception::throw_invalid("NULL input", __FILE__, __LINE__);
13618 auto saved_ctx = ctx();
13619 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13620 auto res = isl_schedule_node_band_member_set_ast_loop_type(copy(), pos, isl_ast_loop_default);
13621 if (!res)
13622 exception::throw_last_error(saved_ctx);
13623 return manage(res).as<schedule_node_band>();
13624}
13625
13626
13627schedule_node_band schedule_node_band::member_set_ast_loop_atomic(int pos) const
13628{
13629 if (!ptr)
13630 exception::throw_invalid("NULL input", __FILE__, __LINE__);
13631 auto saved_ctx = ctx();
13632 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13633 auto res = isl_schedule_node_band_member_set_ast_loop_type(copy(), pos, isl_ast_loop_atomic);
13634 if (!res)
13635 exception::throw_last_error(saved_ctx);
13636 return manage(res).as<schedule_node_band>();
13637}
13638
13639
13640schedule_node_band schedule_node_band::member_set_ast_loop_unroll(int pos) const
13641{
13642 if (!ptr)
13643 exception::throw_invalid("NULL input", __FILE__, __LINE__);
13644 auto saved_ctx = ctx();
13645 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13646 auto res = isl_schedule_node_band_member_set_ast_loop_type(copy(), pos, isl_ast_loop_unroll);
13647 if (!res)
13648 exception::throw_last_error(saved_ctx);
13649 return manage(res).as<schedule_node_band>();
13650}
13651
13652
13653schedule_node_band schedule_node_band::member_set_ast_loop_separate(int pos) const
13654{
13655 if (!ptr)
13656 exception::throw_invalid("NULL input", __FILE__, __LINE__);
13657 auto saved_ctx = ctx();
13658 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13659 auto res = isl_schedule_node_band_member_set_ast_loop_type(copy(), pos, isl_ast_loop_separate);
13660 if (!res)
13661 exception::throw_last_error(saved_ctx);
13662 return manage(res).as<schedule_node_band>();
13663}
13664
13665inline std::ostream &operator<<(std::ostream &os, const schedule_node_band &obj)
13666{
13667 if (!obj.get())
13668 exception::throw_invalid("NULL input", __FILE__, __LINE__);
13669 auto saved_ctx = isl_schedule_node_get_ctx(obj.get());
13670 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13671 char *str = isl_schedule_node_to_str(obj.get());
13672 if (!str)
13673 exception::throw_last_error(saved_ctx);
13674 os << str;
13675 free(str);
13676 return os;
13677}
13678
13679// implementations for isl::schedule_node_context
13680schedule_node_context::schedule_node_context()
13681 : schedule_node() {}
13682
13683schedule_node_context::schedule_node_context(const schedule_node_context &obj)
13684 : schedule_node(obj)
13685{
13686}
13687
13688schedule_node_context::schedule_node_context(__isl_take isl_schedule_node *ptr)
13689 : schedule_node(ptr) {}
13690
13691schedule_node_context &schedule_node_context::operator=(schedule_node_context obj) {
13692 std::swap(this->ptr, obj.ptr);
13693 return *this;
13694}
13695
13696isl::ctx schedule_node_context::ctx() const {
13697 return isl::ctx(isl_schedule_node_get_ctx(ptr));
13698}
13699
13700isl::set schedule_node_context::context() const
13701{
13702 if (!ptr)
13703 exception::throw_invalid("NULL input", __FILE__, __LINE__);
13704 auto saved_ctx = ctx();
13705 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13706 auto res = isl_schedule_node_context_get_context(get());
13707 if (!res)
13708 exception::throw_last_error(saved_ctx);
13709 return manage(res);
13710}
13711
13712isl::set schedule_node_context::get_context() const
13713{
13714 return context();
13715}
13716
13717inline std::ostream &operator<<(std::ostream &os, const schedule_node_context &obj)
13718{
13719 if (!obj.get())
13720 exception::throw_invalid("NULL input", __FILE__, __LINE__);
13721 auto saved_ctx = isl_schedule_node_get_ctx(obj.get());
13722 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13723 char *str = isl_schedule_node_to_str(obj.get());
13724 if (!str)
13725 exception::throw_last_error(saved_ctx);
13726 os << str;
13727 free(str);
13728 return os;
13729}
13730
13731// implementations for isl::schedule_node_domain
13732schedule_node_domain::schedule_node_domain()
13733 : schedule_node() {}
13734
13735schedule_node_domain::schedule_node_domain(const schedule_node_domain &obj)
13736 : schedule_node(obj)
13737{
13738}
13739
13740schedule_node_domain::schedule_node_domain(__isl_take isl_schedule_node *ptr)
13741 : schedule_node(ptr) {}
13742
13743schedule_node_domain &schedule_node_domain::operator=(schedule_node_domain obj) {
13744 std::swap(this->ptr, obj.ptr);
13745 return *this;
13746}
13747
13748isl::ctx schedule_node_domain::ctx() const {
13749 return isl::ctx(isl_schedule_node_get_ctx(ptr));
13750}
13751
13752isl::union_set schedule_node_domain::domain() const
13753{
13754 if (!ptr)
13755 exception::throw_invalid("NULL input", __FILE__, __LINE__);
13756 auto saved_ctx = ctx();
13757 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13758 auto res = isl_schedule_node_domain_get_domain(get());
13759 if (!res)
13760 exception::throw_last_error(saved_ctx);
13761 return manage(res);
13762}
13763
13764isl::union_set schedule_node_domain::get_domain() const
13765{
13766 return domain();
13767}
13768
13769inline std::ostream &operator<<(std::ostream &os, const schedule_node_domain &obj)
13770{
13771 if (!obj.get())
13772 exception::throw_invalid("NULL input", __FILE__, __LINE__);
13773 auto saved_ctx = isl_schedule_node_get_ctx(obj.get());
13774 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13775 char *str = isl_schedule_node_to_str(obj.get());
13776 if (!str)
13777 exception::throw_last_error(saved_ctx);
13778 os << str;
13779 free(str);
13780 return os;
13781}
13782
13783// implementations for isl::schedule_node_expansion
13784schedule_node_expansion::schedule_node_expansion()
13785 : schedule_node() {}
13786
13787schedule_node_expansion::schedule_node_expansion(const schedule_node_expansion &obj)
13788 : schedule_node(obj)
13789{
13790}
13791
13792schedule_node_expansion::schedule_node_expansion(__isl_take isl_schedule_node *ptr)
13793 : schedule_node(ptr) {}
13794
13795schedule_node_expansion &schedule_node_expansion::operator=(schedule_node_expansion obj) {
13796 std::swap(this->ptr, obj.ptr);
13797 return *this;
13798}
13799
13800isl::ctx schedule_node_expansion::ctx() const {
13801 return isl::ctx(isl_schedule_node_get_ctx(ptr));
13802}
13803
13804isl::union_pw_multi_aff schedule_node_expansion::contraction() const
13805{
13806 if (!ptr)
13807 exception::throw_invalid("NULL input", __FILE__, __LINE__);
13808 auto saved_ctx = ctx();
13809 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13810 auto res = isl_schedule_node_expansion_get_contraction(get());
13811 if (!res)
13812 exception::throw_last_error(saved_ctx);
13813 return manage(res);
13814}
13815
13816isl::union_pw_multi_aff schedule_node_expansion::get_contraction() const
13817{
13818 return contraction();
13819}
13820
13821isl::union_map schedule_node_expansion::expansion() const
13822{
13823 if (!ptr)
13824 exception::throw_invalid("NULL input", __FILE__, __LINE__);
13825 auto saved_ctx = ctx();
13826 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13827 auto res = isl_schedule_node_expansion_get_expansion(get());
13828 if (!res)
13829 exception::throw_last_error(saved_ctx);
13830 return manage(res);
13831}
13832
13833isl::union_map schedule_node_expansion::get_expansion() const
13834{
13835 return expansion();
13836}
13837
13838inline std::ostream &operator<<(std::ostream &os, const schedule_node_expansion &obj)
13839{
13840 if (!obj.get())
13841 exception::throw_invalid("NULL input", __FILE__, __LINE__);
13842 auto saved_ctx = isl_schedule_node_get_ctx(obj.get());
13843 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13844 char *str = isl_schedule_node_to_str(obj.get());
13845 if (!str)
13846 exception::throw_last_error(saved_ctx);
13847 os << str;
13848 free(str);
13849 return os;
13850}
13851
13852// implementations for isl::schedule_node_extension
13853schedule_node_extension::schedule_node_extension()
13854 : schedule_node() {}
13855
13856schedule_node_extension::schedule_node_extension(const schedule_node_extension &obj)
13857 : schedule_node(obj)
13858{
13859}
13860
13861schedule_node_extension::schedule_node_extension(__isl_take isl_schedule_node *ptr)
13862 : schedule_node(ptr) {}
13863
13864schedule_node_extension &schedule_node_extension::operator=(schedule_node_extension obj) {
13865 std::swap(this->ptr, obj.ptr);
13866 return *this;
13867}
13868
13869isl::ctx schedule_node_extension::ctx() const {
13870 return isl::ctx(isl_schedule_node_get_ctx(ptr));
13871}
13872
13873isl::union_map schedule_node_extension::extension() const
13874{
13875 if (!ptr)
13876 exception::throw_invalid("NULL input", __FILE__, __LINE__);
13877 auto saved_ctx = ctx();
13878 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13879 auto res = isl_schedule_node_extension_get_extension(get());
13880 if (!res)
13881 exception::throw_last_error(saved_ctx);
13882 return manage(res);
13883}
13884
13885isl::union_map schedule_node_extension::get_extension() const
13886{
13887 return extension();
13888}
13889
13890inline std::ostream &operator<<(std::ostream &os, const schedule_node_extension &obj)
13891{
13892 if (!obj.get())
13893 exception::throw_invalid("NULL input", __FILE__, __LINE__);
13894 auto saved_ctx = isl_schedule_node_get_ctx(obj.get());
13895 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13896 char *str = isl_schedule_node_to_str(obj.get());
13897 if (!str)
13898 exception::throw_last_error(saved_ctx);
13899 os << str;
13900 free(str);
13901 return os;
13902}
13903
13904// implementations for isl::schedule_node_filter
13905schedule_node_filter::schedule_node_filter()
13906 : schedule_node() {}
13907
13908schedule_node_filter::schedule_node_filter(const schedule_node_filter &obj)
13909 : schedule_node(obj)
13910{
13911}
13912
13913schedule_node_filter::schedule_node_filter(__isl_take isl_schedule_node *ptr)
13914 : schedule_node(ptr) {}
13915
13916schedule_node_filter &schedule_node_filter::operator=(schedule_node_filter obj) {
13917 std::swap(this->ptr, obj.ptr);
13918 return *this;
13919}
13920
13921isl::ctx schedule_node_filter::ctx() const {
13922 return isl::ctx(isl_schedule_node_get_ctx(ptr));
13923}
13924
13925isl::union_set schedule_node_filter::filter() const
13926{
13927 if (!ptr)
13928 exception::throw_invalid("NULL input", __FILE__, __LINE__);
13929 auto saved_ctx = ctx();
13930 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13931 auto res = isl_schedule_node_filter_get_filter(get());
13932 if (!res)
13933 exception::throw_last_error(saved_ctx);
13934 return manage(res);
13935}
13936
13937isl::union_set schedule_node_filter::get_filter() const
13938{
13939 return filter();
13940}
13941
13942inline std::ostream &operator<<(std::ostream &os, const schedule_node_filter &obj)
13943{
13944 if (!obj.get())
13945 exception::throw_invalid("NULL input", __FILE__, __LINE__);
13946 auto saved_ctx = isl_schedule_node_get_ctx(obj.get());
13947 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13948 char *str = isl_schedule_node_to_str(obj.get());
13949 if (!str)
13950 exception::throw_last_error(saved_ctx);
13951 os << str;
13952 free(str);
13953 return os;
13954}
13955
13956// implementations for isl::schedule_node_guard
13957schedule_node_guard::schedule_node_guard()
13958 : schedule_node() {}
13959
13960schedule_node_guard::schedule_node_guard(const schedule_node_guard &obj)
13961 : schedule_node(obj)
13962{
13963}
13964
13965schedule_node_guard::schedule_node_guard(__isl_take isl_schedule_node *ptr)
13966 : schedule_node(ptr) {}
13967
13968schedule_node_guard &schedule_node_guard::operator=(schedule_node_guard obj) {
13969 std::swap(this->ptr, obj.ptr);
13970 return *this;
13971}
13972
13973isl::ctx schedule_node_guard::ctx() const {
13974 return isl::ctx(isl_schedule_node_get_ctx(ptr));
13975}
13976
13977isl::set schedule_node_guard::guard() const
13978{
13979 if (!ptr)
13980 exception::throw_invalid("NULL input", __FILE__, __LINE__);
13981 auto saved_ctx = ctx();
13982 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13983 auto res = isl_schedule_node_guard_get_guard(get());
13984 if (!res)
13985 exception::throw_last_error(saved_ctx);
13986 return manage(res);
13987}
13988
13989isl::set schedule_node_guard::get_guard() const
13990{
13991 return guard();
13992}
13993
13994inline std::ostream &operator<<(std::ostream &os, const schedule_node_guard &obj)
13995{
13996 if (!obj.get())
13997 exception::throw_invalid("NULL input", __FILE__, __LINE__);
13998 auto saved_ctx = isl_schedule_node_get_ctx(obj.get());
13999 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14000 char *str = isl_schedule_node_to_str(obj.get());
14001 if (!str)
14002 exception::throw_last_error(saved_ctx);
14003 os << str;
14004 free(str);
14005 return os;
14006}
14007
14008// implementations for isl::schedule_node_leaf
14009schedule_node_leaf::schedule_node_leaf()
14010 : schedule_node() {}
14011
14012schedule_node_leaf::schedule_node_leaf(const schedule_node_leaf &obj)
14013 : schedule_node(obj)
14014{
14015}
14016
14017schedule_node_leaf::schedule_node_leaf(__isl_take isl_schedule_node *ptr)
14018 : schedule_node(ptr) {}
14019
14020schedule_node_leaf &schedule_node_leaf::operator=(schedule_node_leaf obj) {
14021 std::swap(this->ptr, obj.ptr);
14022 return *this;
14023}
14024
14025isl::ctx schedule_node_leaf::ctx() const {
14026 return isl::ctx(isl_schedule_node_get_ctx(ptr));
14027}
14028
14029inline std::ostream &operator<<(std::ostream &os, const schedule_node_leaf &obj)
14030{
14031 if (!obj.get())
14032 exception::throw_invalid("NULL input", __FILE__, __LINE__);
14033 auto saved_ctx = isl_schedule_node_get_ctx(obj.get());
14034 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14035 char *str = isl_schedule_node_to_str(obj.get());
14036 if (!str)
14037 exception::throw_last_error(saved_ctx);
14038 os << str;
14039 free(str);
14040 return os;
14041}
14042
14043// implementations for isl::schedule_node_mark
14044schedule_node_mark::schedule_node_mark()
14045 : schedule_node() {}
14046
14047schedule_node_mark::schedule_node_mark(const schedule_node_mark &obj)
14048 : schedule_node(obj)
14049{
14050}
14051
14052schedule_node_mark::schedule_node_mark(__isl_take isl_schedule_node *ptr)
14053 : schedule_node(ptr) {}
14054
14055schedule_node_mark &schedule_node_mark::operator=(schedule_node_mark obj) {
14056 std::swap(this->ptr, obj.ptr);
14057 return *this;
14058}
14059
14060isl::ctx schedule_node_mark::ctx() const {
14061 return isl::ctx(isl_schedule_node_get_ctx(ptr));
14062}
14063
14064inline std::ostream &operator<<(std::ostream &os, const schedule_node_mark &obj)
14065{
14066 if (!obj.get())
14067 exception::throw_invalid("NULL input", __FILE__, __LINE__);
14068 auto saved_ctx = isl_schedule_node_get_ctx(obj.get());
14069 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14070 char *str = isl_schedule_node_to_str(obj.get());
14071 if (!str)
14072 exception::throw_last_error(saved_ctx);
14073 os << str;
14074 free(str);
14075 return os;
14076}
14077
14078// implementations for isl::schedule_node_sequence
14079schedule_node_sequence::schedule_node_sequence()
14080 : schedule_node() {}
14081
14082schedule_node_sequence::schedule_node_sequence(const schedule_node_sequence &obj)
14083 : schedule_node(obj)
14084{
14085}
14086
14087schedule_node_sequence::schedule_node_sequence(__isl_take isl_schedule_node *ptr)
14088 : schedule_node(ptr) {}
14089
14090schedule_node_sequence &schedule_node_sequence::operator=(schedule_node_sequence obj) {
14091 std::swap(this->ptr, obj.ptr);
14092 return *this;
14093}
14094
14095isl::ctx schedule_node_sequence::ctx() const {
14096 return isl::ctx(isl_schedule_node_get_ctx(ptr));
14097}
14098
14099inline std::ostream &operator<<(std::ostream &os, const schedule_node_sequence &obj)
14100{
14101 if (!obj.get())
14102 exception::throw_invalid("NULL input", __FILE__, __LINE__);
14103 auto saved_ctx = isl_schedule_node_get_ctx(obj.get());
14104 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14105 char *str = isl_schedule_node_to_str(obj.get());
14106 if (!str)
14107 exception::throw_last_error(saved_ctx);
14108 os << str;
14109 free(str);
14110 return os;
14111}
14112
14113// implementations for isl::schedule_node_set
14114schedule_node_set::schedule_node_set()
14115 : schedule_node() {}
14116
14117schedule_node_set::schedule_node_set(const schedule_node_set &obj)
14118 : schedule_node(obj)
14119{
14120}
14121
14122schedule_node_set::schedule_node_set(__isl_take isl_schedule_node *ptr)
14123 : schedule_node(ptr) {}
14124
14125schedule_node_set &schedule_node_set::operator=(schedule_node_set obj) {
14126 std::swap(this->ptr, obj.ptr);
14127 return *this;
14128}
14129
14130isl::ctx schedule_node_set::ctx() const {
14131 return isl::ctx(isl_schedule_node_get_ctx(ptr));
14132}
14133
14134inline std::ostream &operator<<(std::ostream &os, const schedule_node_set &obj)
14135{
14136 if (!obj.get())
14137 exception::throw_invalid("NULL input", __FILE__, __LINE__);
14138 auto saved_ctx = isl_schedule_node_get_ctx(obj.get());
14139 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14140 char *str = isl_schedule_node_to_str(obj.get());
14141 if (!str)
14142 exception::throw_last_error(saved_ctx);
14143 os << str;
14144 free(str);
14145 return os;
14146}
14147
14148// implementations for isl::set
14149set manage(__isl_take isl_set *ptr) {
14150 if (!ptr)
14151 exception::throw_invalid("NULL input", __FILE__, __LINE__);
14152 return set(ptr);
14153}
14154set manage_copy(__isl_keep isl_set *ptr) {
14155 if (!ptr)
14156 exception::throw_invalid("NULL input", __FILE__, __LINE__);
14157 auto saved_ctx = isl_set_get_ctx(ptr);
14158 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14159 ptr = isl_set_copy(ptr);
14160 if (!ptr)
14161 exception::throw_last_error(saved_ctx);
14162 return set(ptr);
14163}
14164
14165set::set()
14166 : ptr(nullptr) {}
14167
14168set::set(const set &obj)
14169 : ptr(nullptr)
14170{
14171 if (!obj.ptr)
14172 exception::throw_invalid("NULL input", __FILE__, __LINE__);
14173 auto saved_ctx = isl_set_get_ctx(obj.ptr);
14174 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14175 ptr = obj.copy();
14176 if (!ptr)
14177 exception::throw_last_error(saved_ctx);
14178}
14179
14180set::set(__isl_take isl_set *ptr)
14181 : ptr(ptr) {}
14182
14183set::set(isl::basic_set bset)
14184{
14185 if (bset.is_null())
14186 exception::throw_invalid("NULL input", __FILE__, __LINE__);
14187 auto saved_ctx = bset.ctx();
14188 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14189 auto res = isl_set_from_basic_set(bset.release());
14190 if (!res)
14191 exception::throw_last_error(saved_ctx);
14192 ptr = res;
14193}
14194
14195set::set(isl::point pnt)
14196{
14197 if (pnt.is_null())
14198 exception::throw_invalid("NULL input", __FILE__, __LINE__);
14199 auto saved_ctx = pnt.ctx();
14200 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14201 auto res = isl_set_from_point(pnt.release());
14202 if (!res)
14203 exception::throw_last_error(saved_ctx);
14204 ptr = res;
14205}
14206
14207set::set(isl::ctx ctx, const std::string &str)
14208{
14209 auto saved_ctx = ctx;
14210 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14211 auto res = isl_set_read_from_str(ctx.release(), str.c_str());
14212 if (!res)
14213 exception::throw_last_error(saved_ctx);
14214 ptr = res;
14215}
14216
14217set &set::operator=(set obj) {
14218 std::swap(this->ptr, obj.ptr);
14219 return *this;
14220}
14221
14222set::~set() {
14223 if (ptr)
14224 isl_set_free(ptr);
14225}
14226
14227__isl_give isl_set *set::copy() const & {
14228 return isl_set_copy(ptr);
14229}
14230
14231__isl_keep isl_set *set::get() const {
14232 return ptr;
14233}
14234
14235__isl_give isl_set *set::release() {
14236 isl_set *tmp = ptr;
14237 ptr = nullptr;
14238 return tmp;
14239}
14240
14241bool set::is_null() const {
14242 return ptr == nullptr;
14243}
14244
14245isl::ctx set::ctx() const {
14246 return isl::ctx(isl_set_get_ctx(ptr));
14247}
14248
14249isl::basic_set set::affine_hull() const
14250{
14251 if (!ptr)
14252 exception::throw_invalid("NULL input", __FILE__, __LINE__);
14253 auto saved_ctx = ctx();
14254 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14255 auto res = isl_set_affine_hull(copy());
14256 if (!res)
14257 exception::throw_last_error(saved_ctx);
14258 return manage(res);
14259}
14260
14261isl::set set::apply(isl::map map) const
14262{
14263 if (!ptr || map.is_null())
14264 exception::throw_invalid("NULL input", __FILE__, __LINE__);
14265 auto saved_ctx = ctx();
14266 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14267 auto res = isl_set_apply(copy(), map.release());
14268 if (!res)
14269 exception::throw_last_error(saved_ctx);
14270 return manage(res);
14271}
14272
14273isl::set set::bind(isl::multi_id tuple) const
14274{
14275 if (!ptr || tuple.is_null())
14276 exception::throw_invalid("NULL input", __FILE__, __LINE__);
14277 auto saved_ctx = ctx();
14278 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14279 auto res = isl_set_bind(copy(), tuple.release());
14280 if (!res)
14281 exception::throw_last_error(saved_ctx);
14282 return manage(res);
14283}
14284
14285isl::set set::coalesce() const
14286{
14287 if (!ptr)
14288 exception::throw_invalid("NULL input", __FILE__, __LINE__);
14289 auto saved_ctx = ctx();
14290 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14291 auto res = isl_set_coalesce(copy());
14292 if (!res)
14293 exception::throw_last_error(saved_ctx);
14294 return manage(res);
14295}
14296
14297isl::set set::complement() const
14298{
14299 if (!ptr)
14300 exception::throw_invalid("NULL input", __FILE__, __LINE__);
14301 auto saved_ctx = ctx();
14302 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14303 auto res = isl_set_complement(copy());
14304 if (!res)
14305 exception::throw_last_error(saved_ctx);
14306 return manage(res);
14307}
14308
14309isl::set set::detect_equalities() const
14310{
14311 if (!ptr)
14312 exception::throw_invalid("NULL input", __FILE__, __LINE__);
14313 auto saved_ctx = ctx();
14314 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14315 auto res = isl_set_detect_equalities(copy());
14316 if (!res)
14317 exception::throw_last_error(saved_ctx);
14318 return manage(res);
14319}
14320
14321isl::val set::dim_max_val(int pos) const
14322{
14323 if (!ptr)
14324 exception::throw_invalid("NULL input", __FILE__, __LINE__);
14325 auto saved_ctx = ctx();
14326 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14327 auto res = isl_set_dim_max_val(copy(), pos);
14328 if (!res)
14329 exception::throw_last_error(saved_ctx);
14330 return manage(res);
14331}
14332
14333isl::val set::dim_min_val(int pos) const
14334{
14335 if (!ptr)
14336 exception::throw_invalid("NULL input", __FILE__, __LINE__);
14337 auto saved_ctx = ctx();
14338 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14339 auto res = isl_set_dim_min_val(copy(), pos);
14340 if (!res)
14341 exception::throw_last_error(saved_ctx);
14342 return manage(res);
14343}
14344
14345isl::set set::empty(isl::space space)
14346{
14347 if (space.is_null())
14348 exception::throw_invalid("NULL input", __FILE__, __LINE__);
14349 auto saved_ctx = space.ctx();
14350 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14351 auto res = isl_set_empty(space.release());
14352 if (!res)
14353 exception::throw_last_error(saved_ctx);
14354 return manage(res);
14355}
14356
14357isl::set set::flatten() const
14358{
14359 if (!ptr)
14360 exception::throw_invalid("NULL input", __FILE__, __LINE__);
14361 auto saved_ctx = ctx();
14362 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14363 auto res = isl_set_flatten(copy());
14364 if (!res)
14365 exception::throw_last_error(saved_ctx);
14366 return manage(res);
14367}
14368
14369void set::foreach_basic_set(const std::function<void(isl::basic_set)> &fn) const
14370{
14371 if (!ptr)
14372 exception::throw_invalid("NULL input", __FILE__, __LINE__);
14373 auto saved_ctx = ctx();
14374 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14375 struct fn_data {
14376 std::function<void(isl::basic_set)> func;
14377 std::exception_ptr eptr;
14378 } fn_data = { fn };
14379 auto fn_lambda = [](isl_basic_set *arg_0, void *arg_1) -> isl_stat {
14380 auto *data = static_cast<struct fn_data *>(arg_1);
14381 ISL_CPP_TRY {
14382 (data->func)(manage(arg_0));
14383 return isl_stat_ok;
14384 } ISL_CPP_CATCH_ALL {
14385 data->eptr = std::current_exception();
14386 return isl_stat_error;
14387 }
14388 };
14389 auto res = isl_set_foreach_basic_set(get(), fn_lambda, &fn_data);
14390 if (fn_data.eptr)
14391 std::rethrow_exception(fn_data.eptr);
14392 if (res < 0)
14393 exception::throw_last_error(saved_ctx);
14394 return;
14395}
14396
14397void set::foreach_point(const std::function<void(isl::point)> &fn) const
14398{
14399 if (!ptr)
14400 exception::throw_invalid("NULL input", __FILE__, __LINE__);
14401 auto saved_ctx = ctx();
14402 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14403 struct fn_data {
14404 std::function<void(isl::point)> func;
14405 std::exception_ptr eptr;
14406 } fn_data = { fn };
14407 auto fn_lambda = [](isl_point *arg_0, void *arg_1) -> isl_stat {
14408 auto *data = static_cast<struct fn_data *>(arg_1);
14409 ISL_CPP_TRY {
14410 (data->func)(manage(arg_0));
14411 return isl_stat_ok;
14412 } ISL_CPP_CATCH_ALL {
14413 data->eptr = std::current_exception();
14414 return isl_stat_error;
14415 }
14416 };
14417 auto res = isl_set_foreach_point(get(), fn_lambda, &fn_data);
14418 if (fn_data.eptr)
14419 std::rethrow_exception(fn_data.eptr);
14420 if (res < 0)
14421 exception::throw_last_error(saved_ctx);
14422 return;
14423}
14424
14425isl::multi_val set::plain_multi_val_if_fixed() const
14426{
14427 if (!ptr)
14428 exception::throw_invalid("NULL input", __FILE__, __LINE__);
14429 auto saved_ctx = ctx();
14430 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14431 auto res = isl_set_get_plain_multi_val_if_fixed(get());
14432 if (!res)
14433 exception::throw_last_error(saved_ctx);
14434 return manage(res);
14435}
14436
14437isl::multi_val set::get_plain_multi_val_if_fixed() const
14438{
14439 return plain_multi_val_if_fixed();
14440}
14441
14442isl::fixed_box set::simple_fixed_box_hull() const
14443{
14444 if (!ptr)
14445 exception::throw_invalid("NULL input", __FILE__, __LINE__);
14446 auto saved_ctx = ctx();
14447 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14448 auto res = isl_set_get_simple_fixed_box_hull(get());
14449 if (!res)
14450 exception::throw_last_error(saved_ctx);
14451 return manage(res);
14452}
14453
14454isl::fixed_box set::get_simple_fixed_box_hull() const
14455{
14456 return simple_fixed_box_hull();
14457}
14458
14459isl::space set::space() const
14460{
14461 if (!ptr)
14462 exception::throw_invalid("NULL input", __FILE__, __LINE__);
14463 auto saved_ctx = ctx();
14464 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14465 auto res = isl_set_get_space(get());
14466 if (!res)
14467 exception::throw_last_error(saved_ctx);
14468 return manage(res);
14469}
14470
14471isl::space set::get_space() const
14472{
14473 return space();
14474}
14475
14476isl::val set::stride(int pos) const
14477{
14478 if (!ptr)
14479 exception::throw_invalid("NULL input", __FILE__, __LINE__);
14480 auto saved_ctx = ctx();
14481 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14482 auto res = isl_set_get_stride(get(), pos);
14483 if (!res)
14484 exception::throw_last_error(saved_ctx);
14485 return manage(res);
14486}
14487
14488isl::val set::get_stride(int pos) const
14489{
14490 return stride(pos);
14491}
14492
14493isl::set set::gist(isl::set context) const
14494{
14495 if (!ptr || context.is_null())
14496 exception::throw_invalid("NULL input", __FILE__, __LINE__);
14497 auto saved_ctx = ctx();
14498 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14499 auto res = isl_set_gist(copy(), context.release());
14500 if (!res)
14501 exception::throw_last_error(saved_ctx);
14502 return manage(res);
14503}
14504
14505isl::map set::identity() const
14506{
14507 if (!ptr)
14508 exception::throw_invalid("NULL input", __FILE__, __LINE__);
14509 auto saved_ctx = ctx();
14510 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14511 auto res = isl_set_identity(copy());
14512 if (!res)
14513 exception::throw_last_error(saved_ctx);
14514 return manage(res);
14515}
14516
14517isl::pw_aff set::indicator_function() const
14518{
14519 if (!ptr)
14520 exception::throw_invalid("NULL input", __FILE__, __LINE__);
14521 auto saved_ctx = ctx();
14522 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14523 auto res = isl_set_indicator_function(copy());
14524 if (!res)
14525 exception::throw_last_error(saved_ctx);
14526 return manage(res);
14527}
14528
14529isl::map set::insert_domain(isl::space domain) const
14530{
14531 if (!ptr || domain.is_null())
14532 exception::throw_invalid("NULL input", __FILE__, __LINE__);
14533 auto saved_ctx = ctx();
14534 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14535 auto res = isl_set_insert_domain(copy(), domain.release());
14536 if (!res)
14537 exception::throw_last_error(saved_ctx);
14538 return manage(res);
14539}
14540
14541isl::set set::intersect(isl::set set2) const
14542{
14543 if (!ptr || set2.is_null())
14544 exception::throw_invalid("NULL input", __FILE__, __LINE__);
14545 auto saved_ctx = ctx();
14546 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14547 auto res = isl_set_intersect(copy(), set2.release());
14548 if (!res)
14549 exception::throw_last_error(saved_ctx);
14550 return manage(res);
14551}
14552
14553isl::set set::intersect_params(isl::set params) const
14554{
14555 if (!ptr || params.is_null())
14556 exception::throw_invalid("NULL input", __FILE__, __LINE__);
14557 auto saved_ctx = ctx();
14558 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14559 auto res = isl_set_intersect_params(copy(), params.release());
14560 if (!res)
14561 exception::throw_last_error(saved_ctx);
14562 return manage(res);
14563}
14564
14565bool set::involves_locals() const
14566{
14567 if (!ptr)
14568 exception::throw_invalid("NULL input", __FILE__, __LINE__);
14569 auto saved_ctx = ctx();
14570 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14571 auto res = isl_set_involves_locals(get());
14572 if (res < 0)
14573 exception::throw_last_error(saved_ctx);
14574 return res;
14575}
14576
14577bool set::is_disjoint(const isl::set &set2) const
14578{
14579 if (!ptr || set2.is_null())
14580 exception::throw_invalid("NULL input", __FILE__, __LINE__);
14581 auto saved_ctx = ctx();
14582 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14583 auto res = isl_set_is_disjoint(get(), set2.get());
14584 if (res < 0)
14585 exception::throw_last_error(saved_ctx);
14586 return res;
14587}
14588
14589bool set::is_empty() const
14590{
14591 if (!ptr)
14592 exception::throw_invalid("NULL input", __FILE__, __LINE__);
14593 auto saved_ctx = ctx();
14594 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14595 auto res = isl_set_is_empty(get());
14596 if (res < 0)
14597 exception::throw_last_error(saved_ctx);
14598 return res;
14599}
14600
14601bool set::is_equal(const isl::set &set2) const
14602{
14603 if (!ptr || set2.is_null())
14604 exception::throw_invalid("NULL input", __FILE__, __LINE__);
14605 auto saved_ctx = ctx();
14606 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14607 auto res = isl_set_is_equal(get(), set2.get());
14608 if (res < 0)
14609 exception::throw_last_error(saved_ctx);
14610 return res;
14611}
14612
14613bool set::is_singleton() const
14614{
14615 if (!ptr)
14616 exception::throw_invalid("NULL input", __FILE__, __LINE__);
14617 auto saved_ctx = ctx();
14618 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14619 auto res = isl_set_is_singleton(get());
14620 if (res < 0)
14621 exception::throw_last_error(saved_ctx);
14622 return res;
14623}
14624
14625bool set::is_strict_subset(const isl::set &set2) const
14626{
14627 if (!ptr || set2.is_null())
14628 exception::throw_invalid("NULL input", __FILE__, __LINE__);
14629 auto saved_ctx = ctx();
14630 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14631 auto res = isl_set_is_strict_subset(get(), set2.get());
14632 if (res < 0)
14633 exception::throw_last_error(saved_ctx);
14634 return res;
14635}
14636
14637bool set::is_subset(const isl::set &set2) const
14638{
14639 if (!ptr || set2.is_null())
14640 exception::throw_invalid("NULL input", __FILE__, __LINE__);
14641 auto saved_ctx = ctx();
14642 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14643 auto res = isl_set_is_subset(get(), set2.get());
14644 if (res < 0)
14645 exception::throw_last_error(saved_ctx);
14646 return res;
14647}
14648
14649bool set::is_wrapping() const
14650{
14651 if (!ptr)
14652 exception::throw_invalid("NULL input", __FILE__, __LINE__);
14653 auto saved_ctx = ctx();
14654 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14655 auto res = isl_set_is_wrapping(get());
14656 if (res < 0)
14657 exception::throw_last_error(saved_ctx);
14658 return res;
14659}
14660
14661isl::set set::lexmax() const
14662{
14663 if (!ptr)
14664 exception::throw_invalid("NULL input", __FILE__, __LINE__);
14665 auto saved_ctx = ctx();
14666 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14667 auto res = isl_set_lexmax(copy());
14668 if (!res)
14669 exception::throw_last_error(saved_ctx);
14670 return manage(res);
14671}
14672
14673isl::pw_multi_aff set::lexmax_pw_multi_aff() const
14674{
14675 if (!ptr)
14676 exception::throw_invalid("NULL input", __FILE__, __LINE__);
14677 auto saved_ctx = ctx();
14678 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14679 auto res = isl_set_lexmax_pw_multi_aff(copy());
14680 if (!res)
14681 exception::throw_last_error(saved_ctx);
14682 return manage(res);
14683}
14684
14685isl::set set::lexmin() const
14686{
14687 if (!ptr)
14688 exception::throw_invalid("NULL input", __FILE__, __LINE__);
14689 auto saved_ctx = ctx();
14690 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14691 auto res = isl_set_lexmin(copy());
14692 if (!res)
14693 exception::throw_last_error(saved_ctx);
14694 return manage(res);
14695}
14696
14697isl::pw_multi_aff set::lexmin_pw_multi_aff() const
14698{
14699 if (!ptr)
14700 exception::throw_invalid("NULL input", __FILE__, __LINE__);
14701 auto saved_ctx = ctx();
14702 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14703 auto res = isl_set_lexmin_pw_multi_aff(copy());
14704 if (!res)
14705 exception::throw_last_error(saved_ctx);
14706 return manage(res);
14707}
14708
14709isl::set set::lower_bound(isl::multi_pw_aff lower) const
14710{
14711 if (!ptr || lower.is_null())
14712 exception::throw_invalid("NULL input", __FILE__, __LINE__);
14713 auto saved_ctx = ctx();
14714 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14715 auto res = isl_set_lower_bound_multi_pw_aff(copy(), lower.release());
14716 if (!res)
14717 exception::throw_last_error(saved_ctx);
14718 return manage(res);
14719}
14720
14721isl::set set::lower_bound(isl::multi_val lower) const
14722{
14723 if (!ptr || lower.is_null())
14724 exception::throw_invalid("NULL input", __FILE__, __LINE__);
14725 auto saved_ctx = ctx();
14726 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14727 auto res = isl_set_lower_bound_multi_val(copy(), lower.release());
14728 if (!res)
14729 exception::throw_last_error(saved_ctx);
14730 return manage(res);
14731}
14732
14733isl::multi_pw_aff set::max_multi_pw_aff() const
14734{
14735 if (!ptr)
14736 exception::throw_invalid("NULL input", __FILE__, __LINE__);
14737 auto saved_ctx = ctx();
14738 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14739 auto res = isl_set_max_multi_pw_aff(copy());
14740 if (!res)
14741 exception::throw_last_error(saved_ctx);
14742 return manage(res);
14743}
14744
14745isl::val set::max_val(const isl::aff &obj) const
14746{
14747 if (!ptr || obj.is_null())
14748 exception::throw_invalid("NULL input", __FILE__, __LINE__);
14749 auto saved_ctx = ctx();
14750 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14751 auto res = isl_set_max_val(get(), obj.get());
14752 if (!res)
14753 exception::throw_last_error(saved_ctx);
14754 return manage(res);
14755}
14756
14757isl::multi_pw_aff set::min_multi_pw_aff() const
14758{
14759 if (!ptr)
14760 exception::throw_invalid("NULL input", __FILE__, __LINE__);
14761 auto saved_ctx = ctx();
14762 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14763 auto res = isl_set_min_multi_pw_aff(copy());
14764 if (!res)
14765 exception::throw_last_error(saved_ctx);
14766 return manage(res);
14767}
14768
14769isl::val set::min_val(const isl::aff &obj) const
14770{
14771 if (!ptr || obj.is_null())
14772 exception::throw_invalid("NULL input", __FILE__, __LINE__);
14773 auto saved_ctx = ctx();
14774 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14775 auto res = isl_set_min_val(get(), obj.get());
14776 if (!res)
14777 exception::throw_last_error(saved_ctx);
14778 return manage(res);
14779}
14780
14781isl::set set::params() const
14782{
14783 if (!ptr)
14784 exception::throw_invalid("NULL input", __FILE__, __LINE__);
14785 auto saved_ctx = ctx();
14786 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14787 auto res = isl_set_params(copy());
14788 if (!res)
14789 exception::throw_last_error(saved_ctx);
14790 return manage(res);
14791}
14792
14793isl::basic_set set::polyhedral_hull() const
14794{
14795 if (!ptr)
14796 exception::throw_invalid("NULL input", __FILE__, __LINE__);
14797 auto saved_ctx = ctx();
14798 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14799 auto res = isl_set_polyhedral_hull(copy());
14800 if (!res)
14801 exception::throw_last_error(saved_ctx);
14802 return manage(res);
14803}
14804
14805isl::set set::preimage(isl::multi_aff ma) const
14806{
14807 if (!ptr || ma.is_null())
14808 exception::throw_invalid("NULL input", __FILE__, __LINE__);
14809 auto saved_ctx = ctx();
14810 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14811 auto res = isl_set_preimage_multi_aff(copy(), ma.release());
14812 if (!res)
14813 exception::throw_last_error(saved_ctx);
14814 return manage(res);
14815}
14816
14817isl::set set::preimage(isl::multi_pw_aff mpa) const
14818{
14819 if (!ptr || mpa.is_null())
14820 exception::throw_invalid("NULL input", __FILE__, __LINE__);
14821 auto saved_ctx = ctx();
14822 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14823 auto res = isl_set_preimage_multi_pw_aff(copy(), mpa.release());
14824 if (!res)
14825 exception::throw_last_error(saved_ctx);
14826 return manage(res);
14827}
14828
14829isl::set set::preimage(isl::pw_multi_aff pma) const
14830{
14831 if (!ptr || pma.is_null())
14832 exception::throw_invalid("NULL input", __FILE__, __LINE__);
14833 auto saved_ctx = ctx();
14834 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14835 auto res = isl_set_preimage_pw_multi_aff(copy(), pma.release());
14836 if (!res)
14837 exception::throw_last_error(saved_ctx);
14838 return manage(res);
14839}
14840
14841isl::set set::product(isl::set set2) const
14842{
14843 if (!ptr || set2.is_null())
14844 exception::throw_invalid("NULL input", __FILE__, __LINE__);
14845 auto saved_ctx = ctx();
14846 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14847 auto res = isl_set_product(copy(), set2.release());
14848 if (!res)
14849 exception::throw_last_error(saved_ctx);
14850 return manage(res);
14851}
14852
14853isl::set set::project_out_all_params() const
14854{
14855 if (!ptr)
14856 exception::throw_invalid("NULL input", __FILE__, __LINE__);
14857 auto saved_ctx = ctx();
14858 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14859 auto res = isl_set_project_out_all_params(copy());
14860 if (!res)
14861 exception::throw_last_error(saved_ctx);
14862 return manage(res);
14863}
14864
14865isl::set set::project_out_param(isl::id id) const
14866{
14867 if (!ptr || id.is_null())
14868 exception::throw_invalid("NULL input", __FILE__, __LINE__);
14869 auto saved_ctx = ctx();
14870 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14871 auto res = isl_set_project_out_param_id(copy(), id.release());
14872 if (!res)
14873 exception::throw_last_error(saved_ctx);
14874 return manage(res);
14875}
14876
14877isl::set set::project_out_param(const std::string &id) const
14878{
14879 if (!ptr)
14880 exception::throw_invalid("NULL input", __FILE__, __LINE__);
14881 return this->project_out_param(isl::id(ctx(), id));
14882}
14883
14884isl::set set::project_out_param(isl::id_list list) const
14885{
14886 if (!ptr || list.is_null())
14887 exception::throw_invalid("NULL input", __FILE__, __LINE__);
14888 auto saved_ctx = ctx();
14889 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14890 auto res = isl_set_project_out_param_id_list(copy(), list.release());
14891 if (!res)
14892 exception::throw_last_error(saved_ctx);
14893 return manage(res);
14894}
14895
14896isl::basic_set set::sample() const
14897{
14898 if (!ptr)
14899 exception::throw_invalid("NULL input", __FILE__, __LINE__);
14900 auto saved_ctx = ctx();
14901 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14902 auto res = isl_set_sample(copy());
14903 if (!res)
14904 exception::throw_last_error(saved_ctx);
14905 return manage(res);
14906}
14907
14908isl::point set::sample_point() const
14909{
14910 if (!ptr)
14911 exception::throw_invalid("NULL input", __FILE__, __LINE__);
14912 auto saved_ctx = ctx();
14913 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14914 auto res = isl_set_sample_point(copy());
14915 if (!res)
14916 exception::throw_last_error(saved_ctx);
14917 return manage(res);
14918}
14919
14920isl::set set::subtract(isl::set set2) const
14921{
14922 if (!ptr || set2.is_null())
14923 exception::throw_invalid("NULL input", __FILE__, __LINE__);
14924 auto saved_ctx = ctx();
14925 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14926 auto res = isl_set_subtract(copy(), set2.release());
14927 if (!res)
14928 exception::throw_last_error(saved_ctx);
14929 return manage(res);
14930}
14931
14932isl::set set::unbind_params(isl::multi_id tuple) const
14933{
14934 if (!ptr || tuple.is_null())
14935 exception::throw_invalid("NULL input", __FILE__, __LINE__);
14936 auto saved_ctx = ctx();
14937 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14938 auto res = isl_set_unbind_params(copy(), tuple.release());
14939 if (!res)
14940 exception::throw_last_error(saved_ctx);
14941 return manage(res);
14942}
14943
14944isl::map set::unbind_params_insert_domain(isl::multi_id domain) const
14945{
14946 if (!ptr || domain.is_null())
14947 exception::throw_invalid("NULL input", __FILE__, __LINE__);
14948 auto saved_ctx = ctx();
14949 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14950 auto res = isl_set_unbind_params_insert_domain(copy(), domain.release());
14951 if (!res)
14952 exception::throw_last_error(saved_ctx);
14953 return manage(res);
14954}
14955
14956isl::set set::unite(isl::set set2) const
14957{
14958 if (!ptr || set2.is_null())
14959 exception::throw_invalid("NULL input", __FILE__, __LINE__);
14960 auto saved_ctx = ctx();
14961 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14962 auto res = isl_set_union(copy(), set2.release());
14963 if (!res)
14964 exception::throw_last_error(saved_ctx);
14965 return manage(res);
14966}
14967
14968isl::set set::universe(isl::space space)
14969{
14970 if (space.is_null())
14971 exception::throw_invalid("NULL input", __FILE__, __LINE__);
14972 auto saved_ctx = space.ctx();
14973 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14974 auto res = isl_set_universe(space.release());
14975 if (!res)
14976 exception::throw_last_error(saved_ctx);
14977 return manage(res);
14978}
14979
14980isl::basic_set set::unshifted_simple_hull() const
14981{
14982 if (!ptr)
14983 exception::throw_invalid("NULL input", __FILE__, __LINE__);
14984 auto saved_ctx = ctx();
14985 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14986 auto res = isl_set_unshifted_simple_hull(copy());
14987 if (!res)
14988 exception::throw_last_error(saved_ctx);
14989 return manage(res);
14990}
14991
14992isl::map set::unwrap() const
14993{
14994 if (!ptr)
14995 exception::throw_invalid("NULL input", __FILE__, __LINE__);
14996 auto saved_ctx = ctx();
14997 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14998 auto res = isl_set_unwrap(copy());
14999 if (!res)
15000 exception::throw_last_error(saved_ctx);
15001 return manage(res);
15002}
15003
15004isl::set set::upper_bound(isl::multi_pw_aff upper) const
15005{
15006 if (!ptr || upper.is_null())
15007 exception::throw_invalid("NULL input", __FILE__, __LINE__);
15008 auto saved_ctx = ctx();
15009 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15010 auto res = isl_set_upper_bound_multi_pw_aff(copy(), upper.release());
15011 if (!res)
15012 exception::throw_last_error(saved_ctx);
15013 return manage(res);
15014}
15015
15016isl::set set::upper_bound(isl::multi_val upper) const
15017{
15018 if (!ptr || upper.is_null())
15019 exception::throw_invalid("NULL input", __FILE__, __LINE__);
15020 auto saved_ctx = ctx();
15021 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15022 auto res = isl_set_upper_bound_multi_val(copy(), upper.release());
15023 if (!res)
15024 exception::throw_last_error(saved_ctx);
15025 return manage(res);
15026}
15027
15028inline std::ostream &operator<<(std::ostream &os, const set &obj)
15029{
15030 if (!obj.get())
15031 exception::throw_invalid("NULL input", __FILE__, __LINE__);
15032 auto saved_ctx = isl_set_get_ctx(obj.get());
15033 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15034 char *str = isl_set_to_str(obj.get());
15035 if (!str)
15036 exception::throw_last_error(saved_ctx);
15037 os << str;
15038 free(str);
15039 return os;
15040}
15041
15042// implementations for isl::space
15043space manage(__isl_take isl_space *ptr) {
15044 if (!ptr)
15045 exception::throw_invalid("NULL input", __FILE__, __LINE__);
15046 return space(ptr);
15047}
15048space manage_copy(__isl_keep isl_space *ptr) {
15049 if (!ptr)
15050 exception::throw_invalid("NULL input", __FILE__, __LINE__);
15051 auto saved_ctx = isl_space_get_ctx(ptr);
15052 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15053 ptr = isl_space_copy(ptr);
15054 if (!ptr)
15055 exception::throw_last_error(saved_ctx);
15056 return space(ptr);
15057}
15058
15059space::space()
15060 : ptr(nullptr) {}
15061
15062space::space(const space &obj)
15063 : ptr(nullptr)
15064{
15065 if (!obj.ptr)
15066 exception::throw_invalid("NULL input", __FILE__, __LINE__);
15067 auto saved_ctx = isl_space_get_ctx(obj.ptr);
15068 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15069 ptr = obj.copy();
15070 if (!ptr)
15071 exception::throw_last_error(saved_ctx);
15072}
15073
15074space::space(__isl_take isl_space *ptr)
15075 : ptr(ptr) {}
15076
15077space &space::operator=(space obj) {
15078 std::swap(this->ptr, obj.ptr);
15079 return *this;
15080}
15081
15082space::~space() {
15083 if (ptr)
15084 isl_space_free(ptr);
15085}
15086
15087__isl_give isl_space *space::copy() const & {
15088 return isl_space_copy(ptr);
15089}
15090
15091__isl_keep isl_space *space::get() const {
15092 return ptr;
15093}
15094
15095__isl_give isl_space *space::release() {
15096 isl_space *tmp = ptr;
15097 ptr = nullptr;
15098 return tmp;
15099}
15100
15101bool space::is_null() const {
15102 return ptr == nullptr;
15103}
15104
15105isl::ctx space::ctx() const {
15106 return isl::ctx(isl_space_get_ctx(ptr));
15107}
15108
15109isl::space space::add_named_tuple(isl::id tuple_id, unsigned int dim) const
15110{
15111 if (!ptr || tuple_id.is_null())
15112 exception::throw_invalid("NULL input", __FILE__, __LINE__);
15113 auto saved_ctx = ctx();
15114 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15115 auto res = isl_space_add_named_tuple_id_ui(copy(), tuple_id.release(), dim);
15116 if (!res)
15117 exception::throw_last_error(saved_ctx);
15118 return manage(res);
15119}
15120
15121isl::space space::add_named_tuple(const std::string &tuple_id, unsigned int dim) const
15122{
15123 if (!ptr)
15124 exception::throw_invalid("NULL input", __FILE__, __LINE__);
15125 return this->add_named_tuple(isl::id(ctx(), tuple_id), dim);
15126}
15127
15128isl::space space::add_unnamed_tuple(unsigned int dim) const
15129{
15130 if (!ptr)
15131 exception::throw_invalid("NULL input", __FILE__, __LINE__);
15132 auto saved_ctx = ctx();
15133 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15134 auto res = isl_space_add_unnamed_tuple_ui(copy(), dim);
15135 if (!res)
15136 exception::throw_last_error(saved_ctx);
15137 return manage(res);
15138}
15139
15140isl::space space::domain() const
15141{
15142 if (!ptr)
15143 exception::throw_invalid("NULL input", __FILE__, __LINE__);
15144 auto saved_ctx = ctx();
15145 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15146 auto res = isl_space_domain(copy());
15147 if (!res)
15148 exception::throw_last_error(saved_ctx);
15149 return manage(res);
15150}
15151
15152isl::space space::flatten_domain() const
15153{
15154 if (!ptr)
15155 exception::throw_invalid("NULL input", __FILE__, __LINE__);
15156 auto saved_ctx = ctx();
15157 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15158 auto res = isl_space_flatten_domain(copy());
15159 if (!res)
15160 exception::throw_last_error(saved_ctx);
15161 return manage(res);
15162}
15163
15164isl::space space::flatten_range() const
15165{
15166 if (!ptr)
15167 exception::throw_invalid("NULL input", __FILE__, __LINE__);
15168 auto saved_ctx = ctx();
15169 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15170 auto res = isl_space_flatten_range(copy());
15171 if (!res)
15172 exception::throw_last_error(saved_ctx);
15173 return manage(res);
15174}
15175
15176bool space::is_equal(const isl::space &space2) const
15177{
15178 if (!ptr || space2.is_null())
15179 exception::throw_invalid("NULL input", __FILE__, __LINE__);
15180 auto saved_ctx = ctx();
15181 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15182 auto res = isl_space_is_equal(get(), space2.get());
15183 if (res < 0)
15184 exception::throw_last_error(saved_ctx);
15185 return res;
15186}
15187
15188bool space::is_wrapping() const
15189{
15190 if (!ptr)
15191 exception::throw_invalid("NULL input", __FILE__, __LINE__);
15192 auto saved_ctx = ctx();
15193 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15194 auto res = isl_space_is_wrapping(get());
15195 if (res < 0)
15196 exception::throw_last_error(saved_ctx);
15197 return res;
15198}
15199
15200isl::space space::map_from_set() const
15201{
15202 if (!ptr)
15203 exception::throw_invalid("NULL input", __FILE__, __LINE__);
15204 auto saved_ctx = ctx();
15205 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15206 auto res = isl_space_map_from_set(copy());
15207 if (!res)
15208 exception::throw_last_error(saved_ctx);
15209 return manage(res);
15210}
15211
15212isl::space space::params() const
15213{
15214 if (!ptr)
15215 exception::throw_invalid("NULL input", __FILE__, __LINE__);
15216 auto saved_ctx = ctx();
15217 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15218 auto res = isl_space_params(copy());
15219 if (!res)
15220 exception::throw_last_error(saved_ctx);
15221 return manage(res);
15222}
15223
15224isl::space space::range() const
15225{
15226 if (!ptr)
15227 exception::throw_invalid("NULL input", __FILE__, __LINE__);
15228 auto saved_ctx = ctx();
15229 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15230 auto res = isl_space_range(copy());
15231 if (!res)
15232 exception::throw_last_error(saved_ctx);
15233 return manage(res);
15234}
15235
15236isl::space space::unit(isl::ctx ctx)
15237{
15238 auto saved_ctx = ctx;
15239 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15240 auto res = isl_space_unit(ctx.release());
15241 if (!res)
15242 exception::throw_last_error(saved_ctx);
15243 return manage(res);
15244}
15245
15246isl::space space::unwrap() const
15247{
15248 if (!ptr)
15249 exception::throw_invalid("NULL input", __FILE__, __LINE__);
15250 auto saved_ctx = ctx();
15251 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15252 auto res = isl_space_unwrap(copy());
15253 if (!res)
15254 exception::throw_last_error(saved_ctx);
15255 return manage(res);
15256}
15257
15258isl::space space::wrap() const
15259{
15260 if (!ptr)
15261 exception::throw_invalid("NULL input", __FILE__, __LINE__);
15262 auto saved_ctx = ctx();
15263 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15264 auto res = isl_space_wrap(copy());
15265 if (!res)
15266 exception::throw_last_error(saved_ctx);
15267 return manage(res);
15268}
15269
15270inline std::ostream &operator<<(std::ostream &os, const space &obj)
15271{
15272 if (!obj.get())
15273 exception::throw_invalid("NULL input", __FILE__, __LINE__);
15274 auto saved_ctx = isl_space_get_ctx(obj.get());
15275 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15276 char *str = isl_space_to_str(obj.get());
15277 if (!str)
15278 exception::throw_last_error(saved_ctx);
15279 os << str;
15280 free(str);
15281 return os;
15282}
15283
15284// implementations for isl::union_access_info
15285union_access_info manage(__isl_take isl_union_access_info *ptr) {
15286 if (!ptr)
15287 exception::throw_invalid("NULL input", __FILE__, __LINE__);
15288 return union_access_info(ptr);
15289}
15290union_access_info manage_copy(__isl_keep isl_union_access_info *ptr) {
15291 if (!ptr)
15292 exception::throw_invalid("NULL input", __FILE__, __LINE__);
15293 auto saved_ctx = isl_union_access_info_get_ctx(ptr);
15294 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15295 ptr = isl_union_access_info_copy(ptr);
15296 if (!ptr)
15297 exception::throw_last_error(saved_ctx);
15298 return union_access_info(ptr);
15299}
15300
15301union_access_info::union_access_info()
15302 : ptr(nullptr) {}
15303
15304union_access_info::union_access_info(const union_access_info &obj)
15305 : ptr(nullptr)
15306{
15307 if (!obj.ptr)
15308 exception::throw_invalid("NULL input", __FILE__, __LINE__);
15309 auto saved_ctx = isl_union_access_info_get_ctx(obj.ptr);
15310 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15311 ptr = obj.copy();
15312 if (!ptr)
15313 exception::throw_last_error(saved_ctx);
15314}
15315
15316union_access_info::union_access_info(__isl_take isl_union_access_info *ptr)
15317 : ptr(ptr) {}
15318
15319union_access_info::union_access_info(isl::union_map sink)
15320{
15321 if (sink.is_null())
15322 exception::throw_invalid("NULL input", __FILE__, __LINE__);
15323 auto saved_ctx = sink.ctx();
15324 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15325 auto res = isl_union_access_info_from_sink(sink.release());
15326 if (!res)
15327 exception::throw_last_error(saved_ctx);
15328 ptr = res;
15329}
15330
15331union_access_info &union_access_info::operator=(union_access_info obj) {
15332 std::swap(this->ptr, obj.ptr);
15333 return *this;
15334}
15335
15336union_access_info::~union_access_info() {
15337 if (ptr)
15338 isl_union_access_info_free(ptr);
15339}
15340
15341__isl_give isl_union_access_info *union_access_info::copy() const & {
15342 return isl_union_access_info_copy(ptr);
15343}
15344
15345__isl_keep isl_union_access_info *union_access_info::get() const {
15346 return ptr;
15347}
15348
15349__isl_give isl_union_access_info *union_access_info::release() {
15350 isl_union_access_info *tmp = ptr;
15351 ptr = nullptr;
15352 return tmp;
15353}
15354
15355bool union_access_info::is_null() const {
15356 return ptr == nullptr;
15357}
15358
15359isl::ctx union_access_info::ctx() const {
15360 return isl::ctx(isl_union_access_info_get_ctx(ptr));
15361}
15362
15363isl::union_flow union_access_info::compute_flow() const
15364{
15365 if (!ptr)
15366 exception::throw_invalid("NULL input", __FILE__, __LINE__);
15367 auto saved_ctx = ctx();
15368 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15369 auto res = isl_union_access_info_compute_flow(copy());
15370 if (!res)
15371 exception::throw_last_error(saved_ctx);
15372 return manage(res);
15373}
15374
15375isl::union_access_info union_access_info::set_kill(isl::union_map kill) const
15376{
15377 if (!ptr || kill.is_null())
15378 exception::throw_invalid("NULL input", __FILE__, __LINE__);
15379 auto saved_ctx = ctx();
15380 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15381 auto res = isl_union_access_info_set_kill(copy(), kill.release());
15382 if (!res)
15383 exception::throw_last_error(saved_ctx);
15384 return manage(res);
15385}
15386
15387isl::union_access_info union_access_info::set_may_source(isl::union_map may_source) const
15388{
15389 if (!ptr || may_source.is_null())
15390 exception::throw_invalid("NULL input", __FILE__, __LINE__);
15391 auto saved_ctx = ctx();
15392 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15393 auto res = isl_union_access_info_set_may_source(copy(), may_source.release());
15394 if (!res)
15395 exception::throw_last_error(saved_ctx);
15396 return manage(res);
15397}
15398
15399isl::union_access_info union_access_info::set_must_source(isl::union_map must_source) const
15400{
15401 if (!ptr || must_source.is_null())
15402 exception::throw_invalid("NULL input", __FILE__, __LINE__);
15403 auto saved_ctx = ctx();
15404 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15405 auto res = isl_union_access_info_set_must_source(copy(), must_source.release());
15406 if (!res)
15407 exception::throw_last_error(saved_ctx);
15408 return manage(res);
15409}
15410
15411isl::union_access_info union_access_info::set_schedule(isl::schedule schedule) const
15412{
15413 if (!ptr || schedule.is_null())
15414 exception::throw_invalid("NULL input", __FILE__, __LINE__);
15415 auto saved_ctx = ctx();
15416 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15417 auto res = isl_union_access_info_set_schedule(copy(), schedule.release());
15418 if (!res)
15419 exception::throw_last_error(saved_ctx);
15420 return manage(res);
15421}
15422
15423isl::union_access_info union_access_info::set_schedule_map(isl::union_map schedule_map) const
15424{
15425 if (!ptr || schedule_map.is_null())
15426 exception::throw_invalid("NULL input", __FILE__, __LINE__);
15427 auto saved_ctx = ctx();
15428 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15429 auto res = isl_union_access_info_set_schedule_map(copy(), schedule_map.release());
15430 if (!res)
15431 exception::throw_last_error(saved_ctx);
15432 return manage(res);
15433}
15434
15435inline std::ostream &operator<<(std::ostream &os, const union_access_info &obj)
15436{
15437 if (!obj.get())
15438 exception::throw_invalid("NULL input", __FILE__, __LINE__);
15439 auto saved_ctx = isl_union_access_info_get_ctx(obj.get());
15440 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15441 char *str = isl_union_access_info_to_str(obj.get());
15442 if (!str)
15443 exception::throw_last_error(saved_ctx);
15444 os << str;
15445 free(str);
15446 return os;
15447}
15448
15449// implementations for isl::union_flow
15450union_flow manage(__isl_take isl_union_flow *ptr) {
15451 if (!ptr)
15452 exception::throw_invalid("NULL input", __FILE__, __LINE__);
15453 return union_flow(ptr);
15454}
15455union_flow manage_copy(__isl_keep isl_union_flow *ptr) {
15456 if (!ptr)
15457 exception::throw_invalid("NULL input", __FILE__, __LINE__);
15458 auto saved_ctx = isl_union_flow_get_ctx(ptr);
15459 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15460 ptr = isl_union_flow_copy(ptr);
15461 if (!ptr)
15462 exception::throw_last_error(saved_ctx);
15463 return union_flow(ptr);
15464}
15465
15466union_flow::union_flow()
15467 : ptr(nullptr) {}
15468
15469union_flow::union_flow(const union_flow &obj)
15470 : ptr(nullptr)
15471{
15472 if (!obj.ptr)
15473 exception::throw_invalid("NULL input", __FILE__, __LINE__);
15474 auto saved_ctx = isl_union_flow_get_ctx(obj.ptr);
15475 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15476 ptr = obj.copy();
15477 if (!ptr)
15478 exception::throw_last_error(saved_ctx);
15479}
15480
15481union_flow::union_flow(__isl_take isl_union_flow *ptr)
15482 : ptr(ptr) {}
15483
15484union_flow &union_flow::operator=(union_flow obj) {
15485 std::swap(this->ptr, obj.ptr);
15486 return *this;
15487}
15488
15489union_flow::~union_flow() {
15490 if (ptr)
15491 isl_union_flow_free(ptr);
15492}
15493
15494__isl_give isl_union_flow *union_flow::copy() const & {
15495 return isl_union_flow_copy(ptr);
15496}
15497
15498__isl_keep isl_union_flow *union_flow::get() const {
15499 return ptr;
15500}
15501
15502__isl_give isl_union_flow *union_flow::release() {
15503 isl_union_flow *tmp = ptr;
15504 ptr = nullptr;
15505 return tmp;
15506}
15507
15508bool union_flow::is_null() const {
15509 return ptr == nullptr;
15510}
15511
15512isl::ctx union_flow::ctx() const {
15513 return isl::ctx(isl_union_flow_get_ctx(ptr));
15514}
15515
15516isl::union_map union_flow::full_may_dependence() const
15517{
15518 if (!ptr)
15519 exception::throw_invalid("NULL input", __FILE__, __LINE__);
15520 auto saved_ctx = ctx();
15521 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15522 auto res = isl_union_flow_get_full_may_dependence(get());
15523 if (!res)
15524 exception::throw_last_error(saved_ctx);
15525 return manage(res);
15526}
15527
15528isl::union_map union_flow::get_full_may_dependence() const
15529{
15530 return full_may_dependence();
15531}
15532
15533isl::union_map union_flow::full_must_dependence() const
15534{
15535 if (!ptr)
15536 exception::throw_invalid("NULL input", __FILE__, __LINE__);
15537 auto saved_ctx = ctx();
15538 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15539 auto res = isl_union_flow_get_full_must_dependence(get());
15540 if (!res)
15541 exception::throw_last_error(saved_ctx);
15542 return manage(res);
15543}
15544
15545isl::union_map union_flow::get_full_must_dependence() const
15546{
15547 return full_must_dependence();
15548}
15549
15550isl::union_map union_flow::may_dependence() const
15551{
15552 if (!ptr)
15553 exception::throw_invalid("NULL input", __FILE__, __LINE__);
15554 auto saved_ctx = ctx();
15555 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15556 auto res = isl_union_flow_get_may_dependence(get());
15557 if (!res)
15558 exception::throw_last_error(saved_ctx);
15559 return manage(res);
15560}
15561
15562isl::union_map union_flow::get_may_dependence() const
15563{
15564 return may_dependence();
15565}
15566
15567isl::union_map union_flow::may_no_source() const
15568{
15569 if (!ptr)
15570 exception::throw_invalid("NULL input", __FILE__, __LINE__);
15571 auto saved_ctx = ctx();
15572 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15573 auto res = isl_union_flow_get_may_no_source(get());
15574 if (!res)
15575 exception::throw_last_error(saved_ctx);
15576 return manage(res);
15577}
15578
15579isl::union_map union_flow::get_may_no_source() const
15580{
15581 return may_no_source();
15582}
15583
15584isl::union_map union_flow::must_dependence() const
15585{
15586 if (!ptr)
15587 exception::throw_invalid("NULL input", __FILE__, __LINE__);
15588 auto saved_ctx = ctx();
15589 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15590 auto res = isl_union_flow_get_must_dependence(get());
15591 if (!res)
15592 exception::throw_last_error(saved_ctx);
15593 return manage(res);
15594}
15595
15596isl::union_map union_flow::get_must_dependence() const
15597{
15598 return must_dependence();
15599}
15600
15601isl::union_map union_flow::must_no_source() const
15602{
15603 if (!ptr)
15604 exception::throw_invalid("NULL input", __FILE__, __LINE__);
15605 auto saved_ctx = ctx();
15606 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15607 auto res = isl_union_flow_get_must_no_source(get());
15608 if (!res)
15609 exception::throw_last_error(saved_ctx);
15610 return manage(res);
15611}
15612
15613isl::union_map union_flow::get_must_no_source() const
15614{
15615 return must_no_source();
15616}
15617
15618inline std::ostream &operator<<(std::ostream &os, const union_flow &obj)
15619{
15620 if (!obj.get())
15621 exception::throw_invalid("NULL input", __FILE__, __LINE__);
15622 auto saved_ctx = isl_union_flow_get_ctx(obj.get());
15623 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15624 char *str = isl_union_flow_to_str(obj.get());
15625 if (!str)
15626 exception::throw_last_error(saved_ctx);
15627 os << str;
15628 free(str);
15629 return os;
15630}
15631
15632// implementations for isl::union_map
15633union_map manage(__isl_take isl_union_map *ptr) {
15634 if (!ptr)
15635 exception::throw_invalid("NULL input", __FILE__, __LINE__);
15636 return union_map(ptr);
15637}
15638union_map manage_copy(__isl_keep isl_union_map *ptr) {
15639 if (!ptr)
15640 exception::throw_invalid("NULL input", __FILE__, __LINE__);
15641 auto saved_ctx = isl_union_map_get_ctx(ptr);
15642 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15643 ptr = isl_union_map_copy(ptr);
15644 if (!ptr)
15645 exception::throw_last_error(saved_ctx);
15646 return union_map(ptr);
15647}
15648
15649union_map::union_map()
15650 : ptr(nullptr) {}
15651
15652union_map::union_map(const union_map &obj)
15653 : ptr(nullptr)
15654{
15655 if (!obj.ptr)
15656 exception::throw_invalid("NULL input", __FILE__, __LINE__);
15657 auto saved_ctx = isl_union_map_get_ctx(obj.ptr);
15658 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15659 ptr = obj.copy();
15660 if (!ptr)
15661 exception::throw_last_error(saved_ctx);
15662}
15663
15664union_map::union_map(__isl_take isl_union_map *ptr)
15665 : ptr(ptr) {}
15666
15667union_map::union_map(isl::basic_map bmap)
15668{
15669 if (bmap.is_null())
15670 exception::throw_invalid("NULL input", __FILE__, __LINE__);
15671 auto saved_ctx = bmap.ctx();
15672 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15673 auto res = isl_union_map_from_basic_map(bmap.release());
15674 if (!res)
15675 exception::throw_last_error(saved_ctx);
15676 ptr = res;
15677}
15678
15679union_map::union_map(isl::map map)
15680{
15681 if (map.is_null())
15682 exception::throw_invalid("NULL input", __FILE__, __LINE__);
15683 auto saved_ctx = map.ctx();
15684 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15685 auto res = isl_union_map_from_map(map.release());
15686 if (!res)
15687 exception::throw_last_error(saved_ctx);
15688 ptr = res;
15689}
15690
15691union_map::union_map(isl::ctx ctx, const std::string &str)
15692{
15693 auto saved_ctx = ctx;
15694 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15695 auto res = isl_union_map_read_from_str(ctx.release(), str.c_str());
15696 if (!res)
15697 exception::throw_last_error(saved_ctx);
15698 ptr = res;
15699}
15700
15701union_map &union_map::operator=(union_map obj) {
15702 std::swap(this->ptr, obj.ptr);
15703 return *this;
15704}
15705
15706union_map::~union_map() {
15707 if (ptr)
15708 isl_union_map_free(ptr);
15709}
15710
15711__isl_give isl_union_map *union_map::copy() const & {
15712 return isl_union_map_copy(ptr);
15713}
15714
15715__isl_keep isl_union_map *union_map::get() const {
15716 return ptr;
15717}
15718
15719__isl_give isl_union_map *union_map::release() {
15720 isl_union_map *tmp = ptr;
15721 ptr = nullptr;
15722 return tmp;
15723}
15724
15725bool union_map::is_null() const {
15726 return ptr == nullptr;
15727}
15728
15729isl::ctx union_map::ctx() const {
15730 return isl::ctx(isl_union_map_get_ctx(ptr));
15731}
15732
15733isl::union_map union_map::affine_hull() const
15734{
15735 if (!ptr)
15736 exception::throw_invalid("NULL input", __FILE__, __LINE__);
15737 auto saved_ctx = ctx();
15738 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15739 auto res = isl_union_map_affine_hull(copy());
15740 if (!res)
15741 exception::throw_last_error(saved_ctx);
15742 return manage(res);
15743}
15744
15745isl::union_map union_map::apply_domain(isl::union_map umap2) const
15746{
15747 if (!ptr || umap2.is_null())
15748 exception::throw_invalid("NULL input", __FILE__, __LINE__);
15749 auto saved_ctx = ctx();
15750 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15751 auto res = isl_union_map_apply_domain(copy(), umap2.release());
15752 if (!res)
15753 exception::throw_last_error(saved_ctx);
15754 return manage(res);
15755}
15756
15757isl::union_map union_map::apply_range(isl::union_map umap2) const
15758{
15759 if (!ptr || umap2.is_null())
15760 exception::throw_invalid("NULL input", __FILE__, __LINE__);
15761 auto saved_ctx = ctx();
15762 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15763 auto res = isl_union_map_apply_range(copy(), umap2.release());
15764 if (!res)
15765 exception::throw_last_error(saved_ctx);
15766 return manage(res);
15767}
15768
15769isl::union_set union_map::bind_range(isl::multi_id tuple) const
15770{
15771 if (!ptr || tuple.is_null())
15772 exception::throw_invalid("NULL input", __FILE__, __LINE__);
15773 auto saved_ctx = ctx();
15774 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15775 auto res = isl_union_map_bind_range(copy(), tuple.release());
15776 if (!res)
15777 exception::throw_last_error(saved_ctx);
15778 return manage(res);
15779}
15780
15781isl::union_map union_map::coalesce() const
15782{
15783 if (!ptr)
15784 exception::throw_invalid("NULL input", __FILE__, __LINE__);
15785 auto saved_ctx = ctx();
15786 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15787 auto res = isl_union_map_coalesce(copy());
15788 if (!res)
15789 exception::throw_last_error(saved_ctx);
15790 return manage(res);
15791}
15792
15793isl::union_map union_map::compute_divs() const
15794{
15795 if (!ptr)
15796 exception::throw_invalid("NULL input", __FILE__, __LINE__);
15797 auto saved_ctx = ctx();
15798 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15799 auto res = isl_union_map_compute_divs(copy());
15800 if (!res)
15801 exception::throw_last_error(saved_ctx);
15802 return manage(res);
15803}
15804
15805isl::union_map union_map::curry() const
15806{
15807 if (!ptr)
15808 exception::throw_invalid("NULL input", __FILE__, __LINE__);
15809 auto saved_ctx = ctx();
15810 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15811 auto res = isl_union_map_curry(copy());
15812 if (!res)
15813 exception::throw_last_error(saved_ctx);
15814 return manage(res);
15815}
15816
15817isl::union_set union_map::deltas() const
15818{
15819 if (!ptr)
15820 exception::throw_invalid("NULL input", __FILE__, __LINE__);
15821 auto saved_ctx = ctx();
15822 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15823 auto res = isl_union_map_deltas(copy());
15824 if (!res)
15825 exception::throw_last_error(saved_ctx);
15826 return manage(res);
15827}
15828
15829isl::union_map union_map::detect_equalities() const
15830{
15831 if (!ptr)
15832 exception::throw_invalid("NULL input", __FILE__, __LINE__);
15833 auto saved_ctx = ctx();
15834 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15835 auto res = isl_union_map_detect_equalities(copy());
15836 if (!res)
15837 exception::throw_last_error(saved_ctx);
15838 return manage(res);
15839}
15840
15841isl::union_set union_map::domain() const
15842{
15843 if (!ptr)
15844 exception::throw_invalid("NULL input", __FILE__, __LINE__);
15845 auto saved_ctx = ctx();
15846 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15847 auto res = isl_union_map_domain(copy());
15848 if (!res)
15849 exception::throw_last_error(saved_ctx);
15850 return manage(res);
15851}
15852
15853isl::union_map union_map::domain_factor_domain() const
15854{
15855 if (!ptr)
15856 exception::throw_invalid("NULL input", __FILE__, __LINE__);
15857 auto saved_ctx = ctx();
15858 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15859 auto res = isl_union_map_domain_factor_domain(copy());
15860 if (!res)
15861 exception::throw_last_error(saved_ctx);
15862 return manage(res);
15863}
15864
15865isl::union_map union_map::domain_factor_range() const
15866{
15867 if (!ptr)
15868 exception::throw_invalid("NULL input", __FILE__, __LINE__);
15869 auto saved_ctx = ctx();
15870 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15871 auto res = isl_union_map_domain_factor_range(copy());
15872 if (!res)
15873 exception::throw_last_error(saved_ctx);
15874 return manage(res);
15875}
15876
15877isl::union_map union_map::domain_map() const
15878{
15879 if (!ptr)
15880 exception::throw_invalid("NULL input", __FILE__, __LINE__);
15881 auto saved_ctx = ctx();
15882 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15883 auto res = isl_union_map_domain_map(copy());
15884 if (!res)
15885 exception::throw_last_error(saved_ctx);
15886 return manage(res);
15887}
15888
15889isl::union_pw_multi_aff union_map::domain_map_union_pw_multi_aff() const
15890{
15891 if (!ptr)
15892 exception::throw_invalid("NULL input", __FILE__, __LINE__);
15893 auto saved_ctx = ctx();
15894 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15895 auto res = isl_union_map_domain_map_union_pw_multi_aff(copy());
15896 if (!res)
15897 exception::throw_last_error(saved_ctx);
15898 return manage(res);
15899}
15900
15901isl::union_map union_map::domain_product(isl::union_map umap2) const
15902{
15903 if (!ptr || umap2.is_null())
15904 exception::throw_invalid("NULL input", __FILE__, __LINE__);
15905 auto saved_ctx = ctx();
15906 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15907 auto res = isl_union_map_domain_product(copy(), umap2.release());
15908 if (!res)
15909 exception::throw_last_error(saved_ctx);
15910 return manage(res);
15911}
15912
15913isl::union_map union_map::empty(isl::ctx ctx)
15914{
15915 auto saved_ctx = ctx;
15916 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15917 auto res = isl_union_map_empty_ctx(ctx.release());
15918 if (!res)
15919 exception::throw_last_error(saved_ctx);
15920 return manage(res);
15921}
15922
15923isl::union_map union_map::eq_at(isl::multi_union_pw_aff mupa) const
15924{
15925 if (!ptr || mupa.is_null())
15926 exception::throw_invalid("NULL input", __FILE__, __LINE__);
15927 auto saved_ctx = ctx();
15928 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15929 auto res = isl_union_map_eq_at_multi_union_pw_aff(copy(), mupa.release());
15930 if (!res)
15931 exception::throw_last_error(saved_ctx);
15932 return manage(res);
15933}
15934
15935bool union_map::every_map(const std::function<bool(isl::map)> &test) const
15936{
15937 if (!ptr)
15938 exception::throw_invalid("NULL input", __FILE__, __LINE__);
15939 auto saved_ctx = ctx();
15940 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15941 struct test_data {
15942 std::function<bool(isl::map)> func;
15943 std::exception_ptr eptr;
15944 } test_data = { test };
15945 auto test_lambda = [](isl_map *arg_0, void *arg_1) -> isl_bool {
15946 auto *data = static_cast<struct test_data *>(arg_1);
15947 ISL_CPP_TRY {
15948 auto ret = (data->func)(manage_copy(arg_0));
15949 return ret ? isl_bool_true : isl_bool_false;
15950 } ISL_CPP_CATCH_ALL {
15951 data->eptr = std::current_exception();
15952 return isl_bool_error;
15953 }
15954 };
15955 auto res = isl_union_map_every_map(get(), test_lambda, &test_data);
15956 if (test_data.eptr)
15957 std::rethrow_exception(test_data.eptr);
15958 if (res < 0)
15959 exception::throw_last_error(saved_ctx);
15960 return res;
15961}
15962
15963isl::map union_map::extract_map(isl::space space) const
15964{
15965 if (!ptr || space.is_null())
15966 exception::throw_invalid("NULL input", __FILE__, __LINE__);
15967 auto saved_ctx = ctx();
15968 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15969 auto res = isl_union_map_extract_map(get(), space.release());
15970 if (!res)
15971 exception::throw_last_error(saved_ctx);
15972 return manage(res);
15973}
15974
15975isl::union_map union_map::factor_domain() const
15976{
15977 if (!ptr)
15978 exception::throw_invalid("NULL input", __FILE__, __LINE__);
15979 auto saved_ctx = ctx();
15980 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15981 auto res = isl_union_map_factor_domain(copy());
15982 if (!res)
15983 exception::throw_last_error(saved_ctx);
15984 return manage(res);
15985}
15986
15987isl::union_map union_map::factor_range() const
15988{
15989 if (!ptr)
15990 exception::throw_invalid("NULL input", __FILE__, __LINE__);
15991 auto saved_ctx = ctx();
15992 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15993 auto res = isl_union_map_factor_range(copy());
15994 if (!res)
15995 exception::throw_last_error(saved_ctx);
15996 return manage(res);
15997}
15998
15999isl::union_map union_map::fixed_power(isl::val exp) const
16000{
16001 if (!ptr || exp.is_null())
16002 exception::throw_invalid("NULL input", __FILE__, __LINE__);
16003 auto saved_ctx = ctx();
16004 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16005 auto res = isl_union_map_fixed_power_val(copy(), exp.release());
16006 if (!res)
16007 exception::throw_last_error(saved_ctx);
16008 return manage(res);
16009}
16010
16011isl::union_map union_map::fixed_power(long exp) const
16012{
16013 if (!ptr)
16014 exception::throw_invalid("NULL input", __FILE__, __LINE__);
16015 return this->fixed_power(isl::val(ctx(), exp));
16016}
16017
16018void union_map::foreach_map(const std::function<void(isl::map)> &fn) const
16019{
16020 if (!ptr)
16021 exception::throw_invalid("NULL input", __FILE__, __LINE__);
16022 auto saved_ctx = ctx();
16023 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16024 struct fn_data {
16025 std::function<void(isl::map)> func;
16026 std::exception_ptr eptr;
16027 } fn_data = { fn };
16028 auto fn_lambda = [](isl_map *arg_0, void *arg_1) -> isl_stat {
16029 auto *data = static_cast<struct fn_data *>(arg_1);
16030 ISL_CPP_TRY {
16031 (data->func)(manage(arg_0));
16032 return isl_stat_ok;
16033 } ISL_CPP_CATCH_ALL {
16034 data->eptr = std::current_exception();
16035 return isl_stat_error;
16036 }
16037 };
16038 auto res = isl_union_map_foreach_map(get(), fn_lambda, &fn_data);
16039 if (fn_data.eptr)
16040 std::rethrow_exception(fn_data.eptr);
16041 if (res < 0)
16042 exception::throw_last_error(saved_ctx);
16043 return;
16044}
16045
16046isl::union_map union_map::from(isl::multi_union_pw_aff mupa)
16047{
16048 if (mupa.is_null())
16049 exception::throw_invalid("NULL input", __FILE__, __LINE__);
16050 auto saved_ctx = mupa.ctx();
16051 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16052 auto res = isl_union_map_from_multi_union_pw_aff(mupa.release());
16053 if (!res)
16054 exception::throw_last_error(saved_ctx);
16055 return manage(res);
16056}
16057
16058isl::union_map union_map::from(isl::union_pw_multi_aff upma)
16059{
16060 if (upma.is_null())
16061 exception::throw_invalid("NULL input", __FILE__, __LINE__);
16062 auto saved_ctx = upma.ctx();
16063 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16064 auto res = isl_union_map_from_union_pw_multi_aff(upma.release());
16065 if (!res)
16066 exception::throw_last_error(saved_ctx);
16067 return manage(res);
16068}
16069
16070isl::union_map union_map::from_domain(isl::union_set uset)
16071{
16072 if (uset.is_null())
16073 exception::throw_invalid("NULL input", __FILE__, __LINE__);
16074 auto saved_ctx = uset.ctx();
16075 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16076 auto res = isl_union_map_from_domain(uset.release());
16077 if (!res)
16078 exception::throw_last_error(saved_ctx);
16079 return manage(res);
16080}
16081
16082isl::union_map union_map::from_domain_and_range(isl::union_set domain, isl::union_set range)
16083{
16084 if (domain.is_null() || range.is_null())
16085 exception::throw_invalid("NULL input", __FILE__, __LINE__);
16086 auto saved_ctx = domain.ctx();
16087 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16088 auto res = isl_union_map_from_domain_and_range(domain.release(), range.release());
16089 if (!res)
16090 exception::throw_last_error(saved_ctx);
16091 return manage(res);
16092}
16093
16094isl::union_map union_map::from_range(isl::union_set uset)
16095{
16096 if (uset.is_null())
16097 exception::throw_invalid("NULL input", __FILE__, __LINE__);
16098 auto saved_ctx = uset.ctx();
16099 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16100 auto res = isl_union_map_from_range(uset.release());
16101 if (!res)
16102 exception::throw_last_error(saved_ctx);
16103 return manage(res);
16104}
16105
16106isl::space union_map::space() const
16107{
16108 if (!ptr)
16109 exception::throw_invalid("NULL input", __FILE__, __LINE__);
16110 auto saved_ctx = ctx();
16111 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16112 auto res = isl_union_map_get_space(get());
16113 if (!res)
16114 exception::throw_last_error(saved_ctx);
16115 return manage(res);
16116}
16117
16118isl::space union_map::get_space() const
16119{
16120 return space();
16121}
16122
16123isl::union_map union_map::gist(isl::union_map context) const
16124{
16125 if (!ptr || context.is_null())
16126 exception::throw_invalid("NULL input", __FILE__, __LINE__);
16127 auto saved_ctx = ctx();
16128 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16129 auto res = isl_union_map_gist(copy(), context.release());
16130 if (!res)
16131 exception::throw_last_error(saved_ctx);
16132 return manage(res);
16133}
16134
16135isl::union_map union_map::gist_domain(isl::union_set uset) const
16136{
16137 if (!ptr || uset.is_null())
16138 exception::throw_invalid("NULL input", __FILE__, __LINE__);
16139 auto saved_ctx = ctx();
16140 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16141 auto res = isl_union_map_gist_domain(copy(), uset.release());
16142 if (!res)
16143 exception::throw_last_error(saved_ctx);
16144 return manage(res);
16145}
16146
16147isl::union_map union_map::gist_params(isl::set set) const
16148{
16149 if (!ptr || set.is_null())
16150 exception::throw_invalid("NULL input", __FILE__, __LINE__);
16151 auto saved_ctx = ctx();
16152 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16153 auto res = isl_union_map_gist_params(copy(), set.release());
16154 if (!res)
16155 exception::throw_last_error(saved_ctx);
16156 return manage(res);
16157}
16158
16159isl::union_map union_map::gist_range(isl::union_set uset) const
16160{
16161 if (!ptr || uset.is_null())
16162 exception::throw_invalid("NULL input", __FILE__, __LINE__);
16163 auto saved_ctx = ctx();
16164 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16165 auto res = isl_union_map_gist_range(copy(), uset.release());
16166 if (!res)
16167 exception::throw_last_error(saved_ctx);
16168 return manage(res);
16169}
16170
16171isl::union_map union_map::intersect(isl::union_map umap2) const
16172{
16173 if (!ptr || umap2.is_null())
16174 exception::throw_invalid("NULL input", __FILE__, __LINE__);
16175 auto saved_ctx = ctx();
16176 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16177 auto res = isl_union_map_intersect(copy(), umap2.release());
16178 if (!res)
16179 exception::throw_last_error(saved_ctx);
16180 return manage(res);
16181}
16182
16183isl::union_map union_map::intersect_domain(isl::space space) const
16184{
16185 if (!ptr || space.is_null())
16186 exception::throw_invalid("NULL input", __FILE__, __LINE__);
16187 auto saved_ctx = ctx();
16188 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16189 auto res = isl_union_map_intersect_domain_space(copy(), space.release());
16190 if (!res)
16191 exception::throw_last_error(saved_ctx);
16192 return manage(res);
16193}
16194
16195isl::union_map union_map::intersect_domain(isl::union_set uset) const
16196{
16197 if (!ptr || uset.is_null())
16198 exception::throw_invalid("NULL input", __FILE__, __LINE__);
16199 auto saved_ctx = ctx();
16200 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16201 auto res = isl_union_map_intersect_domain_union_set(copy(), uset.release());
16202 if (!res)
16203 exception::throw_last_error(saved_ctx);
16204 return manage(res);
16205}
16206
16207isl::union_map union_map::intersect_params(isl::set set) const
16208{
16209 if (!ptr || set.is_null())
16210 exception::throw_invalid("NULL input", __FILE__, __LINE__);
16211 auto saved_ctx = ctx();
16212 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16213 auto res = isl_union_map_intersect_params(copy(), set.release());
16214 if (!res)
16215 exception::throw_last_error(saved_ctx);
16216 return manage(res);
16217}
16218
16219isl::union_map union_map::intersect_range(isl::space space) const
16220{
16221 if (!ptr || space.is_null())
16222 exception::throw_invalid("NULL input", __FILE__, __LINE__);
16223 auto saved_ctx = ctx();
16224 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16225 auto res = isl_union_map_intersect_range_space(copy(), space.release());
16226 if (!res)
16227 exception::throw_last_error(saved_ctx);
16228 return manage(res);
16229}
16230
16231isl::union_map union_map::intersect_range(isl::union_set uset) const
16232{
16233 if (!ptr || uset.is_null())
16234 exception::throw_invalid("NULL input", __FILE__, __LINE__);
16235 auto saved_ctx = ctx();
16236 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16237 auto res = isl_union_map_intersect_range_union_set(copy(), uset.release());
16238 if (!res)
16239 exception::throw_last_error(saved_ctx);
16240 return manage(res);
16241}
16242
16243bool union_map::is_bijective() const
16244{
16245 if (!ptr)
16246 exception::throw_invalid("NULL input", __FILE__, __LINE__);
16247 auto saved_ctx = ctx();
16248 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16249 auto res = isl_union_map_is_bijective(get());
16250 if (res < 0)
16251 exception::throw_last_error(saved_ctx);
16252 return res;
16253}
16254
16255bool union_map::is_disjoint(const isl::union_map &umap2) const
16256{
16257 if (!ptr || umap2.is_null())
16258 exception::throw_invalid("NULL input", __FILE__, __LINE__);
16259 auto saved_ctx = ctx();
16260 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16261 auto res = isl_union_map_is_disjoint(get(), umap2.get());
16262 if (res < 0)
16263 exception::throw_last_error(saved_ctx);
16264 return res;
16265}
16266
16267bool union_map::is_empty() const
16268{
16269 if (!ptr)
16270 exception::throw_invalid("NULL input", __FILE__, __LINE__);
16271 auto saved_ctx = ctx();
16272 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16273 auto res = isl_union_map_is_empty(get());
16274 if (res < 0)
16275 exception::throw_last_error(saved_ctx);
16276 return res;
16277}
16278
16279bool union_map::is_equal(const isl::union_map &umap2) const
16280{
16281 if (!ptr || umap2.is_null())
16282 exception::throw_invalid("NULL input", __FILE__, __LINE__);
16283 auto saved_ctx = ctx();
16284 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16285 auto res = isl_union_map_is_equal(get(), umap2.get());
16286 if (res < 0)
16287 exception::throw_last_error(saved_ctx);
16288 return res;
16289}
16290
16291bool union_map::is_injective() const
16292{
16293 if (!ptr)
16294 exception::throw_invalid("NULL input", __FILE__, __LINE__);
16295 auto saved_ctx = ctx();
16296 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16297 auto res = isl_union_map_is_injective(get());
16298 if (res < 0)
16299 exception::throw_last_error(saved_ctx);
16300 return res;
16301}
16302
16303bool union_map::is_single_valued() const
16304{
16305 if (!ptr)
16306 exception::throw_invalid("NULL input", __FILE__, __LINE__);
16307 auto saved_ctx = ctx();
16308 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16309 auto res = isl_union_map_is_single_valued(get());
16310 if (res < 0)
16311 exception::throw_last_error(saved_ctx);
16312 return res;
16313}
16314
16315bool union_map::is_strict_subset(const isl::union_map &umap2) const
16316{
16317 if (!ptr || umap2.is_null())
16318 exception::throw_invalid("NULL input", __FILE__, __LINE__);
16319 auto saved_ctx = ctx();
16320 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16321 auto res = isl_union_map_is_strict_subset(get(), umap2.get());
16322 if (res < 0)
16323 exception::throw_last_error(saved_ctx);
16324 return res;
16325}
16326
16327bool union_map::is_subset(const isl::union_map &umap2) const
16328{
16329 if (!ptr || umap2.is_null())
16330 exception::throw_invalid("NULL input", __FILE__, __LINE__);
16331 auto saved_ctx = ctx();
16332 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16333 auto res = isl_union_map_is_subset(get(), umap2.get());
16334 if (res < 0)
16335 exception::throw_last_error(saved_ctx);
16336 return res;
16337}
16338
16339bool union_map::isa_map() const
16340{
16341 if (!ptr)
16342 exception::throw_invalid("NULL input", __FILE__, __LINE__);
16343 auto saved_ctx = ctx();
16344 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16345 auto res = isl_union_map_isa_map(get());
16346 if (res < 0)
16347 exception::throw_last_error(saved_ctx);
16348 return res;
16349}
16350
16351isl::union_map union_map::lexmax() const
16352{
16353 if (!ptr)
16354 exception::throw_invalid("NULL input", __FILE__, __LINE__);
16355 auto saved_ctx = ctx();
16356 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16357 auto res = isl_union_map_lexmax(copy());
16358 if (!res)
16359 exception::throw_last_error(saved_ctx);
16360 return manage(res);
16361}
16362
16363isl::union_map union_map::lexmin() const
16364{
16365 if (!ptr)
16366 exception::throw_invalid("NULL input", __FILE__, __LINE__);
16367 auto saved_ctx = ctx();
16368 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16369 auto res = isl_union_map_lexmin(copy());
16370 if (!res)
16371 exception::throw_last_error(saved_ctx);
16372 return manage(res);
16373}
16374
16375isl::union_map union_map::polyhedral_hull() const
16376{
16377 if (!ptr)
16378 exception::throw_invalid("NULL input", __FILE__, __LINE__);
16379 auto saved_ctx = ctx();
16380 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16381 auto res = isl_union_map_polyhedral_hull(copy());
16382 if (!res)
16383 exception::throw_last_error(saved_ctx);
16384 return manage(res);
16385}
16386
16387isl::union_map union_map::preimage_domain(isl::multi_aff ma) const
16388{
16389 if (!ptr || ma.is_null())
16390 exception::throw_invalid("NULL input", __FILE__, __LINE__);
16391 auto saved_ctx = ctx();
16392 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16393 auto res = isl_union_map_preimage_domain_multi_aff(copy(), ma.release());
16394 if (!res)
16395 exception::throw_last_error(saved_ctx);
16396 return manage(res);
16397}
16398
16399isl::union_map union_map::preimage_domain(isl::multi_pw_aff mpa) const
16400{
16401 if (!ptr || mpa.is_null())
16402 exception::throw_invalid("NULL input", __FILE__, __LINE__);
16403 auto saved_ctx = ctx();
16404 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16405 auto res = isl_union_map_preimage_domain_multi_pw_aff(copy(), mpa.release());
16406 if (!res)
16407 exception::throw_last_error(saved_ctx);
16408 return manage(res);
16409}
16410
16411isl::union_map union_map::preimage_domain(isl::pw_multi_aff pma) const
16412{
16413 if (!ptr || pma.is_null())
16414 exception::throw_invalid("NULL input", __FILE__, __LINE__);
16415 auto saved_ctx = ctx();
16416 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16417 auto res = isl_union_map_preimage_domain_pw_multi_aff(copy(), pma.release());
16418 if (!res)
16419 exception::throw_last_error(saved_ctx);
16420 return manage(res);
16421}
16422
16423isl::union_map union_map::preimage_domain(isl::union_pw_multi_aff upma) const
16424{
16425 if (!ptr || upma.is_null())
16426 exception::throw_invalid("NULL input", __FILE__, __LINE__);
16427 auto saved_ctx = ctx();
16428 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16429 auto res = isl_union_map_preimage_domain_union_pw_multi_aff(copy(), upma.release());
16430 if (!res)
16431 exception::throw_last_error(saved_ctx);
16432 return manage(res);
16433}
16434
16435isl::union_map union_map::preimage_range(isl::multi_aff ma) const
16436{
16437 if (!ptr || ma.is_null())
16438 exception::throw_invalid("NULL input", __FILE__, __LINE__);
16439 auto saved_ctx = ctx();
16440 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16441 auto res = isl_union_map_preimage_range_multi_aff(copy(), ma.release());
16442 if (!res)
16443 exception::throw_last_error(saved_ctx);
16444 return manage(res);
16445}
16446
16447isl::union_map union_map::preimage_range(isl::pw_multi_aff pma) const
16448{
16449 if (!ptr || pma.is_null())
16450 exception::throw_invalid("NULL input", __FILE__, __LINE__);
16451 auto saved_ctx = ctx();
16452 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16453 auto res = isl_union_map_preimage_range_pw_multi_aff(copy(), pma.release());
16454 if (!res)
16455 exception::throw_last_error(saved_ctx);
16456 return manage(res);
16457}
16458
16459isl::union_map union_map::preimage_range(isl::union_pw_multi_aff upma) const
16460{
16461 if (!ptr || upma.is_null())
16462 exception::throw_invalid("NULL input", __FILE__, __LINE__);
16463 auto saved_ctx = ctx();
16464 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16465 auto res = isl_union_map_preimage_range_union_pw_multi_aff(copy(), upma.release());
16466 if (!res)
16467 exception::throw_last_error(saved_ctx);
16468 return manage(res);
16469}
16470
16471isl::union_map union_map::product(isl::union_map umap2) const
16472{
16473 if (!ptr || umap2.is_null())
16474 exception::throw_invalid("NULL input", __FILE__, __LINE__);
16475 auto saved_ctx = ctx();
16476 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16477 auto res = isl_union_map_product(copy(), umap2.release());
16478 if (!res)
16479 exception::throw_last_error(saved_ctx);
16480 return manage(res);
16481}
16482
16483isl::union_map union_map::project_out_all_params() const
16484{
16485 if (!ptr)
16486 exception::throw_invalid("NULL input", __FILE__, __LINE__);
16487 auto saved_ctx = ctx();
16488 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16489 auto res = isl_union_map_project_out_all_params(copy());
16490 if (!res)
16491 exception::throw_last_error(saved_ctx);
16492 return manage(res);
16493}
16494
16495isl::union_set union_map::range() const
16496{
16497 if (!ptr)
16498 exception::throw_invalid("NULL input", __FILE__, __LINE__);
16499 auto saved_ctx = ctx();
16500 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16501 auto res = isl_union_map_range(copy());
16502 if (!res)
16503 exception::throw_last_error(saved_ctx);
16504 return manage(res);
16505}
16506
16507isl::union_map union_map::range_factor_domain() const
16508{
16509 if (!ptr)
16510 exception::throw_invalid("NULL input", __FILE__, __LINE__);
16511 auto saved_ctx = ctx();
16512 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16513 auto res = isl_union_map_range_factor_domain(copy());
16514 if (!res)
16515 exception::throw_last_error(saved_ctx);
16516 return manage(res);
16517}
16518
16519isl::union_map union_map::range_factor_range() const
16520{
16521 if (!ptr)
16522 exception::throw_invalid("NULL input", __FILE__, __LINE__);
16523 auto saved_ctx = ctx();
16524 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16525 auto res = isl_union_map_range_factor_range(copy());
16526 if (!res)
16527 exception::throw_last_error(saved_ctx);
16528 return manage(res);
16529}
16530
16531isl::union_map union_map::range_map() const
16532{
16533 if (!ptr)
16534 exception::throw_invalid("NULL input", __FILE__, __LINE__);
16535 auto saved_ctx = ctx();
16536 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16537 auto res = isl_union_map_range_map(copy());
16538 if (!res)
16539 exception::throw_last_error(saved_ctx);
16540 return manage(res);
16541}
16542
16543isl::union_map union_map::range_product(isl::union_map umap2) const
16544{
16545 if (!ptr || umap2.is_null())
16546 exception::throw_invalid("NULL input", __FILE__, __LINE__);
16547 auto saved_ctx = ctx();
16548 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16549 auto res = isl_union_map_range_product(copy(), umap2.release());
16550 if (!res)
16551 exception::throw_last_error(saved_ctx);
16552 return manage(res);
16553}
16554
16555isl::union_map union_map::range_reverse() const
16556{
16557 if (!ptr)
16558 exception::throw_invalid("NULL input", __FILE__, __LINE__);
16559 auto saved_ctx = ctx();
16560 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16561 auto res = isl_union_map_range_reverse(copy());
16562 if (!res)
16563 exception::throw_last_error(saved_ctx);
16564 return manage(res);
16565}
16566
16567isl::union_map union_map::reverse() const
16568{
16569 if (!ptr)
16570 exception::throw_invalid("NULL input", __FILE__, __LINE__);
16571 auto saved_ctx = ctx();
16572 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16573 auto res = isl_union_map_reverse(copy());
16574 if (!res)
16575 exception::throw_last_error(saved_ctx);
16576 return manage(res);
16577}
16578
16579isl::union_map union_map::subtract(isl::union_map umap2) const
16580{
16581 if (!ptr || umap2.is_null())
16582 exception::throw_invalid("NULL input", __FILE__, __LINE__);
16583 auto saved_ctx = ctx();
16584 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16585 auto res = isl_union_map_subtract(copy(), umap2.release());
16586 if (!res)
16587 exception::throw_last_error(saved_ctx);
16588 return manage(res);
16589}
16590
16591isl::union_map union_map::subtract_domain(isl::union_set dom) const
16592{
16593 if (!ptr || dom.is_null())
16594 exception::throw_invalid("NULL input", __FILE__, __LINE__);
16595 auto saved_ctx = ctx();
16596 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16597 auto res = isl_union_map_subtract_domain(copy(), dom.release());
16598 if (!res)
16599 exception::throw_last_error(saved_ctx);
16600 return manage(res);
16601}
16602
16603isl::union_map union_map::subtract_range(isl::union_set dom) const
16604{
16605 if (!ptr || dom.is_null())
16606 exception::throw_invalid("NULL input", __FILE__, __LINE__);
16607 auto saved_ctx = ctx();
16608 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16609 auto res = isl_union_map_subtract_range(copy(), dom.release());
16610 if (!res)
16611 exception::throw_last_error(saved_ctx);
16612 return manage(res);
16613}
16614
16615isl::union_map union_map::uncurry() const
16616{
16617 if (!ptr)
16618 exception::throw_invalid("NULL input", __FILE__, __LINE__);
16619 auto saved_ctx = ctx();
16620 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16621 auto res = isl_union_map_uncurry(copy());
16622 if (!res)
16623 exception::throw_last_error(saved_ctx);
16624 return manage(res);
16625}
16626
16627isl::union_map union_map::unite(isl::union_map umap2) const
16628{
16629 if (!ptr || umap2.is_null())
16630 exception::throw_invalid("NULL input", __FILE__, __LINE__);
16631 auto saved_ctx = ctx();
16632 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16633 auto res = isl_union_map_union(copy(), umap2.release());
16634 if (!res)
16635 exception::throw_last_error(saved_ctx);
16636 return manage(res);
16637}
16638
16639isl::union_map union_map::universe() const
16640{
16641 if (!ptr)
16642 exception::throw_invalid("NULL input", __FILE__, __LINE__);
16643 auto saved_ctx = ctx();
16644 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16645 auto res = isl_union_map_universe(copy());
16646 if (!res)
16647 exception::throw_last_error(saved_ctx);
16648 return manage(res);
16649}
16650
16651isl::union_set union_map::wrap() const
16652{
16653 if (!ptr)
16654 exception::throw_invalid("NULL input", __FILE__, __LINE__);
16655 auto saved_ctx = ctx();
16656 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16657 auto res = isl_union_map_wrap(copy());
16658 if (!res)
16659 exception::throw_last_error(saved_ctx);
16660 return manage(res);
16661}
16662
16663isl::union_map union_map::zip() const
16664{
16665 if (!ptr)
16666 exception::throw_invalid("NULL input", __FILE__, __LINE__);
16667 auto saved_ctx = ctx();
16668 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16669 auto res = isl_union_map_zip(copy());
16670 if (!res)
16671 exception::throw_last_error(saved_ctx);
16672 return manage(res);
16673}
16674
16675inline std::ostream &operator<<(std::ostream &os, const union_map &obj)
16676{
16677 if (!obj.get())
16678 exception::throw_invalid("NULL input", __FILE__, __LINE__);
16679 auto saved_ctx = isl_union_map_get_ctx(obj.get());
16680 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16681 char *str = isl_union_map_to_str(obj.get());
16682 if (!str)
16683 exception::throw_last_error(saved_ctx);
16684 os << str;
16685 free(str);
16686 return os;
16687}
16688
16689// implementations for isl::union_pw_aff
16690union_pw_aff manage(__isl_take isl_union_pw_aff *ptr) {
16691 if (!ptr)
16692 exception::throw_invalid("NULL input", __FILE__, __LINE__);
16693 return union_pw_aff(ptr);
16694}
16695union_pw_aff manage_copy(__isl_keep isl_union_pw_aff *ptr) {
16696 if (!ptr)
16697 exception::throw_invalid("NULL input", __FILE__, __LINE__);
16698 auto saved_ctx = isl_union_pw_aff_get_ctx(ptr);
16699 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16700 ptr = isl_union_pw_aff_copy(ptr);
16701 if (!ptr)
16702 exception::throw_last_error(saved_ctx);
16703 return union_pw_aff(ptr);
16704}
16705
16706union_pw_aff::union_pw_aff()
16707 : ptr(nullptr) {}
16708
16709union_pw_aff::union_pw_aff(const union_pw_aff &obj)
16710 : ptr(nullptr)
16711{
16712 if (!obj.ptr)
16713 exception::throw_invalid("NULL input", __FILE__, __LINE__);
16714 auto saved_ctx = isl_union_pw_aff_get_ctx(obj.ptr);
16715 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16716 ptr = obj.copy();
16717 if (!ptr)
16718 exception::throw_last_error(saved_ctx);
16719}
16720
16721union_pw_aff::union_pw_aff(__isl_take isl_union_pw_aff *ptr)
16722 : ptr(ptr) {}
16723
16724union_pw_aff::union_pw_aff(isl::aff aff)
16725{
16726 if (aff.is_null())
16727 exception::throw_invalid("NULL input", __FILE__, __LINE__);
16728 auto saved_ctx = aff.ctx();
16729 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16730 auto res = isl_union_pw_aff_from_aff(aff.release());
16731 if (!res)
16732 exception::throw_last_error(saved_ctx);
16733 ptr = res;
16734}
16735
16736union_pw_aff::union_pw_aff(isl::pw_aff pa)
16737{
16738 if (pa.is_null())
16739 exception::throw_invalid("NULL input", __FILE__, __LINE__);
16740 auto saved_ctx = pa.ctx();
16741 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16742 auto res = isl_union_pw_aff_from_pw_aff(pa.release());
16743 if (!res)
16744 exception::throw_last_error(saved_ctx);
16745 ptr = res;
16746}
16747
16748union_pw_aff::union_pw_aff(isl::ctx ctx, const std::string &str)
16749{
16750 auto saved_ctx = ctx;
16751 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16752 auto res = isl_union_pw_aff_read_from_str(ctx.release(), str.c_str());
16753 if (!res)
16754 exception::throw_last_error(saved_ctx);
16755 ptr = res;
16756}
16757
16758union_pw_aff &union_pw_aff::operator=(union_pw_aff obj) {
16759 std::swap(this->ptr, obj.ptr);
16760 return *this;
16761}
16762
16763union_pw_aff::~union_pw_aff() {
16764 if (ptr)
16765 isl_union_pw_aff_free(ptr);
16766}
16767
16768__isl_give isl_union_pw_aff *union_pw_aff::copy() const & {
16769 return isl_union_pw_aff_copy(ptr);
16770}
16771
16772__isl_keep isl_union_pw_aff *union_pw_aff::get() const {
16773 return ptr;
16774}
16775
16776__isl_give isl_union_pw_aff *union_pw_aff::release() {
16777 isl_union_pw_aff *tmp = ptr;
16778 ptr = nullptr;
16779 return tmp;
16780}
16781
16782bool union_pw_aff::is_null() const {
16783 return ptr == nullptr;
16784}
16785
16786isl::ctx union_pw_aff::ctx() const {
16787 return isl::ctx(isl_union_pw_aff_get_ctx(ptr));
16788}
16789
16790isl::union_pw_aff union_pw_aff::add(isl::union_pw_aff upa2) const
16791{
16792 if (!ptr || upa2.is_null())
16793 exception::throw_invalid("NULL input", __FILE__, __LINE__);
16794 auto saved_ctx = ctx();
16795 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16796 auto res = isl_union_pw_aff_add(copy(), upa2.release());
16797 if (!res)
16798 exception::throw_last_error(saved_ctx);
16799 return manage(res);
16800}
16801
16802isl::union_set union_pw_aff::bind(isl::id id) const
16803{
16804 if (!ptr || id.is_null())
16805 exception::throw_invalid("NULL input", __FILE__, __LINE__);
16806 auto saved_ctx = ctx();
16807 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16808 auto res = isl_union_pw_aff_bind_id(copy(), id.release());
16809 if (!res)
16810 exception::throw_last_error(saved_ctx);
16811 return manage(res);
16812}
16813
16814isl::union_set union_pw_aff::bind(const std::string &id) const
16815{
16816 if (!ptr)
16817 exception::throw_invalid("NULL input", __FILE__, __LINE__);
16818 return this->bind(isl::id(ctx(), id));
16819}
16820
16821isl::union_pw_aff union_pw_aff::coalesce() const
16822{
16823 if (!ptr)
16824 exception::throw_invalid("NULL input", __FILE__, __LINE__);
16825 auto saved_ctx = ctx();
16826 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16827 auto res = isl_union_pw_aff_coalesce(copy());
16828 if (!res)
16829 exception::throw_last_error(saved_ctx);
16830 return manage(res);
16831}
16832
16833isl::union_set union_pw_aff::domain() const
16834{
16835 if (!ptr)
16836 exception::throw_invalid("NULL input", __FILE__, __LINE__);
16837 auto saved_ctx = ctx();
16838 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16839 auto res = isl_union_pw_aff_domain(copy());
16840 if (!res)
16841 exception::throw_last_error(saved_ctx);
16842 return manage(res);
16843}
16844
16845isl::space union_pw_aff::space() const
16846{
16847 if (!ptr)
16848 exception::throw_invalid("NULL input", __FILE__, __LINE__);
16849 auto saved_ctx = ctx();
16850 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16851 auto res = isl_union_pw_aff_get_space(get());
16852 if (!res)
16853 exception::throw_last_error(saved_ctx);
16854 return manage(res);
16855}
16856
16857isl::space union_pw_aff::get_space() const
16858{
16859 return space();
16860}
16861
16862isl::union_pw_aff union_pw_aff::gist(isl::union_set context) const
16863{
16864 if (!ptr || context.is_null())
16865 exception::throw_invalid("NULL input", __FILE__, __LINE__);
16866 auto saved_ctx = ctx();
16867 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16868 auto res = isl_union_pw_aff_gist(copy(), context.release());
16869 if (!res)
16870 exception::throw_last_error(saved_ctx);
16871 return manage(res);
16872}
16873
16874isl::union_pw_aff union_pw_aff::intersect_domain(isl::space space) const
16875{
16876 if (!ptr || space.is_null())
16877 exception::throw_invalid("NULL input", __FILE__, __LINE__);
16878 auto saved_ctx = ctx();
16879 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16880 auto res = isl_union_pw_aff_intersect_domain_space(copy(), space.release());
16881 if (!res)
16882 exception::throw_last_error(saved_ctx);
16883 return manage(res);
16884}
16885
16886isl::union_pw_aff union_pw_aff::intersect_domain(isl::union_set uset) const
16887{
16888 if (!ptr || uset.is_null())
16889 exception::throw_invalid("NULL input", __FILE__, __LINE__);
16890 auto saved_ctx = ctx();
16891 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16892 auto res = isl_union_pw_aff_intersect_domain_union_set(copy(), uset.release());
16893 if (!res)
16894 exception::throw_last_error(saved_ctx);
16895 return manage(res);
16896}
16897
16898isl::union_pw_aff union_pw_aff::intersect_domain_wrapped_domain(isl::union_set uset) const
16899{
16900 if (!ptr || uset.is_null())
16901 exception::throw_invalid("NULL input", __FILE__, __LINE__);
16902 auto saved_ctx = ctx();
16903 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16904 auto res = isl_union_pw_aff_intersect_domain_wrapped_domain(copy(), uset.release());
16905 if (!res)
16906 exception::throw_last_error(saved_ctx);
16907 return manage(res);
16908}
16909
16910isl::union_pw_aff union_pw_aff::intersect_domain_wrapped_range(isl::union_set uset) const
16911{
16912 if (!ptr || uset.is_null())
16913 exception::throw_invalid("NULL input", __FILE__, __LINE__);
16914 auto saved_ctx = ctx();
16915 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16916 auto res = isl_union_pw_aff_intersect_domain_wrapped_range(copy(), uset.release());
16917 if (!res)
16918 exception::throw_last_error(saved_ctx);
16919 return manage(res);
16920}
16921
16922isl::union_pw_aff union_pw_aff::intersect_params(isl::set set) const
16923{
16924 if (!ptr || set.is_null())
16925 exception::throw_invalid("NULL input", __FILE__, __LINE__);
16926 auto saved_ctx = ctx();
16927 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16928 auto res = isl_union_pw_aff_intersect_params(copy(), set.release());
16929 if (!res)
16930 exception::throw_last_error(saved_ctx);
16931 return manage(res);
16932}
16933
16934isl::union_pw_aff union_pw_aff::pullback(isl::union_pw_multi_aff upma) const
16935{
16936 if (!ptr || upma.is_null())
16937 exception::throw_invalid("NULL input", __FILE__, __LINE__);
16938 auto saved_ctx = ctx();
16939 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16940 auto res = isl_union_pw_aff_pullback_union_pw_multi_aff(copy(), upma.release());
16941 if (!res)
16942 exception::throw_last_error(saved_ctx);
16943 return manage(res);
16944}
16945
16946isl::union_pw_aff union_pw_aff::sub(isl::union_pw_aff upa2) const
16947{
16948 if (!ptr || upa2.is_null())
16949 exception::throw_invalid("NULL input", __FILE__, __LINE__);
16950 auto saved_ctx = ctx();
16951 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16952 auto res = isl_union_pw_aff_sub(copy(), upa2.release());
16953 if (!res)
16954 exception::throw_last_error(saved_ctx);
16955 return manage(res);
16956}
16957
16958isl::union_pw_aff union_pw_aff::subtract_domain(isl::space space) const
16959{
16960 if (!ptr || space.is_null())
16961 exception::throw_invalid("NULL input", __FILE__, __LINE__);
16962 auto saved_ctx = ctx();
16963 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16964 auto res = isl_union_pw_aff_subtract_domain_space(copy(), space.release());
16965 if (!res)
16966 exception::throw_last_error(saved_ctx);
16967 return manage(res);
16968}
16969
16970isl::union_pw_aff union_pw_aff::subtract_domain(isl::union_set uset) const
16971{
16972 if (!ptr || uset.is_null())
16973 exception::throw_invalid("NULL input", __FILE__, __LINE__);
16974 auto saved_ctx = ctx();
16975 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16976 auto res = isl_union_pw_aff_subtract_domain_union_set(copy(), uset.release());
16977 if (!res)
16978 exception::throw_last_error(saved_ctx);
16979 return manage(res);
16980}
16981
16982isl::union_pw_aff union_pw_aff::union_add(isl::union_pw_aff upa2) const
16983{
16984 if (!ptr || upa2.is_null())
16985 exception::throw_invalid("NULL input", __FILE__, __LINE__);
16986 auto saved_ctx = ctx();
16987 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16988 auto res = isl_union_pw_aff_union_add(copy(), upa2.release());
16989 if (!res)
16990 exception::throw_last_error(saved_ctx);
16991 return manage(res);
16992}
16993
16994inline std::ostream &operator<<(std::ostream &os, const union_pw_aff &obj)
16995{
16996 if (!obj.get())
16997 exception::throw_invalid("NULL input", __FILE__, __LINE__);
16998 auto saved_ctx = isl_union_pw_aff_get_ctx(obj.get());
16999 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17000 char *str = isl_union_pw_aff_to_str(obj.get());
17001 if (!str)
17002 exception::throw_last_error(saved_ctx);
17003 os << str;
17004 free(str);
17005 return os;
17006}
17007
17008// implementations for isl::union_pw_aff_list
17009union_pw_aff_list manage(__isl_take isl_union_pw_aff_list *ptr) {
17010 if (!ptr)
17011 exception::throw_invalid("NULL input", __FILE__, __LINE__);
17012 return union_pw_aff_list(ptr);
17013}
17014union_pw_aff_list manage_copy(__isl_keep isl_union_pw_aff_list *ptr) {
17015 if (!ptr)
17016 exception::throw_invalid("NULL input", __FILE__, __LINE__);
17017 auto saved_ctx = isl_union_pw_aff_list_get_ctx(ptr);
17018 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17019 ptr = isl_union_pw_aff_list_copy(ptr);
17020 if (!ptr)
17021 exception::throw_last_error(saved_ctx);
17022 return union_pw_aff_list(ptr);
17023}
17024
17025union_pw_aff_list::union_pw_aff_list()
17026 : ptr(nullptr) {}
17027
17028union_pw_aff_list::union_pw_aff_list(const union_pw_aff_list &obj)
17029 : ptr(nullptr)
17030{
17031 if (!obj.ptr)
17032 exception::throw_invalid("NULL input", __FILE__, __LINE__);
17033 auto saved_ctx = isl_union_pw_aff_list_get_ctx(obj.ptr);
17034 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17035 ptr = obj.copy();
17036 if (!ptr)
17037 exception::throw_last_error(saved_ctx);
17038}
17039
17040union_pw_aff_list::union_pw_aff_list(__isl_take isl_union_pw_aff_list *ptr)
17041 : ptr(ptr) {}
17042
17043union_pw_aff_list::union_pw_aff_list(isl::ctx ctx, int n)
17044{
17045 auto saved_ctx = ctx;
17046 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17047 auto res = isl_union_pw_aff_list_alloc(ctx.release(), n);
17048 if (!res)
17049 exception::throw_last_error(saved_ctx);
17050 ptr = res;
17051}
17052
17053union_pw_aff_list::union_pw_aff_list(isl::union_pw_aff el)
17054{
17055 if (el.is_null())
17056 exception::throw_invalid("NULL input", __FILE__, __LINE__);
17057 auto saved_ctx = el.ctx();
17058 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17059 auto res = isl_union_pw_aff_list_from_union_pw_aff(el.release());
17060 if (!res)
17061 exception::throw_last_error(saved_ctx);
17062 ptr = res;
17063}
17064
17065union_pw_aff_list &union_pw_aff_list::operator=(union_pw_aff_list obj) {
17066 std::swap(this->ptr, obj.ptr);
17067 return *this;
17068}
17069
17070union_pw_aff_list::~union_pw_aff_list() {
17071 if (ptr)
17072 isl_union_pw_aff_list_free(ptr);
17073}
17074
17075__isl_give isl_union_pw_aff_list *union_pw_aff_list::copy() const & {
17076 return isl_union_pw_aff_list_copy(ptr);
17077}
17078
17079__isl_keep isl_union_pw_aff_list *union_pw_aff_list::get() const {
17080 return ptr;
17081}
17082
17083__isl_give isl_union_pw_aff_list *union_pw_aff_list::release() {
17084 isl_union_pw_aff_list *tmp = ptr;
17085 ptr = nullptr;
17086 return tmp;
17087}
17088
17089bool union_pw_aff_list::is_null() const {
17090 return ptr == nullptr;
17091}
17092
17093isl::ctx union_pw_aff_list::ctx() const {
17094 return isl::ctx(isl_union_pw_aff_list_get_ctx(ptr));
17095}
17096
17097isl::union_pw_aff_list union_pw_aff_list::add(isl::union_pw_aff el) const
17098{
17099 if (!ptr || el.is_null())
17100 exception::throw_invalid("NULL input", __FILE__, __LINE__);
17101 auto saved_ctx = ctx();
17102 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17103 auto res = isl_union_pw_aff_list_add(copy(), el.release());
17104 if (!res)
17105 exception::throw_last_error(saved_ctx);
17106 return manage(res);
17107}
17108
17109isl::union_pw_aff_list union_pw_aff_list::clear() const
17110{
17111 if (!ptr)
17112 exception::throw_invalid("NULL input", __FILE__, __LINE__);
17113 auto saved_ctx = ctx();
17114 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17115 auto res = isl_union_pw_aff_list_clear(copy());
17116 if (!res)
17117 exception::throw_last_error(saved_ctx);
17118 return manage(res);
17119}
17120
17121isl::union_pw_aff_list union_pw_aff_list::concat(isl::union_pw_aff_list list2) const
17122{
17123 if (!ptr || list2.is_null())
17124 exception::throw_invalid("NULL input", __FILE__, __LINE__);
17125 auto saved_ctx = ctx();
17126 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17127 auto res = isl_union_pw_aff_list_concat(copy(), list2.release());
17128 if (!res)
17129 exception::throw_last_error(saved_ctx);
17130 return manage(res);
17131}
17132
17133isl::union_pw_aff_list union_pw_aff_list::drop(unsigned int first, unsigned int n) const
17134{
17135 if (!ptr)
17136 exception::throw_invalid("NULL input", __FILE__, __LINE__);
17137 auto saved_ctx = ctx();
17138 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17139 auto res = isl_union_pw_aff_list_drop(copy(), first, n);
17140 if (!res)
17141 exception::throw_last_error(saved_ctx);
17142 return manage(res);
17143}
17144
17145void union_pw_aff_list::foreach(const std::function<void(isl::union_pw_aff)> &fn) const
17146{
17147 if (!ptr)
17148 exception::throw_invalid("NULL input", __FILE__, __LINE__);
17149 auto saved_ctx = ctx();
17150 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17151 struct fn_data {
17152 std::function<void(isl::union_pw_aff)> func;
17153 std::exception_ptr eptr;
17154 } fn_data = { fn };
17155 auto fn_lambda = [](isl_union_pw_aff *arg_0, void *arg_1) -> isl_stat {
17156 auto *data = static_cast<struct fn_data *>(arg_1);
17157 ISL_CPP_TRY {
17158 (data->func)(manage(arg_0));
17159 return isl_stat_ok;
17160 } ISL_CPP_CATCH_ALL {
17161 data->eptr = std::current_exception();
17162 return isl_stat_error;
17163 }
17164 };
17165 auto res = isl_union_pw_aff_list_foreach(get(), fn_lambda, &fn_data);
17166 if (fn_data.eptr)
17167 std::rethrow_exception(fn_data.eptr);
17168 if (res < 0)
17169 exception::throw_last_error(saved_ctx);
17170 return;
17171}
17172
17173isl::union_pw_aff union_pw_aff_list::at(int index) const
17174{
17175 if (!ptr)
17176 exception::throw_invalid("NULL input", __FILE__, __LINE__);
17177 auto saved_ctx = ctx();
17178 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17179 auto res = isl_union_pw_aff_list_get_at(get(), index);
17180 if (!res)
17181 exception::throw_last_error(saved_ctx);
17182 return manage(res);
17183}
17184
17185isl::union_pw_aff union_pw_aff_list::get_at(int index) const
17186{
17187 return at(index);
17188}
17189
17190isl::union_pw_aff_list union_pw_aff_list::insert(unsigned int pos, isl::union_pw_aff el) const
17191{
17192 if (!ptr || el.is_null())
17193 exception::throw_invalid("NULL input", __FILE__, __LINE__);
17194 auto saved_ctx = ctx();
17195 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17196 auto res = isl_union_pw_aff_list_insert(copy(), pos, el.release());
17197 if (!res)
17198 exception::throw_last_error(saved_ctx);
17199 return manage(res);
17200}
17201
17202unsigned union_pw_aff_list::size() const
17203{
17204 if (!ptr)
17205 exception::throw_invalid("NULL input", __FILE__, __LINE__);
17206 auto saved_ctx = ctx();
17207 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17208 auto res = isl_union_pw_aff_list_size(get());
17209 if (res < 0)
17210 exception::throw_last_error(saved_ctx);
17211 return res;
17212}
17213
17214inline std::ostream &operator<<(std::ostream &os, const union_pw_aff_list &obj)
17215{
17216 if (!obj.get())
17217 exception::throw_invalid("NULL input", __FILE__, __LINE__);
17218 auto saved_ctx = isl_union_pw_aff_list_get_ctx(obj.get());
17219 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17220 char *str = isl_union_pw_aff_list_to_str(obj.get());
17221 if (!str)
17222 exception::throw_last_error(saved_ctx);
17223 os << str;
17224 free(str);
17225 return os;
17226}
17227
17228// implementations for isl::union_pw_multi_aff
17229union_pw_multi_aff manage(__isl_take isl_union_pw_multi_aff *ptr) {
17230 if (!ptr)
17231 exception::throw_invalid("NULL input", __FILE__, __LINE__);
17232 return union_pw_multi_aff(ptr);
17233}
17234union_pw_multi_aff manage_copy(__isl_keep isl_union_pw_multi_aff *ptr) {
17235 if (!ptr)
17236 exception::throw_invalid("NULL input", __FILE__, __LINE__);
17237 auto saved_ctx = isl_union_pw_multi_aff_get_ctx(ptr);
17238 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17239 ptr = isl_union_pw_multi_aff_copy(ptr);
17240 if (!ptr)
17241 exception::throw_last_error(saved_ctx);
17242 return union_pw_multi_aff(ptr);
17243}
17244
17245union_pw_multi_aff::union_pw_multi_aff()
17246 : ptr(nullptr) {}
17247
17248union_pw_multi_aff::union_pw_multi_aff(const union_pw_multi_aff &obj)
17249 : ptr(nullptr)
17250{
17251 if (!obj.ptr)
17252 exception::throw_invalid("NULL input", __FILE__, __LINE__);
17253 auto saved_ctx = isl_union_pw_multi_aff_get_ctx(obj.ptr);
17254 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17255 ptr = obj.copy();
17256 if (!ptr)
17257 exception::throw_last_error(saved_ctx);
17258}
17259
17260union_pw_multi_aff::union_pw_multi_aff(__isl_take isl_union_pw_multi_aff *ptr)
17261 : ptr(ptr) {}
17262
17263union_pw_multi_aff::union_pw_multi_aff(isl::multi_aff ma)
17264{
17265 if (ma.is_null())
17266 exception::throw_invalid("NULL input", __FILE__, __LINE__);
17267 auto saved_ctx = ma.ctx();
17268 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17269 auto res = isl_union_pw_multi_aff_from_multi_aff(ma.release());
17270 if (!res)
17271 exception::throw_last_error(saved_ctx);
17272 ptr = res;
17273}
17274
17275union_pw_multi_aff::union_pw_multi_aff(isl::pw_multi_aff pma)
17276{
17277 if (pma.is_null())
17278 exception::throw_invalid("NULL input", __FILE__, __LINE__);
17279 auto saved_ctx = pma.ctx();
17280 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17281 auto res = isl_union_pw_multi_aff_from_pw_multi_aff(pma.release());
17282 if (!res)
17283 exception::throw_last_error(saved_ctx);
17284 ptr = res;
17285}
17286
17287union_pw_multi_aff::union_pw_multi_aff(isl::union_pw_aff upa)
17288{
17289 if (upa.is_null())
17290 exception::throw_invalid("NULL input", __FILE__, __LINE__);
17291 auto saved_ctx = upa.ctx();
17292 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17293 auto res = isl_union_pw_multi_aff_from_union_pw_aff(upa.release());
17294 if (!res)
17295 exception::throw_last_error(saved_ctx);
17296 ptr = res;
17297}
17298
17299union_pw_multi_aff::union_pw_multi_aff(isl::ctx ctx, const std::string &str)
17300{
17301 auto saved_ctx = ctx;
17302 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17303 auto res = isl_union_pw_multi_aff_read_from_str(ctx.release(), str.c_str());
17304 if (!res)
17305 exception::throw_last_error(saved_ctx);
17306 ptr = res;
17307}
17308
17309union_pw_multi_aff &union_pw_multi_aff::operator=(union_pw_multi_aff obj) {
17310 std::swap(this->ptr, obj.ptr);
17311 return *this;
17312}
17313
17314union_pw_multi_aff::~union_pw_multi_aff() {
17315 if (ptr)
17316 isl_union_pw_multi_aff_free(ptr);
17317}
17318
17319__isl_give isl_union_pw_multi_aff *union_pw_multi_aff::copy() const & {
17320 return isl_union_pw_multi_aff_copy(ptr);
17321}
17322
17323__isl_keep isl_union_pw_multi_aff *union_pw_multi_aff::get() const {
17324 return ptr;
17325}
17326
17327__isl_give isl_union_pw_multi_aff *union_pw_multi_aff::release() {
17328 isl_union_pw_multi_aff *tmp = ptr;
17329 ptr = nullptr;
17330 return tmp;
17331}
17332
17333bool union_pw_multi_aff::is_null() const {
17334 return ptr == nullptr;
17335}
17336
17337isl::ctx union_pw_multi_aff::ctx() const {
17338 return isl::ctx(isl_union_pw_multi_aff_get_ctx(ptr));
17339}
17340
17341isl::union_pw_multi_aff union_pw_multi_aff::add(isl::union_pw_multi_aff upma2) const
17342{
17343 if (!ptr || upma2.is_null())
17344 exception::throw_invalid("NULL input", __FILE__, __LINE__);
17345 auto saved_ctx = ctx();
17346 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17347 auto res = isl_union_pw_multi_aff_add(copy(), upma2.release());
17348 if (!res)
17349 exception::throw_last_error(saved_ctx);
17350 return manage(res);
17351}
17352
17353isl::union_pw_multi_aff union_pw_multi_aff::apply(isl::union_pw_multi_aff upma2) const
17354{
17355 if (!ptr || upma2.is_null())
17356 exception::throw_invalid("NULL input", __FILE__, __LINE__);
17357 auto saved_ctx = ctx();
17358 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17359 auto res = isl_union_pw_multi_aff_apply_union_pw_multi_aff(copy(), upma2.release());
17360 if (!res)
17361 exception::throw_last_error(saved_ctx);
17362 return manage(res);
17363}
17364
17365isl::pw_multi_aff union_pw_multi_aff::as_pw_multi_aff() const
17366{
17367 if (!ptr)
17368 exception::throw_invalid("NULL input", __FILE__, __LINE__);
17369 auto saved_ctx = ctx();
17370 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17371 auto res = isl_union_pw_multi_aff_as_pw_multi_aff(copy());
17372 if (!res)
17373 exception::throw_last_error(saved_ctx);
17374 return manage(res);
17375}
17376
17377isl::union_pw_multi_aff union_pw_multi_aff::coalesce() const
17378{
17379 if (!ptr)
17380 exception::throw_invalid("NULL input", __FILE__, __LINE__);
17381 auto saved_ctx = ctx();
17382 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17383 auto res = isl_union_pw_multi_aff_coalesce(copy());
17384 if (!res)
17385 exception::throw_last_error(saved_ctx);
17386 return manage(res);
17387}
17388
17389isl::union_set union_pw_multi_aff::domain() const
17390{
17391 if (!ptr)
17392 exception::throw_invalid("NULL input", __FILE__, __LINE__);
17393 auto saved_ctx = ctx();
17394 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17395 auto res = isl_union_pw_multi_aff_domain(copy());
17396 if (!res)
17397 exception::throw_last_error(saved_ctx);
17398 return manage(res);
17399}
17400
17401isl::union_pw_multi_aff union_pw_multi_aff::empty(isl::ctx ctx)
17402{
17403 auto saved_ctx = ctx;
17404 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17405 auto res = isl_union_pw_multi_aff_empty_ctx(ctx.release());
17406 if (!res)
17407 exception::throw_last_error(saved_ctx);
17408 return manage(res);
17409}
17410
17411isl::pw_multi_aff union_pw_multi_aff::extract_pw_multi_aff(isl::space space) const
17412{
17413 if (!ptr || space.is_null())
17414 exception::throw_invalid("NULL input", __FILE__, __LINE__);
17415 auto saved_ctx = ctx();
17416 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17417 auto res = isl_union_pw_multi_aff_extract_pw_multi_aff(get(), space.release());
17418 if (!res)
17419 exception::throw_last_error(saved_ctx);
17420 return manage(res);
17421}
17422
17423isl::union_pw_multi_aff union_pw_multi_aff::flat_range_product(isl::union_pw_multi_aff upma2) const
17424{
17425 if (!ptr || upma2.is_null())
17426 exception::throw_invalid("NULL input", __FILE__, __LINE__);
17427 auto saved_ctx = ctx();
17428 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17429 auto res = isl_union_pw_multi_aff_flat_range_product(copy(), upma2.release());
17430 if (!res)
17431 exception::throw_last_error(saved_ctx);
17432 return manage(res);
17433}
17434
17435isl::space union_pw_multi_aff::space() const
17436{
17437 if (!ptr)
17438 exception::throw_invalid("NULL input", __FILE__, __LINE__);
17439 auto saved_ctx = ctx();
17440 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17441 auto res = isl_union_pw_multi_aff_get_space(get());
17442 if (!res)
17443 exception::throw_last_error(saved_ctx);
17444 return manage(res);
17445}
17446
17447isl::space union_pw_multi_aff::get_space() const
17448{
17449 return space();
17450}
17451
17452isl::union_pw_multi_aff union_pw_multi_aff::gist(isl::union_set context) const
17453{
17454 if (!ptr || context.is_null())
17455 exception::throw_invalid("NULL input", __FILE__, __LINE__);
17456 auto saved_ctx = ctx();
17457 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17458 auto res = isl_union_pw_multi_aff_gist(copy(), context.release());
17459 if (!res)
17460 exception::throw_last_error(saved_ctx);
17461 return manage(res);
17462}
17463
17464isl::union_pw_multi_aff union_pw_multi_aff::intersect_domain(isl::space space) const
17465{
17466 if (!ptr || space.is_null())
17467 exception::throw_invalid("NULL input", __FILE__, __LINE__);
17468 auto saved_ctx = ctx();
17469 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17470 auto res = isl_union_pw_multi_aff_intersect_domain_space(copy(), space.release());
17471 if (!res)
17472 exception::throw_last_error(saved_ctx);
17473 return manage(res);
17474}
17475
17476isl::union_pw_multi_aff union_pw_multi_aff::intersect_domain(isl::union_set uset) const
17477{
17478 if (!ptr || uset.is_null())
17479 exception::throw_invalid("NULL input", __FILE__, __LINE__);
17480 auto saved_ctx = ctx();
17481 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17482 auto res = isl_union_pw_multi_aff_intersect_domain_union_set(copy(), uset.release());
17483 if (!res)
17484 exception::throw_last_error(saved_ctx);
17485 return manage(res);
17486}
17487
17488isl::union_pw_multi_aff union_pw_multi_aff::intersect_domain_wrapped_domain(isl::union_set uset) const
17489{
17490 if (!ptr || uset.is_null())
17491 exception::throw_invalid("NULL input", __FILE__, __LINE__);
17492 auto saved_ctx = ctx();
17493 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17494 auto res = isl_union_pw_multi_aff_intersect_domain_wrapped_domain(copy(), uset.release());
17495 if (!res)
17496 exception::throw_last_error(saved_ctx);
17497 return manage(res);
17498}
17499
17500isl::union_pw_multi_aff union_pw_multi_aff::intersect_domain_wrapped_range(isl::union_set uset) const
17501{
17502 if (!ptr || uset.is_null())
17503 exception::throw_invalid("NULL input", __FILE__, __LINE__);
17504 auto saved_ctx = ctx();
17505 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17506 auto res = isl_union_pw_multi_aff_intersect_domain_wrapped_range(copy(), uset.release());
17507 if (!res)
17508 exception::throw_last_error(saved_ctx);
17509 return manage(res);
17510}
17511
17512isl::union_pw_multi_aff union_pw_multi_aff::intersect_params(isl::set set) const
17513{
17514 if (!ptr || set.is_null())
17515 exception::throw_invalid("NULL input", __FILE__, __LINE__);
17516 auto saved_ctx = ctx();
17517 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17518 auto res = isl_union_pw_multi_aff_intersect_params(copy(), set.release());
17519 if (!res)
17520 exception::throw_last_error(saved_ctx);
17521 return manage(res);
17522}
17523
17524bool union_pw_multi_aff::involves_locals() const
17525{
17526 if (!ptr)
17527 exception::throw_invalid("NULL input", __FILE__, __LINE__);
17528 auto saved_ctx = ctx();
17529 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17530 auto res = isl_union_pw_multi_aff_involves_locals(get());
17531 if (res < 0)
17532 exception::throw_last_error(saved_ctx);
17533 return res;
17534}
17535
17536bool union_pw_multi_aff::isa_pw_multi_aff() const
17537{
17538 if (!ptr)
17539 exception::throw_invalid("NULL input", __FILE__, __LINE__);
17540 auto saved_ctx = ctx();
17541 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17542 auto res = isl_union_pw_multi_aff_isa_pw_multi_aff(get());
17543 if (res < 0)
17544 exception::throw_last_error(saved_ctx);
17545 return res;
17546}
17547
17548bool union_pw_multi_aff::plain_is_empty() const
17549{
17550 if (!ptr)
17551 exception::throw_invalid("NULL input", __FILE__, __LINE__);
17552 auto saved_ctx = ctx();
17553 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17554 auto res = isl_union_pw_multi_aff_plain_is_empty(get());
17555 if (res < 0)
17556 exception::throw_last_error(saved_ctx);
17557 return res;
17558}
17559
17560isl::union_pw_multi_aff union_pw_multi_aff::pullback(isl::union_pw_multi_aff upma2) const
17561{
17562 if (!ptr || upma2.is_null())
17563 exception::throw_invalid("NULL input", __FILE__, __LINE__);
17564 auto saved_ctx = ctx();
17565 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17566 auto res = isl_union_pw_multi_aff_pullback_union_pw_multi_aff(copy(), upma2.release());
17567 if (!res)
17568 exception::throw_last_error(saved_ctx);
17569 return manage(res);
17570}
17571
17572isl::union_pw_multi_aff union_pw_multi_aff::range_factor_domain() const
17573{
17574 if (!ptr)
17575 exception::throw_invalid("NULL input", __FILE__, __LINE__);
17576 auto saved_ctx = ctx();
17577 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17578 auto res = isl_union_pw_multi_aff_range_factor_domain(copy());
17579 if (!res)
17580 exception::throw_last_error(saved_ctx);
17581 return manage(res);
17582}
17583
17584isl::union_pw_multi_aff union_pw_multi_aff::range_factor_range() const
17585{
17586 if (!ptr)
17587 exception::throw_invalid("NULL input", __FILE__, __LINE__);
17588 auto saved_ctx = ctx();
17589 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17590 auto res = isl_union_pw_multi_aff_range_factor_range(copy());
17591 if (!res)
17592 exception::throw_last_error(saved_ctx);
17593 return manage(res);
17594}
17595
17596isl::union_pw_multi_aff union_pw_multi_aff::range_product(isl::union_pw_multi_aff upma2) const
17597{
17598 if (!ptr || upma2.is_null())
17599 exception::throw_invalid("NULL input", __FILE__, __LINE__);
17600 auto saved_ctx = ctx();
17601 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17602 auto res = isl_union_pw_multi_aff_range_product(copy(), upma2.release());
17603 if (!res)
17604 exception::throw_last_error(saved_ctx);
17605 return manage(res);
17606}
17607
17608isl::union_pw_multi_aff union_pw_multi_aff::sub(isl::union_pw_multi_aff upma2) const
17609{
17610 if (!ptr || upma2.is_null())
17611 exception::throw_invalid("NULL input", __FILE__, __LINE__);
17612 auto saved_ctx = ctx();
17613 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17614 auto res = isl_union_pw_multi_aff_sub(copy(), upma2.release());
17615 if (!res)
17616 exception::throw_last_error(saved_ctx);
17617 return manage(res);
17618}
17619
17620isl::union_pw_multi_aff union_pw_multi_aff::subtract_domain(isl::space space) const
17621{
17622 if (!ptr || space.is_null())
17623 exception::throw_invalid("NULL input", __FILE__, __LINE__);
17624 auto saved_ctx = ctx();
17625 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17626 auto res = isl_union_pw_multi_aff_subtract_domain_space(copy(), space.release());
17627 if (!res)
17628 exception::throw_last_error(saved_ctx);
17629 return manage(res);
17630}
17631
17632isl::union_pw_multi_aff union_pw_multi_aff::subtract_domain(isl::union_set uset) const
17633{
17634 if (!ptr || uset.is_null())
17635 exception::throw_invalid("NULL input", __FILE__, __LINE__);
17636 auto saved_ctx = ctx();
17637 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17638 auto res = isl_union_pw_multi_aff_subtract_domain_union_set(copy(), uset.release());
17639 if (!res)
17640 exception::throw_last_error(saved_ctx);
17641 return manage(res);
17642}
17643
17644isl::union_pw_multi_aff union_pw_multi_aff::union_add(isl::union_pw_multi_aff upma2) const
17645{
17646 if (!ptr || upma2.is_null())
17647 exception::throw_invalid("NULL input", __FILE__, __LINE__);
17648 auto saved_ctx = ctx();
17649 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17650 auto res = isl_union_pw_multi_aff_union_add(copy(), upma2.release());
17651 if (!res)
17652 exception::throw_last_error(saved_ctx);
17653 return manage(res);
17654}
17655
17656inline std::ostream &operator<<(std::ostream &os, const union_pw_multi_aff &obj)
17657{
17658 if (!obj.get())
17659 exception::throw_invalid("NULL input", __FILE__, __LINE__);
17660 auto saved_ctx = isl_union_pw_multi_aff_get_ctx(obj.get());
17661 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17662 char *str = isl_union_pw_multi_aff_to_str(obj.get());
17663 if (!str)
17664 exception::throw_last_error(saved_ctx);
17665 os << str;
17666 free(str);
17667 return os;
17668}
17669
17670// implementations for isl::union_set
17671union_set manage(__isl_take isl_union_set *ptr) {
17672 if (!ptr)
17673 exception::throw_invalid("NULL input", __FILE__, __LINE__);
17674 return union_set(ptr);
17675}
17676union_set manage_copy(__isl_keep isl_union_set *ptr) {
17677 if (!ptr)
17678 exception::throw_invalid("NULL input", __FILE__, __LINE__);
17679 auto saved_ctx = isl_union_set_get_ctx(ptr);
17680 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17681 ptr = isl_union_set_copy(ptr);
17682 if (!ptr)
17683 exception::throw_last_error(saved_ctx);
17684 return union_set(ptr);
17685}
17686
17687union_set::union_set()
17688 : ptr(nullptr) {}
17689
17690union_set::union_set(const union_set &obj)
17691 : ptr(nullptr)
17692{
17693 if (!obj.ptr)
17694 exception::throw_invalid("NULL input", __FILE__, __LINE__);
17695 auto saved_ctx = isl_union_set_get_ctx(obj.ptr);
17696 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17697 ptr = obj.copy();
17698 if (!ptr)
17699 exception::throw_last_error(saved_ctx);
17700}
17701
17702union_set::union_set(__isl_take isl_union_set *ptr)
17703 : ptr(ptr) {}
17704
17705union_set::union_set(isl::basic_set bset)
17706{
17707 if (bset.is_null())
17708 exception::throw_invalid("NULL input", __FILE__, __LINE__);
17709 auto saved_ctx = bset.ctx();
17710 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17711 auto res = isl_union_set_from_basic_set(bset.release());
17712 if (!res)
17713 exception::throw_last_error(saved_ctx);
17714 ptr = res;
17715}
17716
17717union_set::union_set(isl::point pnt)
17718{
17719 if (pnt.is_null())
17720 exception::throw_invalid("NULL input", __FILE__, __LINE__);
17721 auto saved_ctx = pnt.ctx();
17722 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17723 auto res = isl_union_set_from_point(pnt.release());
17724 if (!res)
17725 exception::throw_last_error(saved_ctx);
17726 ptr = res;
17727}
17728
17729union_set::union_set(isl::set set)
17730{
17731 if (set.is_null())
17732 exception::throw_invalid("NULL input", __FILE__, __LINE__);
17733 auto saved_ctx = set.ctx();
17734 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17735 auto res = isl_union_set_from_set(set.release());
17736 if (!res)
17737 exception::throw_last_error(saved_ctx);
17738 ptr = res;
17739}
17740
17741union_set::union_set(isl::ctx ctx, const std::string &str)
17742{
17743 auto saved_ctx = ctx;
17744 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17745 auto res = isl_union_set_read_from_str(ctx.release(), str.c_str());
17746 if (!res)
17747 exception::throw_last_error(saved_ctx);
17748 ptr = res;
17749}
17750
17751union_set &union_set::operator=(union_set obj) {
17752 std::swap(this->ptr, obj.ptr);
17753 return *this;
17754}
17755
17756union_set::~union_set() {
17757 if (ptr)
17758 isl_union_set_free(ptr);
17759}
17760
17761__isl_give isl_union_set *union_set::copy() const & {
17762 return isl_union_set_copy(ptr);
17763}
17764
17765__isl_keep isl_union_set *union_set::get() const {
17766 return ptr;
17767}
17768
17769__isl_give isl_union_set *union_set::release() {
17770 isl_union_set *tmp = ptr;
17771 ptr = nullptr;
17772 return tmp;
17773}
17774
17775bool union_set::is_null() const {
17776 return ptr == nullptr;
17777}
17778
17779isl::ctx union_set::ctx() const {
17780 return isl::ctx(isl_union_set_get_ctx(ptr));
17781}
17782
17783isl::union_set union_set::affine_hull() const
17784{
17785 if (!ptr)
17786 exception::throw_invalid("NULL input", __FILE__, __LINE__);
17787 auto saved_ctx = ctx();
17788 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17789 auto res = isl_union_set_affine_hull(copy());
17790 if (!res)
17791 exception::throw_last_error(saved_ctx);
17792 return manage(res);
17793}
17794
17795isl::union_set union_set::apply(isl::union_map umap) const
17796{
17797 if (!ptr || umap.is_null())
17798 exception::throw_invalid("NULL input", __FILE__, __LINE__);
17799 auto saved_ctx = ctx();
17800 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17801 auto res = isl_union_set_apply(copy(), umap.release());
17802 if (!res)
17803 exception::throw_last_error(saved_ctx);
17804 return manage(res);
17805}
17806
17807isl::union_set union_set::coalesce() const
17808{
17809 if (!ptr)
17810 exception::throw_invalid("NULL input", __FILE__, __LINE__);
17811 auto saved_ctx = ctx();
17812 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17813 auto res = isl_union_set_coalesce(copy());
17814 if (!res)
17815 exception::throw_last_error(saved_ctx);
17816 return manage(res);
17817}
17818
17819isl::union_set union_set::compute_divs() const
17820{
17821 if (!ptr)
17822 exception::throw_invalid("NULL input", __FILE__, __LINE__);
17823 auto saved_ctx = ctx();
17824 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17825 auto res = isl_union_set_compute_divs(copy());
17826 if (!res)
17827 exception::throw_last_error(saved_ctx);
17828 return manage(res);
17829}
17830
17831isl::union_set union_set::detect_equalities() const
17832{
17833 if (!ptr)
17834 exception::throw_invalid("NULL input", __FILE__, __LINE__);
17835 auto saved_ctx = ctx();
17836 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17837 auto res = isl_union_set_detect_equalities(copy());
17838 if (!res)
17839 exception::throw_last_error(saved_ctx);
17840 return manage(res);
17841}
17842
17843isl::union_set union_set::empty(isl::ctx ctx)
17844{
17845 auto saved_ctx = ctx;
17846 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17847 auto res = isl_union_set_empty_ctx(ctx.release());
17848 if (!res)
17849 exception::throw_last_error(saved_ctx);
17850 return manage(res);
17851}
17852
17853bool union_set::every_set(const std::function<bool(isl::set)> &test) const
17854{
17855 if (!ptr)
17856 exception::throw_invalid("NULL input", __FILE__, __LINE__);
17857 auto saved_ctx = ctx();
17858 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17859 struct test_data {
17860 std::function<bool(isl::set)> func;
17861 std::exception_ptr eptr;
17862 } test_data = { test };
17863 auto test_lambda = [](isl_set *arg_0, void *arg_1) -> isl_bool {
17864 auto *data = static_cast<struct test_data *>(arg_1);
17865 ISL_CPP_TRY {
17866 auto ret = (data->func)(manage_copy(arg_0));
17867 return ret ? isl_bool_true : isl_bool_false;
17868 } ISL_CPP_CATCH_ALL {
17869 data->eptr = std::current_exception();
17870 return isl_bool_error;
17871 }
17872 };
17873 auto res = isl_union_set_every_set(get(), test_lambda, &test_data);
17874 if (test_data.eptr)
17875 std::rethrow_exception(test_data.eptr);
17876 if (res < 0)
17877 exception::throw_last_error(saved_ctx);
17878 return res;
17879}
17880
17881isl::set union_set::extract_set(isl::space space) const
17882{
17883 if (!ptr || space.is_null())
17884 exception::throw_invalid("NULL input", __FILE__, __LINE__);
17885 auto saved_ctx = ctx();
17886 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17887 auto res = isl_union_set_extract_set(get(), space.release());
17888 if (!res)
17889 exception::throw_last_error(saved_ctx);
17890 return manage(res);
17891}
17892
17893void union_set::foreach_point(const std::function<void(isl::point)> &fn) const
17894{
17895 if (!ptr)
17896 exception::throw_invalid("NULL input", __FILE__, __LINE__);
17897 auto saved_ctx = ctx();
17898 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17899 struct fn_data {
17900 std::function<void(isl::point)> func;
17901 std::exception_ptr eptr;
17902 } fn_data = { fn };
17903 auto fn_lambda = [](isl_point *arg_0, void *arg_1) -> isl_stat {
17904 auto *data = static_cast<struct fn_data *>(arg_1);
17905 ISL_CPP_TRY {
17906 (data->func)(manage(arg_0));
17907 return isl_stat_ok;
17908 } ISL_CPP_CATCH_ALL {
17909 data->eptr = std::current_exception();
17910 return isl_stat_error;
17911 }
17912 };
17913 auto res = isl_union_set_foreach_point(get(), fn_lambda, &fn_data);
17914 if (fn_data.eptr)
17915 std::rethrow_exception(fn_data.eptr);
17916 if (res < 0)
17917 exception::throw_last_error(saved_ctx);
17918 return;
17919}
17920
17921void union_set::foreach_set(const std::function<void(isl::set)> &fn) const
17922{
17923 if (!ptr)
17924 exception::throw_invalid("NULL input", __FILE__, __LINE__);
17925 auto saved_ctx = ctx();
17926 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17927 struct fn_data {
17928 std::function<void(isl::set)> func;
17929 std::exception_ptr eptr;
17930 } fn_data = { fn };
17931 auto fn_lambda = [](isl_set *arg_0, void *arg_1) -> isl_stat {
17932 auto *data = static_cast<struct fn_data *>(arg_1);
17933 ISL_CPP_TRY {
17934 (data->func)(manage(arg_0));
17935 return isl_stat_ok;
17936 } ISL_CPP_CATCH_ALL {
17937 data->eptr = std::current_exception();
17938 return isl_stat_error;
17939 }
17940 };
17941 auto res = isl_union_set_foreach_set(get(), fn_lambda, &fn_data);
17942 if (fn_data.eptr)
17943 std::rethrow_exception(fn_data.eptr);
17944 if (res < 0)
17945 exception::throw_last_error(saved_ctx);
17946 return;
17947}
17948
17949isl::space union_set::space() const
17950{
17951 if (!ptr)
17952 exception::throw_invalid("NULL input", __FILE__, __LINE__);
17953 auto saved_ctx = ctx();
17954 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17955 auto res = isl_union_set_get_space(get());
17956 if (!res)
17957 exception::throw_last_error(saved_ctx);
17958 return manage(res);
17959}
17960
17961isl::space union_set::get_space() const
17962{
17963 return space();
17964}
17965
17966isl::union_set union_set::gist(isl::union_set context) const
17967{
17968 if (!ptr || context.is_null())
17969 exception::throw_invalid("NULL input", __FILE__, __LINE__);
17970 auto saved_ctx = ctx();
17971 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17972 auto res = isl_union_set_gist(copy(), context.release());
17973 if (!res)
17974 exception::throw_last_error(saved_ctx);
17975 return manage(res);
17976}
17977
17978isl::union_set union_set::gist_params(isl::set set) const
17979{
17980 if (!ptr || set.is_null())
17981 exception::throw_invalid("NULL input", __FILE__, __LINE__);
17982 auto saved_ctx = ctx();
17983 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17984 auto res = isl_union_set_gist_params(copy(), set.release());
17985 if (!res)
17986 exception::throw_last_error(saved_ctx);
17987 return manage(res);
17988}
17989
17990isl::union_map union_set::identity() const
17991{
17992 if (!ptr)
17993 exception::throw_invalid("NULL input", __FILE__, __LINE__);
17994 auto saved_ctx = ctx();
17995 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17996 auto res = isl_union_set_identity(copy());
17997 if (!res)
17998 exception::throw_last_error(saved_ctx);
17999 return manage(res);
18000}
18001
18002isl::union_set union_set::intersect(isl::union_set uset2) const
18003{
18004 if (!ptr || uset2.is_null())
18005 exception::throw_invalid("NULL input", __FILE__, __LINE__);
18006 auto saved_ctx = ctx();
18007 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
18008 auto res = isl_union_set_intersect(copy(), uset2.release());
18009 if (!res)
18010 exception::throw_last_error(saved_ctx);
18011 return manage(res);
18012}
18013
18014isl::union_set union_set::intersect_params(isl::set set) const
18015{
18016 if (!ptr || set.is_null())
18017 exception::throw_invalid("NULL input", __FILE__, __LINE__);
18018 auto saved_ctx = ctx();
18019 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
18020 auto res = isl_union_set_intersect_params(copy(), set.release());
18021 if (!res)
18022 exception::throw_last_error(saved_ctx);
18023 return manage(res);
18024}
18025
18026bool union_set::is_disjoint(const isl::union_set &uset2) const
18027{
18028 if (!ptr || uset2.is_null())
18029 exception::throw_invalid("NULL input", __FILE__, __LINE__);
18030 auto saved_ctx = ctx();
18031 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
18032 auto res = isl_union_set_is_disjoint(get(), uset2.get());
18033 if (res < 0)
18034 exception::throw_last_error(saved_ctx);
18035 return res;
18036}
18037
18038bool union_set::is_empty() const
18039{
18040 if (!ptr)
18041 exception::throw_invalid("NULL input", __FILE__, __LINE__);
18042 auto saved_ctx = ctx();
18043 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
18044 auto res = isl_union_set_is_empty(get());
18045 if (res < 0)
18046 exception::throw_last_error(saved_ctx);
18047 return res;
18048}
18049
18050bool union_set::is_equal(const isl::union_set &uset2) const
18051{
18052 if (!ptr || uset2.is_null())
18053 exception::throw_invalid("NULL input", __FILE__, __LINE__);
18054 auto saved_ctx = ctx();
18055 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
18056 auto res = isl_union_set_is_equal(get(), uset2.get());
18057 if (res < 0)
18058 exception::throw_last_error(saved_ctx);
18059 return res;
18060}
18061
18062bool union_set::is_strict_subset(const isl::union_set &uset2) const
18063{
18064 if (!ptr || uset2.is_null())
18065 exception::throw_invalid("NULL input", __FILE__, __LINE__);
18066 auto saved_ctx = ctx();
18067 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
18068 auto res = isl_union_set_is_strict_subset(get(), uset2.get());
18069 if (res < 0)
18070 exception::throw_last_error(saved_ctx);
18071 return res;
18072}
18073
18074bool union_set::is_subset(const isl::union_set &uset2) const
18075{
18076 if (!ptr || uset2.is_null())
18077 exception::throw_invalid("NULL input", __FILE__, __LINE__);
18078 auto saved_ctx = ctx();
18079 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
18080 auto res = isl_union_set_is_subset(get(), uset2.get());
18081 if (res < 0)
18082 exception::throw_last_error(saved_ctx);
18083 return res;
18084}
18085
18086bool union_set::isa_set() const
18087{
18088 if (!ptr)
18089 exception::throw_invalid("NULL input", __FILE__, __LINE__);
18090 auto saved_ctx = ctx();
18091 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
18092 auto res = isl_union_set_isa_set(get());
18093 if (res < 0)
18094 exception::throw_last_error(saved_ctx);
18095 return res;
18096}
18097
18098isl::union_set union_set::lexmax() const
18099{
18100 if (!ptr)
18101 exception::throw_invalid("NULL input", __FILE__, __LINE__);
18102 auto saved_ctx = ctx();
18103 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
18104 auto res = isl_union_set_lexmax(copy());
18105 if (!res)
18106 exception::throw_last_error(saved_ctx);
18107 return manage(res);
18108}
18109
18110isl::union_set union_set::lexmin() const
18111{
18112 if (!ptr)
18113 exception::throw_invalid("NULL input", __FILE__, __LINE__);
18114 auto saved_ctx = ctx();
18115 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
18116 auto res = isl_union_set_lexmin(copy());
18117 if (!res)
18118 exception::throw_last_error(saved_ctx);
18119 return manage(res);
18120}
18121
18122isl::union_set union_set::polyhedral_hull() const
18123{
18124 if (!ptr)
18125 exception::throw_invalid("NULL input", __FILE__, __LINE__);
18126 auto saved_ctx = ctx();
18127 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
18128 auto res = isl_union_set_polyhedral_hull(copy());
18129 if (!res)
18130 exception::throw_last_error(saved_ctx);
18131 return manage(res);
18132}
18133
18134isl::union_set union_set::preimage(isl::multi_aff ma) const
18135{
18136 if (!ptr || ma.is_null())
18137 exception::throw_invalid("NULL input", __FILE__, __LINE__);
18138 auto saved_ctx = ctx();
18139 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
18140 auto res = isl_union_set_preimage_multi_aff(copy(), ma.release());
18141 if (!res)
18142 exception::throw_last_error(saved_ctx);
18143 return manage(res);
18144}
18145
18146isl::union_set union_set::preimage(isl::pw_multi_aff pma) const
18147{
18148 if (!ptr || pma.is_null())
18149 exception::throw_invalid("NULL input", __FILE__, __LINE__);
18150 auto saved_ctx = ctx();
18151 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
18152 auto res = isl_union_set_preimage_pw_multi_aff(copy(), pma.release());
18153 if (!res)
18154 exception::throw_last_error(saved_ctx);
18155 return manage(res);
18156}
18157
18158isl::union_set union_set::preimage(isl::union_pw_multi_aff upma) const
18159{
18160 if (!ptr || upma.is_null())
18161 exception::throw_invalid("NULL input", __FILE__, __LINE__);
18162 auto saved_ctx = ctx();
18163 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
18164 auto res = isl_union_set_preimage_union_pw_multi_aff(copy(), upma.release());
18165 if (!res)
18166 exception::throw_last_error(saved_ctx);
18167 return manage(res);
18168}
18169
18170isl::point union_set::sample_point() const
18171{
18172 if (!ptr)
18173 exception::throw_invalid("NULL input", __FILE__, __LINE__);
18174 auto saved_ctx = ctx();
18175 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
18176 auto res = isl_union_set_sample_point(copy());
18177 if (!res)
18178 exception::throw_last_error(saved_ctx);
18179 return manage(res);
18180}
18181
18182isl::union_set union_set::subtract(isl::union_set uset2) const
18183{
18184 if (!ptr || uset2.is_null())
18185 exception::throw_invalid("NULL input", __FILE__, __LINE__);
18186 auto saved_ctx = ctx();
18187 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
18188 auto res = isl_union_set_subtract(copy(), uset2.release());
18189 if (!res)
18190 exception::throw_last_error(saved_ctx);
18191 return manage(res);
18192}
18193
18194isl::union_set union_set::unite(isl::union_set uset2) const
18195{
18196 if (!ptr || uset2.is_null())
18197 exception::throw_invalid("NULL input", __FILE__, __LINE__);
18198 auto saved_ctx = ctx();
18199 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
18200 auto res = isl_union_set_union(copy(), uset2.release());
18201 if (!res)
18202 exception::throw_last_error(saved_ctx);
18203 return manage(res);
18204}
18205
18206isl::union_set union_set::universe() const
18207{
18208 if (!ptr)
18209 exception::throw_invalid("NULL input", __FILE__, __LINE__);
18210 auto saved_ctx = ctx();
18211 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
18212 auto res = isl_union_set_universe(copy());
18213 if (!res)
18214 exception::throw_last_error(saved_ctx);
18215 return manage(res);
18216}
18217
18218isl::union_map union_set::unwrap() const
18219{
18220 if (!ptr)
18221 exception::throw_invalid("NULL input", __FILE__, __LINE__);
18222 auto saved_ctx = ctx();
18223 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
18224 auto res = isl_union_set_unwrap(copy());
18225 if (!res)
18226 exception::throw_last_error(saved_ctx);
18227 return manage(res);
18228}
18229
18230inline std::ostream &operator<<(std::ostream &os, const union_set &obj)
18231{
18232 if (!obj.get())
18233 exception::throw_invalid("NULL input", __FILE__, __LINE__);
18234 auto saved_ctx = isl_union_set_get_ctx(obj.get());
18235 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
18236 char *str = isl_union_set_to_str(obj.get());
18237 if (!str)
18238 exception::throw_last_error(saved_ctx);
18239 os << str;
18240 free(str);
18241 return os;
18242}
18243
18244// implementations for isl::union_set_list
18245union_set_list manage(__isl_take isl_union_set_list *ptr) {
18246 if (!ptr)
18247 exception::throw_invalid("NULL input", __FILE__, __LINE__);
18248 return union_set_list(ptr);
18249}
18250union_set_list manage_copy(__isl_keep isl_union_set_list *ptr) {
18251 if (!ptr)
18252 exception::throw_invalid("NULL input", __FILE__, __LINE__);
18253 auto saved_ctx = isl_union_set_list_get_ctx(ptr);
18254 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
18255 ptr = isl_union_set_list_copy(ptr);
18256 if (!ptr)
18257 exception::throw_last_error(saved_ctx);
18258 return union_set_list(ptr);
18259}
18260
18261union_set_list::union_set_list()
18262 : ptr(nullptr) {}
18263
18264union_set_list::union_set_list(const union_set_list &obj)
18265 : ptr(nullptr)
18266{
18267 if (!obj.ptr)
18268 exception::throw_invalid("NULL input", __FILE__, __LINE__);
18269 auto saved_ctx = isl_union_set_list_get_ctx(obj.ptr);
18270 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
18271 ptr = obj.copy();
18272 if (!ptr)
18273 exception::throw_last_error(saved_ctx);
18274}
18275
18276union_set_list::union_set_list(__isl_take isl_union_set_list *ptr)
18277 : ptr(ptr) {}
18278
18279union_set_list::union_set_list(isl::ctx ctx, int n)
18280{
18281 auto saved_ctx = ctx;
18282 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
18283 auto res = isl_union_set_list_alloc(ctx.release(), n);
18284 if (!res)
18285 exception::throw_last_error(saved_ctx);
18286 ptr = res;
18287}
18288
18289union_set_list::union_set_list(isl::union_set el)
18290{
18291 if (el.is_null())
18292 exception::throw_invalid("NULL input", __FILE__, __LINE__);
18293 auto saved_ctx = el.ctx();
18294 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
18295 auto res = isl_union_set_list_from_union_set(el.release());
18296 if (!res)
18297 exception::throw_last_error(saved_ctx);
18298 ptr = res;
18299}
18300
18301union_set_list &union_set_list::operator=(union_set_list obj) {
18302 std::swap(this->ptr, obj.ptr);
18303 return *this;
18304}
18305
18306union_set_list::~union_set_list() {
18307 if (ptr)
18308 isl_union_set_list_free(ptr);
18309}
18310
18311__isl_give isl_union_set_list *union_set_list::copy() const & {
18312 return isl_union_set_list_copy(ptr);
18313}
18314
18315__isl_keep isl_union_set_list *union_set_list::get() const {
18316 return ptr;
18317}
18318
18319__isl_give isl_union_set_list *union_set_list::release() {
18320 isl_union_set_list *tmp = ptr;
18321 ptr = nullptr;
18322 return tmp;
18323}
18324
18325bool union_set_list::is_null() const {
18326 return ptr == nullptr;
18327}
18328
18329isl::ctx union_set_list::ctx() const {
18330 return isl::ctx(isl_union_set_list_get_ctx(ptr));
18331}
18332
18333isl::union_set_list union_set_list::add(isl::union_set el) const
18334{
18335 if (!ptr || el.is_null())
18336 exception::throw_invalid("NULL input", __FILE__, __LINE__);
18337 auto saved_ctx = ctx();
18338 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
18339 auto res = isl_union_set_list_add(copy(), el.release());
18340 if (!res)
18341 exception::throw_last_error(saved_ctx);
18342 return manage(res);
18343}
18344
18345isl::union_set_list union_set_list::clear() const
18346{
18347 if (!ptr)
18348 exception::throw_invalid("NULL input", __FILE__, __LINE__);
18349 auto saved_ctx = ctx();
18350 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
18351 auto res = isl_union_set_list_clear(copy());
18352 if (!res)
18353 exception::throw_last_error(saved_ctx);
18354 return manage(res);
18355}
18356
18357isl::union_set_list union_set_list::concat(isl::union_set_list list2) const
18358{
18359 if (!ptr || list2.is_null())
18360 exception::throw_invalid("NULL input", __FILE__, __LINE__);
18361 auto saved_ctx = ctx();
18362 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
18363 auto res = isl_union_set_list_concat(copy(), list2.release());
18364 if (!res)
18365 exception::throw_last_error(saved_ctx);
18366 return manage(res);
18367}
18368
18369isl::union_set_list union_set_list::drop(unsigned int first, unsigned int n) const
18370{
18371 if (!ptr)
18372 exception::throw_invalid("NULL input", __FILE__, __LINE__);
18373 auto saved_ctx = ctx();
18374 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
18375 auto res = isl_union_set_list_drop(copy(), first, n);
18376 if (!res)
18377 exception::throw_last_error(saved_ctx);
18378 return manage(res);
18379}
18380
18381void union_set_list::foreach(const std::function<void(isl::union_set)> &fn) const
18382{
18383 if (!ptr)
18384 exception::throw_invalid("NULL input", __FILE__, __LINE__);
18385 auto saved_ctx = ctx();
18386 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
18387 struct fn_data {
18388 std::function<void(isl::union_set)> func;
18389 std::exception_ptr eptr;
18390 } fn_data = { fn };
18391 auto fn_lambda = [](isl_union_set *arg_0, void *arg_1) -> isl_stat {
18392 auto *data = static_cast<struct fn_data *>(arg_1);
18393 ISL_CPP_TRY {
18394 (data->func)(manage(arg_0));
18395 return isl_stat_ok;
18396 } ISL_CPP_CATCH_ALL {
18397 data->eptr = std::current_exception();
18398 return isl_stat_error;
18399 }
18400 };
18401 auto res = isl_union_set_list_foreach(get(), fn_lambda, &fn_data);
18402 if (fn_data.eptr)
18403 std::rethrow_exception(fn_data.eptr);
18404 if (res < 0)
18405 exception::throw_last_error(saved_ctx);
18406 return;
18407}
18408
18409isl::union_set union_set_list::at(int index) const
18410{
18411 if (!ptr)
18412 exception::throw_invalid("NULL input", __FILE__, __LINE__);
18413 auto saved_ctx = ctx();
18414 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
18415 auto res = isl_union_set_list_get_at(get(), index);
18416 if (!res)
18417 exception::throw_last_error(saved_ctx);
18418 return manage(res);
18419}
18420
18421isl::union_set union_set_list::get_at(int index) const
18422{
18423 return at(index);
18424}
18425
18426isl::union_set_list union_set_list::insert(unsigned int pos, isl::union_set el) const
18427{
18428 if (!ptr || el.is_null())
18429 exception::throw_invalid("NULL input", __FILE__, __LINE__);
18430 auto saved_ctx = ctx();
18431 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
18432 auto res = isl_union_set_list_insert(copy(), pos, el.release());
18433 if (!res)
18434 exception::throw_last_error(saved_ctx);
18435 return manage(res);
18436}
18437
18438unsigned union_set_list::size() const
18439{
18440 if (!ptr)
18441 exception::throw_invalid("NULL input", __FILE__, __LINE__);
18442 auto saved_ctx = ctx();
18443 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
18444 auto res = isl_union_set_list_size(get());
18445 if (res < 0)
18446 exception::throw_last_error(saved_ctx);
18447 return res;
18448}
18449
18450inline std::ostream &operator<<(std::ostream &os, const union_set_list &obj)
18451{
18452 if (!obj.get())
18453 exception::throw_invalid("NULL input", __FILE__, __LINE__);
18454 auto saved_ctx = isl_union_set_list_get_ctx(obj.get());
18455 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
18456 char *str = isl_union_set_list_to_str(obj.get());
18457 if (!str)
18458 exception::throw_last_error(saved_ctx);
18459 os << str;
18460 free(str);
18461 return os;
18462}
18463
18464// implementations for isl::val
18465val manage(__isl_take isl_val *ptr) {
18466 if (!ptr)
18467 exception::throw_invalid("NULL input", __FILE__, __LINE__);
18468 return val(ptr);
18469}
18470val manage_copy(__isl_keep isl_val *ptr) {
18471 if (!ptr)
18472 exception::throw_invalid("NULL input", __FILE__, __LINE__);
18473 auto saved_ctx = isl_val_get_ctx(ptr);
18474 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
18475 ptr = isl_val_copy(ptr);
18476 if (!ptr)
18477 exception::throw_last_error(saved_ctx);
18478 return val(ptr);
18479}
18480
18481val::val()
18482 : ptr(nullptr) {}
18483
18484val::val(const val &obj)
18485 : ptr(nullptr)
18486{
18487 if (!obj.ptr)
18488 exception::throw_invalid("NULL input", __FILE__, __LINE__);
18489 auto saved_ctx = isl_val_get_ctx(obj.ptr);
18490 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
18491 ptr = obj.copy();
18492 if (!ptr)
18493 exception::throw_last_error(saved_ctx);
18494}
18495
18496val::val(__isl_take isl_val *ptr)
18497 : ptr(ptr) {}
18498
18499val::val(isl::ctx ctx, long i)
18500{
18501 auto saved_ctx = ctx;
18502 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
18503 auto res = isl_val_int_from_si(ctx.release(), i);
18504 if (!res)
18505 exception::throw_last_error(saved_ctx);
18506 ptr = res;
18507}
18508
18509val::val(isl::ctx ctx, const std::string &str)
18510{
18511 auto saved_ctx = ctx;
18512 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
18513 auto res = isl_val_read_from_str(ctx.release(), str.c_str());
18514 if (!res)
18515 exception::throw_last_error(saved_ctx);
18516 ptr = res;
18517}
18518
18519val &val::operator=(val obj) {
18520 std::swap(this->ptr, obj.ptr);
18521 return *this;
18522}
18523
18524val::~val() {
18525 if (ptr)
18526 isl_val_free(ptr);
18527}
18528
18529__isl_give isl_val *val::copy() const & {
18530 return isl_val_copy(ptr);
18531}
18532
18533__isl_keep isl_val *val::get() const {
18534 return ptr;
18535}
18536
18537__isl_give isl_val *val::release() {
18538 isl_val *tmp = ptr;
18539 ptr = nullptr;
18540 return tmp;
18541}
18542
18543bool val::is_null() const {
18544 return ptr == nullptr;
18545}
18546
18547isl::ctx val::ctx() const {
18548 return isl::ctx(isl_val_get_ctx(ptr));
18549}
18550
18551isl::val val::abs() const
18552{
18553 if (!ptr)
18554 exception::throw_invalid("NULL input", __FILE__, __LINE__);
18555 auto saved_ctx = ctx();
18556 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
18557 auto res = isl_val_abs(copy());
18558 if (!res)
18559 exception::throw_last_error(saved_ctx);
18560 return manage(res);
18561}
18562
18563bool val::abs_eq(const isl::val &v2) const
18564{
18565 if (!ptr || v2.is_null())
18566 exception::throw_invalid("NULL input", __FILE__, __LINE__);
18567 auto saved_ctx = ctx();
18568 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
18569 auto res = isl_val_abs_eq(get(), v2.get());
18570 if (res < 0)
18571 exception::throw_last_error(saved_ctx);
18572 return res;
18573}
18574
18575bool val::abs_eq(long v2) const
18576{
18577 if (!ptr)
18578 exception::throw_invalid("NULL input", __FILE__, __LINE__);
18579 return this->abs_eq(isl::val(ctx(), v2));
18580}
18581
18582isl::val val::add(isl::val v2) const
18583{
18584 if (!ptr || v2.is_null())
18585 exception::throw_invalid("NULL input", __FILE__, __LINE__);
18586 auto saved_ctx = ctx();
18587 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
18588 auto res = isl_val_add(copy(), v2.release());
18589 if (!res)
18590 exception::throw_last_error(saved_ctx);
18591 return manage(res);
18592}
18593
18594isl::val val::add(long v2) const
18595{
18596 if (!ptr)
18597 exception::throw_invalid("NULL input", __FILE__, __LINE__);
18598 return this->add(isl::val(ctx(), v2));
18599}
18600
18601isl::val val::ceil() const
18602{
18603 if (!ptr)
18604 exception::throw_invalid("NULL input", __FILE__, __LINE__);
18605 auto saved_ctx = ctx();
18606 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
18607 auto res = isl_val_ceil(copy());
18608 if (!res)
18609 exception::throw_last_error(saved_ctx);
18610 return manage(res);
18611}
18612
18613int val::cmp_si(long i) const
18614{
18615 if (!ptr)
18616 exception::throw_invalid("NULL input", __FILE__, __LINE__);
18617 auto saved_ctx = ctx();
18618 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
18619 auto res = isl_val_cmp_si(get(), i);
18620 return res;
18621}
18622
18623isl::val val::div(isl::val v2) const
18624{
18625 if (!ptr || v2.is_null())
18626 exception::throw_invalid("NULL input", __FILE__, __LINE__);
18627 auto saved_ctx = ctx();
18628 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
18629 auto res = isl_val_div(copy(), v2.release());
18630 if (!res)
18631 exception::throw_last_error(saved_ctx);
18632 return manage(res);
18633}
18634
18635isl::val val::div(long v2) const
18636{
18637 if (!ptr)
18638 exception::throw_invalid("NULL input", __FILE__, __LINE__);
18639 return this->div(isl::val(ctx(), v2));
18640}
18641
18642bool val::eq(const isl::val &v2) const
18643{
18644 if (!ptr || v2.is_null())
18645 exception::throw_invalid("NULL input", __FILE__, __LINE__);
18646 auto saved_ctx = ctx();
18647 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
18648 auto res = isl_val_eq(get(), v2.get());
18649 if (res < 0)
18650 exception::throw_last_error(saved_ctx);
18651 return res;
18652}
18653
18654bool val::eq(long v2) const
18655{
18656 if (!ptr)
18657 exception::throw_invalid("NULL input", __FILE__, __LINE__);
18658 return this->eq(isl::val(ctx(), v2));
18659}
18660
18661isl::val val::floor() const
18662{
18663 if (!ptr)
18664 exception::throw_invalid("NULL input", __FILE__, __LINE__);
18665 auto saved_ctx = ctx();
18666 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
18667 auto res = isl_val_floor(copy());
18668 if (!res)
18669 exception::throw_last_error(saved_ctx);
18670 return manage(res);
18671}
18672
18673isl::val val::gcd(isl::val v2) const
18674{
18675 if (!ptr || v2.is_null())
18676 exception::throw_invalid("NULL input", __FILE__, __LINE__);
18677 auto saved_ctx = ctx();
18678 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
18679 auto res = isl_val_gcd(copy(), v2.release());
18680 if (!res)
18681 exception::throw_last_error(saved_ctx);
18682 return manage(res);
18683}
18684
18685isl::val val::gcd(long v2) const
18686{
18687 if (!ptr)
18688 exception::throw_invalid("NULL input", __FILE__, __LINE__);
18689 return this->gcd(isl::val(ctx(), v2));
18690}
18691
18692bool val::ge(const isl::val &v2) const
18693{
18694 if (!ptr || v2.is_null())
18695 exception::throw_invalid("NULL input", __FILE__, __LINE__);
18696 auto saved_ctx = ctx();
18697 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
18698 auto res = isl_val_ge(get(), v2.get());
18699 if (res < 0)
18700 exception::throw_last_error(saved_ctx);
18701 return res;
18702}
18703
18704bool val::ge(long v2) const
18705{
18706 if (!ptr)
18707 exception::throw_invalid("NULL input", __FILE__, __LINE__);
18708 return this->ge(isl::val(ctx(), v2));
18709}
18710
18711long val::den_si() const
18712{
18713 if (!ptr)
18714 exception::throw_invalid("NULL input", __FILE__, __LINE__);
18715 auto saved_ctx = ctx();
18716 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
18717 auto res = isl_val_get_den_si(get());
18718 return res;
18719}
18720
18721long val::get_den_si() const
18722{
18723 return den_si();
18724}
18725
18726long val::num_si() const
18727{
18728 if (!ptr)
18729 exception::throw_invalid("NULL input", __FILE__, __LINE__);
18730 auto saved_ctx = ctx();
18731 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
18732 auto res = isl_val_get_num_si(get());
18733 return res;
18734}
18735
18736long val::get_num_si() const
18737{
18738 return num_si();
18739}
18740
18741bool val::gt(const isl::val &v2) const
18742{
18743 if (!ptr || v2.is_null())
18744 exception::throw_invalid("NULL input", __FILE__, __LINE__);
18745 auto saved_ctx = ctx();
18746 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
18747 auto res = isl_val_gt(get(), v2.get());
18748 if (res < 0)
18749 exception::throw_last_error(saved_ctx);
18750 return res;
18751}
18752
18753bool val::gt(long v2) const
18754{
18755 if (!ptr)
18756 exception::throw_invalid("NULL input", __FILE__, __LINE__);
18757 return this->gt(isl::val(ctx(), v2));
18758}
18759
18760isl::val val::infty(isl::ctx ctx)
18761{
18762 auto saved_ctx = ctx;
18763 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
18764 auto res = isl_val_infty(ctx.release());
18765 if (!res)
18766 exception::throw_last_error(saved_ctx);
18767 return manage(res);
18768}
18769
18770isl::val val::inv() const
18771{
18772 if (!ptr)
18773 exception::throw_invalid("NULL input", __FILE__, __LINE__);
18774 auto saved_ctx = ctx();
18775 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
18776 auto res = isl_val_inv(copy());
18777 if (!res)
18778 exception::throw_last_error(saved_ctx);
18779 return manage(res);
18780}
18781
18782bool val::is_divisible_by(const isl::val &v2) const
18783{
18784 if (!ptr || v2.is_null())
18785 exception::throw_invalid("NULL input", __FILE__, __LINE__);
18786 auto saved_ctx = ctx();
18787 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
18788 auto res = isl_val_is_divisible_by(get(), v2.get());
18789 if (res < 0)
18790 exception::throw_last_error(saved_ctx);
18791 return res;
18792}
18793
18794bool val::is_divisible_by(long v2) const
18795{
18796 if (!ptr)
18797 exception::throw_invalid("NULL input", __FILE__, __LINE__);
18798 return this->is_divisible_by(isl::val(ctx(), v2));
18799}
18800
18801bool val::is_infty() const
18802{
18803 if (!ptr)
18804 exception::throw_invalid("NULL input", __FILE__, __LINE__);
18805 auto saved_ctx = ctx();
18806 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
18807 auto res = isl_val_is_infty(get());
18808 if (res < 0)
18809 exception::throw_last_error(saved_ctx);
18810 return res;
18811}
18812
18813bool val::is_int() const
18814{
18815 if (!ptr)
18816 exception::throw_invalid("NULL input", __FILE__, __LINE__);
18817 auto saved_ctx = ctx();
18818 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
18819 auto res = isl_val_is_int(get());
18820 if (res < 0)
18821 exception::throw_last_error(saved_ctx);
18822 return res;
18823}
18824
18825bool val::is_nan() const
18826{
18827 if (!ptr)
18828 exception::throw_invalid("NULL input", __FILE__, __LINE__);
18829 auto saved_ctx = ctx();
18830 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
18831 auto res = isl_val_is_nan(get());
18832 if (res < 0)
18833 exception::throw_last_error(saved_ctx);
18834 return res;
18835}
18836
18837bool val::is_neg() const
18838{
18839 if (!ptr)
18840 exception::throw_invalid("NULL input", __FILE__, __LINE__);
18841 auto saved_ctx = ctx();
18842 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
18843 auto res = isl_val_is_neg(get());
18844 if (res < 0)
18845 exception::throw_last_error(saved_ctx);
18846 return res;
18847}
18848
18849bool val::is_neginfty() const
18850{
18851 if (!ptr)
18852 exception::throw_invalid("NULL input", __FILE__, __LINE__);
18853 auto saved_ctx = ctx();
18854 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
18855 auto res = isl_val_is_neginfty(get());
18856 if (res < 0)
18857 exception::throw_last_error(saved_ctx);
18858 return res;
18859}
18860
18861bool val::is_negone() const
18862{
18863 if (!ptr)
18864 exception::throw_invalid("NULL input", __FILE__, __LINE__);
18865 auto saved_ctx = ctx();
18866 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
18867 auto res = isl_val_is_negone(get());
18868 if (res < 0)
18869 exception::throw_last_error(saved_ctx);
18870 return res;
18871}
18872
18873bool val::is_nonneg() const
18874{
18875 if (!ptr)
18876 exception::throw_invalid("NULL input", __FILE__, __LINE__);
18877 auto saved_ctx = ctx();
18878 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
18879 auto res = isl_val_is_nonneg(get());
18880 if (res < 0)
18881 exception::throw_last_error(saved_ctx);
18882 return res;
18883}
18884
18885bool val::is_nonpos() const
18886{
18887 if (!ptr)
18888 exception::throw_invalid("NULL input", __FILE__, __LINE__);
18889 auto saved_ctx = ctx();
18890 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
18891 auto res = isl_val_is_nonpos(get());
18892 if (res < 0)
18893 exception::throw_last_error(saved_ctx);
18894 return res;
18895}
18896
18897bool val::is_one() const
18898{
18899 if (!ptr)
18900 exception::throw_invalid("NULL input", __FILE__, __LINE__);
18901 auto saved_ctx = ctx();
18902 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
18903 auto res = isl_val_is_one(get());
18904 if (res < 0)
18905 exception::throw_last_error(saved_ctx);
18906 return res;
18907}
18908
18909bool val::is_pos() const
18910{
18911 if (!ptr)
18912 exception::throw_invalid("NULL input", __FILE__, __LINE__);
18913 auto saved_ctx = ctx();
18914 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
18915 auto res = isl_val_is_pos(get());
18916 if (res < 0)
18917 exception::throw_last_error(saved_ctx);
18918 return res;
18919}
18920
18921bool val::is_rat() const
18922{
18923 if (!ptr)
18924 exception::throw_invalid("NULL input", __FILE__, __LINE__);
18925 auto saved_ctx = ctx();
18926 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
18927 auto res = isl_val_is_rat(get());
18928 if (res < 0)
18929 exception::throw_last_error(saved_ctx);
18930 return res;
18931}
18932
18933bool val::is_zero() const
18934{
18935 if (!ptr)
18936 exception::throw_invalid("NULL input", __FILE__, __LINE__);
18937 auto saved_ctx = ctx();
18938 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
18939 auto res = isl_val_is_zero(get());
18940 if (res < 0)
18941 exception::throw_last_error(saved_ctx);
18942 return res;
18943}
18944
18945bool val::le(const isl::val &v2) const
18946{
18947 if (!ptr || v2.is_null())
18948 exception::throw_invalid("NULL input", __FILE__, __LINE__);
18949 auto saved_ctx = ctx();
18950 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
18951 auto res = isl_val_le(get(), v2.get());
18952 if (res < 0)
18953 exception::throw_last_error(saved_ctx);
18954 return res;
18955}
18956
18957bool val::le(long v2) const
18958{
18959 if (!ptr)
18960 exception::throw_invalid("NULL input", __FILE__, __LINE__);
18961 return this->le(isl::val(ctx(), v2));
18962}
18963
18964bool val::lt(const isl::val &v2) const
18965{
18966 if (!ptr || v2.is_null())
18967 exception::throw_invalid("NULL input", __FILE__, __LINE__);
18968 auto saved_ctx = ctx();
18969 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
18970 auto res = isl_val_lt(get(), v2.get());
18971 if (res < 0)
18972 exception::throw_last_error(saved_ctx);
18973 return res;
18974}
18975
18976bool val::lt(long v2) const
18977{
18978 if (!ptr)
18979 exception::throw_invalid("NULL input", __FILE__, __LINE__);
18980 return this->lt(isl::val(ctx(), v2));
18981}
18982
18983isl::val val::max(isl::val v2) const
18984{
18985 if (!ptr || v2.is_null())
18986 exception::throw_invalid("NULL input", __FILE__, __LINE__);
18987 auto saved_ctx = ctx();
18988 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
18989 auto res = isl_val_max(copy(), v2.release());
18990 if (!res)
18991 exception::throw_last_error(saved_ctx);
18992 return manage(res);
18993}
18994
18995isl::val val::max(long v2) const
18996{
18997 if (!ptr)
18998 exception::throw_invalid("NULL input", __FILE__, __LINE__);
18999 return this->max(isl::val(ctx(), v2));
19000}
19001
19002isl::val val::min(isl::val v2) const
19003{
19004 if (!ptr || v2.is_null())
19005 exception::throw_invalid("NULL input", __FILE__, __LINE__);
19006 auto saved_ctx = ctx();
19007 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
19008 auto res = isl_val_min(copy(), v2.release());
19009 if (!res)
19010 exception::throw_last_error(saved_ctx);
19011 return manage(res);
19012}
19013
19014isl::val val::min(long v2) const
19015{
19016 if (!ptr)
19017 exception::throw_invalid("NULL input", __FILE__, __LINE__);
19018 return this->min(isl::val(ctx(), v2));
19019}
19020
19021isl::val val::mod(isl::val v2) const
19022{
19023 if (!ptr || v2.is_null())
19024 exception::throw_invalid("NULL input", __FILE__, __LINE__);
19025 auto saved_ctx = ctx();
19026 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
19027 auto res = isl_val_mod(copy(), v2.release());
19028 if (!res)
19029 exception::throw_last_error(saved_ctx);
19030 return manage(res);
19031}
19032
19033isl::val val::mod(long v2) const
19034{
19035 if (!ptr)
19036 exception::throw_invalid("NULL input", __FILE__, __LINE__);
19037 return this->mod(isl::val(ctx(), v2));
19038}
19039
19040isl::val val::mul(isl::val v2) const
19041{
19042 if (!ptr || v2.is_null())
19043 exception::throw_invalid("NULL input", __FILE__, __LINE__);
19044 auto saved_ctx = ctx();
19045 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
19046 auto res = isl_val_mul(copy(), v2.release());
19047 if (!res)
19048 exception::throw_last_error(saved_ctx);
19049 return manage(res);
19050}
19051
19052isl::val val::mul(long v2) const
19053{
19054 if (!ptr)
19055 exception::throw_invalid("NULL input", __FILE__, __LINE__);
19056 return this->mul(isl::val(ctx(), v2));
19057}
19058
19059isl::val val::nan(isl::ctx ctx)
19060{
19061 auto saved_ctx = ctx;
19062 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
19063 auto res = isl_val_nan(ctx.release());
19064 if (!res)
19065 exception::throw_last_error(saved_ctx);
19066 return manage(res);
19067}
19068
19069bool val::ne(const isl::val &v2) const
19070{
19071 if (!ptr || v2.is_null())
19072 exception::throw_invalid("NULL input", __FILE__, __LINE__);
19073 auto saved_ctx = ctx();
19074 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
19075 auto res = isl_val_ne(get(), v2.get());
19076 if (res < 0)
19077 exception::throw_last_error(saved_ctx);
19078 return res;
19079}
19080
19081bool val::ne(long v2) const
19082{
19083 if (!ptr)
19084 exception::throw_invalid("NULL input", __FILE__, __LINE__);
19085 return this->ne(isl::val(ctx(), v2));
19086}
19087
19088isl::val val::neg() const
19089{
19090 if (!ptr)
19091 exception::throw_invalid("NULL input", __FILE__, __LINE__);
19092 auto saved_ctx = ctx();
19093 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
19094 auto res = isl_val_neg(copy());
19095 if (!res)
19096 exception::throw_last_error(saved_ctx);
19097 return manage(res);
19098}
19099
19100isl::val val::neginfty(isl::ctx ctx)
19101{
19102 auto saved_ctx = ctx;
19103 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
19104 auto res = isl_val_neginfty(ctx.release());
19105 if (!res)
19106 exception::throw_last_error(saved_ctx);
19107 return manage(res);
19108}
19109
19110isl::val val::negone(isl::ctx ctx)
19111{
19112 auto saved_ctx = ctx;
19113 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
19114 auto res = isl_val_negone(ctx.release());
19115 if (!res)
19116 exception::throw_last_error(saved_ctx);
19117 return manage(res);
19118}
19119
19120isl::val val::one(isl::ctx ctx)
19121{
19122 auto saved_ctx = ctx;
19123 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
19124 auto res = isl_val_one(ctx.release());
19125 if (!res)
19126 exception::throw_last_error(saved_ctx);
19127 return manage(res);
19128}
19129
19130isl::val val::pow2() const
19131{
19132 if (!ptr)
19133 exception::throw_invalid("NULL input", __FILE__, __LINE__);
19134 auto saved_ctx = ctx();
19135 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
19136 auto res = isl_val_pow2(copy());
19137 if (!res)
19138 exception::throw_last_error(saved_ctx);
19139 return manage(res);
19140}
19141
19142int val::sgn() const
19143{
19144 if (!ptr)
19145 exception::throw_invalid("NULL input", __FILE__, __LINE__);
19146 auto saved_ctx = ctx();
19147 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
19148 auto res = isl_val_sgn(get());
19149 return res;
19150}
19151
19152isl::val val::sub(isl::val v2) const
19153{
19154 if (!ptr || v2.is_null())
19155 exception::throw_invalid("NULL input", __FILE__, __LINE__);
19156 auto saved_ctx = ctx();
19157 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
19158 auto res = isl_val_sub(copy(), v2.release());
19159 if (!res)
19160 exception::throw_last_error(saved_ctx);
19161 return manage(res);
19162}
19163
19164isl::val val::sub(long v2) const
19165{
19166 if (!ptr)
19167 exception::throw_invalid("NULL input", __FILE__, __LINE__);
19168 return this->sub(isl::val(ctx(), v2));
19169}
19170
19171isl::val val::trunc() const
19172{
19173 if (!ptr)
19174 exception::throw_invalid("NULL input", __FILE__, __LINE__);
19175 auto saved_ctx = ctx();
19176 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
19177 auto res = isl_val_trunc(copy());
19178 if (!res)
19179 exception::throw_last_error(saved_ctx);
19180 return manage(res);
19181}
19182
19183isl::val val::zero(isl::ctx ctx)
19184{
19185 auto saved_ctx = ctx;
19186 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
19187 auto res = isl_val_zero(ctx.release());
19188 if (!res)
19189 exception::throw_last_error(saved_ctx);
19190 return manage(res);
19191}
19192
19193inline std::ostream &operator<<(std::ostream &os, const val &obj)
19194{
19195 if (!obj.get())
19196 exception::throw_invalid("NULL input", __FILE__, __LINE__);
19197 auto saved_ctx = isl_val_get_ctx(obj.get());
19198 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
19199 char *str = isl_val_to_str(obj.get());
19200 if (!str)
19201 exception::throw_last_error(saved_ctx);
19202 os << str;
19203 free(str);
19204 return os;
19205}
19206
19207// implementations for isl::val_list
19208val_list manage(__isl_take isl_val_list *ptr) {
19209 if (!ptr)
19210 exception::throw_invalid("NULL input", __FILE__, __LINE__);
19211 return val_list(ptr);
19212}
19213val_list manage_copy(__isl_keep isl_val_list *ptr) {
19214 if (!ptr)
19215 exception::throw_invalid("NULL input", __FILE__, __LINE__);
19216 auto saved_ctx = isl_val_list_get_ctx(ptr);
19217 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
19218 ptr = isl_val_list_copy(ptr);
19219 if (!ptr)
19220 exception::throw_last_error(saved_ctx);
19221 return val_list(ptr);
19222}
19223
19224val_list::val_list()
19225 : ptr(nullptr) {}
19226
19227val_list::val_list(const val_list &obj)
19228 : ptr(nullptr)
19229{
19230 if (!obj.ptr)
19231 exception::throw_invalid("NULL input", __FILE__, __LINE__);
19232 auto saved_ctx = isl_val_list_get_ctx(obj.ptr);
19233 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
19234 ptr = obj.copy();
19235 if (!ptr)
19236 exception::throw_last_error(saved_ctx);
19237}
19238
19239val_list::val_list(__isl_take isl_val_list *ptr)
19240 : ptr(ptr) {}
19241
19242val_list::val_list(isl::ctx ctx, int n)
19243{
19244 auto saved_ctx = ctx;
19245 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
19246 auto res = isl_val_list_alloc(ctx.release(), n);
19247 if (!res)
19248 exception::throw_last_error(saved_ctx);
19249 ptr = res;
19250}
19251
19252val_list::val_list(isl::val el)
19253{
19254 if (el.is_null())
19255 exception::throw_invalid("NULL input", __FILE__, __LINE__);
19256 auto saved_ctx = el.ctx();
19257 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
19258 auto res = isl_val_list_from_val(el.release());
19259 if (!res)
19260 exception::throw_last_error(saved_ctx);
19261 ptr = res;
19262}
19263
19264val_list &val_list::operator=(val_list obj) {
19265 std::swap(this->ptr, obj.ptr);
19266 return *this;
19267}
19268
19269val_list::~val_list() {
19270 if (ptr)
19271 isl_val_list_free(ptr);
19272}
19273
19274__isl_give isl_val_list *val_list::copy() const & {
19275 return isl_val_list_copy(ptr);
19276}
19277
19278__isl_keep isl_val_list *val_list::get() const {
19279 return ptr;
19280}
19281
19282__isl_give isl_val_list *val_list::release() {
19283 isl_val_list *tmp = ptr;
19284 ptr = nullptr;
19285 return tmp;
19286}
19287
19288bool val_list::is_null() const {
19289 return ptr == nullptr;
19290}
19291
19292isl::ctx val_list::ctx() const {
19293 return isl::ctx(isl_val_list_get_ctx(ptr));
19294}
19295
19296isl::val_list val_list::add(isl::val el) const
19297{
19298 if (!ptr || el.is_null())
19299 exception::throw_invalid("NULL input", __FILE__, __LINE__);
19300 auto saved_ctx = ctx();
19301 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
19302 auto res = isl_val_list_add(copy(), el.release());
19303 if (!res)
19304 exception::throw_last_error(saved_ctx);
19305 return manage(res);
19306}
19307
19308isl::val_list val_list::add(long el) const
19309{
19310 if (!ptr)
19311 exception::throw_invalid("NULL input", __FILE__, __LINE__);
19312 return this->add(isl::val(ctx(), el));
19313}
19314
19315isl::val_list val_list::clear() const
19316{
19317 if (!ptr)
19318 exception::throw_invalid("NULL input", __FILE__, __LINE__);
19319 auto saved_ctx = ctx();
19320 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
19321 auto res = isl_val_list_clear(copy());
19322 if (!res)
19323 exception::throw_last_error(saved_ctx);
19324 return manage(res);
19325}
19326
19327isl::val_list val_list::concat(isl::val_list list2) const
19328{
19329 if (!ptr || list2.is_null())
19330 exception::throw_invalid("NULL input", __FILE__, __LINE__);
19331 auto saved_ctx = ctx();
19332 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
19333 auto res = isl_val_list_concat(copy(), list2.release());
19334 if (!res)
19335 exception::throw_last_error(saved_ctx);
19336 return manage(res);
19337}
19338
19339isl::val_list val_list::drop(unsigned int first, unsigned int n) const
19340{
19341 if (!ptr)
19342 exception::throw_invalid("NULL input", __FILE__, __LINE__);
19343 auto saved_ctx = ctx();
19344 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
19345 auto res = isl_val_list_drop(copy(), first, n);
19346 if (!res)
19347 exception::throw_last_error(saved_ctx);
19348 return manage(res);
19349}
19350
19351void val_list::foreach(const std::function<void(isl::val)> &fn) const
19352{
19353 if (!ptr)
19354 exception::throw_invalid("NULL input", __FILE__, __LINE__);
19355 auto saved_ctx = ctx();
19356 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
19357 struct fn_data {
19358 std::function<void(isl::val)> func;
19359 std::exception_ptr eptr;
19360 } fn_data = { fn };
19361 auto fn_lambda = [](isl_val *arg_0, void *arg_1) -> isl_stat {
19362 auto *data = static_cast<struct fn_data *>(arg_1);
19363 ISL_CPP_TRY {
19364 (data->func)(manage(arg_0));
19365 return isl_stat_ok;
19366 } ISL_CPP_CATCH_ALL {
19367 data->eptr = std::current_exception();
19368 return isl_stat_error;
19369 }
19370 };
19371 auto res = isl_val_list_foreach(get(), fn_lambda, &fn_data);
19372 if (fn_data.eptr)
19373 std::rethrow_exception(fn_data.eptr);
19374 if (res < 0)
19375 exception::throw_last_error(saved_ctx);
19376 return;
19377}
19378
19379isl::val val_list::at(int index) const
19380{
19381 if (!ptr)
19382 exception::throw_invalid("NULL input", __FILE__, __LINE__);
19383 auto saved_ctx = ctx();
19384 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
19385 auto res = isl_val_list_get_at(get(), index);
19386 if (!res)
19387 exception::throw_last_error(saved_ctx);
19388 return manage(res);
19389}
19390
19391isl::val val_list::get_at(int index) const
19392{
19393 return at(index);
19394}
19395
19396isl::val_list val_list::insert(unsigned int pos, isl::val el) const
19397{
19398 if (!ptr || el.is_null())
19399 exception::throw_invalid("NULL input", __FILE__, __LINE__);
19400 auto saved_ctx = ctx();
19401 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
19402 auto res = isl_val_list_insert(copy(), pos, el.release());
19403 if (!res)
19404 exception::throw_last_error(saved_ctx);
19405 return manage(res);
19406}
19407
19408isl::val_list val_list::insert(unsigned int pos, long el) const
19409{
19410 if (!ptr)
19411 exception::throw_invalid("NULL input", __FILE__, __LINE__);
19412 return this->insert(pos, isl::val(ctx(), el));
19413}
19414
19415unsigned val_list::size() const
19416{
19417 if (!ptr)
19418 exception::throw_invalid("NULL input", __FILE__, __LINE__);
19419 auto saved_ctx = ctx();
19420 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
19421 auto res = isl_val_list_size(get());
19422 if (res < 0)
19423 exception::throw_last_error(saved_ctx);
19424 return res;
19425}
19426
19427inline std::ostream &operator<<(std::ostream &os, const val_list &obj)
19428{
19429 if (!obj.get())
19430 exception::throw_invalid("NULL input", __FILE__, __LINE__);
19431 auto saved_ctx = isl_val_list_get_ctx(obj.get());
19432 options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
19433 char *str = isl_val_list_to_str(obj.get());
19434 if (!str)
19435 exception::throw_last_error(saved_ctx);
19436 os << str;
19437 free(str);
19438 return os;
19439}
19440} // namespace isl
19441
19442#endif /* ISL_CPP */