1 /// 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 
50 namespace isl {
51 
52 class ctx {
53 	isl_ctx *ptr;
54 public:
ctx(isl_ctx * ctx)55 	/* implicit */ ctx(isl_ctx *ctx) : ptr(ctx) {}
release()56 	isl_ctx *release() {
57 		auto tmp = ptr;
58 		ptr = nullptr;
59 		return tmp;
60 	}
get()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  */
86 class exception : public std::exception {
87 	std::shared_ptr<std::string> what_str;
88 
89 protected:
90 	inline exception(const char *what_arg, const char *msg,
91 		const char *file, int line);
92 public:
exception()93 	exception() {}
exception(const char * what_arg)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);
what()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 	 */
throw_invalid(const char * msg,const char * file,int line)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  */
exception(const char * what_arg,const char * msg,const char * file,int line)125 exception::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 
135 class exception_abort : public exception {
136 	friend exception;
exception_abort(const char * msg,const char * file,int line)137 	exception_abort(const char *msg, const char *file, int line) :
138 		exception("execution aborted", msg, file, line) {}
139 };
140 
141 class exception_alloc : public exception {
142 	friend exception;
exception_alloc(const char * msg,const char * file,int line)143 	exception_alloc(const char *msg, const char *file, int line) :
144 		exception("memory allocation failure", msg, file, line) {}
145 };
146 
147 class exception_unknown : public exception {
148 	friend exception;
exception_unknown(const char * msg,const char * file,int line)149 	exception_unknown(const char *msg, const char *file, int line) :
150 		exception("unknown failure", msg, file, line) {}
151 };
152 
153 class exception_internal : public exception {
154 	friend exception;
exception_internal(const char * msg,const char * file,int line)155 	exception_internal(const char *msg, const char *file, int line) :
156 		exception("internal error", msg, file, line) {}
157 };
158 
159 class exception_invalid : public exception {
160 	friend exception;
exception_invalid(const char * msg,const char * file,int line)161 	exception_invalid(const char *msg, const char *file, int line) :
162 		exception("invalid argument", msg, file, line) {}
163 };
164 
165 class exception_quota : public exception {
166 	friend exception;
exception_quota(const char * msg,const char * file,int line)167 	exception_quota(const char *msg, const char *file, int line) :
168 		exception("quota exceeded", msg, file, line) {}
169 };
170 
171 class exception_unsupported : public exception {
172 	friend exception;
exception_unsupported(const char * msg,const char * file,int line)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  */
throw_error(enum isl_error error,const char * msg,const char * file,int line)182 void 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  */
throw_last_error(ctx ctx)207 void 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 
227 class exception {
228 public:
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 	 */
throw_invalid(const char * msg,const char * file,int line)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 	 */
throw_last_error(ctx ctx)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  */
256 class options_scoped_set_on_error {
257 	isl_ctx *ctx;
258 	int saved_on_error;
259 public:
options_scoped_set_on_error(class ctx ctx,int on_error)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 	}
~options_scoped_set_on_error()265 	~options_scoped_set_on_error() {
266 		isl_options_set_on_error(ctx, saved_on_error);
267 	}
268 };
269 
270 } // namespace isl
271 
272 namespace isl {
273 
274 // forward declarations
275 class aff;
276 class aff_list;
277 class ast_build;
278 class ast_expr;
279 class ast_expr_id;
280 class ast_expr_int;
281 class ast_expr_op;
282 class ast_expr_op_access;
283 class ast_expr_op_add;
284 class ast_expr_op_address_of;
285 class ast_expr_op_and;
286 class ast_expr_op_and_then;
287 class ast_expr_op_call;
288 class ast_expr_op_cond;
289 class ast_expr_op_div;
290 class ast_expr_op_eq;
291 class ast_expr_op_fdiv_q;
292 class ast_expr_op_ge;
293 class ast_expr_op_gt;
294 class ast_expr_op_le;
295 class ast_expr_op_lt;
296 class ast_expr_op_max;
297 class ast_expr_op_member;
298 class ast_expr_op_min;
299 class ast_expr_op_minus;
300 class ast_expr_op_mul;
301 class ast_expr_op_or;
302 class ast_expr_op_or_else;
303 class ast_expr_op_pdiv_q;
304 class ast_expr_op_pdiv_r;
305 class ast_expr_op_select;
306 class ast_expr_op_sub;
307 class ast_expr_op_zdiv_r;
308 class ast_node;
309 class ast_node_block;
310 class ast_node_for;
311 class ast_node_if;
312 class ast_node_list;
313 class ast_node_mark;
314 class ast_node_user;
315 class basic_map;
316 class basic_set;
317 class fixed_box;
318 class id;
319 class id_list;
320 class map;
321 class multi_aff;
322 class multi_id;
323 class multi_pw_aff;
324 class multi_union_pw_aff;
325 class multi_val;
326 class point;
327 class pw_aff;
328 class pw_aff_list;
329 class pw_multi_aff;
330 class pw_multi_aff_list;
331 class schedule;
332 class schedule_constraints;
333 class schedule_node;
334 class schedule_node_band;
335 class schedule_node_context;
336 class schedule_node_domain;
337 class schedule_node_expansion;
338 class schedule_node_extension;
339 class schedule_node_filter;
340 class schedule_node_guard;
341 class schedule_node_leaf;
342 class schedule_node_mark;
343 class schedule_node_sequence;
344 class schedule_node_set;
345 class set;
346 class space;
347 class union_access_info;
348 class union_flow;
349 class union_map;
350 class union_pw_aff;
351 class union_pw_aff_list;
352 class union_pw_multi_aff;
353 class union_set;
354 class union_set_list;
355 class val;
356 class val_list;
357 
358 // declarations for isl::aff
359 inline aff manage(__isl_take isl_aff *ptr);
360 inline aff manage_copy(__isl_keep isl_aff *ptr);
361 
362 class aff {
363   friend inline aff manage(__isl_take isl_aff *ptr);
364   friend inline aff manage_copy(__isl_keep isl_aff *ptr);
365 
366 protected:
367   isl_aff *ptr = nullptr;
368 
369   inline explicit aff(__isl_take isl_aff *ptr);
370 
371 public:
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 };
412 
413 // declarations for isl::aff_list
414 inline aff_list manage(__isl_take isl_aff_list *ptr);
415 inline aff_list manage_copy(__isl_keep isl_aff_list *ptr);
416 
417 class aff_list {
418   friend inline aff_list manage(__isl_take isl_aff_list *ptr);
419   friend inline aff_list manage_copy(__isl_keep isl_aff_list *ptr);
420 
421 protected:
422   isl_aff_list *ptr = nullptr;
423 
424   inline explicit aff_list(__isl_take isl_aff_list *ptr);
425 
426 public:
427   inline /* implicit */ aff_list();
428   inline /* implicit */ aff_list(const aff_list &obj);
429   inline explicit aff_list(isl::ctx ctx, int n);
430   inline explicit aff_list(isl::aff el);
431   inline aff_list &operator=(aff_list obj);
432   inline ~aff_list();
433   inline __isl_give isl_aff_list *copy() const &;
434   inline __isl_give isl_aff_list *copy() && = delete;
435   inline __isl_keep isl_aff_list *get() const;
436   inline __isl_give isl_aff_list *release();
437   inline bool is_null() const;
438   inline isl::ctx ctx() const;
439 
440   inline isl::aff_list add(isl::aff el) const;
441   inline isl::aff_list clear() const;
442   inline isl::aff_list concat(isl::aff_list list2) const;
443   inline void foreach(const std::function<void(isl::aff)> &fn) const;
444   inline isl::aff at(int index) const;
445   inline isl::aff get_at(int index) const;
446   inline unsigned size() const;
447 };
448 
449 // declarations for isl::ast_build
450 inline ast_build manage(__isl_take isl_ast_build *ptr);
451 inline ast_build manage_copy(__isl_keep isl_ast_build *ptr);
452 
453 class ast_build {
454   friend inline ast_build manage(__isl_take isl_ast_build *ptr);
455   friend inline ast_build manage_copy(__isl_keep isl_ast_build *ptr);
456 
457 protected:
458   isl_ast_build *ptr = nullptr;
459 
460   inline explicit ast_build(__isl_take isl_ast_build *ptr);
461 
462 public:
463   inline /* implicit */ ast_build();
464   inline /* implicit */ ast_build(const ast_build &obj);
465   inline explicit ast_build(isl::ctx ctx);
466   inline ast_build &operator=(ast_build obj);
467   inline ~ast_build();
468   inline __isl_give isl_ast_build *copy() const &;
469   inline __isl_give isl_ast_build *copy() && = delete;
470   inline __isl_keep isl_ast_build *get() const;
471   inline __isl_give isl_ast_build *release();
472   inline bool is_null() const;
473   inline isl::ctx ctx() const;
474 
475 private:
476   inline ast_build &copy_callbacks(const ast_build &obj);
477   struct at_each_domain_data {
478     std::function<isl::ast_node(isl::ast_node, isl::ast_build)> func;
479     std::exception_ptr eptr;
480   };
481   std::shared_ptr<at_each_domain_data> at_each_domain_data;
482   static inline isl_ast_node *at_each_domain(isl_ast_node *arg_0, isl_ast_build *arg_1, void *arg_2);
483   inline void set_at_each_domain_data(const std::function<isl::ast_node(isl::ast_node, isl::ast_build)> &fn);
484 public:
485   inline isl::ast_build set_at_each_domain(const std::function<isl::ast_node(isl::ast_node, isl::ast_build)> &fn) const;
486   inline isl::ast_expr access_from(isl::multi_pw_aff mpa) const;
487   inline isl::ast_expr access_from(isl::pw_multi_aff pma) const;
488   inline isl::ast_expr call_from(isl::multi_pw_aff mpa) const;
489   inline isl::ast_expr call_from(isl::pw_multi_aff pma) const;
490   inline isl::ast_expr expr_from(isl::pw_aff pa) const;
491   inline isl::ast_expr expr_from(isl::set set) const;
492   static inline isl::ast_build from_context(isl::set set);
493   inline isl::union_map schedule() const;
494   inline isl::union_map get_schedule() const;
495   inline isl::ast_node node_from(isl::schedule schedule) const;
496   inline isl::ast_node node_from_schedule_map(isl::union_map schedule) const;
497 };
498 
499 // declarations for isl::ast_expr
500 inline ast_expr manage(__isl_take isl_ast_expr *ptr);
501 inline ast_expr manage_copy(__isl_keep isl_ast_expr *ptr);
502 
503 class ast_expr {
504   friend inline ast_expr manage(__isl_take isl_ast_expr *ptr);
505   friend inline ast_expr manage_copy(__isl_keep isl_ast_expr *ptr);
506 
507 protected:
508   isl_ast_expr *ptr = nullptr;
509 
510   inline explicit ast_expr(__isl_take isl_ast_expr *ptr);
511 
512 public:
513   inline /* implicit */ ast_expr();
514   inline /* implicit */ ast_expr(const ast_expr &obj);
515   inline ast_expr &operator=(ast_expr obj);
516   inline ~ast_expr();
517   inline __isl_give isl_ast_expr *copy() const &;
518   inline __isl_give isl_ast_expr *copy() && = delete;
519   inline __isl_keep isl_ast_expr *get() const;
520   inline __isl_give isl_ast_expr *release();
521   inline bool is_null() const;
522 private:
523   template <typename T,
524           typename = typename std::enable_if<std::is_same<
525                   const decltype(isl_ast_expr_get_type(NULL)),
526                   const T>::value>::type>
527   inline bool isa_type(T subtype) const;
528 public:
529   template <class T> inline bool isa() const;
530   template <class T> inline T as() const;
531   inline isl::ctx ctx() const;
532 
533   inline std::string to_C_str() const;
534 };
535 
536 // declarations for isl::ast_expr_id
537 
538 class ast_expr_id : public ast_expr {
539   template <class T>
540   friend bool ast_expr::isa() const;
541   friend ast_expr_id ast_expr::as<ast_expr_id>() const;
542   static const auto type = isl_ast_expr_id;
543 
544 protected:
545   inline explicit ast_expr_id(__isl_take isl_ast_expr *ptr);
546 
547 public:
548   inline /* implicit */ ast_expr_id();
549   inline /* implicit */ ast_expr_id(const ast_expr_id &obj);
550   inline ast_expr_id &operator=(ast_expr_id obj);
551   inline isl::ctx ctx() const;
552 
553   inline isl::id id() const;
554   inline isl::id get_id() const;
555 };
556 
557 // declarations for isl::ast_expr_int
558 
559 class ast_expr_int : public ast_expr {
560   template <class T>
561   friend bool ast_expr::isa() const;
562   friend ast_expr_int ast_expr::as<ast_expr_int>() const;
563   static const auto type = isl_ast_expr_int;
564 
565 protected:
566   inline explicit ast_expr_int(__isl_take isl_ast_expr *ptr);
567 
568 public:
569   inline /* implicit */ ast_expr_int();
570   inline /* implicit */ ast_expr_int(const ast_expr_int &obj);
571   inline ast_expr_int &operator=(ast_expr_int obj);
572   inline isl::ctx ctx() const;
573 
574   inline isl::val val() const;
575   inline isl::val get_val() const;
576 };
577 
578 // declarations for isl::ast_expr_op
579 
580 class ast_expr_op : public ast_expr {
581   template <class T>
582   friend bool ast_expr::isa() const;
583   friend ast_expr_op ast_expr::as<ast_expr_op>() const;
584   static const auto type = isl_ast_expr_op;
585 
586 protected:
587   inline explicit ast_expr_op(__isl_take isl_ast_expr *ptr);
588 
589 public:
590   inline /* implicit */ ast_expr_op();
591   inline /* implicit */ ast_expr_op(const ast_expr_op &obj);
592   inline ast_expr_op &operator=(ast_expr_op obj);
593 private:
594   template <typename T,
595           typename = typename std::enable_if<std::is_same<
596                   const decltype(isl_ast_expr_op_get_type(NULL)),
597                   const T>::value>::type>
598   inline bool isa_type(T subtype) const;
599 public:
600   template <class T> inline bool isa() const;
601   template <class T> inline T as() const;
602   inline isl::ctx ctx() const;
603 
604   inline isl::ast_expr arg(int pos) const;
605   inline isl::ast_expr get_arg(int pos) const;
606   inline unsigned n_arg() const;
607   inline unsigned get_n_arg() const;
608 };
609 
610 // declarations for isl::ast_expr_op_access
611 
612 class ast_expr_op_access : public ast_expr_op {
613   template <class T>
614   friend bool ast_expr_op::isa() const;
615   friend ast_expr_op_access ast_expr_op::as<ast_expr_op_access>() const;
616   static const auto type = isl_ast_expr_op_access;
617 
618 protected:
619   inline explicit ast_expr_op_access(__isl_take isl_ast_expr *ptr);
620 
621 public:
622   inline /* implicit */ ast_expr_op_access();
623   inline /* implicit */ ast_expr_op_access(const ast_expr_op_access &obj);
624   inline ast_expr_op_access &operator=(ast_expr_op_access obj);
625   inline isl::ctx ctx() const;
626 
627 };
628 
629 // declarations for isl::ast_expr_op_add
630 
631 class ast_expr_op_add : public ast_expr_op {
632   template <class T>
633   friend bool ast_expr_op::isa() const;
634   friend ast_expr_op_add ast_expr_op::as<ast_expr_op_add>() const;
635   static const auto type = isl_ast_expr_op_add;
636 
637 protected:
638   inline explicit ast_expr_op_add(__isl_take isl_ast_expr *ptr);
639 
640 public:
641   inline /* implicit */ ast_expr_op_add();
642   inline /* implicit */ ast_expr_op_add(const ast_expr_op_add &obj);
643   inline ast_expr_op_add &operator=(ast_expr_op_add obj);
644   inline isl::ctx ctx() const;
645 
646 };
647 
648 // declarations for isl::ast_expr_op_address_of
649 
650 class ast_expr_op_address_of : public ast_expr_op {
651   template <class T>
652   friend bool ast_expr_op::isa() const;
653   friend ast_expr_op_address_of ast_expr_op::as<ast_expr_op_address_of>() const;
654   static const auto type = isl_ast_expr_op_address_of;
655 
656 protected:
657   inline explicit ast_expr_op_address_of(__isl_take isl_ast_expr *ptr);
658 
659 public:
660   inline /* implicit */ ast_expr_op_address_of();
661   inline /* implicit */ ast_expr_op_address_of(const ast_expr_op_address_of &obj);
662   inline ast_expr_op_address_of &operator=(ast_expr_op_address_of obj);
663   inline isl::ctx ctx() const;
664 
665 };
666 
667 // declarations for isl::ast_expr_op_and
668 
669 class ast_expr_op_and : public ast_expr_op {
670   template <class T>
671   friend bool ast_expr_op::isa() const;
672   friend ast_expr_op_and ast_expr_op::as<ast_expr_op_and>() const;
673   static const auto type = isl_ast_expr_op_and;
674 
675 protected:
676   inline explicit ast_expr_op_and(__isl_take isl_ast_expr *ptr);
677 
678 public:
679   inline /* implicit */ ast_expr_op_and();
680   inline /* implicit */ ast_expr_op_and(const ast_expr_op_and &obj);
681   inline ast_expr_op_and &operator=(ast_expr_op_and obj);
682   inline isl::ctx ctx() const;
683 
684 };
685 
686 // declarations for isl::ast_expr_op_and_then
687 
688 class ast_expr_op_and_then : public ast_expr_op {
689   template <class T>
690   friend bool ast_expr_op::isa() const;
691   friend ast_expr_op_and_then ast_expr_op::as<ast_expr_op_and_then>() const;
692   static const auto type = isl_ast_expr_op_and_then;
693 
694 protected:
695   inline explicit ast_expr_op_and_then(__isl_take isl_ast_expr *ptr);
696 
697 public:
698   inline /* implicit */ ast_expr_op_and_then();
699   inline /* implicit */ ast_expr_op_and_then(const ast_expr_op_and_then &obj);
700   inline ast_expr_op_and_then &operator=(ast_expr_op_and_then obj);
701   inline isl::ctx ctx() const;
702 
703 };
704 
705 // declarations for isl::ast_expr_op_call
706 
707 class ast_expr_op_call : public ast_expr_op {
708   template <class T>
709   friend bool ast_expr_op::isa() const;
710   friend ast_expr_op_call ast_expr_op::as<ast_expr_op_call>() const;
711   static const auto type = isl_ast_expr_op_call;
712 
713 protected:
714   inline explicit ast_expr_op_call(__isl_take isl_ast_expr *ptr);
715 
716 public:
717   inline /* implicit */ ast_expr_op_call();
718   inline /* implicit */ ast_expr_op_call(const ast_expr_op_call &obj);
719   inline ast_expr_op_call &operator=(ast_expr_op_call obj);
720   inline isl::ctx ctx() const;
721 
722 };
723 
724 // declarations for isl::ast_expr_op_cond
725 
726 class ast_expr_op_cond : public ast_expr_op {
727   template <class T>
728   friend bool ast_expr_op::isa() const;
729   friend ast_expr_op_cond ast_expr_op::as<ast_expr_op_cond>() const;
730   static const auto type = isl_ast_expr_op_cond;
731 
732 protected:
733   inline explicit ast_expr_op_cond(__isl_take isl_ast_expr *ptr);
734 
735 public:
736   inline /* implicit */ ast_expr_op_cond();
737   inline /* implicit */ ast_expr_op_cond(const ast_expr_op_cond &obj);
738   inline ast_expr_op_cond &operator=(ast_expr_op_cond obj);
739   inline isl::ctx ctx() const;
740 
741 };
742 
743 // declarations for isl::ast_expr_op_div
744 
745 class ast_expr_op_div : public ast_expr_op {
746   template <class T>
747   friend bool ast_expr_op::isa() const;
748   friend ast_expr_op_div ast_expr_op::as<ast_expr_op_div>() const;
749   static const auto type = isl_ast_expr_op_div;
750 
751 protected:
752   inline explicit ast_expr_op_div(__isl_take isl_ast_expr *ptr);
753 
754 public:
755   inline /* implicit */ ast_expr_op_div();
756   inline /* implicit */ ast_expr_op_div(const ast_expr_op_div &obj);
757   inline ast_expr_op_div &operator=(ast_expr_op_div obj);
758   inline isl::ctx ctx() const;
759 
760 };
761 
762 // declarations for isl::ast_expr_op_eq
763 
764 class ast_expr_op_eq : public ast_expr_op {
765   template <class T>
766   friend bool ast_expr_op::isa() const;
767   friend ast_expr_op_eq ast_expr_op::as<ast_expr_op_eq>() const;
768   static const auto type = isl_ast_expr_op_eq;
769 
770 protected:
771   inline explicit ast_expr_op_eq(__isl_take isl_ast_expr *ptr);
772 
773 public:
774   inline /* implicit */ ast_expr_op_eq();
775   inline /* implicit */ ast_expr_op_eq(const ast_expr_op_eq &obj);
776   inline ast_expr_op_eq &operator=(ast_expr_op_eq obj);
777   inline isl::ctx ctx() const;
778 
779 };
780 
781 // declarations for isl::ast_expr_op_fdiv_q
782 
783 class ast_expr_op_fdiv_q : public ast_expr_op {
784   template <class T>
785   friend bool ast_expr_op::isa() const;
786   friend ast_expr_op_fdiv_q ast_expr_op::as<ast_expr_op_fdiv_q>() const;
787   static const auto type = isl_ast_expr_op_fdiv_q;
788 
789 protected:
790   inline explicit ast_expr_op_fdiv_q(__isl_take isl_ast_expr *ptr);
791 
792 public:
793   inline /* implicit */ ast_expr_op_fdiv_q();
794   inline /* implicit */ ast_expr_op_fdiv_q(const ast_expr_op_fdiv_q &obj);
795   inline ast_expr_op_fdiv_q &operator=(ast_expr_op_fdiv_q obj);
796   inline isl::ctx ctx() const;
797 
798 };
799 
800 // declarations for isl::ast_expr_op_ge
801 
802 class ast_expr_op_ge : public ast_expr_op {
803   template <class T>
804   friend bool ast_expr_op::isa() const;
805   friend ast_expr_op_ge ast_expr_op::as<ast_expr_op_ge>() const;
806   static const auto type = isl_ast_expr_op_ge;
807 
808 protected:
809   inline explicit ast_expr_op_ge(__isl_take isl_ast_expr *ptr);
810 
811 public:
812   inline /* implicit */ ast_expr_op_ge();
813   inline /* implicit */ ast_expr_op_ge(const ast_expr_op_ge &obj);
814   inline ast_expr_op_ge &operator=(ast_expr_op_ge obj);
815   inline isl::ctx ctx() const;
816 
817 };
818 
819 // declarations for isl::ast_expr_op_gt
820 
821 class ast_expr_op_gt : public ast_expr_op {
822   template <class T>
823   friend bool ast_expr_op::isa() const;
824   friend ast_expr_op_gt ast_expr_op::as<ast_expr_op_gt>() const;
825   static const auto type = isl_ast_expr_op_gt;
826 
827 protected:
828   inline explicit ast_expr_op_gt(__isl_take isl_ast_expr *ptr);
829 
830 public:
831   inline /* implicit */ ast_expr_op_gt();
832   inline /* implicit */ ast_expr_op_gt(const ast_expr_op_gt &obj);
833   inline ast_expr_op_gt &operator=(ast_expr_op_gt obj);
834   inline isl::ctx ctx() const;
835 
836 };
837 
838 // declarations for isl::ast_expr_op_le
839 
840 class ast_expr_op_le : public ast_expr_op {
841   template <class T>
842   friend bool ast_expr_op::isa() const;
843   friend ast_expr_op_le ast_expr_op::as<ast_expr_op_le>() const;
844   static const auto type = isl_ast_expr_op_le;
845 
846 protected:
847   inline explicit ast_expr_op_le(__isl_take isl_ast_expr *ptr);
848 
849 public:
850   inline /* implicit */ ast_expr_op_le();
851   inline /* implicit */ ast_expr_op_le(const ast_expr_op_le &obj);
852   inline ast_expr_op_le &operator=(ast_expr_op_le obj);
853   inline isl::ctx ctx() const;
854 
855 };
856 
857 // declarations for isl::ast_expr_op_lt
858 
859 class ast_expr_op_lt : public ast_expr_op {
860   template <class T>
861   friend bool ast_expr_op::isa() const;
862   friend ast_expr_op_lt ast_expr_op::as<ast_expr_op_lt>() const;
863   static const auto type = isl_ast_expr_op_lt;
864 
865 protected:
866   inline explicit ast_expr_op_lt(__isl_take isl_ast_expr *ptr);
867 
868 public:
869   inline /* implicit */ ast_expr_op_lt();
870   inline /* implicit */ ast_expr_op_lt(const ast_expr_op_lt &obj);
871   inline ast_expr_op_lt &operator=(ast_expr_op_lt obj);
872   inline isl::ctx ctx() const;
873 
874 };
875 
876 // declarations for isl::ast_expr_op_max
877 
878 class ast_expr_op_max : public ast_expr_op {
879   template <class T>
880   friend bool ast_expr_op::isa() const;
881   friend ast_expr_op_max ast_expr_op::as<ast_expr_op_max>() const;
882   static const auto type = isl_ast_expr_op_max;
883 
884 protected:
885   inline explicit ast_expr_op_max(__isl_take isl_ast_expr *ptr);
886 
887 public:
888   inline /* implicit */ ast_expr_op_max();
889   inline /* implicit */ ast_expr_op_max(const ast_expr_op_max &obj);
890   inline ast_expr_op_max &operator=(ast_expr_op_max obj);
891   inline isl::ctx ctx() const;
892 
893 };
894 
895 // declarations for isl::ast_expr_op_member
896 
897 class ast_expr_op_member : public ast_expr_op {
898   template <class T>
899   friend bool ast_expr_op::isa() const;
900   friend ast_expr_op_member ast_expr_op::as<ast_expr_op_member>() const;
901   static const auto type = isl_ast_expr_op_member;
902 
903 protected:
904   inline explicit ast_expr_op_member(__isl_take isl_ast_expr *ptr);
905 
906 public:
907   inline /* implicit */ ast_expr_op_member();
908   inline /* implicit */ ast_expr_op_member(const ast_expr_op_member &obj);
909   inline ast_expr_op_member &operator=(ast_expr_op_member obj);
910   inline isl::ctx ctx() const;
911 
912 };
913 
914 // declarations for isl::ast_expr_op_min
915 
916 class ast_expr_op_min : public ast_expr_op {
917   template <class T>
918   friend bool ast_expr_op::isa() const;
919   friend ast_expr_op_min ast_expr_op::as<ast_expr_op_min>() const;
920   static const auto type = isl_ast_expr_op_min;
921 
922 protected:
923   inline explicit ast_expr_op_min(__isl_take isl_ast_expr *ptr);
924 
925 public:
926   inline /* implicit */ ast_expr_op_min();
927   inline /* implicit */ ast_expr_op_min(const ast_expr_op_min &obj);
928   inline ast_expr_op_min &operator=(ast_expr_op_min obj);
929   inline isl::ctx ctx() const;
930 
931 };
932 
933 // declarations for isl::ast_expr_op_minus
934 
935 class ast_expr_op_minus : public ast_expr_op {
936   template <class T>
937   friend bool ast_expr_op::isa() const;
938   friend ast_expr_op_minus ast_expr_op::as<ast_expr_op_minus>() const;
939   static const auto type = isl_ast_expr_op_minus;
940 
941 protected:
942   inline explicit ast_expr_op_minus(__isl_take isl_ast_expr *ptr);
943 
944 public:
945   inline /* implicit */ ast_expr_op_minus();
946   inline /* implicit */ ast_expr_op_minus(const ast_expr_op_minus &obj);
947   inline ast_expr_op_minus &operator=(ast_expr_op_minus obj);
948   inline isl::ctx ctx() const;
949 
950 };
951 
952 // declarations for isl::ast_expr_op_mul
953 
954 class ast_expr_op_mul : public ast_expr_op {
955   template <class T>
956   friend bool ast_expr_op::isa() const;
957   friend ast_expr_op_mul ast_expr_op::as<ast_expr_op_mul>() const;
958   static const auto type = isl_ast_expr_op_mul;
959 
960 protected:
961   inline explicit ast_expr_op_mul(__isl_take isl_ast_expr *ptr);
962 
963 public:
964   inline /* implicit */ ast_expr_op_mul();
965   inline /* implicit */ ast_expr_op_mul(const ast_expr_op_mul &obj);
966   inline ast_expr_op_mul &operator=(ast_expr_op_mul obj);
967   inline isl::ctx ctx() const;
968 
969 };
970 
971 // declarations for isl::ast_expr_op_or
972 
973 class ast_expr_op_or : public ast_expr_op {
974   template <class T>
975   friend bool ast_expr_op::isa() const;
976   friend ast_expr_op_or ast_expr_op::as<ast_expr_op_or>() const;
977   static const auto type = isl_ast_expr_op_or;
978 
979 protected:
980   inline explicit ast_expr_op_or(__isl_take isl_ast_expr *ptr);
981 
982 public:
983   inline /* implicit */ ast_expr_op_or();
984   inline /* implicit */ ast_expr_op_or(const ast_expr_op_or &obj);
985   inline ast_expr_op_or &operator=(ast_expr_op_or obj);
986   inline isl::ctx ctx() const;
987 
988 };
989 
990 // declarations for isl::ast_expr_op_or_else
991 
992 class ast_expr_op_or_else : public ast_expr_op {
993   template <class T>
994   friend bool ast_expr_op::isa() const;
995   friend ast_expr_op_or_else ast_expr_op::as<ast_expr_op_or_else>() const;
996   static const auto type = isl_ast_expr_op_or_else;
997 
998 protected:
999   inline explicit ast_expr_op_or_else(__isl_take isl_ast_expr *ptr);
1000 
1001 public:
1002   inline /* implicit */ ast_expr_op_or_else();
1003   inline /* implicit */ ast_expr_op_or_else(const ast_expr_op_or_else &obj);
1004   inline ast_expr_op_or_else &operator=(ast_expr_op_or_else obj);
1005   inline isl::ctx ctx() const;
1006 
1007 };
1008 
1009 // declarations for isl::ast_expr_op_pdiv_q
1010 
1011 class ast_expr_op_pdiv_q : public ast_expr_op {
1012   template <class T>
1013   friend bool ast_expr_op::isa() const;
1014   friend ast_expr_op_pdiv_q ast_expr_op::as<ast_expr_op_pdiv_q>() const;
1015   static const auto type = isl_ast_expr_op_pdiv_q;
1016 
1017 protected:
1018   inline explicit ast_expr_op_pdiv_q(__isl_take isl_ast_expr *ptr);
1019 
1020 public:
1021   inline /* implicit */ ast_expr_op_pdiv_q();
1022   inline /* implicit */ ast_expr_op_pdiv_q(const ast_expr_op_pdiv_q &obj);
1023   inline ast_expr_op_pdiv_q &operator=(ast_expr_op_pdiv_q obj);
1024   inline isl::ctx ctx() const;
1025 
1026 };
1027 
1028 // declarations for isl::ast_expr_op_pdiv_r
1029 
1030 class ast_expr_op_pdiv_r : public ast_expr_op {
1031   template <class T>
1032   friend bool ast_expr_op::isa() const;
1033   friend ast_expr_op_pdiv_r ast_expr_op::as<ast_expr_op_pdiv_r>() const;
1034   static const auto type = isl_ast_expr_op_pdiv_r;
1035 
1036 protected:
1037   inline explicit ast_expr_op_pdiv_r(__isl_take isl_ast_expr *ptr);
1038 
1039 public:
1040   inline /* implicit */ ast_expr_op_pdiv_r();
1041   inline /* implicit */ ast_expr_op_pdiv_r(const ast_expr_op_pdiv_r &obj);
1042   inline ast_expr_op_pdiv_r &operator=(ast_expr_op_pdiv_r obj);
1043   inline isl::ctx ctx() const;
1044 
1045 };
1046 
1047 // declarations for isl::ast_expr_op_select
1048 
1049 class ast_expr_op_select : public ast_expr_op {
1050   template <class T>
1051   friend bool ast_expr_op::isa() const;
1052   friend ast_expr_op_select ast_expr_op::as<ast_expr_op_select>() const;
1053   static const auto type = isl_ast_expr_op_select;
1054 
1055 protected:
1056   inline explicit ast_expr_op_select(__isl_take isl_ast_expr *ptr);
1057 
1058 public:
1059   inline /* implicit */ ast_expr_op_select();
1060   inline /* implicit */ ast_expr_op_select(const ast_expr_op_select &obj);
1061   inline ast_expr_op_select &operator=(ast_expr_op_select obj);
1062   inline isl::ctx ctx() const;
1063 
1064 };
1065 
1066 // declarations for isl::ast_expr_op_sub
1067 
1068 class ast_expr_op_sub : public ast_expr_op {
1069   template <class T>
1070   friend bool ast_expr_op::isa() const;
1071   friend ast_expr_op_sub ast_expr_op::as<ast_expr_op_sub>() const;
1072   static const auto type = isl_ast_expr_op_sub;
1073 
1074 protected:
1075   inline explicit ast_expr_op_sub(__isl_take isl_ast_expr *ptr);
1076 
1077 public:
1078   inline /* implicit */ ast_expr_op_sub();
1079   inline /* implicit */ ast_expr_op_sub(const ast_expr_op_sub &obj);
1080   inline ast_expr_op_sub &operator=(ast_expr_op_sub obj);
1081   inline isl::ctx ctx() const;
1082 
1083 };
1084 
1085 // declarations for isl::ast_expr_op_zdiv_r
1086 
1087 class ast_expr_op_zdiv_r : public ast_expr_op {
1088   template <class T>
1089   friend bool ast_expr_op::isa() const;
1090   friend ast_expr_op_zdiv_r ast_expr_op::as<ast_expr_op_zdiv_r>() const;
1091   static const auto type = isl_ast_expr_op_zdiv_r;
1092 
1093 protected:
1094   inline explicit ast_expr_op_zdiv_r(__isl_take isl_ast_expr *ptr);
1095 
1096 public:
1097   inline /* implicit */ ast_expr_op_zdiv_r();
1098   inline /* implicit */ ast_expr_op_zdiv_r(const ast_expr_op_zdiv_r &obj);
1099   inline ast_expr_op_zdiv_r &operator=(ast_expr_op_zdiv_r obj);
1100   inline isl::ctx ctx() const;
1101 
1102 };
1103 
1104 // declarations for isl::ast_node
1105 inline ast_node manage(__isl_take isl_ast_node *ptr);
1106 inline ast_node manage_copy(__isl_keep isl_ast_node *ptr);
1107 
1108 class ast_node {
1109   friend inline ast_node manage(__isl_take isl_ast_node *ptr);
1110   friend inline ast_node manage_copy(__isl_keep isl_ast_node *ptr);
1111 
1112 protected:
1113   isl_ast_node *ptr = nullptr;
1114 
1115   inline explicit ast_node(__isl_take isl_ast_node *ptr);
1116 
1117 public:
1118   inline /* implicit */ ast_node();
1119   inline /* implicit */ ast_node(const ast_node &obj);
1120   inline ast_node &operator=(ast_node obj);
1121   inline ~ast_node();
1122   inline __isl_give isl_ast_node *copy() const &;
1123   inline __isl_give isl_ast_node *copy() && = delete;
1124   inline __isl_keep isl_ast_node *get() const;
1125   inline __isl_give isl_ast_node *release();
1126   inline bool is_null() const;
1127 private:
1128   template <typename T,
1129           typename = typename std::enable_if<std::is_same<
1130                   const decltype(isl_ast_node_get_type(NULL)),
1131                   const T>::value>::type>
1132   inline bool isa_type(T subtype) const;
1133 public:
1134   template <class T> inline bool isa() const;
1135   template <class T> inline T as() const;
1136   inline isl::ctx ctx() const;
1137 
1138   inline std::string to_C_str() const;
1139 };
1140 
1141 // declarations for isl::ast_node_block
1142 
1143 class ast_node_block : public ast_node {
1144   template <class T>
1145   friend bool ast_node::isa() const;
1146   friend ast_node_block ast_node::as<ast_node_block>() const;
1147   static const auto type = isl_ast_node_block;
1148 
1149 protected:
1150   inline explicit ast_node_block(__isl_take isl_ast_node *ptr);
1151 
1152 public:
1153   inline /* implicit */ ast_node_block();
1154   inline /* implicit */ ast_node_block(const ast_node_block &obj);
1155   inline ast_node_block &operator=(ast_node_block obj);
1156   inline isl::ctx ctx() const;
1157 
1158   inline isl::ast_node_list children() const;
1159   inline isl::ast_node_list get_children() const;
1160 };
1161 
1162 // declarations for isl::ast_node_for
1163 
1164 class ast_node_for : public ast_node {
1165   template <class T>
1166   friend bool ast_node::isa() const;
1167   friend ast_node_for ast_node::as<ast_node_for>() const;
1168   static const auto type = isl_ast_node_for;
1169 
1170 protected:
1171   inline explicit ast_node_for(__isl_take isl_ast_node *ptr);
1172 
1173 public:
1174   inline /* implicit */ ast_node_for();
1175   inline /* implicit */ ast_node_for(const ast_node_for &obj);
1176   inline ast_node_for &operator=(ast_node_for obj);
1177   inline isl::ctx ctx() const;
1178 
1179   inline isl::ast_node body() const;
1180   inline isl::ast_node get_body() const;
1181   inline isl::ast_expr cond() const;
1182   inline isl::ast_expr get_cond() const;
1183   inline isl::ast_expr inc() const;
1184   inline isl::ast_expr get_inc() const;
1185   inline isl::ast_expr init() const;
1186   inline isl::ast_expr get_init() const;
1187   inline isl::ast_expr iterator() const;
1188   inline isl::ast_expr get_iterator() const;
1189   inline bool is_degenerate() const;
1190 };
1191 
1192 // declarations for isl::ast_node_if
1193 
1194 class ast_node_if : public ast_node {
1195   template <class T>
1196   friend bool ast_node::isa() const;
1197   friend ast_node_if ast_node::as<ast_node_if>() const;
1198   static const auto type = isl_ast_node_if;
1199 
1200 protected:
1201   inline explicit ast_node_if(__isl_take isl_ast_node *ptr);
1202 
1203 public:
1204   inline /* implicit */ ast_node_if();
1205   inline /* implicit */ ast_node_if(const ast_node_if &obj);
1206   inline ast_node_if &operator=(ast_node_if obj);
1207   inline isl::ctx ctx() const;
1208 
1209   inline isl::ast_expr cond() const;
1210   inline isl::ast_expr get_cond() const;
1211   inline isl::ast_node else_node() const;
1212   inline isl::ast_node get_else_node() const;
1213   inline isl::ast_node then_node() const;
1214   inline isl::ast_node get_then_node() const;
1215   inline bool has_else_node() const;
1216 };
1217 
1218 // declarations for isl::ast_node_list
1219 inline ast_node_list manage(__isl_take isl_ast_node_list *ptr);
1220 inline ast_node_list manage_copy(__isl_keep isl_ast_node_list *ptr);
1221 
1222 class ast_node_list {
1223   friend inline ast_node_list manage(__isl_take isl_ast_node_list *ptr);
1224   friend inline ast_node_list manage_copy(__isl_keep isl_ast_node_list *ptr);
1225 
1226 protected:
1227   isl_ast_node_list *ptr = nullptr;
1228 
1229   inline explicit ast_node_list(__isl_take isl_ast_node_list *ptr);
1230 
1231 public:
1232   inline /* implicit */ ast_node_list();
1233   inline /* implicit */ ast_node_list(const ast_node_list &obj);
1234   inline explicit ast_node_list(isl::ctx ctx, int n);
1235   inline explicit ast_node_list(isl::ast_node el);
1236   inline ast_node_list &operator=(ast_node_list obj);
1237   inline ~ast_node_list();
1238   inline __isl_give isl_ast_node_list *copy() const &;
1239   inline __isl_give isl_ast_node_list *copy() && = delete;
1240   inline __isl_keep isl_ast_node_list *get() const;
1241   inline __isl_give isl_ast_node_list *release();
1242   inline bool is_null() const;
1243   inline isl::ctx ctx() const;
1244 
1245   inline isl::ast_node_list add(isl::ast_node el) const;
1246   inline isl::ast_node_list clear() const;
1247   inline isl::ast_node_list concat(isl::ast_node_list list2) const;
1248   inline void foreach(const std::function<void(isl::ast_node)> &fn) const;
1249   inline isl::ast_node at(int index) const;
1250   inline isl::ast_node get_at(int index) const;
1251   inline unsigned size() const;
1252 };
1253 
1254 // declarations for isl::ast_node_mark
1255 
1256 class ast_node_mark : public ast_node {
1257   template <class T>
1258   friend bool ast_node::isa() const;
1259   friend ast_node_mark ast_node::as<ast_node_mark>() const;
1260   static const auto type = isl_ast_node_mark;
1261 
1262 protected:
1263   inline explicit ast_node_mark(__isl_take isl_ast_node *ptr);
1264 
1265 public:
1266   inline /* implicit */ ast_node_mark();
1267   inline /* implicit */ ast_node_mark(const ast_node_mark &obj);
1268   inline ast_node_mark &operator=(ast_node_mark obj);
1269   inline isl::ctx ctx() const;
1270 
1271   inline isl::id id() const;
1272   inline isl::id get_id() const;
1273   inline isl::ast_node node() const;
1274   inline isl::ast_node get_node() const;
1275 };
1276 
1277 // declarations for isl::ast_node_user
1278 
1279 class ast_node_user : public ast_node {
1280   template <class T>
1281   friend bool ast_node::isa() const;
1282   friend ast_node_user ast_node::as<ast_node_user>() const;
1283   static const auto type = isl_ast_node_user;
1284 
1285 protected:
1286   inline explicit ast_node_user(__isl_take isl_ast_node *ptr);
1287 
1288 public:
1289   inline /* implicit */ ast_node_user();
1290   inline /* implicit */ ast_node_user(const ast_node_user &obj);
1291   inline ast_node_user &operator=(ast_node_user obj);
1292   inline isl::ctx ctx() const;
1293 
1294   inline isl::ast_expr expr() const;
1295   inline isl::ast_expr get_expr() const;
1296 };
1297 
1298 // declarations for isl::basic_map
1299 inline basic_map manage(__isl_take isl_basic_map *ptr);
1300 inline basic_map manage_copy(__isl_keep isl_basic_map *ptr);
1301 
1302 class basic_map {
1303   friend inline basic_map manage(__isl_take isl_basic_map *ptr);
1304   friend inline basic_map manage_copy(__isl_keep isl_basic_map *ptr);
1305 
1306 protected:
1307   isl_basic_map *ptr = nullptr;
1308 
1309   inline explicit basic_map(__isl_take isl_basic_map *ptr);
1310 
1311 public:
1312   inline /* implicit */ basic_map();
1313   inline /* implicit */ basic_map(const basic_map &obj);
1314   inline explicit basic_map(isl::ctx ctx, const std::string &str);
1315   inline basic_map &operator=(basic_map obj);
1316   inline ~basic_map();
1317   inline __isl_give isl_basic_map *copy() const &;
1318   inline __isl_give isl_basic_map *copy() && = delete;
1319   inline __isl_keep isl_basic_map *get() const;
1320   inline __isl_give isl_basic_map *release();
1321   inline bool is_null() const;
1322   inline isl::ctx ctx() const;
1323 
1324   inline isl::basic_map affine_hull() const;
1325   inline isl::basic_map apply_domain(isl::basic_map bmap2) const;
1326   inline isl::basic_map apply_range(isl::basic_map bmap2) const;
1327   inline isl::basic_set deltas() const;
1328   inline isl::basic_map detect_equalities() const;
1329   inline isl::basic_map flatten() const;
1330   inline isl::basic_map flatten_domain() const;
1331   inline isl::basic_map flatten_range() const;
1332   inline isl::basic_map gist(isl::basic_map context) const;
1333   inline isl::basic_map intersect(isl::basic_map bmap2) const;
1334   inline isl::basic_map intersect_domain(isl::basic_set bset) const;
1335   inline isl::basic_map intersect_range(isl::basic_set bset) const;
1336   inline bool is_empty() const;
1337   inline bool is_equal(const isl::basic_map &bmap2) const;
1338   inline bool is_subset(const isl::basic_map &bmap2) const;
1339   inline isl::map lexmax() const;
1340   inline isl::map lexmin() const;
1341   inline isl::basic_map reverse() const;
1342   inline isl::basic_map sample() const;
1343   inline isl::map unite(isl::basic_map bmap2) const;
1344 };
1345 
1346 // declarations for isl::basic_set
1347 inline basic_set manage(__isl_take isl_basic_set *ptr);
1348 inline basic_set manage_copy(__isl_keep isl_basic_set *ptr);
1349 
1350 class basic_set {
1351   friend inline basic_set manage(__isl_take isl_basic_set *ptr);
1352   friend inline basic_set manage_copy(__isl_keep isl_basic_set *ptr);
1353 
1354 protected:
1355   isl_basic_set *ptr = nullptr;
1356 
1357   inline explicit basic_set(__isl_take isl_basic_set *ptr);
1358 
1359 public:
1360   inline /* implicit */ basic_set();
1361   inline /* implicit */ basic_set(const basic_set &obj);
1362   inline /* implicit */ basic_set(isl::point pnt);
1363   inline explicit basic_set(isl::ctx ctx, const std::string &str);
1364   inline basic_set &operator=(basic_set obj);
1365   inline ~basic_set();
1366   inline __isl_give isl_basic_set *copy() const &;
1367   inline __isl_give isl_basic_set *copy() && = delete;
1368   inline __isl_keep isl_basic_set *get() const;
1369   inline __isl_give isl_basic_set *release();
1370   inline bool is_null() const;
1371   inline isl::ctx ctx() const;
1372 
1373   inline isl::basic_set affine_hull() const;
1374   inline isl::basic_set apply(isl::basic_map bmap) const;
1375   inline isl::basic_set detect_equalities() const;
1376   inline isl::val dim_max_val(int pos) const;
1377   inline isl::basic_set flatten() const;
1378   inline isl::basic_set gist(isl::basic_set context) const;
1379   inline isl::basic_set intersect(isl::basic_set bset2) const;
1380   inline isl::basic_set intersect_params(isl::basic_set bset2) const;
1381   inline bool is_empty() const;
1382   inline bool is_equal(const isl::basic_set &bset2) const;
1383   inline bool is_subset(const isl::basic_set &bset2) const;
1384   inline bool is_wrapping() const;
1385   inline isl::set lexmax() const;
1386   inline isl::set lexmin() const;
1387   inline isl::basic_set params() const;
1388   inline isl::basic_set sample() const;
1389   inline isl::point sample_point() const;
1390   inline isl::set unite(isl::basic_set bset2) const;
1391 };
1392 
1393 // declarations for isl::fixed_box
1394 inline fixed_box manage(__isl_take isl_fixed_box *ptr);
1395 inline fixed_box manage_copy(__isl_keep isl_fixed_box *ptr);
1396 
1397 class fixed_box {
1398   friend inline fixed_box manage(__isl_take isl_fixed_box *ptr);
1399   friend inline fixed_box manage_copy(__isl_keep isl_fixed_box *ptr);
1400 
1401 protected:
1402   isl_fixed_box *ptr = nullptr;
1403 
1404   inline explicit fixed_box(__isl_take isl_fixed_box *ptr);
1405 
1406 public:
1407   inline /* implicit */ fixed_box();
1408   inline /* implicit */ fixed_box(const fixed_box &obj);
1409   inline fixed_box &operator=(fixed_box obj);
1410   inline ~fixed_box();
1411   inline __isl_give isl_fixed_box *copy() const &;
1412   inline __isl_give isl_fixed_box *copy() && = delete;
1413   inline __isl_keep isl_fixed_box *get() const;
1414   inline __isl_give isl_fixed_box *release();
1415   inline bool is_null() const;
1416   inline isl::ctx ctx() const;
1417 
1418   inline isl::multi_aff offset() const;
1419   inline isl::multi_aff get_offset() const;
1420   inline isl::multi_val size() const;
1421   inline isl::multi_val get_size() const;
1422   inline isl::space space() const;
1423   inline isl::space get_space() const;
1424   inline bool is_valid() const;
1425 };
1426 
1427 // declarations for isl::id
1428 inline id manage(__isl_take isl_id *ptr);
1429 inline id manage_copy(__isl_keep isl_id *ptr);
1430 
1431 class id {
1432   friend inline id manage(__isl_take isl_id *ptr);
1433   friend inline id manage_copy(__isl_keep isl_id *ptr);
1434 
1435 protected:
1436   isl_id *ptr = nullptr;
1437 
1438   inline explicit id(__isl_take isl_id *ptr);
1439 
1440 public:
1441   inline /* implicit */ id();
1442   inline /* implicit */ id(const id &obj);
1443   inline explicit id(isl::ctx ctx, const std::string &str);
1444   inline id &operator=(id obj);
1445   inline ~id();
1446   inline __isl_give isl_id *copy() const &;
1447   inline __isl_give isl_id *copy() && = delete;
1448   inline __isl_keep isl_id *get() const;
1449   inline __isl_give isl_id *release();
1450   inline bool is_null() const;
1451   inline isl::ctx ctx() const;
1452 
1453   inline std::string name() const;
1454   inline std::string get_name() const;
1455 };
1456 
1457 // declarations for isl::id_list
1458 inline id_list manage(__isl_take isl_id_list *ptr);
1459 inline id_list manage_copy(__isl_keep isl_id_list *ptr);
1460 
1461 class id_list {
1462   friend inline id_list manage(__isl_take isl_id_list *ptr);
1463   friend inline id_list manage_copy(__isl_keep isl_id_list *ptr);
1464 
1465 protected:
1466   isl_id_list *ptr = nullptr;
1467 
1468   inline explicit id_list(__isl_take isl_id_list *ptr);
1469 
1470 public:
1471   inline /* implicit */ id_list();
1472   inline /* implicit */ id_list(const id_list &obj);
1473   inline explicit id_list(isl::ctx ctx, int n);
1474   inline explicit id_list(isl::id el);
1475   inline id_list &operator=(id_list obj);
1476   inline ~id_list();
1477   inline __isl_give isl_id_list *copy() const &;
1478   inline __isl_give isl_id_list *copy() && = delete;
1479   inline __isl_keep isl_id_list *get() const;
1480   inline __isl_give isl_id_list *release();
1481   inline bool is_null() const;
1482   inline isl::ctx ctx() const;
1483 
1484   inline isl::id_list add(isl::id el) const;
1485   inline isl::id_list add(const std::string &el) const;
1486   inline isl::id_list clear() const;
1487   inline isl::id_list concat(isl::id_list list2) const;
1488   inline void foreach(const std::function<void(isl::id)> &fn) const;
1489   inline isl::id at(int index) const;
1490   inline isl::id get_at(int index) const;
1491   inline unsigned size() const;
1492 };
1493 
1494 // declarations for isl::map
1495 inline map manage(__isl_take isl_map *ptr);
1496 inline map manage_copy(__isl_keep isl_map *ptr);
1497 
1498 class map {
1499   friend inline map manage(__isl_take isl_map *ptr);
1500   friend inline map manage_copy(__isl_keep isl_map *ptr);
1501 
1502 protected:
1503   isl_map *ptr = nullptr;
1504 
1505   inline explicit map(__isl_take isl_map *ptr);
1506 
1507 public:
1508   inline /* implicit */ map();
1509   inline /* implicit */ map(const map &obj);
1510   inline /* implicit */ map(isl::basic_map bmap);
1511   inline explicit map(isl::ctx ctx, const std::string &str);
1512   inline map &operator=(map obj);
1513   inline ~map();
1514   inline __isl_give isl_map *copy() const &;
1515   inline __isl_give isl_map *copy() && = delete;
1516   inline __isl_keep isl_map *get() const;
1517   inline __isl_give isl_map *release();
1518   inline bool is_null() const;
1519   inline isl::ctx ctx() const;
1520 
1521   inline isl::basic_map affine_hull() const;
1522   inline isl::map apply_domain(isl::map map2) const;
1523   inline isl::map apply_range(isl::map map2) const;
1524   inline isl::set bind_domain(isl::multi_id tuple) const;
1525   inline isl::set bind_range(isl::multi_id tuple) const;
1526   inline isl::map coalesce() const;
1527   inline isl::map complement() const;
1528   inline isl::map curry() const;
1529   inline isl::set deltas() const;
1530   inline isl::map detect_equalities() const;
1531   inline isl::set domain() const;
1532   inline isl::map domain_factor_domain() const;
1533   inline isl::map domain_factor_range() const;
1534   inline isl::map domain_product(isl::map map2) const;
1535   static inline isl::map empty(isl::space space);
1536   inline isl::map factor_domain() const;
1537   inline isl::map factor_range() const;
1538   inline isl::map flatten() const;
1539   inline isl::map flatten_domain() const;
1540   inline isl::map flatten_range() const;
1541   inline void foreach_basic_map(const std::function<void(isl::basic_map)> &fn) const;
1542   inline isl::fixed_box range_simple_fixed_box_hull() const;
1543   inline isl::fixed_box get_range_simple_fixed_box_hull() const;
1544   inline isl::space space() const;
1545   inline isl::space get_space() const;
1546   inline isl::map gist(isl::map context) const;
1547   inline isl::map gist_domain(isl::set context) const;
1548   inline isl::map intersect(isl::map map2) const;
1549   inline isl::map intersect_domain(isl::set set) const;
1550   inline isl::map intersect_params(isl::set params) const;
1551   inline isl::map intersect_range(isl::set set) const;
1552   inline bool is_bijective() const;
1553   inline bool is_disjoint(const isl::map &map2) const;
1554   inline bool is_empty() const;
1555   inline bool is_equal(const isl::map &map2) const;
1556   inline bool is_injective() const;
1557   inline bool is_single_valued() const;
1558   inline bool is_strict_subset(const isl::map &map2) const;
1559   inline bool is_subset(const isl::map &map2) const;
1560   inline isl::map lexmax() const;
1561   inline isl::pw_multi_aff lexmax_pw_multi_aff() const;
1562   inline isl::map lexmin() const;
1563   inline isl::pw_multi_aff lexmin_pw_multi_aff() const;
1564   inline isl::map lower_bound(isl::multi_pw_aff lower) const;
1565   inline isl::map lower_bound(isl::multi_val lower) const;
1566   inline isl::basic_map polyhedral_hull() const;
1567   inline isl::map preimage_domain(isl::multi_aff ma) const;
1568   inline isl::map preimage_domain(isl::multi_pw_aff mpa) const;
1569   inline isl::map preimage_domain(isl::pw_multi_aff pma) const;
1570   inline isl::map preimage_range(isl::multi_aff ma) const;
1571   inline isl::map preimage_range(isl::pw_multi_aff pma) const;
1572   inline isl::map project_out_all_params() const;
1573   inline isl::set range() const;
1574   inline isl::map range_factor_domain() const;
1575   inline isl::map range_factor_range() const;
1576   inline isl::map range_product(isl::map map2) const;
1577   inline isl::map range_reverse() const;
1578   inline isl::map reverse() const;
1579   inline isl::basic_map sample() const;
1580   inline isl::map subtract(isl::map map2) const;
1581   inline isl::map uncurry() const;
1582   inline isl::map unite(isl::map map2) const;
1583   static inline isl::map universe(isl::space space);
1584   inline isl::basic_map unshifted_simple_hull() const;
1585   inline isl::map upper_bound(isl::multi_pw_aff upper) const;
1586   inline isl::map upper_bound(isl::multi_val upper) const;
1587   inline isl::set wrap() const;
1588 };
1589 
1590 // declarations for isl::multi_aff
1591 inline multi_aff manage(__isl_take isl_multi_aff *ptr);
1592 inline multi_aff manage_copy(__isl_keep isl_multi_aff *ptr);
1593 
1594 class multi_aff {
1595   friend inline multi_aff manage(__isl_take isl_multi_aff *ptr);
1596   friend inline multi_aff manage_copy(__isl_keep isl_multi_aff *ptr);
1597 
1598 protected:
1599   isl_multi_aff *ptr = nullptr;
1600 
1601   inline explicit multi_aff(__isl_take isl_multi_aff *ptr);
1602 
1603 public:
1604   inline /* implicit */ multi_aff();
1605   inline /* implicit */ multi_aff(const multi_aff &obj);
1606   inline /* implicit */ multi_aff(isl::aff aff);
1607   inline explicit multi_aff(isl::space space, isl::aff_list list);
1608   inline explicit multi_aff(isl::ctx ctx, const std::string &str);
1609   inline multi_aff &operator=(multi_aff obj);
1610   inline ~multi_aff();
1611   inline __isl_give isl_multi_aff *copy() const &;
1612   inline __isl_give isl_multi_aff *copy() && = delete;
1613   inline __isl_keep isl_multi_aff *get() const;
1614   inline __isl_give isl_multi_aff *release();
1615   inline bool is_null() const;
1616   inline isl::ctx ctx() const;
1617 
1618   inline isl::multi_aff add(isl::multi_aff multi2) const;
1619   inline isl::multi_aff add_constant(isl::multi_val mv) const;
1620   inline isl::multi_aff add_constant(isl::val v) const;
1621   inline isl::multi_aff add_constant(long v) const;
1622   inline isl::basic_set bind(isl::multi_id tuple) const;
1623   inline isl::multi_aff bind_domain(isl::multi_id tuple) const;
1624   inline isl::multi_aff bind_domain_wrapped_domain(isl::multi_id tuple) const;
1625   static inline isl::multi_aff domain_map(isl::space space);
1626   inline isl::multi_aff flat_range_product(isl::multi_aff multi2) const;
1627   inline isl::multi_aff floor() const;
1628   inline isl::aff at(int pos) const;
1629   inline isl::aff get_at(int pos) const;
1630   inline isl::multi_val constant_multi_val() const;
1631   inline isl::multi_val get_constant_multi_val() const;
1632   inline isl::space space() const;
1633   inline isl::space get_space() const;
1634   inline isl::multi_aff gist(isl::set context) const;
1635   inline isl::multi_aff identity() const;
1636   static inline isl::multi_aff identity_on_domain(isl::space space);
1637   inline bool involves_locals() const;
1638   inline isl::multi_aff neg() const;
1639   inline bool plain_is_equal(const isl::multi_aff &multi2) const;
1640   inline isl::multi_aff product(isl::multi_aff multi2) const;
1641   inline isl::multi_aff pullback(isl::multi_aff ma2) const;
1642   static inline isl::multi_aff range_map(isl::space space);
1643   inline isl::multi_aff range_product(isl::multi_aff multi2) const;
1644   inline isl::multi_aff scale(isl::multi_val mv) const;
1645   inline isl::multi_aff scale(isl::val v) const;
1646   inline isl::multi_aff scale(long v) const;
1647   inline isl::multi_aff scale_down(isl::multi_val mv) const;
1648   inline isl::multi_aff scale_down(isl::val v) const;
1649   inline isl::multi_aff scale_down(long v) const;
1650   inline isl::multi_aff set_at(int pos, isl::aff el) const;
1651   inline unsigned size() const;
1652   inline isl::multi_aff sub(isl::multi_aff multi2) const;
1653   static inline isl::multi_aff zero(isl::space space);
1654 };
1655 
1656 // declarations for isl::multi_id
1657 inline multi_id manage(__isl_take isl_multi_id *ptr);
1658 inline multi_id manage_copy(__isl_keep isl_multi_id *ptr);
1659 
1660 class multi_id {
1661   friend inline multi_id manage(__isl_take isl_multi_id *ptr);
1662   friend inline multi_id manage_copy(__isl_keep isl_multi_id *ptr);
1663 
1664 protected:
1665   isl_multi_id *ptr = nullptr;
1666 
1667   inline explicit multi_id(__isl_take isl_multi_id *ptr);
1668 
1669 public:
1670   inline /* implicit */ multi_id();
1671   inline /* implicit */ multi_id(const multi_id &obj);
1672   inline explicit multi_id(isl::space space, isl::id_list list);
1673   inline explicit multi_id(isl::ctx ctx, const std::string &str);
1674   inline multi_id &operator=(multi_id obj);
1675   inline ~multi_id();
1676   inline __isl_give isl_multi_id *copy() const &;
1677   inline __isl_give isl_multi_id *copy() && = delete;
1678   inline __isl_keep isl_multi_id *get() const;
1679   inline __isl_give isl_multi_id *release();
1680   inline bool is_null() const;
1681   inline isl::ctx ctx() const;
1682 
1683   inline isl::multi_id flat_range_product(isl::multi_id multi2) const;
1684   inline isl::id at(int pos) const;
1685   inline isl::id get_at(int pos) const;
1686   inline isl::space space() const;
1687   inline isl::space get_space() const;
1688   inline bool plain_is_equal(const isl::multi_id &multi2) const;
1689   inline isl::multi_id range_product(isl::multi_id multi2) const;
1690   inline isl::multi_id set_at(int pos, isl::id el) const;
1691   inline isl::multi_id set_at(int pos, const std::string &el) const;
1692   inline unsigned size() const;
1693 };
1694 
1695 // declarations for isl::multi_pw_aff
1696 inline multi_pw_aff manage(__isl_take isl_multi_pw_aff *ptr);
1697 inline multi_pw_aff manage_copy(__isl_keep isl_multi_pw_aff *ptr);
1698 
1699 class multi_pw_aff {
1700   friend inline multi_pw_aff manage(__isl_take isl_multi_pw_aff *ptr);
1701   friend inline multi_pw_aff manage_copy(__isl_keep isl_multi_pw_aff *ptr);
1702 
1703 protected:
1704   isl_multi_pw_aff *ptr = nullptr;
1705 
1706   inline explicit multi_pw_aff(__isl_take isl_multi_pw_aff *ptr);
1707 
1708 public:
1709   inline /* implicit */ multi_pw_aff();
1710   inline /* implicit */ multi_pw_aff(const multi_pw_aff &obj);
1711   inline /* implicit */ multi_pw_aff(isl::multi_aff ma);
1712   inline /* implicit */ multi_pw_aff(isl::pw_aff pa);
1713   inline explicit multi_pw_aff(isl::space space, isl::pw_aff_list list);
1714   inline /* implicit */ multi_pw_aff(isl::pw_multi_aff pma);
1715   inline explicit multi_pw_aff(isl::ctx ctx, const std::string &str);
1716   inline multi_pw_aff &operator=(multi_pw_aff obj);
1717   inline ~multi_pw_aff();
1718   inline __isl_give isl_multi_pw_aff *copy() const &;
1719   inline __isl_give isl_multi_pw_aff *copy() && = delete;
1720   inline __isl_keep isl_multi_pw_aff *get() const;
1721   inline __isl_give isl_multi_pw_aff *release();
1722   inline bool is_null() const;
1723   inline isl::ctx ctx() const;
1724 
1725   inline isl::multi_pw_aff add(isl::multi_pw_aff multi2) const;
1726   inline isl::multi_pw_aff add_constant(isl::multi_val mv) const;
1727   inline isl::multi_pw_aff add_constant(isl::val v) const;
1728   inline isl::multi_pw_aff add_constant(long v) const;
1729   inline isl::set bind(isl::multi_id tuple) const;
1730   inline isl::multi_pw_aff bind_domain(isl::multi_id tuple) const;
1731   inline isl::multi_pw_aff bind_domain_wrapped_domain(isl::multi_id tuple) const;
1732   inline isl::multi_pw_aff coalesce() const;
1733   inline isl::set domain() const;
1734   inline isl::multi_pw_aff flat_range_product(isl::multi_pw_aff multi2) const;
1735   inline isl::pw_aff at(int pos) const;
1736   inline isl::pw_aff get_at(int pos) const;
1737   inline isl::space space() const;
1738   inline isl::space get_space() const;
1739   inline isl::multi_pw_aff gist(isl::set set) const;
1740   inline isl::multi_pw_aff identity() const;
1741   static inline isl::multi_pw_aff identity_on_domain(isl::space space);
1742   inline isl::multi_pw_aff intersect_domain(isl::set domain) const;
1743   inline isl::multi_pw_aff intersect_params(isl::set set) const;
1744   inline bool involves_param(const isl::id &id) const;
1745   inline bool involves_param(const std::string &id) const;
1746   inline bool involves_param(const isl::id_list &list) const;
1747   inline isl::multi_pw_aff neg() const;
1748   inline bool plain_is_equal(const isl::multi_pw_aff &multi2) const;
1749   inline isl::multi_pw_aff product(isl::multi_pw_aff multi2) const;
1750   inline isl::multi_pw_aff pullback(isl::multi_aff ma) const;
1751   inline isl::multi_pw_aff pullback(isl::multi_pw_aff mpa2) const;
1752   inline isl::multi_pw_aff pullback(isl::pw_multi_aff pma) const;
1753   inline isl::multi_pw_aff range_product(isl::multi_pw_aff multi2) const;
1754   inline isl::multi_pw_aff scale(isl::multi_val mv) const;
1755   inline isl::multi_pw_aff scale(isl::val v) const;
1756   inline isl::multi_pw_aff scale(long v) const;
1757   inline isl::multi_pw_aff scale_down(isl::multi_val mv) const;
1758   inline isl::multi_pw_aff scale_down(isl::val v) const;
1759   inline isl::multi_pw_aff scale_down(long v) const;
1760   inline isl::multi_pw_aff set_at(int pos, isl::pw_aff el) const;
1761   inline unsigned size() const;
1762   inline isl::multi_pw_aff sub(isl::multi_pw_aff multi2) const;
1763   static inline isl::multi_pw_aff zero(isl::space space);
1764 };
1765 
1766 // declarations for isl::multi_union_pw_aff
1767 inline multi_union_pw_aff manage(__isl_take isl_multi_union_pw_aff *ptr);
1768 inline multi_union_pw_aff manage_copy(__isl_keep isl_multi_union_pw_aff *ptr);
1769 
1770 class multi_union_pw_aff {
1771   friend inline multi_union_pw_aff manage(__isl_take isl_multi_union_pw_aff *ptr);
1772   friend inline multi_union_pw_aff manage_copy(__isl_keep isl_multi_union_pw_aff *ptr);
1773 
1774 protected:
1775   isl_multi_union_pw_aff *ptr = nullptr;
1776 
1777   inline explicit multi_union_pw_aff(__isl_take isl_multi_union_pw_aff *ptr);
1778 
1779 public:
1780   inline /* implicit */ multi_union_pw_aff();
1781   inline /* implicit */ multi_union_pw_aff(const multi_union_pw_aff &obj);
1782   inline /* implicit */ multi_union_pw_aff(isl::multi_pw_aff mpa);
1783   inline /* implicit */ multi_union_pw_aff(isl::union_pw_aff upa);
1784   inline explicit multi_union_pw_aff(isl::space space, isl::union_pw_aff_list list);
1785   inline explicit multi_union_pw_aff(isl::ctx ctx, const std::string &str);
1786   inline multi_union_pw_aff &operator=(multi_union_pw_aff obj);
1787   inline ~multi_union_pw_aff();
1788   inline __isl_give isl_multi_union_pw_aff *copy() const &;
1789   inline __isl_give isl_multi_union_pw_aff *copy() && = delete;
1790   inline __isl_keep isl_multi_union_pw_aff *get() const;
1791   inline __isl_give isl_multi_union_pw_aff *release();
1792   inline bool is_null() const;
1793   inline isl::ctx ctx() const;
1794 
1795   inline isl::multi_union_pw_aff add(isl::multi_union_pw_aff multi2) const;
1796   inline isl::union_set bind(isl::multi_id tuple) const;
1797   inline isl::multi_union_pw_aff coalesce() const;
1798   inline isl::union_set domain() const;
1799   inline isl::multi_union_pw_aff flat_range_product(isl::multi_union_pw_aff multi2) const;
1800   inline isl::union_pw_aff at(int pos) const;
1801   inline isl::union_pw_aff get_at(int pos) const;
1802   inline isl::space space() const;
1803   inline isl::space get_space() const;
1804   inline isl::multi_union_pw_aff gist(isl::union_set context) const;
1805   inline isl::multi_union_pw_aff intersect_domain(isl::union_set uset) const;
1806   inline isl::multi_union_pw_aff intersect_params(isl::set params) const;
1807   inline isl::multi_union_pw_aff neg() const;
1808   inline bool plain_is_equal(const isl::multi_union_pw_aff &multi2) const;
1809   inline isl::multi_union_pw_aff pullback(isl::union_pw_multi_aff upma) const;
1810   inline isl::multi_union_pw_aff range_product(isl::multi_union_pw_aff multi2) const;
1811   inline isl::multi_union_pw_aff scale(isl::multi_val mv) const;
1812   inline isl::multi_union_pw_aff scale(isl::val v) const;
1813   inline isl::multi_union_pw_aff scale(long v) const;
1814   inline isl::multi_union_pw_aff scale_down(isl::multi_val mv) const;
1815   inline isl::multi_union_pw_aff scale_down(isl::val v) const;
1816   inline isl::multi_union_pw_aff scale_down(long v) const;
1817   inline isl::multi_union_pw_aff set_at(int pos, isl::union_pw_aff el) const;
1818   inline unsigned size() const;
1819   inline isl::multi_union_pw_aff sub(isl::multi_union_pw_aff multi2) const;
1820   inline isl::multi_union_pw_aff union_add(isl::multi_union_pw_aff mupa2) const;
1821   static inline isl::multi_union_pw_aff zero(isl::space space);
1822 };
1823 
1824 // declarations for isl::multi_val
1825 inline multi_val manage(__isl_take isl_multi_val *ptr);
1826 inline multi_val manage_copy(__isl_keep isl_multi_val *ptr);
1827 
1828 class multi_val {
1829   friend inline multi_val manage(__isl_take isl_multi_val *ptr);
1830   friend inline multi_val manage_copy(__isl_keep isl_multi_val *ptr);
1831 
1832 protected:
1833   isl_multi_val *ptr = nullptr;
1834 
1835   inline explicit multi_val(__isl_take isl_multi_val *ptr);
1836 
1837 public:
1838   inline /* implicit */ multi_val();
1839   inline /* implicit */ multi_val(const multi_val &obj);
1840   inline explicit multi_val(isl::space space, isl::val_list list);
1841   inline explicit multi_val(isl::ctx ctx, const std::string &str);
1842   inline multi_val &operator=(multi_val obj);
1843   inline ~multi_val();
1844   inline __isl_give isl_multi_val *copy() const &;
1845   inline __isl_give isl_multi_val *copy() && = delete;
1846   inline __isl_keep isl_multi_val *get() const;
1847   inline __isl_give isl_multi_val *release();
1848   inline bool is_null() const;
1849   inline isl::ctx ctx() const;
1850 
1851   inline isl::multi_val add(isl::multi_val multi2) const;
1852   inline isl::multi_val add(isl::val v) const;
1853   inline isl::multi_val add(long v) const;
1854   inline isl::multi_val flat_range_product(isl::multi_val multi2) const;
1855   inline isl::val at(int pos) const;
1856   inline isl::val get_at(int pos) const;
1857   inline isl::space space() const;
1858   inline isl::space get_space() const;
1859   inline isl::multi_val neg() const;
1860   inline bool plain_is_equal(const isl::multi_val &multi2) const;
1861   inline isl::multi_val product(isl::multi_val multi2) const;
1862   inline isl::multi_val range_product(isl::multi_val multi2) const;
1863   inline isl::multi_val scale(isl::multi_val mv) const;
1864   inline isl::multi_val scale(isl::val v) const;
1865   inline isl::multi_val scale(long v) const;
1866   inline isl::multi_val scale_down(isl::multi_val mv) const;
1867   inline isl::multi_val scale_down(isl::val v) const;
1868   inline isl::multi_val scale_down(long v) const;
1869   inline isl::multi_val set_at(int pos, isl::val el) const;
1870   inline isl::multi_val set_at(int pos, long el) const;
1871   inline unsigned size() const;
1872   inline isl::multi_val sub(isl::multi_val multi2) const;
1873   static inline isl::multi_val zero(isl::space space);
1874 };
1875 
1876 // declarations for isl::point
1877 inline point manage(__isl_take isl_point *ptr);
1878 inline point manage_copy(__isl_keep isl_point *ptr);
1879 
1880 class point {
1881   friend inline point manage(__isl_take isl_point *ptr);
1882   friend inline point manage_copy(__isl_keep isl_point *ptr);
1883 
1884 protected:
1885   isl_point *ptr = nullptr;
1886 
1887   inline explicit point(__isl_take isl_point *ptr);
1888 
1889 public:
1890   inline /* implicit */ point();
1891   inline /* implicit */ point(const point &obj);
1892   inline point &operator=(point obj);
1893   inline ~point();
1894   inline __isl_give isl_point *copy() const &;
1895   inline __isl_give isl_point *copy() && = delete;
1896   inline __isl_keep isl_point *get() const;
1897   inline __isl_give isl_point *release();
1898   inline bool is_null() const;
1899   inline isl::ctx ctx() const;
1900 
1901   inline isl::multi_val multi_val() const;
1902   inline isl::multi_val get_multi_val() const;
1903 };
1904 
1905 // declarations for isl::pw_aff
1906 inline pw_aff manage(__isl_take isl_pw_aff *ptr);
1907 inline pw_aff manage_copy(__isl_keep isl_pw_aff *ptr);
1908 
1909 class pw_aff {
1910   friend inline pw_aff manage(__isl_take isl_pw_aff *ptr);
1911   friend inline pw_aff manage_copy(__isl_keep isl_pw_aff *ptr);
1912 
1913 protected:
1914   isl_pw_aff *ptr = nullptr;
1915 
1916   inline explicit pw_aff(__isl_take isl_pw_aff *ptr);
1917 
1918 public:
1919   inline /* implicit */ pw_aff();
1920   inline /* implicit */ pw_aff(const pw_aff &obj);
1921   inline /* implicit */ pw_aff(isl::aff aff);
1922   inline explicit pw_aff(isl::ctx ctx, const std::string &str);
1923   inline pw_aff &operator=(pw_aff obj);
1924   inline ~pw_aff();
1925   inline __isl_give isl_pw_aff *copy() const &;
1926   inline __isl_give isl_pw_aff *copy() && = delete;
1927   inline __isl_keep isl_pw_aff *get() const;
1928   inline __isl_give isl_pw_aff *release();
1929   inline bool is_null() const;
1930   inline isl::ctx ctx() const;
1931 
1932   inline isl::pw_aff add(isl::pw_aff pwaff2) const;
1933   inline isl::pw_aff add_constant(isl::val v) const;
1934   inline isl::pw_aff add_constant(long v) const;
1935   inline isl::aff as_aff() const;
1936   inline isl::set bind(isl::id id) const;
1937   inline isl::set bind(const std::string &id) const;
1938   inline isl::pw_aff bind_domain(isl::multi_id tuple) const;
1939   inline isl::pw_aff bind_domain_wrapped_domain(isl::multi_id tuple) const;
1940   inline isl::pw_aff ceil() const;
1941   inline isl::pw_aff coalesce() const;
1942   inline isl::pw_aff cond(isl::pw_aff pwaff_true, isl::pw_aff pwaff_false) const;
1943   inline isl::pw_aff div(isl::pw_aff pa2) const;
1944   inline isl::set domain() const;
1945   inline isl::set eq_set(isl::pw_aff pwaff2) const;
1946   inline isl::val eval(isl::point pnt) const;
1947   inline isl::pw_aff floor() const;
1948   inline isl::set ge_set(isl::pw_aff pwaff2) const;
1949   inline isl::pw_aff gist(isl::set context) const;
1950   inline isl::set gt_set(isl::pw_aff pwaff2) const;
1951   inline isl::pw_aff intersect_domain(isl::set set) const;
1952   inline isl::pw_aff intersect_params(isl::set set) const;
1953   inline bool isa_aff() const;
1954   inline isl::set le_set(isl::pw_aff pwaff2) const;
1955   inline isl::set lt_set(isl::pw_aff pwaff2) const;
1956   inline isl::pw_aff max(isl::pw_aff pwaff2) const;
1957   inline isl::pw_aff min(isl::pw_aff pwaff2) const;
1958   inline isl::pw_aff mod(isl::val mod) const;
1959   inline isl::pw_aff mod(long mod) const;
1960   inline isl::pw_aff mul(isl::pw_aff pwaff2) const;
1961   inline isl::set ne_set(isl::pw_aff pwaff2) const;
1962   inline isl::pw_aff neg() const;
1963   static inline isl::pw_aff param_on_domain(isl::set domain, isl::id id);
1964   inline isl::pw_aff pullback(isl::multi_aff ma) const;
1965   inline isl::pw_aff pullback(isl::multi_pw_aff mpa) const;
1966   inline isl::pw_aff pullback(isl::pw_multi_aff pma) const;
1967   inline isl::pw_aff scale(isl::val v) const;
1968   inline isl::pw_aff scale(long v) const;
1969   inline isl::pw_aff scale_down(isl::val f) const;
1970   inline isl::pw_aff scale_down(long f) const;
1971   inline isl::pw_aff sub(isl::pw_aff pwaff2) const;
1972   inline isl::pw_aff subtract_domain(isl::set set) const;
1973   inline isl::pw_aff tdiv_q(isl::pw_aff pa2) const;
1974   inline isl::pw_aff tdiv_r(isl::pw_aff pa2) const;
1975   inline isl::pw_aff union_add(isl::pw_aff pwaff2) const;
1976 };
1977 
1978 // declarations for isl::pw_aff_list
1979 inline pw_aff_list manage(__isl_take isl_pw_aff_list *ptr);
1980 inline pw_aff_list manage_copy(__isl_keep isl_pw_aff_list *ptr);
1981 
1982 class pw_aff_list {
1983   friend inline pw_aff_list manage(__isl_take isl_pw_aff_list *ptr);
1984   friend inline pw_aff_list manage_copy(__isl_keep isl_pw_aff_list *ptr);
1985 
1986 protected:
1987   isl_pw_aff_list *ptr = nullptr;
1988 
1989   inline explicit pw_aff_list(__isl_take isl_pw_aff_list *ptr);
1990 
1991 public:
1992   inline /* implicit */ pw_aff_list();
1993   inline /* implicit */ pw_aff_list(const pw_aff_list &obj);
1994   inline explicit pw_aff_list(isl::ctx ctx, int n);
1995   inline explicit pw_aff_list(isl::pw_aff el);
1996   inline pw_aff_list &operator=(pw_aff_list obj);
1997   inline ~pw_aff_list();
1998   inline __isl_give isl_pw_aff_list *copy() const &;
1999   inline __isl_give isl_pw_aff_list *copy() && = delete;
2000   inline __isl_keep isl_pw_aff_list *get() const;
2001   inline __isl_give isl_pw_aff_list *release();
2002   inline bool is_null() const;
2003   inline isl::ctx ctx() const;
2004 
2005   inline isl::pw_aff_list add(isl::pw_aff el) const;
2006   inline isl::pw_aff_list clear() const;
2007   inline isl::pw_aff_list concat(isl::pw_aff_list list2) const;
2008   inline void foreach(const std::function<void(isl::pw_aff)> &fn) const;
2009   inline isl::pw_aff at(int index) const;
2010   inline isl::pw_aff get_at(int index) const;
2011   inline unsigned size() const;
2012 };
2013 
2014 // declarations for isl::pw_multi_aff
2015 inline pw_multi_aff manage(__isl_take isl_pw_multi_aff *ptr);
2016 inline pw_multi_aff manage_copy(__isl_keep isl_pw_multi_aff *ptr);
2017 
2018 class pw_multi_aff {
2019   friend inline pw_multi_aff manage(__isl_take isl_pw_multi_aff *ptr);
2020   friend inline pw_multi_aff manage_copy(__isl_keep isl_pw_multi_aff *ptr);
2021 
2022 protected:
2023   isl_pw_multi_aff *ptr = nullptr;
2024 
2025   inline explicit pw_multi_aff(__isl_take isl_pw_multi_aff *ptr);
2026 
2027 public:
2028   inline /* implicit */ pw_multi_aff();
2029   inline /* implicit */ pw_multi_aff(const pw_multi_aff &obj);
2030   inline /* implicit */ pw_multi_aff(isl::multi_aff ma);
2031   inline /* implicit */ pw_multi_aff(isl::pw_aff pa);
2032   inline explicit pw_multi_aff(isl::ctx ctx, const std::string &str);
2033   inline pw_multi_aff &operator=(pw_multi_aff obj);
2034   inline ~pw_multi_aff();
2035   inline __isl_give isl_pw_multi_aff *copy() const &;
2036   inline __isl_give isl_pw_multi_aff *copy() && = delete;
2037   inline __isl_keep isl_pw_multi_aff *get() const;
2038   inline __isl_give isl_pw_multi_aff *release();
2039   inline bool is_null() const;
2040   inline isl::ctx ctx() const;
2041 
2042   inline isl::pw_multi_aff add(isl::pw_multi_aff pma2) const;
2043   inline isl::pw_multi_aff add_constant(isl::multi_val mv) const;
2044   inline isl::pw_multi_aff add_constant(isl::val v) const;
2045   inline isl::pw_multi_aff add_constant(long v) const;
2046   inline isl::multi_aff as_multi_aff() const;
2047   inline isl::pw_multi_aff bind_domain(isl::multi_id tuple) const;
2048   inline isl::pw_multi_aff bind_domain_wrapped_domain(isl::multi_id tuple) const;
2049   inline isl::pw_multi_aff coalesce() const;
2050   inline isl::set domain() const;
2051   inline isl::pw_multi_aff flat_range_product(isl::pw_multi_aff pma2) const;
2052   inline void foreach_piece(const std::function<void(isl::set, isl::multi_aff)> &fn) const;
2053   inline isl::space space() const;
2054   inline isl::space get_space() const;
2055   inline isl::pw_multi_aff gist(isl::set set) const;
2056   inline isl::pw_multi_aff intersect_domain(isl::set set) const;
2057   inline isl::pw_multi_aff intersect_params(isl::set set) const;
2058   inline bool isa_multi_aff() const;
2059   inline unsigned n_piece() const;
2060   inline isl::pw_multi_aff product(isl::pw_multi_aff pma2) const;
2061   inline isl::pw_multi_aff pullback(isl::multi_aff ma) const;
2062   inline isl::pw_multi_aff pullback(isl::pw_multi_aff pma2) const;
2063   inline isl::pw_multi_aff range_factor_domain() const;
2064   inline isl::pw_multi_aff range_factor_range() const;
2065   inline isl::pw_multi_aff range_product(isl::pw_multi_aff pma2) const;
2066   inline isl::pw_multi_aff scale(isl::val v) const;
2067   inline isl::pw_multi_aff scale(long v) const;
2068   inline isl::pw_multi_aff scale_down(isl::val v) const;
2069   inline isl::pw_multi_aff scale_down(long v) const;
2070   inline isl::pw_multi_aff sub(isl::pw_multi_aff pma2) const;
2071   inline isl::pw_multi_aff subtract_domain(isl::set set) const;
2072   inline isl::pw_multi_aff union_add(isl::pw_multi_aff pma2) const;
2073   static inline isl::pw_multi_aff zero(isl::space space);
2074 };
2075 
2076 // declarations for isl::pw_multi_aff_list
2077 inline pw_multi_aff_list manage(__isl_take isl_pw_multi_aff_list *ptr);
2078 inline pw_multi_aff_list manage_copy(__isl_keep isl_pw_multi_aff_list *ptr);
2079 
2080 class pw_multi_aff_list {
2081   friend inline pw_multi_aff_list manage(__isl_take isl_pw_multi_aff_list *ptr);
2082   friend inline pw_multi_aff_list manage_copy(__isl_keep isl_pw_multi_aff_list *ptr);
2083 
2084 protected:
2085   isl_pw_multi_aff_list *ptr = nullptr;
2086 
2087   inline explicit pw_multi_aff_list(__isl_take isl_pw_multi_aff_list *ptr);
2088 
2089 public:
2090   inline /* implicit */ pw_multi_aff_list();
2091   inline /* implicit */ pw_multi_aff_list(const pw_multi_aff_list &obj);
2092   inline explicit pw_multi_aff_list(isl::ctx ctx, int n);
2093   inline explicit pw_multi_aff_list(isl::pw_multi_aff el);
2094   inline pw_multi_aff_list &operator=(pw_multi_aff_list obj);
2095   inline ~pw_multi_aff_list();
2096   inline __isl_give isl_pw_multi_aff_list *copy() const &;
2097   inline __isl_give isl_pw_multi_aff_list *copy() && = delete;
2098   inline __isl_keep isl_pw_multi_aff_list *get() const;
2099   inline __isl_give isl_pw_multi_aff_list *release();
2100   inline bool is_null() const;
2101   inline isl::ctx ctx() const;
2102 
2103   inline isl::pw_multi_aff_list add(isl::pw_multi_aff el) const;
2104   inline isl::pw_multi_aff_list clear() const;
2105   inline isl::pw_multi_aff_list concat(isl::pw_multi_aff_list list2) const;
2106   inline void foreach(const std::function<void(isl::pw_multi_aff)> &fn) const;
2107   inline isl::pw_multi_aff at(int index) const;
2108   inline isl::pw_multi_aff get_at(int index) const;
2109   inline unsigned size() const;
2110 };
2111 
2112 // declarations for isl::schedule
2113 inline schedule manage(__isl_take isl_schedule *ptr);
2114 inline schedule manage_copy(__isl_keep isl_schedule *ptr);
2115 
2116 class schedule {
2117   friend inline schedule manage(__isl_take isl_schedule *ptr);
2118   friend inline schedule manage_copy(__isl_keep isl_schedule *ptr);
2119 
2120 protected:
2121   isl_schedule *ptr = nullptr;
2122 
2123   inline explicit schedule(__isl_take isl_schedule *ptr);
2124 
2125 public:
2126   inline /* implicit */ schedule();
2127   inline /* implicit */ schedule(const schedule &obj);
2128   inline explicit schedule(isl::ctx ctx, const std::string &str);
2129   inline schedule &operator=(schedule obj);
2130   inline ~schedule();
2131   inline __isl_give isl_schedule *copy() const &;
2132   inline __isl_give isl_schedule *copy() && = delete;
2133   inline __isl_keep isl_schedule *get() const;
2134   inline __isl_give isl_schedule *release();
2135   inline bool is_null() const;
2136   inline isl::ctx ctx() const;
2137 
2138   static inline isl::schedule from_domain(isl::union_set domain);
2139   inline isl::union_map map() const;
2140   inline isl::union_map get_map() const;
2141   inline isl::schedule_node root() const;
2142   inline isl::schedule_node get_root() const;
2143   inline isl::schedule pullback(isl::union_pw_multi_aff upma) const;
2144 };
2145 
2146 // declarations for isl::schedule_constraints
2147 inline schedule_constraints manage(__isl_take isl_schedule_constraints *ptr);
2148 inline schedule_constraints manage_copy(__isl_keep isl_schedule_constraints *ptr);
2149 
2150 class schedule_constraints {
2151   friend inline schedule_constraints manage(__isl_take isl_schedule_constraints *ptr);
2152   friend inline schedule_constraints manage_copy(__isl_keep isl_schedule_constraints *ptr);
2153 
2154 protected:
2155   isl_schedule_constraints *ptr = nullptr;
2156 
2157   inline explicit schedule_constraints(__isl_take isl_schedule_constraints *ptr);
2158 
2159 public:
2160   inline /* implicit */ schedule_constraints();
2161   inline /* implicit */ schedule_constraints(const schedule_constraints &obj);
2162   inline explicit schedule_constraints(isl::ctx ctx, const std::string &str);
2163   inline schedule_constraints &operator=(schedule_constraints obj);
2164   inline ~schedule_constraints();
2165   inline __isl_give isl_schedule_constraints *copy() const &;
2166   inline __isl_give isl_schedule_constraints *copy() && = delete;
2167   inline __isl_keep isl_schedule_constraints *get() const;
2168   inline __isl_give isl_schedule_constraints *release();
2169   inline bool is_null() const;
2170   inline isl::ctx ctx() const;
2171 
2172   inline isl::schedule compute_schedule() const;
2173   inline isl::union_map coincidence() const;
2174   inline isl::union_map get_coincidence() const;
2175   inline isl::union_map conditional_validity() const;
2176   inline isl::union_map get_conditional_validity() const;
2177   inline isl::union_map conditional_validity_condition() const;
2178   inline isl::union_map get_conditional_validity_condition() const;
2179   inline isl::set context() const;
2180   inline isl::set get_context() const;
2181   inline isl::union_set domain() const;
2182   inline isl::union_set get_domain() const;
2183   inline isl::union_map proximity() const;
2184   inline isl::union_map get_proximity() const;
2185   inline isl::union_map validity() const;
2186   inline isl::union_map get_validity() const;
2187   static inline isl::schedule_constraints on_domain(isl::union_set domain);
2188   inline isl::schedule_constraints set_coincidence(isl::union_map coincidence) const;
2189   inline isl::schedule_constraints set_conditional_validity(isl::union_map condition, isl::union_map validity) const;
2190   inline isl::schedule_constraints set_context(isl::set context) const;
2191   inline isl::schedule_constraints set_proximity(isl::union_map proximity) const;
2192   inline isl::schedule_constraints set_validity(isl::union_map validity) const;
2193 };
2194 
2195 // declarations for isl::schedule_node
2196 inline schedule_node manage(__isl_take isl_schedule_node *ptr);
2197 inline schedule_node manage_copy(__isl_keep isl_schedule_node *ptr);
2198 
2199 class schedule_node {
2200   friend inline schedule_node manage(__isl_take isl_schedule_node *ptr);
2201   friend inline schedule_node manage_copy(__isl_keep isl_schedule_node *ptr);
2202 
2203 protected:
2204   isl_schedule_node *ptr = nullptr;
2205 
2206   inline explicit schedule_node(__isl_take isl_schedule_node *ptr);
2207 
2208 public:
2209   inline /* implicit */ schedule_node();
2210   inline /* implicit */ schedule_node(const schedule_node &obj);
2211   inline schedule_node &operator=(schedule_node obj);
2212   inline ~schedule_node();
2213   inline __isl_give isl_schedule_node *copy() const &;
2214   inline __isl_give isl_schedule_node *copy() && = delete;
2215   inline __isl_keep isl_schedule_node *get() const;
2216   inline __isl_give isl_schedule_node *release();
2217   inline bool is_null() const;
2218 private:
2219   template <typename T,
2220           typename = typename std::enable_if<std::is_same<
2221                   const decltype(isl_schedule_node_get_type(NULL)),
2222                   const T>::value>::type>
2223   inline bool isa_type(T subtype) const;
2224 public:
2225   template <class T> inline bool isa() const;
2226   template <class T> inline T as() const;
2227   inline isl::ctx ctx() const;
2228 
2229   inline isl::schedule_node ancestor(int generation) const;
2230   inline isl::schedule_node child(int pos) const;
2231   inline bool every_descendant(const std::function<bool(isl::schedule_node)> &test) const;
2232   inline isl::schedule_node first_child() const;
2233   inline void foreach_ancestor_top_down(const std::function<void(isl::schedule_node)> &fn) const;
2234   inline void foreach_descendant_top_down(const std::function<bool(isl::schedule_node)> &fn) const;
2235   static inline isl::schedule_node from_domain(isl::union_set domain);
2236   static inline isl::schedule_node from_extension(isl::union_map extension);
2237   inline unsigned ancestor_child_position(const isl::schedule_node &ancestor) const;
2238   inline unsigned get_ancestor_child_position(const isl::schedule_node &ancestor) const;
2239   inline unsigned child_position() const;
2240   inline unsigned get_child_position() const;
2241   inline isl::multi_union_pw_aff prefix_schedule_multi_union_pw_aff() const;
2242   inline isl::multi_union_pw_aff get_prefix_schedule_multi_union_pw_aff() const;
2243   inline isl::union_map prefix_schedule_union_map() const;
2244   inline isl::union_map get_prefix_schedule_union_map() const;
2245   inline isl::union_pw_multi_aff prefix_schedule_union_pw_multi_aff() const;
2246   inline isl::union_pw_multi_aff get_prefix_schedule_union_pw_multi_aff() const;
2247   inline isl::schedule schedule() const;
2248   inline isl::schedule get_schedule() const;
2249   inline isl::schedule_node shared_ancestor(const isl::schedule_node &node2) const;
2250   inline isl::schedule_node get_shared_ancestor(const isl::schedule_node &node2) const;
2251   inline unsigned tree_depth() const;
2252   inline unsigned get_tree_depth() const;
2253   inline isl::schedule_node graft_after(isl::schedule_node graft) const;
2254   inline isl::schedule_node graft_before(isl::schedule_node graft) const;
2255   inline bool has_children() const;
2256   inline bool has_next_sibling() const;
2257   inline bool has_parent() const;
2258   inline bool has_previous_sibling() const;
2259   inline isl::schedule_node insert_context(isl::set context) const;
2260   inline isl::schedule_node insert_filter(isl::union_set filter) const;
2261   inline isl::schedule_node insert_guard(isl::set context) const;
2262   inline isl::schedule_node insert_mark(isl::id mark) const;
2263   inline isl::schedule_node insert_mark(const std::string &mark) const;
2264   inline isl::schedule_node insert_partial_schedule(isl::multi_union_pw_aff schedule) const;
2265   inline isl::schedule_node insert_sequence(isl::union_set_list filters) const;
2266   inline isl::schedule_node insert_set(isl::union_set_list filters) const;
2267   inline bool is_equal(const isl::schedule_node &node2) const;
2268   inline bool is_subtree_anchored() const;
2269   inline isl::schedule_node map_descendant_bottom_up(const std::function<isl::schedule_node(isl::schedule_node)> &fn) const;
2270   inline unsigned n_children() const;
2271   inline isl::schedule_node next_sibling() const;
2272   inline isl::schedule_node order_after(isl::union_set filter) const;
2273   inline isl::schedule_node order_before(isl::union_set filter) const;
2274   inline isl::schedule_node parent() const;
2275   inline isl::schedule_node previous_sibling() const;
2276   inline isl::schedule_node root() const;
2277 };
2278 
2279 // declarations for isl::schedule_node_band
2280 
2281 class schedule_node_band : public schedule_node {
2282   template <class T>
2283   friend bool schedule_node::isa() const;
2284   friend schedule_node_band schedule_node::as<schedule_node_band>() const;
2285   static const auto type = isl_schedule_node_band;
2286 
2287 protected:
2288   inline explicit schedule_node_band(__isl_take isl_schedule_node *ptr);
2289 
2290 public:
2291   inline /* implicit */ schedule_node_band();
2292   inline /* implicit */ schedule_node_band(const schedule_node_band &obj);
2293   inline schedule_node_band &operator=(schedule_node_band obj);
2294   inline isl::ctx ctx() const;
2295 
2296   inline isl::union_set ast_build_options() const;
2297   inline isl::union_set get_ast_build_options() const;
2298   inline isl::set ast_isolate_option() const;
2299   inline isl::set get_ast_isolate_option() const;
2300   inline isl::multi_union_pw_aff partial_schedule() const;
2301   inline isl::multi_union_pw_aff get_partial_schedule() const;
2302   inline bool permutable() const;
2303   inline bool get_permutable() const;
2304   inline bool member_get_coincident(int pos) const;
2305   inline schedule_node_band member_set_coincident(int pos, int coincident) const;
2306   inline schedule_node_band mod(isl::multi_val mv) const;
2307   inline unsigned n_member() const;
2308   inline schedule_node_band scale(isl::multi_val mv) const;
2309   inline schedule_node_band scale_down(isl::multi_val mv) const;
2310   inline schedule_node_band set_ast_build_options(isl::union_set options) const;
2311   inline schedule_node_band set_permutable(int permutable) const;
2312   inline schedule_node_band shift(isl::multi_union_pw_aff shift) const;
2313   inline schedule_node_band split(int pos) const;
2314   inline schedule_node_band tile(isl::multi_val sizes) const;
2315   inline schedule_node_band member_set_ast_loop_default(int pos) const;
2316   inline schedule_node_band member_set_ast_loop_atomic(int pos) const;
2317   inline schedule_node_band member_set_ast_loop_unroll(int pos) const;
2318   inline schedule_node_band member_set_ast_loop_separate(int pos) const;
2319 };
2320 
2321 // declarations for isl::schedule_node_context
2322 
2323 class schedule_node_context : public schedule_node {
2324   template <class T>
2325   friend bool schedule_node::isa() const;
2326   friend schedule_node_context schedule_node::as<schedule_node_context>() const;
2327   static const auto type = isl_schedule_node_context;
2328 
2329 protected:
2330   inline explicit schedule_node_context(__isl_take isl_schedule_node *ptr);
2331 
2332 public:
2333   inline /* implicit */ schedule_node_context();
2334   inline /* implicit */ schedule_node_context(const schedule_node_context &obj);
2335   inline schedule_node_context &operator=(schedule_node_context obj);
2336   inline isl::ctx ctx() const;
2337 
2338   inline isl::set context() const;
2339   inline isl::set get_context() const;
2340 };
2341 
2342 // declarations for isl::schedule_node_domain
2343 
2344 class schedule_node_domain : public schedule_node {
2345   template <class T>
2346   friend bool schedule_node::isa() const;
2347   friend schedule_node_domain schedule_node::as<schedule_node_domain>() const;
2348   static const auto type = isl_schedule_node_domain;
2349 
2350 protected:
2351   inline explicit schedule_node_domain(__isl_take isl_schedule_node *ptr);
2352 
2353 public:
2354   inline /* implicit */ schedule_node_domain();
2355   inline /* implicit */ schedule_node_domain(const schedule_node_domain &obj);
2356   inline schedule_node_domain &operator=(schedule_node_domain obj);
2357   inline isl::ctx ctx() const;
2358 
2359   inline isl::union_set domain() const;
2360   inline isl::union_set get_domain() const;
2361 };
2362 
2363 // declarations for isl::schedule_node_expansion
2364 
2365 class schedule_node_expansion : public schedule_node {
2366   template <class T>
2367   friend bool schedule_node::isa() const;
2368   friend schedule_node_expansion schedule_node::as<schedule_node_expansion>() const;
2369   static const auto type = isl_schedule_node_expansion;
2370 
2371 protected:
2372   inline explicit schedule_node_expansion(__isl_take isl_schedule_node *ptr);
2373 
2374 public:
2375   inline /* implicit */ schedule_node_expansion();
2376   inline /* implicit */ schedule_node_expansion(const schedule_node_expansion &obj);
2377   inline schedule_node_expansion &operator=(schedule_node_expansion obj);
2378   inline isl::ctx ctx() const;
2379 
2380   inline isl::union_pw_multi_aff contraction() const;
2381   inline isl::union_pw_multi_aff get_contraction() const;
2382   inline isl::union_map expansion() const;
2383   inline isl::union_map get_expansion() const;
2384 };
2385 
2386 // declarations for isl::schedule_node_extension
2387 
2388 class schedule_node_extension : public schedule_node {
2389   template <class T>
2390   friend bool schedule_node::isa() const;
2391   friend schedule_node_extension schedule_node::as<schedule_node_extension>() const;
2392   static const auto type = isl_schedule_node_extension;
2393 
2394 protected:
2395   inline explicit schedule_node_extension(__isl_take isl_schedule_node *ptr);
2396 
2397 public:
2398   inline /* implicit */ schedule_node_extension();
2399   inline /* implicit */ schedule_node_extension(const schedule_node_extension &obj);
2400   inline schedule_node_extension &operator=(schedule_node_extension obj);
2401   inline isl::ctx ctx() const;
2402 
2403   inline isl::union_map extension() const;
2404   inline isl::union_map get_extension() const;
2405 };
2406 
2407 // declarations for isl::schedule_node_filter
2408 
2409 class schedule_node_filter : public schedule_node {
2410   template <class T>
2411   friend bool schedule_node::isa() const;
2412   friend schedule_node_filter schedule_node::as<schedule_node_filter>() const;
2413   static const auto type = isl_schedule_node_filter;
2414 
2415 protected:
2416   inline explicit schedule_node_filter(__isl_take isl_schedule_node *ptr);
2417 
2418 public:
2419   inline /* implicit */ schedule_node_filter();
2420   inline /* implicit */ schedule_node_filter(const schedule_node_filter &obj);
2421   inline schedule_node_filter &operator=(schedule_node_filter obj);
2422   inline isl::ctx ctx() const;
2423 
2424   inline isl::union_set filter() const;
2425   inline isl::union_set get_filter() const;
2426 };
2427 
2428 // declarations for isl::schedule_node_guard
2429 
2430 class schedule_node_guard : public schedule_node {
2431   template <class T>
2432   friend bool schedule_node::isa() const;
2433   friend schedule_node_guard schedule_node::as<schedule_node_guard>() const;
2434   static const auto type = isl_schedule_node_guard;
2435 
2436 protected:
2437   inline explicit schedule_node_guard(__isl_take isl_schedule_node *ptr);
2438 
2439 public:
2440   inline /* implicit */ schedule_node_guard();
2441   inline /* implicit */ schedule_node_guard(const schedule_node_guard &obj);
2442   inline schedule_node_guard &operator=(schedule_node_guard obj);
2443   inline isl::ctx ctx() const;
2444 
2445   inline isl::set guard() const;
2446   inline isl::set get_guard() const;
2447 };
2448 
2449 // declarations for isl::schedule_node_leaf
2450 
2451 class schedule_node_leaf : public schedule_node {
2452   template <class T>
2453   friend bool schedule_node::isa() const;
2454   friend schedule_node_leaf schedule_node::as<schedule_node_leaf>() const;
2455   static const auto type = isl_schedule_node_leaf;
2456 
2457 protected:
2458   inline explicit schedule_node_leaf(__isl_take isl_schedule_node *ptr);
2459 
2460 public:
2461   inline /* implicit */ schedule_node_leaf();
2462   inline /* implicit */ schedule_node_leaf(const schedule_node_leaf &obj);
2463   inline schedule_node_leaf &operator=(schedule_node_leaf obj);
2464   inline isl::ctx ctx() const;
2465 
2466 };
2467 
2468 // declarations for isl::schedule_node_mark
2469 
2470 class schedule_node_mark : public schedule_node {
2471   template <class T>
2472   friend bool schedule_node::isa() const;
2473   friend schedule_node_mark schedule_node::as<schedule_node_mark>() const;
2474   static const auto type = isl_schedule_node_mark;
2475 
2476 protected:
2477   inline explicit schedule_node_mark(__isl_take isl_schedule_node *ptr);
2478 
2479 public:
2480   inline /* implicit */ schedule_node_mark();
2481   inline /* implicit */ schedule_node_mark(const schedule_node_mark &obj);
2482   inline schedule_node_mark &operator=(schedule_node_mark obj);
2483   inline isl::ctx ctx() const;
2484 
2485 };
2486 
2487 // declarations for isl::schedule_node_sequence
2488 
2489 class schedule_node_sequence : public schedule_node {
2490   template <class T>
2491   friend bool schedule_node::isa() const;
2492   friend schedule_node_sequence schedule_node::as<schedule_node_sequence>() const;
2493   static const auto type = isl_schedule_node_sequence;
2494 
2495 protected:
2496   inline explicit schedule_node_sequence(__isl_take isl_schedule_node *ptr);
2497 
2498 public:
2499   inline /* implicit */ schedule_node_sequence();
2500   inline /* implicit */ schedule_node_sequence(const schedule_node_sequence &obj);
2501   inline schedule_node_sequence &operator=(schedule_node_sequence obj);
2502   inline isl::ctx ctx() const;
2503 
2504 };
2505 
2506 // declarations for isl::schedule_node_set
2507 
2508 class schedule_node_set : public schedule_node {
2509   template <class T>
2510   friend bool schedule_node::isa() const;
2511   friend schedule_node_set schedule_node::as<schedule_node_set>() const;
2512   static const auto type = isl_schedule_node_set;
2513 
2514 protected:
2515   inline explicit schedule_node_set(__isl_take isl_schedule_node *ptr);
2516 
2517 public:
2518   inline /* implicit */ schedule_node_set();
2519   inline /* implicit */ schedule_node_set(const schedule_node_set &obj);
2520   inline schedule_node_set &operator=(schedule_node_set obj);
2521   inline isl::ctx ctx() const;
2522 
2523 };
2524 
2525 // declarations for isl::set
2526 inline set manage(__isl_take isl_set *ptr);
2527 inline set manage_copy(__isl_keep isl_set *ptr);
2528 
2529 class set {
2530   friend inline set manage(__isl_take isl_set *ptr);
2531   friend inline set manage_copy(__isl_keep isl_set *ptr);
2532 
2533 protected:
2534   isl_set *ptr = nullptr;
2535 
2536   inline explicit set(__isl_take isl_set *ptr);
2537 
2538 public:
2539   inline /* implicit */ set();
2540   inline /* implicit */ set(const set &obj);
2541   inline /* implicit */ set(isl::basic_set bset);
2542   inline /* implicit */ set(isl::point pnt);
2543   inline explicit set(isl::ctx ctx, const std::string &str);
2544   inline set &operator=(set obj);
2545   inline ~set();
2546   inline __isl_give isl_set *copy() const &;
2547   inline __isl_give isl_set *copy() && = delete;
2548   inline __isl_keep isl_set *get() const;
2549   inline __isl_give isl_set *release();
2550   inline bool is_null() const;
2551   inline isl::ctx ctx() const;
2552 
2553   inline isl::basic_set affine_hull() const;
2554   inline isl::set apply(isl::map map) const;
2555   inline isl::set bind(isl::multi_id tuple) const;
2556   inline isl::set coalesce() const;
2557   inline isl::set complement() const;
2558   inline isl::set detect_equalities() const;
2559   static inline isl::set empty(isl::space space);
2560   inline isl::set flatten() const;
2561   inline void foreach_basic_set(const std::function<void(isl::basic_set)> &fn) const;
2562   inline void foreach_point(const std::function<void(isl::point)> &fn) const;
2563   inline isl::multi_val plain_multi_val_if_fixed() const;
2564   inline isl::multi_val get_plain_multi_val_if_fixed() const;
2565   inline isl::fixed_box simple_fixed_box_hull() const;
2566   inline isl::fixed_box get_simple_fixed_box_hull() const;
2567   inline isl::space space() const;
2568   inline isl::space get_space() const;
2569   inline isl::val stride(int pos) const;
2570   inline isl::val get_stride(int pos) const;
2571   inline isl::set gist(isl::set context) const;
2572   inline isl::map identity() const;
2573   inline isl::pw_aff indicator_function() const;
2574   inline isl::set intersect(isl::set set2) const;
2575   inline isl::set intersect_params(isl::set params) const;
2576   inline bool is_disjoint(const isl::set &set2) const;
2577   inline bool is_empty() const;
2578   inline bool is_equal(const isl::set &set2) const;
2579   inline bool is_singleton() const;
2580   inline bool is_strict_subset(const isl::set &set2) const;
2581   inline bool is_subset(const isl::set &set2) const;
2582   inline bool is_wrapping() const;
2583   inline isl::set lexmax() const;
2584   inline isl::pw_multi_aff lexmax_pw_multi_aff() const;
2585   inline isl::set lexmin() const;
2586   inline isl::pw_multi_aff lexmin_pw_multi_aff() const;
2587   inline isl::set lower_bound(isl::multi_pw_aff lower) const;
2588   inline isl::set lower_bound(isl::multi_val lower) const;
2589   inline isl::val max_val(const isl::aff &obj) const;
2590   inline isl::val min_val(const isl::aff &obj) const;
2591   inline isl::set params() const;
2592   inline isl::basic_set polyhedral_hull() const;
2593   inline isl::set preimage(isl::multi_aff ma) const;
2594   inline isl::set preimage(isl::multi_pw_aff mpa) const;
2595   inline isl::set preimage(isl::pw_multi_aff pma) const;
2596   inline isl::set product(isl::set set2) const;
2597   inline isl::set project_out_all_params() const;
2598   inline isl::set project_out_param(isl::id id) const;
2599   inline isl::set project_out_param(const std::string &id) const;
2600   inline isl::set project_out_param(isl::id_list list) const;
2601   inline isl::basic_set sample() const;
2602   inline isl::point sample_point() const;
2603   inline isl::set subtract(isl::set set2) const;
2604   inline isl::set unbind_params(isl::multi_id tuple) const;
2605   inline isl::map unbind_params_insert_domain(isl::multi_id domain) const;
2606   inline isl::set unite(isl::set set2) const;
2607   static inline isl::set universe(isl::space space);
2608   inline isl::basic_set unshifted_simple_hull() const;
2609   inline isl::map unwrap() const;
2610   inline isl::set upper_bound(isl::multi_pw_aff upper) const;
2611   inline isl::set upper_bound(isl::multi_val upper) const;
2612 };
2613 
2614 // declarations for isl::space
2615 inline space manage(__isl_take isl_space *ptr);
2616 inline space manage_copy(__isl_keep isl_space *ptr);
2617 
2618 class space {
2619   friend inline space manage(__isl_take isl_space *ptr);
2620   friend inline space manage_copy(__isl_keep isl_space *ptr);
2621 
2622 protected:
2623   isl_space *ptr = nullptr;
2624 
2625   inline explicit space(__isl_take isl_space *ptr);
2626 
2627 public:
2628   inline /* implicit */ space();
2629   inline /* implicit */ space(const space &obj);
2630   inline space &operator=(space obj);
2631   inline ~space();
2632   inline __isl_give isl_space *copy() const &;
2633   inline __isl_give isl_space *copy() && = delete;
2634   inline __isl_keep isl_space *get() const;
2635   inline __isl_give isl_space *release();
2636   inline bool is_null() const;
2637   inline isl::ctx ctx() const;
2638 
2639   inline isl::space add_named_tuple(isl::id tuple_id, unsigned int dim) const;
2640   inline isl::space add_named_tuple(const std::string &tuple_id, unsigned int dim) const;
2641   inline isl::space add_unnamed_tuple(unsigned int dim) const;
2642   inline isl::space domain() const;
2643   inline isl::space flatten_domain() const;
2644   inline isl::space flatten_range() const;
2645   inline bool is_equal(const isl::space &space2) const;
2646   inline bool is_wrapping() const;
2647   inline isl::space map_from_set() const;
2648   inline isl::space params() const;
2649   inline isl::space range() const;
2650   static inline isl::space unit(isl::ctx ctx);
2651   inline isl::space unwrap() const;
2652   inline isl::space wrap() const;
2653 };
2654 
2655 // declarations for isl::union_access_info
2656 inline union_access_info manage(__isl_take isl_union_access_info *ptr);
2657 inline union_access_info manage_copy(__isl_keep isl_union_access_info *ptr);
2658 
2659 class union_access_info {
2660   friend inline union_access_info manage(__isl_take isl_union_access_info *ptr);
2661   friend inline union_access_info manage_copy(__isl_keep isl_union_access_info *ptr);
2662 
2663 protected:
2664   isl_union_access_info *ptr = nullptr;
2665 
2666   inline explicit union_access_info(__isl_take isl_union_access_info *ptr);
2667 
2668 public:
2669   inline /* implicit */ union_access_info();
2670   inline /* implicit */ union_access_info(const union_access_info &obj);
2671   inline explicit union_access_info(isl::union_map sink);
2672   inline union_access_info &operator=(union_access_info obj);
2673   inline ~union_access_info();
2674   inline __isl_give isl_union_access_info *copy() const &;
2675   inline __isl_give isl_union_access_info *copy() && = delete;
2676   inline __isl_keep isl_union_access_info *get() const;
2677   inline __isl_give isl_union_access_info *release();
2678   inline bool is_null() const;
2679   inline isl::ctx ctx() const;
2680 
2681   inline isl::union_flow compute_flow() const;
2682   inline isl::union_access_info set_kill(isl::union_map kill) const;
2683   inline isl::union_access_info set_may_source(isl::union_map may_source) const;
2684   inline isl::union_access_info set_must_source(isl::union_map must_source) const;
2685   inline isl::union_access_info set_schedule(isl::schedule schedule) const;
2686   inline isl::union_access_info set_schedule_map(isl::union_map schedule_map) const;
2687 };
2688 
2689 // declarations for isl::union_flow
2690 inline union_flow manage(__isl_take isl_union_flow *ptr);
2691 inline union_flow manage_copy(__isl_keep isl_union_flow *ptr);
2692 
2693 class union_flow {
2694   friend inline union_flow manage(__isl_take isl_union_flow *ptr);
2695   friend inline union_flow manage_copy(__isl_keep isl_union_flow *ptr);
2696 
2697 protected:
2698   isl_union_flow *ptr = nullptr;
2699 
2700   inline explicit union_flow(__isl_take isl_union_flow *ptr);
2701 
2702 public:
2703   inline /* implicit */ union_flow();
2704   inline /* implicit */ union_flow(const union_flow &obj);
2705   inline union_flow &operator=(union_flow obj);
2706   inline ~union_flow();
2707   inline __isl_give isl_union_flow *copy() const &;
2708   inline __isl_give isl_union_flow *copy() && = delete;
2709   inline __isl_keep isl_union_flow *get() const;
2710   inline __isl_give isl_union_flow *release();
2711   inline bool is_null() const;
2712   inline isl::ctx ctx() const;
2713 
2714   inline isl::union_map full_may_dependence() const;
2715   inline isl::union_map get_full_may_dependence() const;
2716   inline isl::union_map full_must_dependence() const;
2717   inline isl::union_map get_full_must_dependence() const;
2718   inline isl::union_map may_dependence() const;
2719   inline isl::union_map get_may_dependence() const;
2720   inline isl::union_map may_no_source() const;
2721   inline isl::union_map get_may_no_source() const;
2722   inline isl::union_map must_dependence() const;
2723   inline isl::union_map get_must_dependence() const;
2724   inline isl::union_map must_no_source() const;
2725   inline isl::union_map get_must_no_source() const;
2726 };
2727 
2728 // declarations for isl::union_map
2729 inline union_map manage(__isl_take isl_union_map *ptr);
2730 inline union_map manage_copy(__isl_keep isl_union_map *ptr);
2731 
2732 class union_map {
2733   friend inline union_map manage(__isl_take isl_union_map *ptr);
2734   friend inline union_map manage_copy(__isl_keep isl_union_map *ptr);
2735 
2736 protected:
2737   isl_union_map *ptr = nullptr;
2738 
2739   inline explicit union_map(__isl_take isl_union_map *ptr);
2740 
2741 public:
2742   inline /* implicit */ union_map();
2743   inline /* implicit */ union_map(const union_map &obj);
2744   inline /* implicit */ union_map(isl::basic_map bmap);
2745   inline /* implicit */ union_map(isl::map map);
2746   inline explicit union_map(isl::ctx ctx, const std::string &str);
2747   inline union_map &operator=(union_map obj);
2748   inline ~union_map();
2749   inline __isl_give isl_union_map *copy() const &;
2750   inline __isl_give isl_union_map *copy() && = delete;
2751   inline __isl_keep isl_union_map *get() const;
2752   inline __isl_give isl_union_map *release();
2753   inline bool is_null() const;
2754   inline isl::ctx ctx() const;
2755 
2756   inline isl::union_map affine_hull() const;
2757   inline isl::union_map apply_domain(isl::union_map umap2) const;
2758   inline isl::union_map apply_range(isl::union_map umap2) const;
2759   inline isl::union_set bind_range(isl::multi_id tuple) const;
2760   inline isl::union_map coalesce() const;
2761   inline isl::union_map compute_divs() const;
2762   inline isl::union_map curry() const;
2763   inline isl::union_set deltas() const;
2764   inline isl::union_map detect_equalities() const;
2765   inline isl::union_set domain() const;
2766   inline isl::union_map domain_factor_domain() const;
2767   inline isl::union_map domain_factor_range() const;
2768   inline isl::union_map domain_map() const;
2769   inline isl::union_pw_multi_aff domain_map_union_pw_multi_aff() const;
2770   inline isl::union_map domain_product(isl::union_map umap2) const;
2771   static inline isl::union_map empty(isl::ctx ctx);
2772   inline isl::union_map eq_at(isl::multi_union_pw_aff mupa) const;
2773   inline bool every_map(const std::function<bool(isl::map)> &test) const;
2774   inline isl::map extract_map(isl::space space) const;
2775   inline isl::union_map factor_domain() const;
2776   inline isl::union_map factor_range() const;
2777   inline isl::union_map fixed_power(isl::val exp) const;
2778   inline isl::union_map fixed_power(long exp) const;
2779   inline void foreach_map(const std::function<void(isl::map)> &fn) const;
2780   static inline isl::union_map from(isl::multi_union_pw_aff mupa);
2781   static inline isl::union_map from(isl::union_pw_multi_aff upma);
2782   static inline isl::union_map from_domain(isl::union_set uset);
2783   static inline isl::union_map from_domain_and_range(isl::union_set domain, isl::union_set range);
2784   static inline isl::union_map from_range(isl::union_set uset);
2785   inline isl::space space() const;
2786   inline isl::space get_space() const;
2787   inline isl::union_map gist(isl::union_map context) const;
2788   inline isl::union_map gist_domain(isl::union_set uset) const;
2789   inline isl::union_map gist_params(isl::set set) const;
2790   inline isl::union_map gist_range(isl::union_set uset) const;
2791   inline isl::union_map intersect(isl::union_map umap2) const;
2792   inline isl::union_map intersect_domain(isl::union_set uset) const;
2793   inline isl::union_map intersect_params(isl::set set) const;
2794   inline isl::union_map intersect_range(isl::union_set uset) const;
2795   inline bool is_bijective() const;
2796   inline bool is_disjoint(const isl::union_map &umap2) const;
2797   inline bool is_empty() const;
2798   inline bool is_equal(const isl::union_map &umap2) const;
2799   inline bool is_injective() const;
2800   inline bool is_single_valued() const;
2801   inline bool is_strict_subset(const isl::union_map &umap2) const;
2802   inline bool is_subset(const isl::union_map &umap2) const;
2803   inline bool isa_map() const;
2804   inline isl::union_map lexmax() const;
2805   inline isl::union_map lexmin() const;
2806   inline isl::union_map polyhedral_hull() const;
2807   inline isl::union_map preimage_domain(isl::multi_aff ma) const;
2808   inline isl::union_map preimage_domain(isl::multi_pw_aff mpa) const;
2809   inline isl::union_map preimage_domain(isl::pw_multi_aff pma) const;
2810   inline isl::union_map preimage_domain(isl::union_pw_multi_aff upma) const;
2811   inline isl::union_map preimage_range(isl::multi_aff ma) const;
2812   inline isl::union_map preimage_range(isl::pw_multi_aff pma) const;
2813   inline isl::union_map preimage_range(isl::union_pw_multi_aff upma) const;
2814   inline isl::union_map product(isl::union_map umap2) const;
2815   inline isl::union_map project_out_all_params() const;
2816   inline isl::union_set range() const;
2817   inline isl::union_map range_factor_domain() const;
2818   inline isl::union_map range_factor_range() const;
2819   inline isl::union_map range_map() const;
2820   inline isl::union_map range_product(isl::union_map umap2) const;
2821   inline isl::union_map range_reverse() const;
2822   inline isl::union_map reverse() const;
2823   inline isl::union_map subtract(isl::union_map umap2) const;
2824   inline isl::union_map subtract_domain(isl::union_set dom) const;
2825   inline isl::union_map subtract_range(isl::union_set dom) const;
2826   inline isl::union_map uncurry() const;
2827   inline isl::union_map unite(isl::union_map umap2) const;
2828   inline isl::union_map universe() const;
2829   inline isl::union_set wrap() const;
2830   inline isl::union_map zip() const;
2831 };
2832 
2833 // declarations for isl::union_pw_aff
2834 inline union_pw_aff manage(__isl_take isl_union_pw_aff *ptr);
2835 inline union_pw_aff manage_copy(__isl_keep isl_union_pw_aff *ptr);
2836 
2837 class union_pw_aff {
2838   friend inline union_pw_aff manage(__isl_take isl_union_pw_aff *ptr);
2839   friend inline union_pw_aff manage_copy(__isl_keep isl_union_pw_aff *ptr);
2840 
2841 protected:
2842   isl_union_pw_aff *ptr = nullptr;
2843 
2844   inline explicit union_pw_aff(__isl_take isl_union_pw_aff *ptr);
2845 
2846 public:
2847   inline /* implicit */ union_pw_aff();
2848   inline /* implicit */ union_pw_aff(const union_pw_aff &obj);
2849   inline /* implicit */ union_pw_aff(isl::pw_aff pa);
2850   inline explicit union_pw_aff(isl::ctx ctx, const std::string &str);
2851   inline union_pw_aff &operator=(union_pw_aff obj);
2852   inline ~union_pw_aff();
2853   inline __isl_give isl_union_pw_aff *copy() const &;
2854   inline __isl_give isl_union_pw_aff *copy() && = delete;
2855   inline __isl_keep isl_union_pw_aff *get() const;
2856   inline __isl_give isl_union_pw_aff *release();
2857   inline bool is_null() const;
2858   inline isl::ctx ctx() const;
2859 
2860   inline isl::union_pw_aff add(isl::union_pw_aff upa2) const;
2861   inline isl::union_set bind(isl::id id) const;
2862   inline isl::union_set bind(const std::string &id) const;
2863   inline isl::union_pw_aff coalesce() const;
2864   inline isl::union_set domain() const;
2865   inline isl::space space() const;
2866   inline isl::space get_space() const;
2867   inline isl::union_pw_aff gist(isl::union_set context) const;
2868   inline isl::union_pw_aff intersect_domain(isl::union_set uset) const;
2869   inline isl::union_pw_aff intersect_domain_wrapped_domain(isl::union_set uset) const;
2870   inline isl::union_pw_aff intersect_domain_wrapped_range(isl::union_set uset) const;
2871   inline isl::union_pw_aff intersect_params(isl::set set) const;
2872   inline isl::union_pw_aff pullback(isl::union_pw_multi_aff upma) const;
2873   inline isl::union_pw_aff sub(isl::union_pw_aff upa2) const;
2874   inline isl::union_pw_aff subtract_domain(isl::union_set uset) const;
2875   inline isl::union_pw_aff union_add(isl::union_pw_aff upa2) const;
2876 };
2877 
2878 // declarations for isl::union_pw_aff_list
2879 inline union_pw_aff_list manage(__isl_take isl_union_pw_aff_list *ptr);
2880 inline union_pw_aff_list manage_copy(__isl_keep isl_union_pw_aff_list *ptr);
2881 
2882 class union_pw_aff_list {
2883   friend inline union_pw_aff_list manage(__isl_take isl_union_pw_aff_list *ptr);
2884   friend inline union_pw_aff_list manage_copy(__isl_keep isl_union_pw_aff_list *ptr);
2885 
2886 protected:
2887   isl_union_pw_aff_list *ptr = nullptr;
2888 
2889   inline explicit union_pw_aff_list(__isl_take isl_union_pw_aff_list *ptr);
2890 
2891 public:
2892   inline /* implicit */ union_pw_aff_list();
2893   inline /* implicit */ union_pw_aff_list(const union_pw_aff_list &obj);
2894   inline explicit union_pw_aff_list(isl::ctx ctx, int n);
2895   inline explicit union_pw_aff_list(isl::union_pw_aff el);
2896   inline union_pw_aff_list &operator=(union_pw_aff_list obj);
2897   inline ~union_pw_aff_list();
2898   inline __isl_give isl_union_pw_aff_list *copy() const &;
2899   inline __isl_give isl_union_pw_aff_list *copy() && = delete;
2900   inline __isl_keep isl_union_pw_aff_list *get() const;
2901   inline __isl_give isl_union_pw_aff_list *release();
2902   inline bool is_null() const;
2903   inline isl::ctx ctx() const;
2904 
2905   inline isl::union_pw_aff_list add(isl::union_pw_aff el) const;
2906   inline isl::union_pw_aff_list clear() const;
2907   inline isl::union_pw_aff_list concat(isl::union_pw_aff_list list2) const;
2908   inline void foreach(const std::function<void(isl::union_pw_aff)> &fn) const;
2909   inline isl::union_pw_aff at(int index) const;
2910   inline isl::union_pw_aff get_at(int index) const;
2911   inline unsigned size() const;
2912 };
2913 
2914 // declarations for isl::union_pw_multi_aff
2915 inline union_pw_multi_aff manage(__isl_take isl_union_pw_multi_aff *ptr);
2916 inline union_pw_multi_aff manage_copy(__isl_keep isl_union_pw_multi_aff *ptr);
2917 
2918 class union_pw_multi_aff {
2919   friend inline union_pw_multi_aff manage(__isl_take isl_union_pw_multi_aff *ptr);
2920   friend inline union_pw_multi_aff manage_copy(__isl_keep isl_union_pw_multi_aff *ptr);
2921 
2922 protected:
2923   isl_union_pw_multi_aff *ptr = nullptr;
2924 
2925   inline explicit union_pw_multi_aff(__isl_take isl_union_pw_multi_aff *ptr);
2926 
2927 public:
2928   inline /* implicit */ union_pw_multi_aff();
2929   inline /* implicit */ union_pw_multi_aff(const union_pw_multi_aff &obj);
2930   inline /* implicit */ union_pw_multi_aff(isl::pw_multi_aff pma);
2931   inline /* implicit */ union_pw_multi_aff(isl::union_pw_aff upa);
2932   inline explicit union_pw_multi_aff(isl::ctx ctx, const std::string &str);
2933   inline union_pw_multi_aff &operator=(union_pw_multi_aff obj);
2934   inline ~union_pw_multi_aff();
2935   inline __isl_give isl_union_pw_multi_aff *copy() const &;
2936   inline __isl_give isl_union_pw_multi_aff *copy() && = delete;
2937   inline __isl_keep isl_union_pw_multi_aff *get() const;
2938   inline __isl_give isl_union_pw_multi_aff *release();
2939   inline bool is_null() const;
2940   inline isl::ctx ctx() const;
2941 
2942   inline isl::union_pw_multi_aff add(isl::union_pw_multi_aff upma2) const;
2943   inline isl::pw_multi_aff as_pw_multi_aff() const;
2944   inline isl::union_pw_multi_aff coalesce() const;
2945   inline isl::union_set domain() const;
2946   static inline isl::union_pw_multi_aff empty(isl::ctx ctx);
2947   inline isl::pw_multi_aff extract_pw_multi_aff(isl::space space) const;
2948   inline isl::union_pw_multi_aff flat_range_product(isl::union_pw_multi_aff upma2) const;
2949   inline isl::space space() const;
2950   inline isl::space get_space() const;
2951   inline isl::union_pw_multi_aff gist(isl::union_set context) const;
2952   inline isl::union_pw_multi_aff intersect_domain(isl::union_set uset) const;
2953   inline isl::union_pw_multi_aff intersect_domain_wrapped_domain(isl::union_set uset) const;
2954   inline isl::union_pw_multi_aff intersect_domain_wrapped_range(isl::union_set uset) const;
2955   inline isl::union_pw_multi_aff intersect_params(isl::set set) const;
2956   inline bool isa_pw_multi_aff() const;
2957   inline isl::union_pw_multi_aff pullback(isl::union_pw_multi_aff upma2) const;
2958   inline isl::union_pw_multi_aff range_factor_domain() const;
2959   inline isl::union_pw_multi_aff range_factor_range() const;
2960   inline isl::union_pw_multi_aff sub(isl::union_pw_multi_aff upma2) const;
2961   inline isl::union_pw_multi_aff subtract_domain(isl::union_set uset) const;
2962   inline isl::union_pw_multi_aff union_add(isl::union_pw_multi_aff upma2) const;
2963 };
2964 
2965 // declarations for isl::union_set
2966 inline union_set manage(__isl_take isl_union_set *ptr);
2967 inline union_set manage_copy(__isl_keep isl_union_set *ptr);
2968 
2969 class union_set {
2970   friend inline union_set manage(__isl_take isl_union_set *ptr);
2971   friend inline union_set manage_copy(__isl_keep isl_union_set *ptr);
2972 
2973 protected:
2974   isl_union_set *ptr = nullptr;
2975 
2976   inline explicit union_set(__isl_take isl_union_set *ptr);
2977 
2978 public:
2979   inline /* implicit */ union_set();
2980   inline /* implicit */ union_set(const union_set &obj);
2981   inline /* implicit */ union_set(isl::basic_set bset);
2982   inline /* implicit */ union_set(isl::point pnt);
2983   inline /* implicit */ union_set(isl::set set);
2984   inline explicit union_set(isl::ctx ctx, const std::string &str);
2985   inline union_set &operator=(union_set obj);
2986   inline ~union_set();
2987   inline __isl_give isl_union_set *copy() const &;
2988   inline __isl_give isl_union_set *copy() && = delete;
2989   inline __isl_keep isl_union_set *get() const;
2990   inline __isl_give isl_union_set *release();
2991   inline bool is_null() const;
2992   inline isl::ctx ctx() const;
2993 
2994   inline isl::union_set affine_hull() const;
2995   inline isl::union_set apply(isl::union_map umap) const;
2996   inline isl::union_set coalesce() const;
2997   inline isl::union_set compute_divs() const;
2998   inline isl::union_set detect_equalities() const;
2999   static inline isl::union_set empty(isl::ctx ctx);
3000   inline bool every_set(const std::function<bool(isl::set)> &test) const;
3001   inline isl::set extract_set(isl::space space) const;
3002   inline void foreach_point(const std::function<void(isl::point)> &fn) const;
3003   inline void foreach_set(const std::function<void(isl::set)> &fn) const;
3004   inline isl::space space() const;
3005   inline isl::space get_space() const;
3006   inline isl::union_set gist(isl::union_set context) const;
3007   inline isl::union_set gist_params(isl::set set) const;
3008   inline isl::union_map identity() const;
3009   inline isl::union_set intersect(isl::union_set uset2) const;
3010   inline isl::union_set intersect_params(isl::set set) const;
3011   inline bool is_disjoint(const isl::union_set &uset2) const;
3012   inline bool is_empty() const;
3013   inline bool is_equal(const isl::union_set &uset2) const;
3014   inline bool is_strict_subset(const isl::union_set &uset2) const;
3015   inline bool is_subset(const isl::union_set &uset2) const;
3016   inline bool isa_set() const;
3017   inline isl::union_set lexmax() const;
3018   inline isl::union_set lexmin() const;
3019   inline isl::union_set polyhedral_hull() const;
3020   inline isl::union_set preimage(isl::multi_aff ma) const;
3021   inline isl::union_set preimage(isl::pw_multi_aff pma) const;
3022   inline isl::union_set preimage(isl::union_pw_multi_aff upma) const;
3023   inline isl::point sample_point() const;
3024   inline isl::union_set subtract(isl::union_set uset2) const;
3025   inline isl::union_set unite(isl::union_set uset2) const;
3026   inline isl::union_set universe() const;
3027   inline isl::union_map unwrap() const;
3028 };
3029 
3030 // declarations for isl::union_set_list
3031 inline union_set_list manage(__isl_take isl_union_set_list *ptr);
3032 inline union_set_list manage_copy(__isl_keep isl_union_set_list *ptr);
3033 
3034 class union_set_list {
3035   friend inline union_set_list manage(__isl_take isl_union_set_list *ptr);
3036   friend inline union_set_list manage_copy(__isl_keep isl_union_set_list *ptr);
3037 
3038 protected:
3039   isl_union_set_list *ptr = nullptr;
3040 
3041   inline explicit union_set_list(__isl_take isl_union_set_list *ptr);
3042 
3043 public:
3044   inline /* implicit */ union_set_list();
3045   inline /* implicit */ union_set_list(const union_set_list &obj);
3046   inline explicit union_set_list(isl::ctx ctx, int n);
3047   inline explicit union_set_list(isl::union_set el);
3048   inline union_set_list &operator=(union_set_list obj);
3049   inline ~union_set_list();
3050   inline __isl_give isl_union_set_list *copy() const &;
3051   inline __isl_give isl_union_set_list *copy() && = delete;
3052   inline __isl_keep isl_union_set_list *get() const;
3053   inline __isl_give isl_union_set_list *release();
3054   inline bool is_null() const;
3055   inline isl::ctx ctx() const;
3056 
3057   inline isl::union_set_list add(isl::union_set el) const;
3058   inline isl::union_set_list clear() const;
3059   inline isl::union_set_list concat(isl::union_set_list list2) const;
3060   inline void foreach(const std::function<void(isl::union_set)> &fn) const;
3061   inline isl::union_set at(int index) const;
3062   inline isl::union_set get_at(int index) const;
3063   inline unsigned size() const;
3064 };
3065 
3066 // declarations for isl::val
3067 inline val manage(__isl_take isl_val *ptr);
3068 inline val manage_copy(__isl_keep isl_val *ptr);
3069 
3070 class val {
3071   friend inline val manage(__isl_take isl_val *ptr);
3072   friend inline val manage_copy(__isl_keep isl_val *ptr);
3073 
3074 protected:
3075   isl_val *ptr = nullptr;
3076 
3077   inline explicit val(__isl_take isl_val *ptr);
3078 
3079 public:
3080   inline /* implicit */ val();
3081   inline /* implicit */ val(const val &obj);
3082   inline explicit val(isl::ctx ctx, long i);
3083   inline explicit val(isl::ctx ctx, const std::string &str);
3084   inline val &operator=(val obj);
3085   inline ~val();
3086   inline __isl_give isl_val *copy() const &;
3087   inline __isl_give isl_val *copy() && = delete;
3088   inline __isl_keep isl_val *get() const;
3089   inline __isl_give isl_val *release();
3090   inline bool is_null() const;
3091   inline isl::ctx ctx() const;
3092 
3093   inline isl::val abs() const;
3094   inline bool abs_eq(const isl::val &v2) const;
3095   inline bool abs_eq(long v2) const;
3096   inline isl::val add(isl::val v2) const;
3097   inline isl::val add(long v2) const;
3098   inline isl::val ceil() const;
3099   inline int cmp_si(long i) const;
3100   inline isl::val div(isl::val v2) const;
3101   inline isl::val div(long v2) const;
3102   inline bool eq(const isl::val &v2) const;
3103   inline bool eq(long v2) const;
3104   inline isl::val floor() const;
3105   inline isl::val gcd(isl::val v2) const;
3106   inline isl::val gcd(long v2) const;
3107   inline bool ge(const isl::val &v2) const;
3108   inline bool ge(long v2) const;
3109   inline long den_si() const;
3110   inline long get_den_si() const;
3111   inline long num_si() const;
3112   inline long get_num_si() const;
3113   inline bool gt(const isl::val &v2) const;
3114   inline bool gt(long v2) const;
3115   static inline isl::val infty(isl::ctx ctx);
3116   inline isl::val inv() const;
3117   inline bool is_divisible_by(const isl::val &v2) const;
3118   inline bool is_divisible_by(long v2) const;
3119   inline bool is_infty() const;
3120   inline bool is_int() const;
3121   inline bool is_nan() const;
3122   inline bool is_neg() const;
3123   inline bool is_neginfty() const;
3124   inline bool is_negone() const;
3125   inline bool is_nonneg() const;
3126   inline bool is_nonpos() const;
3127   inline bool is_one() const;
3128   inline bool is_pos() const;
3129   inline bool is_rat() const;
3130   inline bool is_zero() const;
3131   inline bool le(const isl::val &v2) const;
3132   inline bool le(long v2) const;
3133   inline bool lt(const isl::val &v2) const;
3134   inline bool lt(long v2) const;
3135   inline isl::val max(isl::val v2) const;
3136   inline isl::val max(long v2) const;
3137   inline isl::val min(isl::val v2) const;
3138   inline isl::val min(long v2) const;
3139   inline isl::val mod(isl::val v2) const;
3140   inline isl::val mod(long v2) const;
3141   inline isl::val mul(isl::val v2) const;
3142   inline isl::val mul(long v2) const;
3143   static inline isl::val nan(isl::ctx ctx);
3144   inline bool ne(const isl::val &v2) const;
3145   inline bool ne(long v2) const;
3146   inline isl::val neg() const;
3147   static inline isl::val neginfty(isl::ctx ctx);
3148   static inline isl::val negone(isl::ctx ctx);
3149   static inline isl::val one(isl::ctx ctx);
3150   inline isl::val pow2() const;
3151   inline int sgn() const;
3152   inline isl::val sub(isl::val v2) const;
3153   inline isl::val sub(long v2) const;
3154   inline isl::val trunc() const;
3155   static inline isl::val zero(isl::ctx ctx);
3156 };
3157 
3158 // declarations for isl::val_list
3159 inline val_list manage(__isl_take isl_val_list *ptr);
3160 inline val_list manage_copy(__isl_keep isl_val_list *ptr);
3161 
3162 class val_list {
3163   friend inline val_list manage(__isl_take isl_val_list *ptr);
3164   friend inline val_list manage_copy(__isl_keep isl_val_list *ptr);
3165 
3166 protected:
3167   isl_val_list *ptr = nullptr;
3168 
3169   inline explicit val_list(__isl_take isl_val_list *ptr);
3170 
3171 public:
3172   inline /* implicit */ val_list();
3173   inline /* implicit */ val_list(const val_list &obj);
3174   inline explicit val_list(isl::ctx ctx, int n);
3175   inline explicit val_list(isl::val el);
3176   inline val_list &operator=(val_list obj);
3177   inline ~val_list();
3178   inline __isl_give isl_val_list *copy() const &;
3179   inline __isl_give isl_val_list *copy() && = delete;
3180   inline __isl_keep isl_val_list *get() const;
3181   inline __isl_give isl_val_list *release();
3182   inline bool is_null() const;
3183   inline isl::ctx ctx() const;
3184 
3185   inline isl::val_list add(isl::val el) const;
3186   inline isl::val_list add(long el) const;
3187   inline isl::val_list clear() const;
3188   inline isl::val_list concat(isl::val_list list2) const;
3189   inline void foreach(const std::function<void(isl::val)> &fn) const;
3190   inline isl::val at(int index) const;
3191   inline isl::val get_at(int index) const;
3192   inline unsigned size() const;
3193 };
3194 
3195 // implementations for isl::aff
manage(__isl_take isl_aff * ptr)3196 aff manage(__isl_take isl_aff *ptr) {
3197   if (!ptr)
3198     exception::throw_invalid("NULL input", __FILE__, __LINE__);
3199   return aff(ptr);
3200 }
manage_copy(__isl_keep isl_aff * ptr)3201 aff manage_copy(__isl_keep isl_aff *ptr) {
3202   if (!ptr)
3203     exception::throw_invalid("NULL input", __FILE__, __LINE__);
3204   auto saved_ctx = isl_aff_get_ctx(ptr);
3205   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
3206   ptr = isl_aff_copy(ptr);
3207   if (!ptr)
3208     exception::throw_last_error(saved_ctx);
3209   return aff(ptr);
3210 }
3211 
aff()3212 aff::aff()
3213     : ptr(nullptr) {}
3214 
aff(const aff & obj)3215 aff::aff(const aff &obj)
3216     : ptr(nullptr)
3217 {
3218   if (!obj.ptr)
3219     exception::throw_invalid("NULL input", __FILE__, __LINE__);
3220   auto saved_ctx = isl_aff_get_ctx(obj.ptr);
3221   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
3222   ptr = obj.copy();
3223   if (!ptr)
3224     exception::throw_last_error(saved_ctx);
3225 }
3226 
aff(__isl_take isl_aff * ptr)3227 aff::aff(__isl_take isl_aff *ptr)
3228     : ptr(ptr) {}
3229 
aff(isl::ctx ctx,const std::string & str)3230 aff::aff(isl::ctx ctx, const std::string &str)
3231 {
3232   auto saved_ctx = ctx;
3233   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
3234   auto res = isl_aff_read_from_str(ctx.release(), str.c_str());
3235   if (!res)
3236     exception::throw_last_error(saved_ctx);
3237   ptr = res;
3238 }
3239 
3240 aff &aff::operator=(aff obj) {
3241   std::swap(this->ptr, obj.ptr);
3242   return *this;
3243 }
3244 
~aff()3245 aff::~aff() {
3246   if (ptr)
3247     isl_aff_free(ptr);
3248 }
3249 
copy()3250 __isl_give isl_aff *aff::copy() const & {
3251   return isl_aff_copy(ptr);
3252 }
3253 
get()3254 __isl_keep isl_aff *aff::get() const {
3255   return ptr;
3256 }
3257 
release()3258 __isl_give isl_aff *aff::release() {
3259   isl_aff *tmp = ptr;
3260   ptr = nullptr;
3261   return tmp;
3262 }
3263 
is_null()3264 bool aff::is_null() const {
3265   return ptr == nullptr;
3266 }
3267 
ctx()3268 isl::ctx aff::ctx() const {
3269   return isl::ctx(isl_aff_get_ctx(ptr));
3270 }
3271 
add(isl::aff aff2)3272 isl::aff aff::add(isl::aff aff2) const
3273 {
3274   if (!ptr || aff2.is_null())
3275     exception::throw_invalid("NULL input", __FILE__, __LINE__);
3276   auto saved_ctx = ctx();
3277   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
3278   auto res = isl_aff_add(copy(), aff2.release());
3279   if (!res)
3280     exception::throw_last_error(saved_ctx);
3281   return manage(res);
3282 }
3283 
add_constant(isl::val v)3284 isl::aff aff::add_constant(isl::val v) const
3285 {
3286   if (!ptr || v.is_null())
3287     exception::throw_invalid("NULL input", __FILE__, __LINE__);
3288   auto saved_ctx = ctx();
3289   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
3290   auto res = isl_aff_add_constant_val(copy(), v.release());
3291   if (!res)
3292     exception::throw_last_error(saved_ctx);
3293   return manage(res);
3294 }
3295 
add_constant(long v)3296 isl::aff aff::add_constant(long v) const
3297 {
3298   if (!ptr)
3299     exception::throw_invalid("NULL input", __FILE__, __LINE__);
3300   return this->add_constant(isl::val(ctx(), v));
3301 }
3302 
bind(isl::id id)3303 isl::basic_set aff::bind(isl::id id) const
3304 {
3305   if (!ptr || id.is_null())
3306     exception::throw_invalid("NULL input", __FILE__, __LINE__);
3307   auto saved_ctx = ctx();
3308   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
3309   auto res = isl_aff_bind_id(copy(), id.release());
3310   if (!res)
3311     exception::throw_last_error(saved_ctx);
3312   return manage(res);
3313 }
3314 
bind(const std::string & id)3315 isl::basic_set aff::bind(const std::string &id) const
3316 {
3317   if (!ptr)
3318     exception::throw_invalid("NULL input", __FILE__, __LINE__);
3319   return this->bind(isl::id(ctx(), id));
3320 }
3321 
ceil()3322 isl::aff aff::ceil() const
3323 {
3324   if (!ptr)
3325     exception::throw_invalid("NULL input", __FILE__, __LINE__);
3326   auto saved_ctx = ctx();
3327   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
3328   auto res = isl_aff_ceil(copy());
3329   if (!res)
3330     exception::throw_last_error(saved_ctx);
3331   return manage(res);
3332 }
3333 
div(isl::aff aff2)3334 isl::aff aff::div(isl::aff aff2) const
3335 {
3336   if (!ptr || aff2.is_null())
3337     exception::throw_invalid("NULL input", __FILE__, __LINE__);
3338   auto saved_ctx = ctx();
3339   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
3340   auto res = isl_aff_div(copy(), aff2.release());
3341   if (!res)
3342     exception::throw_last_error(saved_ctx);
3343   return manage(res);
3344 }
3345 
eq_set(isl::aff aff2)3346 isl::set aff::eq_set(isl::aff aff2) const
3347 {
3348   if (!ptr || aff2.is_null())
3349     exception::throw_invalid("NULL input", __FILE__, __LINE__);
3350   auto saved_ctx = ctx();
3351   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
3352   auto res = isl_aff_eq_set(copy(), aff2.release());
3353   if (!res)
3354     exception::throw_last_error(saved_ctx);
3355   return manage(res);
3356 }
3357 
eval(isl::point pnt)3358 isl::val aff::eval(isl::point pnt) const
3359 {
3360   if (!ptr || pnt.is_null())
3361     exception::throw_invalid("NULL input", __FILE__, __LINE__);
3362   auto saved_ctx = ctx();
3363   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
3364   auto res = isl_aff_eval(copy(), pnt.release());
3365   if (!res)
3366     exception::throw_last_error(saved_ctx);
3367   return manage(res);
3368 }
3369 
floor()3370 isl::aff aff::floor() const
3371 {
3372   if (!ptr)
3373     exception::throw_invalid("NULL input", __FILE__, __LINE__);
3374   auto saved_ctx = ctx();
3375   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
3376   auto res = isl_aff_floor(copy());
3377   if (!res)
3378     exception::throw_last_error(saved_ctx);
3379   return manage(res);
3380 }
3381 
ge_set(isl::aff aff2)3382 isl::set aff::ge_set(isl::aff aff2) const
3383 {
3384   if (!ptr || aff2.is_null())
3385     exception::throw_invalid("NULL input", __FILE__, __LINE__);
3386   auto saved_ctx = ctx();
3387   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
3388   auto res = isl_aff_ge_set(copy(), aff2.release());
3389   if (!res)
3390     exception::throw_last_error(saved_ctx);
3391   return manage(res);
3392 }
3393 
gist(isl::set context)3394 isl::aff aff::gist(isl::set context) const
3395 {
3396   if (!ptr || context.is_null())
3397     exception::throw_invalid("NULL input", __FILE__, __LINE__);
3398   auto saved_ctx = ctx();
3399   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
3400   auto res = isl_aff_gist(copy(), context.release());
3401   if (!res)
3402     exception::throw_last_error(saved_ctx);
3403   return manage(res);
3404 }
3405 
gt_set(isl::aff aff2)3406 isl::set aff::gt_set(isl::aff aff2) const
3407 {
3408   if (!ptr || aff2.is_null())
3409     exception::throw_invalid("NULL input", __FILE__, __LINE__);
3410   auto saved_ctx = ctx();
3411   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
3412   auto res = isl_aff_gt_set(copy(), aff2.release());
3413   if (!res)
3414     exception::throw_last_error(saved_ctx);
3415   return manage(res);
3416 }
3417 
le_set(isl::aff aff2)3418 isl::set aff::le_set(isl::aff aff2) const
3419 {
3420   if (!ptr || aff2.is_null())
3421     exception::throw_invalid("NULL input", __FILE__, __LINE__);
3422   auto saved_ctx = ctx();
3423   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
3424   auto res = isl_aff_le_set(copy(), aff2.release());
3425   if (!res)
3426     exception::throw_last_error(saved_ctx);
3427   return manage(res);
3428 }
3429 
lt_set(isl::aff aff2)3430 isl::set aff::lt_set(isl::aff aff2) const
3431 {
3432   if (!ptr || aff2.is_null())
3433     exception::throw_invalid("NULL input", __FILE__, __LINE__);
3434   auto saved_ctx = ctx();
3435   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
3436   auto res = isl_aff_lt_set(copy(), aff2.release());
3437   if (!res)
3438     exception::throw_last_error(saved_ctx);
3439   return manage(res);
3440 }
3441 
mod(isl::val mod)3442 isl::aff aff::mod(isl::val mod) const
3443 {
3444   if (!ptr || mod.is_null())
3445     exception::throw_invalid("NULL input", __FILE__, __LINE__);
3446   auto saved_ctx = ctx();
3447   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
3448   auto res = isl_aff_mod_val(copy(), mod.release());
3449   if (!res)
3450     exception::throw_last_error(saved_ctx);
3451   return manage(res);
3452 }
3453 
mod(long mod)3454 isl::aff aff::mod(long mod) const
3455 {
3456   if (!ptr)
3457     exception::throw_invalid("NULL input", __FILE__, __LINE__);
3458   return this->mod(isl::val(ctx(), mod));
3459 }
3460 
mul(isl::aff aff2)3461 isl::aff aff::mul(isl::aff aff2) const
3462 {
3463   if (!ptr || aff2.is_null())
3464     exception::throw_invalid("NULL input", __FILE__, __LINE__);
3465   auto saved_ctx = ctx();
3466   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
3467   auto res = isl_aff_mul(copy(), aff2.release());
3468   if (!res)
3469     exception::throw_last_error(saved_ctx);
3470   return manage(res);
3471 }
3472 
ne_set(isl::aff aff2)3473 isl::set aff::ne_set(isl::aff aff2) const
3474 {
3475   if (!ptr || aff2.is_null())
3476     exception::throw_invalid("NULL input", __FILE__, __LINE__);
3477   auto saved_ctx = ctx();
3478   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
3479   auto res = isl_aff_ne_set(copy(), aff2.release());
3480   if (!res)
3481     exception::throw_last_error(saved_ctx);
3482   return manage(res);
3483 }
3484 
neg()3485 isl::aff aff::neg() const
3486 {
3487   if (!ptr)
3488     exception::throw_invalid("NULL input", __FILE__, __LINE__);
3489   auto saved_ctx = ctx();
3490   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
3491   auto res = isl_aff_neg(copy());
3492   if (!res)
3493     exception::throw_last_error(saved_ctx);
3494   return manage(res);
3495 }
3496 
pullback(isl::multi_aff ma)3497 isl::aff aff::pullback(isl::multi_aff ma) const
3498 {
3499   if (!ptr || ma.is_null())
3500     exception::throw_invalid("NULL input", __FILE__, __LINE__);
3501   auto saved_ctx = ctx();
3502   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
3503   auto res = isl_aff_pullback_multi_aff(copy(), ma.release());
3504   if (!res)
3505     exception::throw_last_error(saved_ctx);
3506   return manage(res);
3507 }
3508 
scale(isl::val v)3509 isl::aff aff::scale(isl::val v) const
3510 {
3511   if (!ptr || v.is_null())
3512     exception::throw_invalid("NULL input", __FILE__, __LINE__);
3513   auto saved_ctx = ctx();
3514   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
3515   auto res = isl_aff_scale_val(copy(), v.release());
3516   if (!res)
3517     exception::throw_last_error(saved_ctx);
3518   return manage(res);
3519 }
3520 
scale(long v)3521 isl::aff aff::scale(long v) const
3522 {
3523   if (!ptr)
3524     exception::throw_invalid("NULL input", __FILE__, __LINE__);
3525   return this->scale(isl::val(ctx(), v));
3526 }
3527 
scale_down(isl::val v)3528 isl::aff aff::scale_down(isl::val v) const
3529 {
3530   if (!ptr || v.is_null())
3531     exception::throw_invalid("NULL input", __FILE__, __LINE__);
3532   auto saved_ctx = ctx();
3533   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
3534   auto res = isl_aff_scale_down_val(copy(), v.release());
3535   if (!res)
3536     exception::throw_last_error(saved_ctx);
3537   return manage(res);
3538 }
3539 
scale_down(long v)3540 isl::aff aff::scale_down(long v) const
3541 {
3542   if (!ptr)
3543     exception::throw_invalid("NULL input", __FILE__, __LINE__);
3544   return this->scale_down(isl::val(ctx(), v));
3545 }
3546 
sub(isl::aff aff2)3547 isl::aff aff::sub(isl::aff aff2) const
3548 {
3549   if (!ptr || aff2.is_null())
3550     exception::throw_invalid("NULL input", __FILE__, __LINE__);
3551   auto saved_ctx = ctx();
3552   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
3553   auto res = isl_aff_sub(copy(), aff2.release());
3554   if (!res)
3555     exception::throw_last_error(saved_ctx);
3556   return manage(res);
3557 }
3558 
unbind_params_insert_domain(isl::multi_id domain)3559 isl::aff aff::unbind_params_insert_domain(isl::multi_id domain) const
3560 {
3561   if (!ptr || domain.is_null())
3562     exception::throw_invalid("NULL input", __FILE__, __LINE__);
3563   auto saved_ctx = ctx();
3564   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
3565   auto res = isl_aff_unbind_params_insert_domain(copy(), domain.release());
3566   if (!res)
3567     exception::throw_last_error(saved_ctx);
3568   return manage(res);
3569 }
3570 
3571 inline std::ostream &operator<<(std::ostream &os, const aff &obj)
3572 {
3573   if (!obj.get())
3574     exception::throw_invalid("NULL input", __FILE__, __LINE__);
3575   auto saved_ctx = isl_aff_get_ctx(obj.get());
3576   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
3577   char *str = isl_aff_to_str(obj.get());
3578   if (!str)
3579     exception::throw_last_error(saved_ctx);
3580   os << str;
3581   free(str);
3582   return os;
3583 }
3584 
3585 // implementations for isl::aff_list
manage(__isl_take isl_aff_list * ptr)3586 aff_list manage(__isl_take isl_aff_list *ptr) {
3587   if (!ptr)
3588     exception::throw_invalid("NULL input", __FILE__, __LINE__);
3589   return aff_list(ptr);
3590 }
manage_copy(__isl_keep isl_aff_list * ptr)3591 aff_list manage_copy(__isl_keep isl_aff_list *ptr) {
3592   if (!ptr)
3593     exception::throw_invalid("NULL input", __FILE__, __LINE__);
3594   auto saved_ctx = isl_aff_list_get_ctx(ptr);
3595   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
3596   ptr = isl_aff_list_copy(ptr);
3597   if (!ptr)
3598     exception::throw_last_error(saved_ctx);
3599   return aff_list(ptr);
3600 }
3601 
aff_list()3602 aff_list::aff_list()
3603     : ptr(nullptr) {}
3604 
aff_list(const aff_list & obj)3605 aff_list::aff_list(const aff_list &obj)
3606     : ptr(nullptr)
3607 {
3608   if (!obj.ptr)
3609     exception::throw_invalid("NULL input", __FILE__, __LINE__);
3610   auto saved_ctx = isl_aff_list_get_ctx(obj.ptr);
3611   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
3612   ptr = obj.copy();
3613   if (!ptr)
3614     exception::throw_last_error(saved_ctx);
3615 }
3616 
aff_list(__isl_take isl_aff_list * ptr)3617 aff_list::aff_list(__isl_take isl_aff_list *ptr)
3618     : ptr(ptr) {}
3619 
aff_list(isl::ctx ctx,int n)3620 aff_list::aff_list(isl::ctx ctx, int n)
3621 {
3622   auto saved_ctx = ctx;
3623   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
3624   auto res = isl_aff_list_alloc(ctx.release(), n);
3625   if (!res)
3626     exception::throw_last_error(saved_ctx);
3627   ptr = res;
3628 }
3629 
aff_list(isl::aff el)3630 aff_list::aff_list(isl::aff el)
3631 {
3632   if (el.is_null())
3633     exception::throw_invalid("NULL input", __FILE__, __LINE__);
3634   auto saved_ctx = el.ctx();
3635   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
3636   auto res = isl_aff_list_from_aff(el.release());
3637   if (!res)
3638     exception::throw_last_error(saved_ctx);
3639   ptr = res;
3640 }
3641 
3642 aff_list &aff_list::operator=(aff_list obj) {
3643   std::swap(this->ptr, obj.ptr);
3644   return *this;
3645 }
3646 
~aff_list()3647 aff_list::~aff_list() {
3648   if (ptr)
3649     isl_aff_list_free(ptr);
3650 }
3651 
copy()3652 __isl_give isl_aff_list *aff_list::copy() const & {
3653   return isl_aff_list_copy(ptr);
3654 }
3655 
get()3656 __isl_keep isl_aff_list *aff_list::get() const {
3657   return ptr;
3658 }
3659 
release()3660 __isl_give isl_aff_list *aff_list::release() {
3661   isl_aff_list *tmp = ptr;
3662   ptr = nullptr;
3663   return tmp;
3664 }
3665 
is_null()3666 bool aff_list::is_null() const {
3667   return ptr == nullptr;
3668 }
3669 
ctx()3670 isl::ctx aff_list::ctx() const {
3671   return isl::ctx(isl_aff_list_get_ctx(ptr));
3672 }
3673 
add(isl::aff el)3674 isl::aff_list aff_list::add(isl::aff el) const
3675 {
3676   if (!ptr || el.is_null())
3677     exception::throw_invalid("NULL input", __FILE__, __LINE__);
3678   auto saved_ctx = ctx();
3679   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
3680   auto res = isl_aff_list_add(copy(), el.release());
3681   if (!res)
3682     exception::throw_last_error(saved_ctx);
3683   return manage(res);
3684 }
3685 
clear()3686 isl::aff_list aff_list::clear() const
3687 {
3688   if (!ptr)
3689     exception::throw_invalid("NULL input", __FILE__, __LINE__);
3690   auto saved_ctx = ctx();
3691   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
3692   auto res = isl_aff_list_clear(copy());
3693   if (!res)
3694     exception::throw_last_error(saved_ctx);
3695   return manage(res);
3696 }
3697 
concat(isl::aff_list list2)3698 isl::aff_list aff_list::concat(isl::aff_list list2) const
3699 {
3700   if (!ptr || list2.is_null())
3701     exception::throw_invalid("NULL input", __FILE__, __LINE__);
3702   auto saved_ctx = ctx();
3703   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
3704   auto res = isl_aff_list_concat(copy(), list2.release());
3705   if (!res)
3706     exception::throw_last_error(saved_ctx);
3707   return manage(res);
3708 }
3709 
foreach(const std::function<void (isl::aff)> & fn)3710 void aff_list::foreach(const std::function<void(isl::aff)> &fn) const
3711 {
3712   if (!ptr)
3713     exception::throw_invalid("NULL input", __FILE__, __LINE__);
3714   auto saved_ctx = ctx();
3715   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
3716   struct fn_data {
3717     std::function<void(isl::aff)> func;
3718     std::exception_ptr eptr;
3719   } fn_data = { fn };
3720   auto fn_lambda = [](isl_aff *arg_0, void *arg_1) -> isl_stat {
3721     auto *data = static_cast<struct fn_data *>(arg_1);
3722     ISL_CPP_TRY {
3723       (data->func)(manage(arg_0));
3724       return isl_stat_ok;
3725     } ISL_CPP_CATCH_ALL {
3726       data->eptr = std::current_exception();
3727       return isl_stat_error;
3728     }
3729   };
3730   auto res = isl_aff_list_foreach(get(), fn_lambda, &fn_data);
3731   if (fn_data.eptr)
3732     std::rethrow_exception(fn_data.eptr);
3733   if (res < 0)
3734     exception::throw_last_error(saved_ctx);
3735   return;
3736 }
3737 
at(int index)3738 isl::aff aff_list::at(int index) const
3739 {
3740   if (!ptr)
3741     exception::throw_invalid("NULL input", __FILE__, __LINE__);
3742   auto saved_ctx = ctx();
3743   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
3744   auto res = isl_aff_list_get_at(get(), index);
3745   if (!res)
3746     exception::throw_last_error(saved_ctx);
3747   return manage(res);
3748 }
3749 
get_at(int index)3750 isl::aff aff_list::get_at(int index) const
3751 {
3752   return at(index);
3753 }
3754 
size()3755 unsigned aff_list::size() const
3756 {
3757   if (!ptr)
3758     exception::throw_invalid("NULL input", __FILE__, __LINE__);
3759   auto saved_ctx = ctx();
3760   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
3761   auto res = isl_aff_list_size(get());
3762   if (res < 0)
3763     exception::throw_last_error(saved_ctx);
3764   return res;
3765 }
3766 
3767 inline std::ostream &operator<<(std::ostream &os, const aff_list &obj)
3768 {
3769   if (!obj.get())
3770     exception::throw_invalid("NULL input", __FILE__, __LINE__);
3771   auto saved_ctx = isl_aff_list_get_ctx(obj.get());
3772   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
3773   char *str = isl_aff_list_to_str(obj.get());
3774   if (!str)
3775     exception::throw_last_error(saved_ctx);
3776   os << str;
3777   free(str);
3778   return os;
3779 }
3780 
3781 // implementations for isl::ast_build
manage(__isl_take isl_ast_build * ptr)3782 ast_build manage(__isl_take isl_ast_build *ptr) {
3783   if (!ptr)
3784     exception::throw_invalid("NULL input", __FILE__, __LINE__);
3785   return ast_build(ptr);
3786 }
manage_copy(__isl_keep isl_ast_build * ptr)3787 ast_build manage_copy(__isl_keep isl_ast_build *ptr) {
3788   if (!ptr)
3789     exception::throw_invalid("NULL input", __FILE__, __LINE__);
3790   auto saved_ctx = isl_ast_build_get_ctx(ptr);
3791   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
3792   ptr = isl_ast_build_copy(ptr);
3793   if (!ptr)
3794     exception::throw_last_error(saved_ctx);
3795   return ast_build(ptr);
3796 }
3797 
ast_build()3798 ast_build::ast_build()
3799     : ptr(nullptr) {}
3800 
ast_build(const ast_build & obj)3801 ast_build::ast_build(const ast_build &obj)
3802     : ptr(nullptr)
3803 {
3804   if (!obj.ptr)
3805     exception::throw_invalid("NULL input", __FILE__, __LINE__);
3806   auto saved_ctx = isl_ast_build_get_ctx(obj.ptr);
3807   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
3808   ptr = obj.copy();
3809   copy_callbacks(obj);
3810   if (!ptr)
3811     exception::throw_last_error(saved_ctx);
3812 }
3813 
ast_build(__isl_take isl_ast_build * ptr)3814 ast_build::ast_build(__isl_take isl_ast_build *ptr)
3815     : ptr(ptr) {}
3816 
ast_build(isl::ctx ctx)3817 ast_build::ast_build(isl::ctx ctx)
3818 {
3819   auto saved_ctx = ctx;
3820   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
3821   auto res = isl_ast_build_alloc(ctx.release());
3822   if (!res)
3823     exception::throw_last_error(saved_ctx);
3824   ptr = res;
3825 }
3826 
3827 ast_build &ast_build::operator=(ast_build obj) {
3828   std::swap(this->ptr, obj.ptr);
3829   copy_callbacks(obj);
3830   return *this;
3831 }
3832 
~ast_build()3833 ast_build::~ast_build() {
3834   if (ptr)
3835     isl_ast_build_free(ptr);
3836 }
3837 
copy()3838 __isl_give isl_ast_build *ast_build::copy() const & {
3839   return isl_ast_build_copy(ptr);
3840 }
3841 
get()3842 __isl_keep isl_ast_build *ast_build::get() const {
3843   return ptr;
3844 }
3845 
release()3846 __isl_give isl_ast_build *ast_build::release() {
3847   if (at_each_domain_data)
3848     exception::throw_invalid("cannot release object with persistent callbacks", __FILE__, __LINE__);
3849   isl_ast_build *tmp = ptr;
3850   ptr = nullptr;
3851   return tmp;
3852 }
3853 
is_null()3854 bool ast_build::is_null() const {
3855   return ptr == nullptr;
3856 }
3857 
ctx()3858 isl::ctx ast_build::ctx() const {
3859   return isl::ctx(isl_ast_build_get_ctx(ptr));
3860 }
3861 
copy_callbacks(const ast_build & obj)3862 ast_build &ast_build::copy_callbacks(const ast_build &obj)
3863 {
3864   at_each_domain_data = obj.at_each_domain_data;
3865   return *this;
3866 }
3867 
at_each_domain(isl_ast_node * arg_0,isl_ast_build * arg_1,void * arg_2)3868 isl_ast_node *ast_build::at_each_domain(isl_ast_node *arg_0, isl_ast_build *arg_1, void *arg_2)
3869 {
3870   auto *data = static_cast<struct at_each_domain_data *>(arg_2);
3871   ISL_CPP_TRY {
3872     auto ret = (data->func)(manage(arg_0), manage_copy(arg_1));
3873     return ret.release();
3874   } ISL_CPP_CATCH_ALL {
3875     data->eptr = std::current_exception();
3876     return NULL;
3877   }
3878 }
3879 
set_at_each_domain_data(const std::function<isl::ast_node (isl::ast_node,isl::ast_build)> & fn)3880 void ast_build::set_at_each_domain_data(const std::function<isl::ast_node(isl::ast_node, isl::ast_build)> &fn)
3881 {
3882   if (!ptr)
3883     exception::throw_invalid("NULL input", __FILE__, __LINE__);
3884   auto saved_ctx = isl_ast_build_get_ctx(ptr);
3885   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
3886   at_each_domain_data = std::make_shared<struct at_each_domain_data>();
3887   at_each_domain_data->func = fn;
3888   ptr = isl_ast_build_set_at_each_domain(ptr, &at_each_domain, at_each_domain_data.get());
3889   if (!ptr)
3890     exception::throw_last_error(saved_ctx);
3891 }
3892 
set_at_each_domain(const std::function<isl::ast_node (isl::ast_node,isl::ast_build)> & fn)3893 isl::ast_build ast_build::set_at_each_domain(const std::function<isl::ast_node(isl::ast_node, isl::ast_build)> &fn) const
3894 {
3895   auto copy = *this;
3896   copy.set_at_each_domain_data(fn);
3897   return copy;
3898 }
3899 
access_from(isl::multi_pw_aff mpa)3900 isl::ast_expr ast_build::access_from(isl::multi_pw_aff mpa) const
3901 {
3902   if (!ptr || mpa.is_null())
3903     exception::throw_invalid("NULL input", __FILE__, __LINE__);
3904   auto saved_ctx = ctx();
3905   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
3906   auto res = isl_ast_build_access_from_multi_pw_aff(get(), mpa.release());
3907   if (at_each_domain_data && at_each_domain_data->eptr) {
3908     std::exception_ptr eptr = at_each_domain_data->eptr;
3909     at_each_domain_data->eptr = nullptr;
3910     std::rethrow_exception(eptr);
3911   }
3912   if (!res)
3913     exception::throw_last_error(saved_ctx);
3914   return manage(res);
3915 }
3916 
access_from(isl::pw_multi_aff pma)3917 isl::ast_expr ast_build::access_from(isl::pw_multi_aff pma) const
3918 {
3919   if (!ptr || pma.is_null())
3920     exception::throw_invalid("NULL input", __FILE__, __LINE__);
3921   auto saved_ctx = ctx();
3922   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
3923   auto res = isl_ast_build_access_from_pw_multi_aff(get(), pma.release());
3924   if (at_each_domain_data && at_each_domain_data->eptr) {
3925     std::exception_ptr eptr = at_each_domain_data->eptr;
3926     at_each_domain_data->eptr = nullptr;
3927     std::rethrow_exception(eptr);
3928   }
3929   if (!res)
3930     exception::throw_last_error(saved_ctx);
3931   return manage(res);
3932 }
3933 
call_from(isl::multi_pw_aff mpa)3934 isl::ast_expr ast_build::call_from(isl::multi_pw_aff mpa) const
3935 {
3936   if (!ptr || mpa.is_null())
3937     exception::throw_invalid("NULL input", __FILE__, __LINE__);
3938   auto saved_ctx = ctx();
3939   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
3940   auto res = isl_ast_build_call_from_multi_pw_aff(get(), mpa.release());
3941   if (at_each_domain_data && at_each_domain_data->eptr) {
3942     std::exception_ptr eptr = at_each_domain_data->eptr;
3943     at_each_domain_data->eptr = nullptr;
3944     std::rethrow_exception(eptr);
3945   }
3946   if (!res)
3947     exception::throw_last_error(saved_ctx);
3948   return manage(res);
3949 }
3950 
call_from(isl::pw_multi_aff pma)3951 isl::ast_expr ast_build::call_from(isl::pw_multi_aff pma) const
3952 {
3953   if (!ptr || pma.is_null())
3954     exception::throw_invalid("NULL input", __FILE__, __LINE__);
3955   auto saved_ctx = ctx();
3956   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
3957   auto res = isl_ast_build_call_from_pw_multi_aff(get(), pma.release());
3958   if (at_each_domain_data && at_each_domain_data->eptr) {
3959     std::exception_ptr eptr = at_each_domain_data->eptr;
3960     at_each_domain_data->eptr = nullptr;
3961     std::rethrow_exception(eptr);
3962   }
3963   if (!res)
3964     exception::throw_last_error(saved_ctx);
3965   return manage(res);
3966 }
3967 
expr_from(isl::pw_aff pa)3968 isl::ast_expr ast_build::expr_from(isl::pw_aff pa) const
3969 {
3970   if (!ptr || pa.is_null())
3971     exception::throw_invalid("NULL input", __FILE__, __LINE__);
3972   auto saved_ctx = ctx();
3973   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
3974   auto res = isl_ast_build_expr_from_pw_aff(get(), pa.release());
3975   if (at_each_domain_data && at_each_domain_data->eptr) {
3976     std::exception_ptr eptr = at_each_domain_data->eptr;
3977     at_each_domain_data->eptr = nullptr;
3978     std::rethrow_exception(eptr);
3979   }
3980   if (!res)
3981     exception::throw_last_error(saved_ctx);
3982   return manage(res);
3983 }
3984 
expr_from(isl::set set)3985 isl::ast_expr ast_build::expr_from(isl::set set) const
3986 {
3987   if (!ptr || set.is_null())
3988     exception::throw_invalid("NULL input", __FILE__, __LINE__);
3989   auto saved_ctx = ctx();
3990   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
3991   auto res = isl_ast_build_expr_from_set(get(), set.release());
3992   if (at_each_domain_data && at_each_domain_data->eptr) {
3993     std::exception_ptr eptr = at_each_domain_data->eptr;
3994     at_each_domain_data->eptr = nullptr;
3995     std::rethrow_exception(eptr);
3996   }
3997   if (!res)
3998     exception::throw_last_error(saved_ctx);
3999   return manage(res);
4000 }
4001 
from_context(isl::set set)4002 isl::ast_build ast_build::from_context(isl::set set)
4003 {
4004   if (set.is_null())
4005     exception::throw_invalid("NULL input", __FILE__, __LINE__);
4006   auto saved_ctx = set.ctx();
4007   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
4008   auto res = isl_ast_build_from_context(set.release());
4009   if (!res)
4010     exception::throw_last_error(saved_ctx);
4011   return manage(res);
4012 }
4013 
schedule()4014 isl::union_map ast_build::schedule() const
4015 {
4016   if (!ptr)
4017     exception::throw_invalid("NULL input", __FILE__, __LINE__);
4018   auto saved_ctx = ctx();
4019   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
4020   auto res = isl_ast_build_get_schedule(get());
4021   if (at_each_domain_data && at_each_domain_data->eptr) {
4022     std::exception_ptr eptr = at_each_domain_data->eptr;
4023     at_each_domain_data->eptr = nullptr;
4024     std::rethrow_exception(eptr);
4025   }
4026   if (!res)
4027     exception::throw_last_error(saved_ctx);
4028   return manage(res);
4029 }
4030 
get_schedule()4031 isl::union_map ast_build::get_schedule() const
4032 {
4033   return schedule();
4034 }
4035 
node_from(isl::schedule schedule)4036 isl::ast_node ast_build::node_from(isl::schedule schedule) const
4037 {
4038   if (!ptr || schedule.is_null())
4039     exception::throw_invalid("NULL input", __FILE__, __LINE__);
4040   auto saved_ctx = ctx();
4041   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
4042   auto res = isl_ast_build_node_from_schedule(get(), schedule.release());
4043   if (at_each_domain_data && at_each_domain_data->eptr) {
4044     std::exception_ptr eptr = at_each_domain_data->eptr;
4045     at_each_domain_data->eptr = nullptr;
4046     std::rethrow_exception(eptr);
4047   }
4048   if (!res)
4049     exception::throw_last_error(saved_ctx);
4050   return manage(res);
4051 }
4052 
node_from_schedule_map(isl::union_map schedule)4053 isl::ast_node ast_build::node_from_schedule_map(isl::union_map schedule) const
4054 {
4055   if (!ptr || schedule.is_null())
4056     exception::throw_invalid("NULL input", __FILE__, __LINE__);
4057   auto saved_ctx = ctx();
4058   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
4059   auto res = isl_ast_build_node_from_schedule_map(get(), schedule.release());
4060   if (at_each_domain_data && at_each_domain_data->eptr) {
4061     std::exception_ptr eptr = at_each_domain_data->eptr;
4062     at_each_domain_data->eptr = nullptr;
4063     std::rethrow_exception(eptr);
4064   }
4065   if (!res)
4066     exception::throw_last_error(saved_ctx);
4067   return manage(res);
4068 }
4069 
4070 // implementations for isl::ast_expr
manage(__isl_take isl_ast_expr * ptr)4071 ast_expr manage(__isl_take isl_ast_expr *ptr) {
4072   if (!ptr)
4073     exception::throw_invalid("NULL input", __FILE__, __LINE__);
4074   return ast_expr(ptr);
4075 }
manage_copy(__isl_keep isl_ast_expr * ptr)4076 ast_expr manage_copy(__isl_keep isl_ast_expr *ptr) {
4077   if (!ptr)
4078     exception::throw_invalid("NULL input", __FILE__, __LINE__);
4079   auto saved_ctx = isl_ast_expr_get_ctx(ptr);
4080   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
4081   ptr = isl_ast_expr_copy(ptr);
4082   if (!ptr)
4083     exception::throw_last_error(saved_ctx);
4084   return ast_expr(ptr);
4085 }
4086 
ast_expr()4087 ast_expr::ast_expr()
4088     : ptr(nullptr) {}
4089 
ast_expr(const ast_expr & obj)4090 ast_expr::ast_expr(const ast_expr &obj)
4091     : ptr(nullptr)
4092 {
4093   if (!obj.ptr)
4094     exception::throw_invalid("NULL input", __FILE__, __LINE__);
4095   auto saved_ctx = isl_ast_expr_get_ctx(obj.ptr);
4096   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
4097   ptr = obj.copy();
4098   if (!ptr)
4099     exception::throw_last_error(saved_ctx);
4100 }
4101 
ast_expr(__isl_take isl_ast_expr * ptr)4102 ast_expr::ast_expr(__isl_take isl_ast_expr *ptr)
4103     : ptr(ptr) {}
4104 
4105 ast_expr &ast_expr::operator=(ast_expr obj) {
4106   std::swap(this->ptr, obj.ptr);
4107   return *this;
4108 }
4109 
~ast_expr()4110 ast_expr::~ast_expr() {
4111   if (ptr)
4112     isl_ast_expr_free(ptr);
4113 }
4114 
copy()4115 __isl_give isl_ast_expr *ast_expr::copy() const & {
4116   return isl_ast_expr_copy(ptr);
4117 }
4118 
get()4119 __isl_keep isl_ast_expr *ast_expr::get() const {
4120   return ptr;
4121 }
4122 
release()4123 __isl_give isl_ast_expr *ast_expr::release() {
4124   isl_ast_expr *tmp = ptr;
4125   ptr = nullptr;
4126   return tmp;
4127 }
4128 
is_null()4129 bool ast_expr::is_null() const {
4130   return ptr == nullptr;
4131 }
4132 
4133 template <typename T, typename>
isa_type(T subtype)4134 bool ast_expr::isa_type(T subtype) const
4135 {
4136   if (is_null())
4137     exception::throw_invalid("NULL input", __FILE__, __LINE__);
4138   return isl_ast_expr_get_type(get()) == subtype;
4139 }
4140 template <class T>
isa()4141 bool ast_expr::isa() const
4142 {
4143   return isa_type<decltype(T::type)>(T::type);
4144 }
4145 template <class T>
as()4146 T ast_expr::as() const
4147 {
4148  if (!isa<T>())
4149     exception::throw_invalid("not an object of the requested subtype", __FILE__, __LINE__);
4150   return T(copy());
4151 }
4152 
ctx()4153 isl::ctx ast_expr::ctx() const {
4154   return isl::ctx(isl_ast_expr_get_ctx(ptr));
4155 }
4156 
to_C_str()4157 std::string ast_expr::to_C_str() const
4158 {
4159   if (!ptr)
4160     exception::throw_invalid("NULL input", __FILE__, __LINE__);
4161   auto saved_ctx = ctx();
4162   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
4163   auto res = isl_ast_expr_to_C_str(get());
4164   std::string tmp(res);
4165   free(res);
4166   return tmp;
4167 }
4168 
4169 inline std::ostream &operator<<(std::ostream &os, const ast_expr &obj)
4170 {
4171   if (!obj.get())
4172     exception::throw_invalid("NULL input", __FILE__, __LINE__);
4173   auto saved_ctx = isl_ast_expr_get_ctx(obj.get());
4174   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
4175   char *str = isl_ast_expr_to_str(obj.get());
4176   if (!str)
4177     exception::throw_last_error(saved_ctx);
4178   os << str;
4179   free(str);
4180   return os;
4181 }
4182 
4183 // implementations for isl::ast_expr_id
ast_expr_id()4184 ast_expr_id::ast_expr_id()
4185     : ast_expr() {}
4186 
ast_expr_id(const ast_expr_id & obj)4187 ast_expr_id::ast_expr_id(const ast_expr_id &obj)
4188     : ast_expr(obj)
4189 {
4190 }
4191 
ast_expr_id(__isl_take isl_ast_expr * ptr)4192 ast_expr_id::ast_expr_id(__isl_take isl_ast_expr *ptr)
4193     : ast_expr(ptr) {}
4194 
4195 ast_expr_id &ast_expr_id::operator=(ast_expr_id obj) {
4196   std::swap(this->ptr, obj.ptr);
4197   return *this;
4198 }
4199 
ctx()4200 isl::ctx ast_expr_id::ctx() const {
4201   return isl::ctx(isl_ast_expr_get_ctx(ptr));
4202 }
4203 
id()4204 isl::id ast_expr_id::id() const
4205 {
4206   if (!ptr)
4207     exception::throw_invalid("NULL input", __FILE__, __LINE__);
4208   auto saved_ctx = ctx();
4209   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
4210   auto res = isl_ast_expr_id_get_id(get());
4211   if (!res)
4212     exception::throw_last_error(saved_ctx);
4213   return manage(res);
4214 }
4215 
get_id()4216 isl::id ast_expr_id::get_id() const
4217 {
4218   return id();
4219 }
4220 
4221 inline std::ostream &operator<<(std::ostream &os, const ast_expr_id &obj)
4222 {
4223   if (!obj.get())
4224     exception::throw_invalid("NULL input", __FILE__, __LINE__);
4225   auto saved_ctx = isl_ast_expr_get_ctx(obj.get());
4226   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
4227   char *str = isl_ast_expr_to_str(obj.get());
4228   if (!str)
4229     exception::throw_last_error(saved_ctx);
4230   os << str;
4231   free(str);
4232   return os;
4233 }
4234 
4235 // implementations for isl::ast_expr_int
ast_expr_int()4236 ast_expr_int::ast_expr_int()
4237     : ast_expr() {}
4238 
ast_expr_int(const ast_expr_int & obj)4239 ast_expr_int::ast_expr_int(const ast_expr_int &obj)
4240     : ast_expr(obj)
4241 {
4242 }
4243 
ast_expr_int(__isl_take isl_ast_expr * ptr)4244 ast_expr_int::ast_expr_int(__isl_take isl_ast_expr *ptr)
4245     : ast_expr(ptr) {}
4246 
4247 ast_expr_int &ast_expr_int::operator=(ast_expr_int obj) {
4248   std::swap(this->ptr, obj.ptr);
4249   return *this;
4250 }
4251 
ctx()4252 isl::ctx ast_expr_int::ctx() const {
4253   return isl::ctx(isl_ast_expr_get_ctx(ptr));
4254 }
4255 
val()4256 isl::val ast_expr_int::val() const
4257 {
4258   if (!ptr)
4259     exception::throw_invalid("NULL input", __FILE__, __LINE__);
4260   auto saved_ctx = ctx();
4261   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
4262   auto res = isl_ast_expr_int_get_val(get());
4263   if (!res)
4264     exception::throw_last_error(saved_ctx);
4265   return manage(res);
4266 }
4267 
get_val()4268 isl::val ast_expr_int::get_val() const
4269 {
4270   return val();
4271 }
4272 
4273 inline std::ostream &operator<<(std::ostream &os, const ast_expr_int &obj)
4274 {
4275   if (!obj.get())
4276     exception::throw_invalid("NULL input", __FILE__, __LINE__);
4277   auto saved_ctx = isl_ast_expr_get_ctx(obj.get());
4278   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
4279   char *str = isl_ast_expr_to_str(obj.get());
4280   if (!str)
4281     exception::throw_last_error(saved_ctx);
4282   os << str;
4283   free(str);
4284   return os;
4285 }
4286 
4287 // implementations for isl::ast_expr_op
ast_expr_op()4288 ast_expr_op::ast_expr_op()
4289     : ast_expr() {}
4290 
ast_expr_op(const ast_expr_op & obj)4291 ast_expr_op::ast_expr_op(const ast_expr_op &obj)
4292     : ast_expr(obj)
4293 {
4294 }
4295 
ast_expr_op(__isl_take isl_ast_expr * ptr)4296 ast_expr_op::ast_expr_op(__isl_take isl_ast_expr *ptr)
4297     : ast_expr(ptr) {}
4298 
4299 ast_expr_op &ast_expr_op::operator=(ast_expr_op obj) {
4300   std::swap(this->ptr, obj.ptr);
4301   return *this;
4302 }
4303 
4304 template <typename T, typename>
isa_type(T subtype)4305 bool ast_expr_op::isa_type(T subtype) const
4306 {
4307   if (is_null())
4308     exception::throw_invalid("NULL input", __FILE__, __LINE__);
4309   return isl_ast_expr_op_get_type(get()) == subtype;
4310 }
4311 template <class T>
isa()4312 bool ast_expr_op::isa() const
4313 {
4314   return isa_type<decltype(T::type)>(T::type);
4315 }
4316 template <class T>
as()4317 T ast_expr_op::as() const
4318 {
4319  if (!isa<T>())
4320     exception::throw_invalid("not an object of the requested subtype", __FILE__, __LINE__);
4321   return T(copy());
4322 }
4323 
ctx()4324 isl::ctx ast_expr_op::ctx() const {
4325   return isl::ctx(isl_ast_expr_get_ctx(ptr));
4326 }
4327 
arg(int pos)4328 isl::ast_expr ast_expr_op::arg(int pos) const
4329 {
4330   if (!ptr)
4331     exception::throw_invalid("NULL input", __FILE__, __LINE__);
4332   auto saved_ctx = ctx();
4333   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
4334   auto res = isl_ast_expr_op_get_arg(get(), pos);
4335   if (!res)
4336     exception::throw_last_error(saved_ctx);
4337   return manage(res);
4338 }
4339 
get_arg(int pos)4340 isl::ast_expr ast_expr_op::get_arg(int pos) const
4341 {
4342   return arg(pos);
4343 }
4344 
n_arg()4345 unsigned ast_expr_op::n_arg() const
4346 {
4347   if (!ptr)
4348     exception::throw_invalid("NULL input", __FILE__, __LINE__);
4349   auto saved_ctx = ctx();
4350   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
4351   auto res = isl_ast_expr_op_get_n_arg(get());
4352   if (res < 0)
4353     exception::throw_last_error(saved_ctx);
4354   return res;
4355 }
4356 
get_n_arg()4357 unsigned ast_expr_op::get_n_arg() const
4358 {
4359   return n_arg();
4360 }
4361 
4362 inline std::ostream &operator<<(std::ostream &os, const ast_expr_op &obj)
4363 {
4364   if (!obj.get())
4365     exception::throw_invalid("NULL input", __FILE__, __LINE__);
4366   auto saved_ctx = isl_ast_expr_get_ctx(obj.get());
4367   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
4368   char *str = isl_ast_expr_to_str(obj.get());
4369   if (!str)
4370     exception::throw_last_error(saved_ctx);
4371   os << str;
4372   free(str);
4373   return os;
4374 }
4375 
4376 // implementations for isl::ast_expr_op_access
ast_expr_op_access()4377 ast_expr_op_access::ast_expr_op_access()
4378     : ast_expr_op() {}
4379 
ast_expr_op_access(const ast_expr_op_access & obj)4380 ast_expr_op_access::ast_expr_op_access(const ast_expr_op_access &obj)
4381     : ast_expr_op(obj)
4382 {
4383 }
4384 
ast_expr_op_access(__isl_take isl_ast_expr * ptr)4385 ast_expr_op_access::ast_expr_op_access(__isl_take isl_ast_expr *ptr)
4386     : ast_expr_op(ptr) {}
4387 
4388 ast_expr_op_access &ast_expr_op_access::operator=(ast_expr_op_access obj) {
4389   std::swap(this->ptr, obj.ptr);
4390   return *this;
4391 }
4392 
ctx()4393 isl::ctx ast_expr_op_access::ctx() const {
4394   return isl::ctx(isl_ast_expr_get_ctx(ptr));
4395 }
4396 
4397 inline std::ostream &operator<<(std::ostream &os, const ast_expr_op_access &obj)
4398 {
4399   if (!obj.get())
4400     exception::throw_invalid("NULL input", __FILE__, __LINE__);
4401   auto saved_ctx = isl_ast_expr_get_ctx(obj.get());
4402   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
4403   char *str = isl_ast_expr_to_str(obj.get());
4404   if (!str)
4405     exception::throw_last_error(saved_ctx);
4406   os << str;
4407   free(str);
4408   return os;
4409 }
4410 
4411 // implementations for isl::ast_expr_op_add
ast_expr_op_add()4412 ast_expr_op_add::ast_expr_op_add()
4413     : ast_expr_op() {}
4414 
ast_expr_op_add(const ast_expr_op_add & obj)4415 ast_expr_op_add::ast_expr_op_add(const ast_expr_op_add &obj)
4416     : ast_expr_op(obj)
4417 {
4418 }
4419 
ast_expr_op_add(__isl_take isl_ast_expr * ptr)4420 ast_expr_op_add::ast_expr_op_add(__isl_take isl_ast_expr *ptr)
4421     : ast_expr_op(ptr) {}
4422 
4423 ast_expr_op_add &ast_expr_op_add::operator=(ast_expr_op_add obj) {
4424   std::swap(this->ptr, obj.ptr);
4425   return *this;
4426 }
4427 
ctx()4428 isl::ctx ast_expr_op_add::ctx() const {
4429   return isl::ctx(isl_ast_expr_get_ctx(ptr));
4430 }
4431 
4432 inline std::ostream &operator<<(std::ostream &os, const ast_expr_op_add &obj)
4433 {
4434   if (!obj.get())
4435     exception::throw_invalid("NULL input", __FILE__, __LINE__);
4436   auto saved_ctx = isl_ast_expr_get_ctx(obj.get());
4437   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
4438   char *str = isl_ast_expr_to_str(obj.get());
4439   if (!str)
4440     exception::throw_last_error(saved_ctx);
4441   os << str;
4442   free(str);
4443   return os;
4444 }
4445 
4446 // implementations for isl::ast_expr_op_address_of
ast_expr_op_address_of()4447 ast_expr_op_address_of::ast_expr_op_address_of()
4448     : ast_expr_op() {}
4449 
ast_expr_op_address_of(const ast_expr_op_address_of & obj)4450 ast_expr_op_address_of::ast_expr_op_address_of(const ast_expr_op_address_of &obj)
4451     : ast_expr_op(obj)
4452 {
4453 }
4454 
ast_expr_op_address_of(__isl_take isl_ast_expr * ptr)4455 ast_expr_op_address_of::ast_expr_op_address_of(__isl_take isl_ast_expr *ptr)
4456     : ast_expr_op(ptr) {}
4457 
4458 ast_expr_op_address_of &ast_expr_op_address_of::operator=(ast_expr_op_address_of obj) {
4459   std::swap(this->ptr, obj.ptr);
4460   return *this;
4461 }
4462 
ctx()4463 isl::ctx ast_expr_op_address_of::ctx() const {
4464   return isl::ctx(isl_ast_expr_get_ctx(ptr));
4465 }
4466 
4467 inline std::ostream &operator<<(std::ostream &os, const ast_expr_op_address_of &obj)
4468 {
4469   if (!obj.get())
4470     exception::throw_invalid("NULL input", __FILE__, __LINE__);
4471   auto saved_ctx = isl_ast_expr_get_ctx(obj.get());
4472   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
4473   char *str = isl_ast_expr_to_str(obj.get());
4474   if (!str)
4475     exception::throw_last_error(saved_ctx);
4476   os << str;
4477   free(str);
4478   return os;
4479 }
4480 
4481 // implementations for isl::ast_expr_op_and
ast_expr_op_and()4482 ast_expr_op_and::ast_expr_op_and()
4483     : ast_expr_op() {}
4484 
ast_expr_op_and(const ast_expr_op_and & obj)4485 ast_expr_op_and::ast_expr_op_and(const ast_expr_op_and &obj)
4486     : ast_expr_op(obj)
4487 {
4488 }
4489 
ast_expr_op_and(__isl_take isl_ast_expr * ptr)4490 ast_expr_op_and::ast_expr_op_and(__isl_take isl_ast_expr *ptr)
4491     : ast_expr_op(ptr) {}
4492 
4493 ast_expr_op_and &ast_expr_op_and::operator=(ast_expr_op_and obj) {
4494   std::swap(this->ptr, obj.ptr);
4495   return *this;
4496 }
4497 
ctx()4498 isl::ctx ast_expr_op_and::ctx() const {
4499   return isl::ctx(isl_ast_expr_get_ctx(ptr));
4500 }
4501 
4502 inline std::ostream &operator<<(std::ostream &os, const ast_expr_op_and &obj)
4503 {
4504   if (!obj.get())
4505     exception::throw_invalid("NULL input", __FILE__, __LINE__);
4506   auto saved_ctx = isl_ast_expr_get_ctx(obj.get());
4507   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
4508   char *str = isl_ast_expr_to_str(obj.get());
4509   if (!str)
4510     exception::throw_last_error(saved_ctx);
4511   os << str;
4512   free(str);
4513   return os;
4514 }
4515 
4516 // implementations for isl::ast_expr_op_and_then
ast_expr_op_and_then()4517 ast_expr_op_and_then::ast_expr_op_and_then()
4518     : ast_expr_op() {}
4519 
ast_expr_op_and_then(const ast_expr_op_and_then & obj)4520 ast_expr_op_and_then::ast_expr_op_and_then(const ast_expr_op_and_then &obj)
4521     : ast_expr_op(obj)
4522 {
4523 }
4524 
ast_expr_op_and_then(__isl_take isl_ast_expr * ptr)4525 ast_expr_op_and_then::ast_expr_op_and_then(__isl_take isl_ast_expr *ptr)
4526     : ast_expr_op(ptr) {}
4527 
4528 ast_expr_op_and_then &ast_expr_op_and_then::operator=(ast_expr_op_and_then obj) {
4529   std::swap(this->ptr, obj.ptr);
4530   return *this;
4531 }
4532 
ctx()4533 isl::ctx ast_expr_op_and_then::ctx() const {
4534   return isl::ctx(isl_ast_expr_get_ctx(ptr));
4535 }
4536 
4537 inline std::ostream &operator<<(std::ostream &os, const ast_expr_op_and_then &obj)
4538 {
4539   if (!obj.get())
4540     exception::throw_invalid("NULL input", __FILE__, __LINE__);
4541   auto saved_ctx = isl_ast_expr_get_ctx(obj.get());
4542   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
4543   char *str = isl_ast_expr_to_str(obj.get());
4544   if (!str)
4545     exception::throw_last_error(saved_ctx);
4546   os << str;
4547   free(str);
4548   return os;
4549 }
4550 
4551 // implementations for isl::ast_expr_op_call
ast_expr_op_call()4552 ast_expr_op_call::ast_expr_op_call()
4553     : ast_expr_op() {}
4554 
ast_expr_op_call(const ast_expr_op_call & obj)4555 ast_expr_op_call::ast_expr_op_call(const ast_expr_op_call &obj)
4556     : ast_expr_op(obj)
4557 {
4558 }
4559 
ast_expr_op_call(__isl_take isl_ast_expr * ptr)4560 ast_expr_op_call::ast_expr_op_call(__isl_take isl_ast_expr *ptr)
4561     : ast_expr_op(ptr) {}
4562 
4563 ast_expr_op_call &ast_expr_op_call::operator=(ast_expr_op_call obj) {
4564   std::swap(this->ptr, obj.ptr);
4565   return *this;
4566 }
4567 
ctx()4568 isl::ctx ast_expr_op_call::ctx() const {
4569   return isl::ctx(isl_ast_expr_get_ctx(ptr));
4570 }
4571 
4572 inline std::ostream &operator<<(std::ostream &os, const ast_expr_op_call &obj)
4573 {
4574   if (!obj.get())
4575     exception::throw_invalid("NULL input", __FILE__, __LINE__);
4576   auto saved_ctx = isl_ast_expr_get_ctx(obj.get());
4577   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
4578   char *str = isl_ast_expr_to_str(obj.get());
4579   if (!str)
4580     exception::throw_last_error(saved_ctx);
4581   os << str;
4582   free(str);
4583   return os;
4584 }
4585 
4586 // implementations for isl::ast_expr_op_cond
ast_expr_op_cond()4587 ast_expr_op_cond::ast_expr_op_cond()
4588     : ast_expr_op() {}
4589 
ast_expr_op_cond(const ast_expr_op_cond & obj)4590 ast_expr_op_cond::ast_expr_op_cond(const ast_expr_op_cond &obj)
4591     : ast_expr_op(obj)
4592 {
4593 }
4594 
ast_expr_op_cond(__isl_take isl_ast_expr * ptr)4595 ast_expr_op_cond::ast_expr_op_cond(__isl_take isl_ast_expr *ptr)
4596     : ast_expr_op(ptr) {}
4597 
4598 ast_expr_op_cond &ast_expr_op_cond::operator=(ast_expr_op_cond obj) {
4599   std::swap(this->ptr, obj.ptr);
4600   return *this;
4601 }
4602 
ctx()4603 isl::ctx ast_expr_op_cond::ctx() const {
4604   return isl::ctx(isl_ast_expr_get_ctx(ptr));
4605 }
4606 
4607 inline std::ostream &operator<<(std::ostream &os, const ast_expr_op_cond &obj)
4608 {
4609   if (!obj.get())
4610     exception::throw_invalid("NULL input", __FILE__, __LINE__);
4611   auto saved_ctx = isl_ast_expr_get_ctx(obj.get());
4612   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
4613   char *str = isl_ast_expr_to_str(obj.get());
4614   if (!str)
4615     exception::throw_last_error(saved_ctx);
4616   os << str;
4617   free(str);
4618   return os;
4619 }
4620 
4621 // implementations for isl::ast_expr_op_div
ast_expr_op_div()4622 ast_expr_op_div::ast_expr_op_div()
4623     : ast_expr_op() {}
4624 
ast_expr_op_div(const ast_expr_op_div & obj)4625 ast_expr_op_div::ast_expr_op_div(const ast_expr_op_div &obj)
4626     : ast_expr_op(obj)
4627 {
4628 }
4629 
ast_expr_op_div(__isl_take isl_ast_expr * ptr)4630 ast_expr_op_div::ast_expr_op_div(__isl_take isl_ast_expr *ptr)
4631     : ast_expr_op(ptr) {}
4632 
4633 ast_expr_op_div &ast_expr_op_div::operator=(ast_expr_op_div obj) {
4634   std::swap(this->ptr, obj.ptr);
4635   return *this;
4636 }
4637 
ctx()4638 isl::ctx ast_expr_op_div::ctx() const {
4639   return isl::ctx(isl_ast_expr_get_ctx(ptr));
4640 }
4641 
4642 inline std::ostream &operator<<(std::ostream &os, const ast_expr_op_div &obj)
4643 {
4644   if (!obj.get())
4645     exception::throw_invalid("NULL input", __FILE__, __LINE__);
4646   auto saved_ctx = isl_ast_expr_get_ctx(obj.get());
4647   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
4648   char *str = isl_ast_expr_to_str(obj.get());
4649   if (!str)
4650     exception::throw_last_error(saved_ctx);
4651   os << str;
4652   free(str);
4653   return os;
4654 }
4655 
4656 // implementations for isl::ast_expr_op_eq
ast_expr_op_eq()4657 ast_expr_op_eq::ast_expr_op_eq()
4658     : ast_expr_op() {}
4659 
ast_expr_op_eq(const ast_expr_op_eq & obj)4660 ast_expr_op_eq::ast_expr_op_eq(const ast_expr_op_eq &obj)
4661     : ast_expr_op(obj)
4662 {
4663 }
4664 
ast_expr_op_eq(__isl_take isl_ast_expr * ptr)4665 ast_expr_op_eq::ast_expr_op_eq(__isl_take isl_ast_expr *ptr)
4666     : ast_expr_op(ptr) {}
4667 
4668 ast_expr_op_eq &ast_expr_op_eq::operator=(ast_expr_op_eq obj) {
4669   std::swap(this->ptr, obj.ptr);
4670   return *this;
4671 }
4672 
ctx()4673 isl::ctx ast_expr_op_eq::ctx() const {
4674   return isl::ctx(isl_ast_expr_get_ctx(ptr));
4675 }
4676 
4677 inline std::ostream &operator<<(std::ostream &os, const ast_expr_op_eq &obj)
4678 {
4679   if (!obj.get())
4680     exception::throw_invalid("NULL input", __FILE__, __LINE__);
4681   auto saved_ctx = isl_ast_expr_get_ctx(obj.get());
4682   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
4683   char *str = isl_ast_expr_to_str(obj.get());
4684   if (!str)
4685     exception::throw_last_error(saved_ctx);
4686   os << str;
4687   free(str);
4688   return os;
4689 }
4690 
4691 // implementations for isl::ast_expr_op_fdiv_q
ast_expr_op_fdiv_q()4692 ast_expr_op_fdiv_q::ast_expr_op_fdiv_q()
4693     : ast_expr_op() {}
4694 
ast_expr_op_fdiv_q(const ast_expr_op_fdiv_q & obj)4695 ast_expr_op_fdiv_q::ast_expr_op_fdiv_q(const ast_expr_op_fdiv_q &obj)
4696     : ast_expr_op(obj)
4697 {
4698 }
4699 
ast_expr_op_fdiv_q(__isl_take isl_ast_expr * ptr)4700 ast_expr_op_fdiv_q::ast_expr_op_fdiv_q(__isl_take isl_ast_expr *ptr)
4701     : ast_expr_op(ptr) {}
4702 
4703 ast_expr_op_fdiv_q &ast_expr_op_fdiv_q::operator=(ast_expr_op_fdiv_q obj) {
4704   std::swap(this->ptr, obj.ptr);
4705   return *this;
4706 }
4707 
ctx()4708 isl::ctx ast_expr_op_fdiv_q::ctx() const {
4709   return isl::ctx(isl_ast_expr_get_ctx(ptr));
4710 }
4711 
4712 inline std::ostream &operator<<(std::ostream &os, const ast_expr_op_fdiv_q &obj)
4713 {
4714   if (!obj.get())
4715     exception::throw_invalid("NULL input", __FILE__, __LINE__);
4716   auto saved_ctx = isl_ast_expr_get_ctx(obj.get());
4717   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
4718   char *str = isl_ast_expr_to_str(obj.get());
4719   if (!str)
4720     exception::throw_last_error(saved_ctx);
4721   os << str;
4722   free(str);
4723   return os;
4724 }
4725 
4726 // implementations for isl::ast_expr_op_ge
ast_expr_op_ge()4727 ast_expr_op_ge::ast_expr_op_ge()
4728     : ast_expr_op() {}
4729 
ast_expr_op_ge(const ast_expr_op_ge & obj)4730 ast_expr_op_ge::ast_expr_op_ge(const ast_expr_op_ge &obj)
4731     : ast_expr_op(obj)
4732 {
4733 }
4734 
ast_expr_op_ge(__isl_take isl_ast_expr * ptr)4735 ast_expr_op_ge::ast_expr_op_ge(__isl_take isl_ast_expr *ptr)
4736     : ast_expr_op(ptr) {}
4737 
4738 ast_expr_op_ge &ast_expr_op_ge::operator=(ast_expr_op_ge obj) {
4739   std::swap(this->ptr, obj.ptr);
4740   return *this;
4741 }
4742 
ctx()4743 isl::ctx ast_expr_op_ge::ctx() const {
4744   return isl::ctx(isl_ast_expr_get_ctx(ptr));
4745 }
4746 
4747 inline std::ostream &operator<<(std::ostream &os, const ast_expr_op_ge &obj)
4748 {
4749   if (!obj.get())
4750     exception::throw_invalid("NULL input", __FILE__, __LINE__);
4751   auto saved_ctx = isl_ast_expr_get_ctx(obj.get());
4752   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
4753   char *str = isl_ast_expr_to_str(obj.get());
4754   if (!str)
4755     exception::throw_last_error(saved_ctx);
4756   os << str;
4757   free(str);
4758   return os;
4759 }
4760 
4761 // implementations for isl::ast_expr_op_gt
ast_expr_op_gt()4762 ast_expr_op_gt::ast_expr_op_gt()
4763     : ast_expr_op() {}
4764 
ast_expr_op_gt(const ast_expr_op_gt & obj)4765 ast_expr_op_gt::ast_expr_op_gt(const ast_expr_op_gt &obj)
4766     : ast_expr_op(obj)
4767 {
4768 }
4769 
ast_expr_op_gt(__isl_take isl_ast_expr * ptr)4770 ast_expr_op_gt::ast_expr_op_gt(__isl_take isl_ast_expr *ptr)
4771     : ast_expr_op(ptr) {}
4772 
4773 ast_expr_op_gt &ast_expr_op_gt::operator=(ast_expr_op_gt obj) {
4774   std::swap(this->ptr, obj.ptr);
4775   return *this;
4776 }
4777 
ctx()4778 isl::ctx ast_expr_op_gt::ctx() const {
4779   return isl::ctx(isl_ast_expr_get_ctx(ptr));
4780 }
4781 
4782 inline std::ostream &operator<<(std::ostream &os, const ast_expr_op_gt &obj)
4783 {
4784   if (!obj.get())
4785     exception::throw_invalid("NULL input", __FILE__, __LINE__);
4786   auto saved_ctx = isl_ast_expr_get_ctx(obj.get());
4787   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
4788   char *str = isl_ast_expr_to_str(obj.get());
4789   if (!str)
4790     exception::throw_last_error(saved_ctx);
4791   os << str;
4792   free(str);
4793   return os;
4794 }
4795 
4796 // implementations for isl::ast_expr_op_le
ast_expr_op_le()4797 ast_expr_op_le::ast_expr_op_le()
4798     : ast_expr_op() {}
4799 
ast_expr_op_le(const ast_expr_op_le & obj)4800 ast_expr_op_le::ast_expr_op_le(const ast_expr_op_le &obj)
4801     : ast_expr_op(obj)
4802 {
4803 }
4804 
ast_expr_op_le(__isl_take isl_ast_expr * ptr)4805 ast_expr_op_le::ast_expr_op_le(__isl_take isl_ast_expr *ptr)
4806     : ast_expr_op(ptr) {}
4807 
4808 ast_expr_op_le &ast_expr_op_le::operator=(ast_expr_op_le obj) {
4809   std::swap(this->ptr, obj.ptr);
4810   return *this;
4811 }
4812 
ctx()4813 isl::ctx ast_expr_op_le::ctx() const {
4814   return isl::ctx(isl_ast_expr_get_ctx(ptr));
4815 }
4816 
4817 inline std::ostream &operator<<(std::ostream &os, const ast_expr_op_le &obj)
4818 {
4819   if (!obj.get())
4820     exception::throw_invalid("NULL input", __FILE__, __LINE__);
4821   auto saved_ctx = isl_ast_expr_get_ctx(obj.get());
4822   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
4823   char *str = isl_ast_expr_to_str(obj.get());
4824   if (!str)
4825     exception::throw_last_error(saved_ctx);
4826   os << str;
4827   free(str);
4828   return os;
4829 }
4830 
4831 // implementations for isl::ast_expr_op_lt
ast_expr_op_lt()4832 ast_expr_op_lt::ast_expr_op_lt()
4833     : ast_expr_op() {}
4834 
ast_expr_op_lt(const ast_expr_op_lt & obj)4835 ast_expr_op_lt::ast_expr_op_lt(const ast_expr_op_lt &obj)
4836     : ast_expr_op(obj)
4837 {
4838 }
4839 
ast_expr_op_lt(__isl_take isl_ast_expr * ptr)4840 ast_expr_op_lt::ast_expr_op_lt(__isl_take isl_ast_expr *ptr)
4841     : ast_expr_op(ptr) {}
4842 
4843 ast_expr_op_lt &ast_expr_op_lt::operator=(ast_expr_op_lt obj) {
4844   std::swap(this->ptr, obj.ptr);
4845   return *this;
4846 }
4847 
ctx()4848 isl::ctx ast_expr_op_lt::ctx() const {
4849   return isl::ctx(isl_ast_expr_get_ctx(ptr));
4850 }
4851 
4852 inline std::ostream &operator<<(std::ostream &os, const ast_expr_op_lt &obj)
4853 {
4854   if (!obj.get())
4855     exception::throw_invalid("NULL input", __FILE__, __LINE__);
4856   auto saved_ctx = isl_ast_expr_get_ctx(obj.get());
4857   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
4858   char *str = isl_ast_expr_to_str(obj.get());
4859   if (!str)
4860     exception::throw_last_error(saved_ctx);
4861   os << str;
4862   free(str);
4863   return os;
4864 }
4865 
4866 // implementations for isl::ast_expr_op_max
ast_expr_op_max()4867 ast_expr_op_max::ast_expr_op_max()
4868     : ast_expr_op() {}
4869 
ast_expr_op_max(const ast_expr_op_max & obj)4870 ast_expr_op_max::ast_expr_op_max(const ast_expr_op_max &obj)
4871     : ast_expr_op(obj)
4872 {
4873 }
4874 
ast_expr_op_max(__isl_take isl_ast_expr * ptr)4875 ast_expr_op_max::ast_expr_op_max(__isl_take isl_ast_expr *ptr)
4876     : ast_expr_op(ptr) {}
4877 
4878 ast_expr_op_max &ast_expr_op_max::operator=(ast_expr_op_max obj) {
4879   std::swap(this->ptr, obj.ptr);
4880   return *this;
4881 }
4882 
ctx()4883 isl::ctx ast_expr_op_max::ctx() const {
4884   return isl::ctx(isl_ast_expr_get_ctx(ptr));
4885 }
4886 
4887 inline std::ostream &operator<<(std::ostream &os, const ast_expr_op_max &obj)
4888 {
4889   if (!obj.get())
4890     exception::throw_invalid("NULL input", __FILE__, __LINE__);
4891   auto saved_ctx = isl_ast_expr_get_ctx(obj.get());
4892   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
4893   char *str = isl_ast_expr_to_str(obj.get());
4894   if (!str)
4895     exception::throw_last_error(saved_ctx);
4896   os << str;
4897   free(str);
4898   return os;
4899 }
4900 
4901 // implementations for isl::ast_expr_op_member
ast_expr_op_member()4902 ast_expr_op_member::ast_expr_op_member()
4903     : ast_expr_op() {}
4904 
ast_expr_op_member(const ast_expr_op_member & obj)4905 ast_expr_op_member::ast_expr_op_member(const ast_expr_op_member &obj)
4906     : ast_expr_op(obj)
4907 {
4908 }
4909 
ast_expr_op_member(__isl_take isl_ast_expr * ptr)4910 ast_expr_op_member::ast_expr_op_member(__isl_take isl_ast_expr *ptr)
4911     : ast_expr_op(ptr) {}
4912 
4913 ast_expr_op_member &ast_expr_op_member::operator=(ast_expr_op_member obj) {
4914   std::swap(this->ptr, obj.ptr);
4915   return *this;
4916 }
4917 
ctx()4918 isl::ctx ast_expr_op_member::ctx() const {
4919   return isl::ctx(isl_ast_expr_get_ctx(ptr));
4920 }
4921 
4922 inline std::ostream &operator<<(std::ostream &os, const ast_expr_op_member &obj)
4923 {
4924   if (!obj.get())
4925     exception::throw_invalid("NULL input", __FILE__, __LINE__);
4926   auto saved_ctx = isl_ast_expr_get_ctx(obj.get());
4927   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
4928   char *str = isl_ast_expr_to_str(obj.get());
4929   if (!str)
4930     exception::throw_last_error(saved_ctx);
4931   os << str;
4932   free(str);
4933   return os;
4934 }
4935 
4936 // implementations for isl::ast_expr_op_min
ast_expr_op_min()4937 ast_expr_op_min::ast_expr_op_min()
4938     : ast_expr_op() {}
4939 
ast_expr_op_min(const ast_expr_op_min & obj)4940 ast_expr_op_min::ast_expr_op_min(const ast_expr_op_min &obj)
4941     : ast_expr_op(obj)
4942 {
4943 }
4944 
ast_expr_op_min(__isl_take isl_ast_expr * ptr)4945 ast_expr_op_min::ast_expr_op_min(__isl_take isl_ast_expr *ptr)
4946     : ast_expr_op(ptr) {}
4947 
4948 ast_expr_op_min &ast_expr_op_min::operator=(ast_expr_op_min obj) {
4949   std::swap(this->ptr, obj.ptr);
4950   return *this;
4951 }
4952 
ctx()4953 isl::ctx ast_expr_op_min::ctx() const {
4954   return isl::ctx(isl_ast_expr_get_ctx(ptr));
4955 }
4956 
4957 inline std::ostream &operator<<(std::ostream &os, const ast_expr_op_min &obj)
4958 {
4959   if (!obj.get())
4960     exception::throw_invalid("NULL input", __FILE__, __LINE__);
4961   auto saved_ctx = isl_ast_expr_get_ctx(obj.get());
4962   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
4963   char *str = isl_ast_expr_to_str(obj.get());
4964   if (!str)
4965     exception::throw_last_error(saved_ctx);
4966   os << str;
4967   free(str);
4968   return os;
4969 }
4970 
4971 // implementations for isl::ast_expr_op_minus
ast_expr_op_minus()4972 ast_expr_op_minus::ast_expr_op_minus()
4973     : ast_expr_op() {}
4974 
ast_expr_op_minus(const ast_expr_op_minus & obj)4975 ast_expr_op_minus::ast_expr_op_minus(const ast_expr_op_minus &obj)
4976     : ast_expr_op(obj)
4977 {
4978 }
4979 
ast_expr_op_minus(__isl_take isl_ast_expr * ptr)4980 ast_expr_op_minus::ast_expr_op_minus(__isl_take isl_ast_expr *ptr)
4981     : ast_expr_op(ptr) {}
4982 
4983 ast_expr_op_minus &ast_expr_op_minus::operator=(ast_expr_op_minus obj) {
4984   std::swap(this->ptr, obj.ptr);
4985   return *this;
4986 }
4987 
ctx()4988 isl::ctx ast_expr_op_minus::ctx() const {
4989   return isl::ctx(isl_ast_expr_get_ctx(ptr));
4990 }
4991 
4992 inline std::ostream &operator<<(std::ostream &os, const ast_expr_op_minus &obj)
4993 {
4994   if (!obj.get())
4995     exception::throw_invalid("NULL input", __FILE__, __LINE__);
4996   auto saved_ctx = isl_ast_expr_get_ctx(obj.get());
4997   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
4998   char *str = isl_ast_expr_to_str(obj.get());
4999   if (!str)
5000     exception::throw_last_error(saved_ctx);
5001   os << str;
5002   free(str);
5003   return os;
5004 }
5005 
5006 // implementations for isl::ast_expr_op_mul
ast_expr_op_mul()5007 ast_expr_op_mul::ast_expr_op_mul()
5008     : ast_expr_op() {}
5009 
ast_expr_op_mul(const ast_expr_op_mul & obj)5010 ast_expr_op_mul::ast_expr_op_mul(const ast_expr_op_mul &obj)
5011     : ast_expr_op(obj)
5012 {
5013 }
5014 
ast_expr_op_mul(__isl_take isl_ast_expr * ptr)5015 ast_expr_op_mul::ast_expr_op_mul(__isl_take isl_ast_expr *ptr)
5016     : ast_expr_op(ptr) {}
5017 
5018 ast_expr_op_mul &ast_expr_op_mul::operator=(ast_expr_op_mul obj) {
5019   std::swap(this->ptr, obj.ptr);
5020   return *this;
5021 }
5022 
ctx()5023 isl::ctx ast_expr_op_mul::ctx() const {
5024   return isl::ctx(isl_ast_expr_get_ctx(ptr));
5025 }
5026 
5027 inline std::ostream &operator<<(std::ostream &os, const ast_expr_op_mul &obj)
5028 {
5029   if (!obj.get())
5030     exception::throw_invalid("NULL input", __FILE__, __LINE__);
5031   auto saved_ctx = isl_ast_expr_get_ctx(obj.get());
5032   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
5033   char *str = isl_ast_expr_to_str(obj.get());
5034   if (!str)
5035     exception::throw_last_error(saved_ctx);
5036   os << str;
5037   free(str);
5038   return os;
5039 }
5040 
5041 // implementations for isl::ast_expr_op_or
ast_expr_op_or()5042 ast_expr_op_or::ast_expr_op_or()
5043     : ast_expr_op() {}
5044 
ast_expr_op_or(const ast_expr_op_or & obj)5045 ast_expr_op_or::ast_expr_op_or(const ast_expr_op_or &obj)
5046     : ast_expr_op(obj)
5047 {
5048 }
5049 
ast_expr_op_or(__isl_take isl_ast_expr * ptr)5050 ast_expr_op_or::ast_expr_op_or(__isl_take isl_ast_expr *ptr)
5051     : ast_expr_op(ptr) {}
5052 
5053 ast_expr_op_or &ast_expr_op_or::operator=(ast_expr_op_or obj) {
5054   std::swap(this->ptr, obj.ptr);
5055   return *this;
5056 }
5057 
ctx()5058 isl::ctx ast_expr_op_or::ctx() const {
5059   return isl::ctx(isl_ast_expr_get_ctx(ptr));
5060 }
5061 
5062 inline std::ostream &operator<<(std::ostream &os, const ast_expr_op_or &obj)
5063 {
5064   if (!obj.get())
5065     exception::throw_invalid("NULL input", __FILE__, __LINE__);
5066   auto saved_ctx = isl_ast_expr_get_ctx(obj.get());
5067   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
5068   char *str = isl_ast_expr_to_str(obj.get());
5069   if (!str)
5070     exception::throw_last_error(saved_ctx);
5071   os << str;
5072   free(str);
5073   return os;
5074 }
5075 
5076 // implementations for isl::ast_expr_op_or_else
ast_expr_op_or_else()5077 ast_expr_op_or_else::ast_expr_op_or_else()
5078     : ast_expr_op() {}
5079 
ast_expr_op_or_else(const ast_expr_op_or_else & obj)5080 ast_expr_op_or_else::ast_expr_op_or_else(const ast_expr_op_or_else &obj)
5081     : ast_expr_op(obj)
5082 {
5083 }
5084 
ast_expr_op_or_else(__isl_take isl_ast_expr * ptr)5085 ast_expr_op_or_else::ast_expr_op_or_else(__isl_take isl_ast_expr *ptr)
5086     : ast_expr_op(ptr) {}
5087 
5088 ast_expr_op_or_else &ast_expr_op_or_else::operator=(ast_expr_op_or_else obj) {
5089   std::swap(this->ptr, obj.ptr);
5090   return *this;
5091 }
5092 
ctx()5093 isl::ctx ast_expr_op_or_else::ctx() const {
5094   return isl::ctx(isl_ast_expr_get_ctx(ptr));
5095 }
5096 
5097 inline std::ostream &operator<<(std::ostream &os, const ast_expr_op_or_else &obj)
5098 {
5099   if (!obj.get())
5100     exception::throw_invalid("NULL input", __FILE__, __LINE__);
5101   auto saved_ctx = isl_ast_expr_get_ctx(obj.get());
5102   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
5103   char *str = isl_ast_expr_to_str(obj.get());
5104   if (!str)
5105     exception::throw_last_error(saved_ctx);
5106   os << str;
5107   free(str);
5108   return os;
5109 }
5110 
5111 // implementations for isl::ast_expr_op_pdiv_q
ast_expr_op_pdiv_q()5112 ast_expr_op_pdiv_q::ast_expr_op_pdiv_q()
5113     : ast_expr_op() {}
5114 
ast_expr_op_pdiv_q(const ast_expr_op_pdiv_q & obj)5115 ast_expr_op_pdiv_q::ast_expr_op_pdiv_q(const ast_expr_op_pdiv_q &obj)
5116     : ast_expr_op(obj)
5117 {
5118 }
5119 
ast_expr_op_pdiv_q(__isl_take isl_ast_expr * ptr)5120 ast_expr_op_pdiv_q::ast_expr_op_pdiv_q(__isl_take isl_ast_expr *ptr)
5121     : ast_expr_op(ptr) {}
5122 
5123 ast_expr_op_pdiv_q &ast_expr_op_pdiv_q::operator=(ast_expr_op_pdiv_q obj) {
5124   std::swap(this->ptr, obj.ptr);
5125   return *this;
5126 }
5127 
ctx()5128 isl::ctx ast_expr_op_pdiv_q::ctx() const {
5129   return isl::ctx(isl_ast_expr_get_ctx(ptr));
5130 }
5131 
5132 inline std::ostream &operator<<(std::ostream &os, const ast_expr_op_pdiv_q &obj)
5133 {
5134   if (!obj.get())
5135     exception::throw_invalid("NULL input", __FILE__, __LINE__);
5136   auto saved_ctx = isl_ast_expr_get_ctx(obj.get());
5137   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
5138   char *str = isl_ast_expr_to_str(obj.get());
5139   if (!str)
5140     exception::throw_last_error(saved_ctx);
5141   os << str;
5142   free(str);
5143   return os;
5144 }
5145 
5146 // implementations for isl::ast_expr_op_pdiv_r
ast_expr_op_pdiv_r()5147 ast_expr_op_pdiv_r::ast_expr_op_pdiv_r()
5148     : ast_expr_op() {}
5149 
ast_expr_op_pdiv_r(const ast_expr_op_pdiv_r & obj)5150 ast_expr_op_pdiv_r::ast_expr_op_pdiv_r(const ast_expr_op_pdiv_r &obj)
5151     : ast_expr_op(obj)
5152 {
5153 }
5154 
ast_expr_op_pdiv_r(__isl_take isl_ast_expr * ptr)5155 ast_expr_op_pdiv_r::ast_expr_op_pdiv_r(__isl_take isl_ast_expr *ptr)
5156     : ast_expr_op(ptr) {}
5157 
5158 ast_expr_op_pdiv_r &ast_expr_op_pdiv_r::operator=(ast_expr_op_pdiv_r obj) {
5159   std::swap(this->ptr, obj.ptr);
5160   return *this;
5161 }
5162 
ctx()5163 isl::ctx ast_expr_op_pdiv_r::ctx() const {
5164   return isl::ctx(isl_ast_expr_get_ctx(ptr));
5165 }
5166 
5167 inline std::ostream &operator<<(std::ostream &os, const ast_expr_op_pdiv_r &obj)
5168 {
5169   if (!obj.get())
5170     exception::throw_invalid("NULL input", __FILE__, __LINE__);
5171   auto saved_ctx = isl_ast_expr_get_ctx(obj.get());
5172   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
5173   char *str = isl_ast_expr_to_str(obj.get());
5174   if (!str)
5175     exception::throw_last_error(saved_ctx);
5176   os << str;
5177   free(str);
5178   return os;
5179 }
5180 
5181 // implementations for isl::ast_expr_op_select
ast_expr_op_select()5182 ast_expr_op_select::ast_expr_op_select()
5183     : ast_expr_op() {}
5184 
ast_expr_op_select(const ast_expr_op_select & obj)5185 ast_expr_op_select::ast_expr_op_select(const ast_expr_op_select &obj)
5186     : ast_expr_op(obj)
5187 {
5188 }
5189 
ast_expr_op_select(__isl_take isl_ast_expr * ptr)5190 ast_expr_op_select::ast_expr_op_select(__isl_take isl_ast_expr *ptr)
5191     : ast_expr_op(ptr) {}
5192 
5193 ast_expr_op_select &ast_expr_op_select::operator=(ast_expr_op_select obj) {
5194   std::swap(this->ptr, obj.ptr);
5195   return *this;
5196 }
5197 
ctx()5198 isl::ctx ast_expr_op_select::ctx() const {
5199   return isl::ctx(isl_ast_expr_get_ctx(ptr));
5200 }
5201 
5202 inline std::ostream &operator<<(std::ostream &os, const ast_expr_op_select &obj)
5203 {
5204   if (!obj.get())
5205     exception::throw_invalid("NULL input", __FILE__, __LINE__);
5206   auto saved_ctx = isl_ast_expr_get_ctx(obj.get());
5207   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
5208   char *str = isl_ast_expr_to_str(obj.get());
5209   if (!str)
5210     exception::throw_last_error(saved_ctx);
5211   os << str;
5212   free(str);
5213   return os;
5214 }
5215 
5216 // implementations for isl::ast_expr_op_sub
ast_expr_op_sub()5217 ast_expr_op_sub::ast_expr_op_sub()
5218     : ast_expr_op() {}
5219 
ast_expr_op_sub(const ast_expr_op_sub & obj)5220 ast_expr_op_sub::ast_expr_op_sub(const ast_expr_op_sub &obj)
5221     : ast_expr_op(obj)
5222 {
5223 }
5224 
ast_expr_op_sub(__isl_take isl_ast_expr * ptr)5225 ast_expr_op_sub::ast_expr_op_sub(__isl_take isl_ast_expr *ptr)
5226     : ast_expr_op(ptr) {}
5227 
5228 ast_expr_op_sub &ast_expr_op_sub::operator=(ast_expr_op_sub obj) {
5229   std::swap(this->ptr, obj.ptr);
5230   return *this;
5231 }
5232 
ctx()5233 isl::ctx ast_expr_op_sub::ctx() const {
5234   return isl::ctx(isl_ast_expr_get_ctx(ptr));
5235 }
5236 
5237 inline std::ostream &operator<<(std::ostream &os, const ast_expr_op_sub &obj)
5238 {
5239   if (!obj.get())
5240     exception::throw_invalid("NULL input", __FILE__, __LINE__);
5241   auto saved_ctx = isl_ast_expr_get_ctx(obj.get());
5242   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
5243   char *str = isl_ast_expr_to_str(obj.get());
5244   if (!str)
5245     exception::throw_last_error(saved_ctx);
5246   os << str;
5247   free(str);
5248   return os;
5249 }
5250 
5251 // implementations for isl::ast_expr_op_zdiv_r
ast_expr_op_zdiv_r()5252 ast_expr_op_zdiv_r::ast_expr_op_zdiv_r()
5253     : ast_expr_op() {}
5254 
ast_expr_op_zdiv_r(const ast_expr_op_zdiv_r & obj)5255 ast_expr_op_zdiv_r::ast_expr_op_zdiv_r(const ast_expr_op_zdiv_r &obj)
5256     : ast_expr_op(obj)
5257 {
5258 }
5259 
ast_expr_op_zdiv_r(__isl_take isl_ast_expr * ptr)5260 ast_expr_op_zdiv_r::ast_expr_op_zdiv_r(__isl_take isl_ast_expr *ptr)
5261     : ast_expr_op(ptr) {}
5262 
5263 ast_expr_op_zdiv_r &ast_expr_op_zdiv_r::operator=(ast_expr_op_zdiv_r obj) {
5264   std::swap(this->ptr, obj.ptr);
5265   return *this;
5266 }
5267 
ctx()5268 isl::ctx ast_expr_op_zdiv_r::ctx() const {
5269   return isl::ctx(isl_ast_expr_get_ctx(ptr));
5270 }
5271 
5272 inline std::ostream &operator<<(std::ostream &os, const ast_expr_op_zdiv_r &obj)
5273 {
5274   if (!obj.get())
5275     exception::throw_invalid("NULL input", __FILE__, __LINE__);
5276   auto saved_ctx = isl_ast_expr_get_ctx(obj.get());
5277   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
5278   char *str = isl_ast_expr_to_str(obj.get());
5279   if (!str)
5280     exception::throw_last_error(saved_ctx);
5281   os << str;
5282   free(str);
5283   return os;
5284 }
5285 
5286 // implementations for isl::ast_node
manage(__isl_take isl_ast_node * ptr)5287 ast_node manage(__isl_take isl_ast_node *ptr) {
5288   if (!ptr)
5289     exception::throw_invalid("NULL input", __FILE__, __LINE__);
5290   return ast_node(ptr);
5291 }
manage_copy(__isl_keep isl_ast_node * ptr)5292 ast_node manage_copy(__isl_keep isl_ast_node *ptr) {
5293   if (!ptr)
5294     exception::throw_invalid("NULL input", __FILE__, __LINE__);
5295   auto saved_ctx = isl_ast_node_get_ctx(ptr);
5296   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
5297   ptr = isl_ast_node_copy(ptr);
5298   if (!ptr)
5299     exception::throw_last_error(saved_ctx);
5300   return ast_node(ptr);
5301 }
5302 
ast_node()5303 ast_node::ast_node()
5304     : ptr(nullptr) {}
5305 
ast_node(const ast_node & obj)5306 ast_node::ast_node(const ast_node &obj)
5307     : ptr(nullptr)
5308 {
5309   if (!obj.ptr)
5310     exception::throw_invalid("NULL input", __FILE__, __LINE__);
5311   auto saved_ctx = isl_ast_node_get_ctx(obj.ptr);
5312   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
5313   ptr = obj.copy();
5314   if (!ptr)
5315     exception::throw_last_error(saved_ctx);
5316 }
5317 
ast_node(__isl_take isl_ast_node * ptr)5318 ast_node::ast_node(__isl_take isl_ast_node *ptr)
5319     : ptr(ptr) {}
5320 
5321 ast_node &ast_node::operator=(ast_node obj) {
5322   std::swap(this->ptr, obj.ptr);
5323   return *this;
5324 }
5325 
~ast_node()5326 ast_node::~ast_node() {
5327   if (ptr)
5328     isl_ast_node_free(ptr);
5329 }
5330 
copy()5331 __isl_give isl_ast_node *ast_node::copy() const & {
5332   return isl_ast_node_copy(ptr);
5333 }
5334 
get()5335 __isl_keep isl_ast_node *ast_node::get() const {
5336   return ptr;
5337 }
5338 
release()5339 __isl_give isl_ast_node *ast_node::release() {
5340   isl_ast_node *tmp = ptr;
5341   ptr = nullptr;
5342   return tmp;
5343 }
5344 
is_null()5345 bool ast_node::is_null() const {
5346   return ptr == nullptr;
5347 }
5348 
5349 template <typename T, typename>
isa_type(T subtype)5350 bool ast_node::isa_type(T subtype) const
5351 {
5352   if (is_null())
5353     exception::throw_invalid("NULL input", __FILE__, __LINE__);
5354   return isl_ast_node_get_type(get()) == subtype;
5355 }
5356 template <class T>
isa()5357 bool ast_node::isa() const
5358 {
5359   return isa_type<decltype(T::type)>(T::type);
5360 }
5361 template <class T>
as()5362 T ast_node::as() const
5363 {
5364  if (!isa<T>())
5365     exception::throw_invalid("not an object of the requested subtype", __FILE__, __LINE__);
5366   return T(copy());
5367 }
5368 
ctx()5369 isl::ctx ast_node::ctx() const {
5370   return isl::ctx(isl_ast_node_get_ctx(ptr));
5371 }
5372 
to_C_str()5373 std::string ast_node::to_C_str() const
5374 {
5375   if (!ptr)
5376     exception::throw_invalid("NULL input", __FILE__, __LINE__);
5377   auto saved_ctx = ctx();
5378   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
5379   auto res = isl_ast_node_to_C_str(get());
5380   std::string tmp(res);
5381   free(res);
5382   return tmp;
5383 }
5384 
5385 inline std::ostream &operator<<(std::ostream &os, const ast_node &obj)
5386 {
5387   if (!obj.get())
5388     exception::throw_invalid("NULL input", __FILE__, __LINE__);
5389   auto saved_ctx = isl_ast_node_get_ctx(obj.get());
5390   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
5391   char *str = isl_ast_node_to_str(obj.get());
5392   if (!str)
5393     exception::throw_last_error(saved_ctx);
5394   os << str;
5395   free(str);
5396   return os;
5397 }
5398 
5399 // implementations for isl::ast_node_block
ast_node_block()5400 ast_node_block::ast_node_block()
5401     : ast_node() {}
5402 
ast_node_block(const ast_node_block & obj)5403 ast_node_block::ast_node_block(const ast_node_block &obj)
5404     : ast_node(obj)
5405 {
5406 }
5407 
ast_node_block(__isl_take isl_ast_node * ptr)5408 ast_node_block::ast_node_block(__isl_take isl_ast_node *ptr)
5409     : ast_node(ptr) {}
5410 
5411 ast_node_block &ast_node_block::operator=(ast_node_block obj) {
5412   std::swap(this->ptr, obj.ptr);
5413   return *this;
5414 }
5415 
ctx()5416 isl::ctx ast_node_block::ctx() const {
5417   return isl::ctx(isl_ast_node_get_ctx(ptr));
5418 }
5419 
children()5420 isl::ast_node_list ast_node_block::children() const
5421 {
5422   if (!ptr)
5423     exception::throw_invalid("NULL input", __FILE__, __LINE__);
5424   auto saved_ctx = ctx();
5425   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
5426   auto res = isl_ast_node_block_get_children(get());
5427   if (!res)
5428     exception::throw_last_error(saved_ctx);
5429   return manage(res);
5430 }
5431 
get_children()5432 isl::ast_node_list ast_node_block::get_children() const
5433 {
5434   return children();
5435 }
5436 
5437 inline std::ostream &operator<<(std::ostream &os, const ast_node_block &obj)
5438 {
5439   if (!obj.get())
5440     exception::throw_invalid("NULL input", __FILE__, __LINE__);
5441   auto saved_ctx = isl_ast_node_get_ctx(obj.get());
5442   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
5443   char *str = isl_ast_node_to_str(obj.get());
5444   if (!str)
5445     exception::throw_last_error(saved_ctx);
5446   os << str;
5447   free(str);
5448   return os;
5449 }
5450 
5451 // implementations for isl::ast_node_for
ast_node_for()5452 ast_node_for::ast_node_for()
5453     : ast_node() {}
5454 
ast_node_for(const ast_node_for & obj)5455 ast_node_for::ast_node_for(const ast_node_for &obj)
5456     : ast_node(obj)
5457 {
5458 }
5459 
ast_node_for(__isl_take isl_ast_node * ptr)5460 ast_node_for::ast_node_for(__isl_take isl_ast_node *ptr)
5461     : ast_node(ptr) {}
5462 
5463 ast_node_for &ast_node_for::operator=(ast_node_for obj) {
5464   std::swap(this->ptr, obj.ptr);
5465   return *this;
5466 }
5467 
ctx()5468 isl::ctx ast_node_for::ctx() const {
5469   return isl::ctx(isl_ast_node_get_ctx(ptr));
5470 }
5471 
body()5472 isl::ast_node ast_node_for::body() const
5473 {
5474   if (!ptr)
5475     exception::throw_invalid("NULL input", __FILE__, __LINE__);
5476   auto saved_ctx = ctx();
5477   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
5478   auto res = isl_ast_node_for_get_body(get());
5479   if (!res)
5480     exception::throw_last_error(saved_ctx);
5481   return manage(res);
5482 }
5483 
get_body()5484 isl::ast_node ast_node_for::get_body() const
5485 {
5486   return body();
5487 }
5488 
cond()5489 isl::ast_expr ast_node_for::cond() const
5490 {
5491   if (!ptr)
5492     exception::throw_invalid("NULL input", __FILE__, __LINE__);
5493   auto saved_ctx = ctx();
5494   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
5495   auto res = isl_ast_node_for_get_cond(get());
5496   if (!res)
5497     exception::throw_last_error(saved_ctx);
5498   return manage(res);
5499 }
5500 
get_cond()5501 isl::ast_expr ast_node_for::get_cond() const
5502 {
5503   return cond();
5504 }
5505 
inc()5506 isl::ast_expr ast_node_for::inc() const
5507 {
5508   if (!ptr)
5509     exception::throw_invalid("NULL input", __FILE__, __LINE__);
5510   auto saved_ctx = ctx();
5511   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
5512   auto res = isl_ast_node_for_get_inc(get());
5513   if (!res)
5514     exception::throw_last_error(saved_ctx);
5515   return manage(res);
5516 }
5517 
get_inc()5518 isl::ast_expr ast_node_for::get_inc() const
5519 {
5520   return inc();
5521 }
5522 
init()5523 isl::ast_expr ast_node_for::init() const
5524 {
5525   if (!ptr)
5526     exception::throw_invalid("NULL input", __FILE__, __LINE__);
5527   auto saved_ctx = ctx();
5528   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
5529   auto res = isl_ast_node_for_get_init(get());
5530   if (!res)
5531     exception::throw_last_error(saved_ctx);
5532   return manage(res);
5533 }
5534 
get_init()5535 isl::ast_expr ast_node_for::get_init() const
5536 {
5537   return init();
5538 }
5539 
iterator()5540 isl::ast_expr ast_node_for::iterator() const
5541 {
5542   if (!ptr)
5543     exception::throw_invalid("NULL input", __FILE__, __LINE__);
5544   auto saved_ctx = ctx();
5545   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
5546   auto res = isl_ast_node_for_get_iterator(get());
5547   if (!res)
5548     exception::throw_last_error(saved_ctx);
5549   return manage(res);
5550 }
5551 
get_iterator()5552 isl::ast_expr ast_node_for::get_iterator() const
5553 {
5554   return iterator();
5555 }
5556 
is_degenerate()5557 bool ast_node_for::is_degenerate() const
5558 {
5559   if (!ptr)
5560     exception::throw_invalid("NULL input", __FILE__, __LINE__);
5561   auto saved_ctx = ctx();
5562   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
5563   auto res = isl_ast_node_for_is_degenerate(get());
5564   if (res < 0)
5565     exception::throw_last_error(saved_ctx);
5566   return res;
5567 }
5568 
5569 inline std::ostream &operator<<(std::ostream &os, const ast_node_for &obj)
5570 {
5571   if (!obj.get())
5572     exception::throw_invalid("NULL input", __FILE__, __LINE__);
5573   auto saved_ctx = isl_ast_node_get_ctx(obj.get());
5574   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
5575   char *str = isl_ast_node_to_str(obj.get());
5576   if (!str)
5577     exception::throw_last_error(saved_ctx);
5578   os << str;
5579   free(str);
5580   return os;
5581 }
5582 
5583 // implementations for isl::ast_node_if
ast_node_if()5584 ast_node_if::ast_node_if()
5585     : ast_node() {}
5586 
ast_node_if(const ast_node_if & obj)5587 ast_node_if::ast_node_if(const ast_node_if &obj)
5588     : ast_node(obj)
5589 {
5590 }
5591 
ast_node_if(__isl_take isl_ast_node * ptr)5592 ast_node_if::ast_node_if(__isl_take isl_ast_node *ptr)
5593     : ast_node(ptr) {}
5594 
5595 ast_node_if &ast_node_if::operator=(ast_node_if obj) {
5596   std::swap(this->ptr, obj.ptr);
5597   return *this;
5598 }
5599 
ctx()5600 isl::ctx ast_node_if::ctx() const {
5601   return isl::ctx(isl_ast_node_get_ctx(ptr));
5602 }
5603 
cond()5604 isl::ast_expr ast_node_if::cond() const
5605 {
5606   if (!ptr)
5607     exception::throw_invalid("NULL input", __FILE__, __LINE__);
5608   auto saved_ctx = ctx();
5609   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
5610   auto res = isl_ast_node_if_get_cond(get());
5611   if (!res)
5612     exception::throw_last_error(saved_ctx);
5613   return manage(res);
5614 }
5615 
get_cond()5616 isl::ast_expr ast_node_if::get_cond() const
5617 {
5618   return cond();
5619 }
5620 
else_node()5621 isl::ast_node ast_node_if::else_node() const
5622 {
5623   if (!ptr)
5624     exception::throw_invalid("NULL input", __FILE__, __LINE__);
5625   auto saved_ctx = ctx();
5626   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
5627   auto res = isl_ast_node_if_get_else_node(get());
5628   if (!res)
5629     exception::throw_last_error(saved_ctx);
5630   return manage(res);
5631 }
5632 
get_else_node()5633 isl::ast_node ast_node_if::get_else_node() const
5634 {
5635   return else_node();
5636 }
5637 
then_node()5638 isl::ast_node ast_node_if::then_node() const
5639 {
5640   if (!ptr)
5641     exception::throw_invalid("NULL input", __FILE__, __LINE__);
5642   auto saved_ctx = ctx();
5643   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
5644   auto res = isl_ast_node_if_get_then_node(get());
5645   if (!res)
5646     exception::throw_last_error(saved_ctx);
5647   return manage(res);
5648 }
5649 
get_then_node()5650 isl::ast_node ast_node_if::get_then_node() const
5651 {
5652   return then_node();
5653 }
5654 
has_else_node()5655 bool ast_node_if::has_else_node() const
5656 {
5657   if (!ptr)
5658     exception::throw_invalid("NULL input", __FILE__, __LINE__);
5659   auto saved_ctx = ctx();
5660   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
5661   auto res = isl_ast_node_if_has_else_node(get());
5662   if (res < 0)
5663     exception::throw_last_error(saved_ctx);
5664   return res;
5665 }
5666 
5667 inline std::ostream &operator<<(std::ostream &os, const ast_node_if &obj)
5668 {
5669   if (!obj.get())
5670     exception::throw_invalid("NULL input", __FILE__, __LINE__);
5671   auto saved_ctx = isl_ast_node_get_ctx(obj.get());
5672   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
5673   char *str = isl_ast_node_to_str(obj.get());
5674   if (!str)
5675     exception::throw_last_error(saved_ctx);
5676   os << str;
5677   free(str);
5678   return os;
5679 }
5680 
5681 // implementations for isl::ast_node_list
manage(__isl_take isl_ast_node_list * ptr)5682 ast_node_list manage(__isl_take isl_ast_node_list *ptr) {
5683   if (!ptr)
5684     exception::throw_invalid("NULL input", __FILE__, __LINE__);
5685   return ast_node_list(ptr);
5686 }
manage_copy(__isl_keep isl_ast_node_list * ptr)5687 ast_node_list manage_copy(__isl_keep isl_ast_node_list *ptr) {
5688   if (!ptr)
5689     exception::throw_invalid("NULL input", __FILE__, __LINE__);
5690   auto saved_ctx = isl_ast_node_list_get_ctx(ptr);
5691   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
5692   ptr = isl_ast_node_list_copy(ptr);
5693   if (!ptr)
5694     exception::throw_last_error(saved_ctx);
5695   return ast_node_list(ptr);
5696 }
5697 
ast_node_list()5698 ast_node_list::ast_node_list()
5699     : ptr(nullptr) {}
5700 
ast_node_list(const ast_node_list & obj)5701 ast_node_list::ast_node_list(const ast_node_list &obj)
5702     : ptr(nullptr)
5703 {
5704   if (!obj.ptr)
5705     exception::throw_invalid("NULL input", __FILE__, __LINE__);
5706   auto saved_ctx = isl_ast_node_list_get_ctx(obj.ptr);
5707   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
5708   ptr = obj.copy();
5709   if (!ptr)
5710     exception::throw_last_error(saved_ctx);
5711 }
5712 
ast_node_list(__isl_take isl_ast_node_list * ptr)5713 ast_node_list::ast_node_list(__isl_take isl_ast_node_list *ptr)
5714     : ptr(ptr) {}
5715 
ast_node_list(isl::ctx ctx,int n)5716 ast_node_list::ast_node_list(isl::ctx ctx, int n)
5717 {
5718   auto saved_ctx = ctx;
5719   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
5720   auto res = isl_ast_node_list_alloc(ctx.release(), n);
5721   if (!res)
5722     exception::throw_last_error(saved_ctx);
5723   ptr = res;
5724 }
5725 
ast_node_list(isl::ast_node el)5726 ast_node_list::ast_node_list(isl::ast_node el)
5727 {
5728   if (el.is_null())
5729     exception::throw_invalid("NULL input", __FILE__, __LINE__);
5730   auto saved_ctx = el.ctx();
5731   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
5732   auto res = isl_ast_node_list_from_ast_node(el.release());
5733   if (!res)
5734     exception::throw_last_error(saved_ctx);
5735   ptr = res;
5736 }
5737 
5738 ast_node_list &ast_node_list::operator=(ast_node_list obj) {
5739   std::swap(this->ptr, obj.ptr);
5740   return *this;
5741 }
5742 
~ast_node_list()5743 ast_node_list::~ast_node_list() {
5744   if (ptr)
5745     isl_ast_node_list_free(ptr);
5746 }
5747 
copy()5748 __isl_give isl_ast_node_list *ast_node_list::copy() const & {
5749   return isl_ast_node_list_copy(ptr);
5750 }
5751 
get()5752 __isl_keep isl_ast_node_list *ast_node_list::get() const {
5753   return ptr;
5754 }
5755 
release()5756 __isl_give isl_ast_node_list *ast_node_list::release() {
5757   isl_ast_node_list *tmp = ptr;
5758   ptr = nullptr;
5759   return tmp;
5760 }
5761 
is_null()5762 bool ast_node_list::is_null() const {
5763   return ptr == nullptr;
5764 }
5765 
ctx()5766 isl::ctx ast_node_list::ctx() const {
5767   return isl::ctx(isl_ast_node_list_get_ctx(ptr));
5768 }
5769 
add(isl::ast_node el)5770 isl::ast_node_list ast_node_list::add(isl::ast_node el) const
5771 {
5772   if (!ptr || el.is_null())
5773     exception::throw_invalid("NULL input", __FILE__, __LINE__);
5774   auto saved_ctx = ctx();
5775   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
5776   auto res = isl_ast_node_list_add(copy(), el.release());
5777   if (!res)
5778     exception::throw_last_error(saved_ctx);
5779   return manage(res);
5780 }
5781 
clear()5782 isl::ast_node_list ast_node_list::clear() const
5783 {
5784   if (!ptr)
5785     exception::throw_invalid("NULL input", __FILE__, __LINE__);
5786   auto saved_ctx = ctx();
5787   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
5788   auto res = isl_ast_node_list_clear(copy());
5789   if (!res)
5790     exception::throw_last_error(saved_ctx);
5791   return manage(res);
5792 }
5793 
concat(isl::ast_node_list list2)5794 isl::ast_node_list ast_node_list::concat(isl::ast_node_list list2) const
5795 {
5796   if (!ptr || list2.is_null())
5797     exception::throw_invalid("NULL input", __FILE__, __LINE__);
5798   auto saved_ctx = ctx();
5799   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
5800   auto res = isl_ast_node_list_concat(copy(), list2.release());
5801   if (!res)
5802     exception::throw_last_error(saved_ctx);
5803   return manage(res);
5804 }
5805 
foreach(const std::function<void (isl::ast_node)> & fn)5806 void ast_node_list::foreach(const std::function<void(isl::ast_node)> &fn) const
5807 {
5808   if (!ptr)
5809     exception::throw_invalid("NULL input", __FILE__, __LINE__);
5810   auto saved_ctx = ctx();
5811   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
5812   struct fn_data {
5813     std::function<void(isl::ast_node)> func;
5814     std::exception_ptr eptr;
5815   } fn_data = { fn };
5816   auto fn_lambda = [](isl_ast_node *arg_0, void *arg_1) -> isl_stat {
5817     auto *data = static_cast<struct fn_data *>(arg_1);
5818     ISL_CPP_TRY {
5819       (data->func)(manage(arg_0));
5820       return isl_stat_ok;
5821     } ISL_CPP_CATCH_ALL {
5822       data->eptr = std::current_exception();
5823       return isl_stat_error;
5824     }
5825   };
5826   auto res = isl_ast_node_list_foreach(get(), fn_lambda, &fn_data);
5827   if (fn_data.eptr)
5828     std::rethrow_exception(fn_data.eptr);
5829   if (res < 0)
5830     exception::throw_last_error(saved_ctx);
5831   return;
5832 }
5833 
at(int index)5834 isl::ast_node ast_node_list::at(int index) const
5835 {
5836   if (!ptr)
5837     exception::throw_invalid("NULL input", __FILE__, __LINE__);
5838   auto saved_ctx = ctx();
5839   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
5840   auto res = isl_ast_node_list_get_at(get(), index);
5841   if (!res)
5842     exception::throw_last_error(saved_ctx);
5843   return manage(res);
5844 }
5845 
get_at(int index)5846 isl::ast_node ast_node_list::get_at(int index) const
5847 {
5848   return at(index);
5849 }
5850 
size()5851 unsigned ast_node_list::size() const
5852 {
5853   if (!ptr)
5854     exception::throw_invalid("NULL input", __FILE__, __LINE__);
5855   auto saved_ctx = ctx();
5856   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
5857   auto res = isl_ast_node_list_size(get());
5858   if (res < 0)
5859     exception::throw_last_error(saved_ctx);
5860   return res;
5861 }
5862 
5863 inline std::ostream &operator<<(std::ostream &os, const ast_node_list &obj)
5864 {
5865   if (!obj.get())
5866     exception::throw_invalid("NULL input", __FILE__, __LINE__);
5867   auto saved_ctx = isl_ast_node_list_get_ctx(obj.get());
5868   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
5869   char *str = isl_ast_node_list_to_str(obj.get());
5870   if (!str)
5871     exception::throw_last_error(saved_ctx);
5872   os << str;
5873   free(str);
5874   return os;
5875 }
5876 
5877 // implementations for isl::ast_node_mark
ast_node_mark()5878 ast_node_mark::ast_node_mark()
5879     : ast_node() {}
5880 
ast_node_mark(const ast_node_mark & obj)5881 ast_node_mark::ast_node_mark(const ast_node_mark &obj)
5882     : ast_node(obj)
5883 {
5884 }
5885 
ast_node_mark(__isl_take isl_ast_node * ptr)5886 ast_node_mark::ast_node_mark(__isl_take isl_ast_node *ptr)
5887     : ast_node(ptr) {}
5888 
5889 ast_node_mark &ast_node_mark::operator=(ast_node_mark obj) {
5890   std::swap(this->ptr, obj.ptr);
5891   return *this;
5892 }
5893 
ctx()5894 isl::ctx ast_node_mark::ctx() const {
5895   return isl::ctx(isl_ast_node_get_ctx(ptr));
5896 }
5897 
id()5898 isl::id ast_node_mark::id() const
5899 {
5900   if (!ptr)
5901     exception::throw_invalid("NULL input", __FILE__, __LINE__);
5902   auto saved_ctx = ctx();
5903   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
5904   auto res = isl_ast_node_mark_get_id(get());
5905   if (!res)
5906     exception::throw_last_error(saved_ctx);
5907   return manage(res);
5908 }
5909 
get_id()5910 isl::id ast_node_mark::get_id() const
5911 {
5912   return id();
5913 }
5914 
node()5915 isl::ast_node ast_node_mark::node() 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_mark_get_node(get());
5922   if (!res)
5923     exception::throw_last_error(saved_ctx);
5924   return manage(res);
5925 }
5926 
get_node()5927 isl::ast_node ast_node_mark::get_node() const
5928 {
5929   return node();
5930 }
5931 
5932 inline std::ostream &operator<<(std::ostream &os, const ast_node_mark &obj)
5933 {
5934   if (!obj.get())
5935     exception::throw_invalid("NULL input", __FILE__, __LINE__);
5936   auto saved_ctx = isl_ast_node_get_ctx(obj.get());
5937   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
5938   char *str = isl_ast_node_to_str(obj.get());
5939   if (!str)
5940     exception::throw_last_error(saved_ctx);
5941   os << str;
5942   free(str);
5943   return os;
5944 }
5945 
5946 // implementations for isl::ast_node_user
ast_node_user()5947 ast_node_user::ast_node_user()
5948     : ast_node() {}
5949 
ast_node_user(const ast_node_user & obj)5950 ast_node_user::ast_node_user(const ast_node_user &obj)
5951     : ast_node(obj)
5952 {
5953 }
5954 
ast_node_user(__isl_take isl_ast_node * ptr)5955 ast_node_user::ast_node_user(__isl_take isl_ast_node *ptr)
5956     : ast_node(ptr) {}
5957 
5958 ast_node_user &ast_node_user::operator=(ast_node_user obj) {
5959   std::swap(this->ptr, obj.ptr);
5960   return *this;
5961 }
5962 
ctx()5963 isl::ctx ast_node_user::ctx() const {
5964   return isl::ctx(isl_ast_node_get_ctx(ptr));
5965 }
5966 
expr()5967 isl::ast_expr ast_node_user::expr() const
5968 {
5969   if (!ptr)
5970     exception::throw_invalid("NULL input", __FILE__, __LINE__);
5971   auto saved_ctx = ctx();
5972   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
5973   auto res = isl_ast_node_user_get_expr(get());
5974   if (!res)
5975     exception::throw_last_error(saved_ctx);
5976   return manage(res);
5977 }
5978 
get_expr()5979 isl::ast_expr ast_node_user::get_expr() const
5980 {
5981   return expr();
5982 }
5983 
5984 inline std::ostream &operator<<(std::ostream &os, const ast_node_user &obj)
5985 {
5986   if (!obj.get())
5987     exception::throw_invalid("NULL input", __FILE__, __LINE__);
5988   auto saved_ctx = isl_ast_node_get_ctx(obj.get());
5989   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
5990   char *str = isl_ast_node_to_str(obj.get());
5991   if (!str)
5992     exception::throw_last_error(saved_ctx);
5993   os << str;
5994   free(str);
5995   return os;
5996 }
5997 
5998 // implementations for isl::basic_map
manage(__isl_take isl_basic_map * ptr)5999 basic_map manage(__isl_take isl_basic_map *ptr) {
6000   if (!ptr)
6001     exception::throw_invalid("NULL input", __FILE__, __LINE__);
6002   return basic_map(ptr);
6003 }
manage_copy(__isl_keep isl_basic_map * ptr)6004 basic_map manage_copy(__isl_keep isl_basic_map *ptr) {
6005   if (!ptr)
6006     exception::throw_invalid("NULL input", __FILE__, __LINE__);
6007   auto saved_ctx = isl_basic_map_get_ctx(ptr);
6008   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6009   ptr = isl_basic_map_copy(ptr);
6010   if (!ptr)
6011     exception::throw_last_error(saved_ctx);
6012   return basic_map(ptr);
6013 }
6014 
basic_map()6015 basic_map::basic_map()
6016     : ptr(nullptr) {}
6017 
basic_map(const basic_map & obj)6018 basic_map::basic_map(const basic_map &obj)
6019     : ptr(nullptr)
6020 {
6021   if (!obj.ptr)
6022     exception::throw_invalid("NULL input", __FILE__, __LINE__);
6023   auto saved_ctx = isl_basic_map_get_ctx(obj.ptr);
6024   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6025   ptr = obj.copy();
6026   if (!ptr)
6027     exception::throw_last_error(saved_ctx);
6028 }
6029 
basic_map(__isl_take isl_basic_map * ptr)6030 basic_map::basic_map(__isl_take isl_basic_map *ptr)
6031     : ptr(ptr) {}
6032 
basic_map(isl::ctx ctx,const std::string & str)6033 basic_map::basic_map(isl::ctx ctx, const std::string &str)
6034 {
6035   auto saved_ctx = ctx;
6036   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6037   auto res = isl_basic_map_read_from_str(ctx.release(), str.c_str());
6038   if (!res)
6039     exception::throw_last_error(saved_ctx);
6040   ptr = res;
6041 }
6042 
6043 basic_map &basic_map::operator=(basic_map obj) {
6044   std::swap(this->ptr, obj.ptr);
6045   return *this;
6046 }
6047 
~basic_map()6048 basic_map::~basic_map() {
6049   if (ptr)
6050     isl_basic_map_free(ptr);
6051 }
6052 
copy()6053 __isl_give isl_basic_map *basic_map::copy() const & {
6054   return isl_basic_map_copy(ptr);
6055 }
6056 
get()6057 __isl_keep isl_basic_map *basic_map::get() const {
6058   return ptr;
6059 }
6060 
release()6061 __isl_give isl_basic_map *basic_map::release() {
6062   isl_basic_map *tmp = ptr;
6063   ptr = nullptr;
6064   return tmp;
6065 }
6066 
is_null()6067 bool basic_map::is_null() const {
6068   return ptr == nullptr;
6069 }
6070 
ctx()6071 isl::ctx basic_map::ctx() const {
6072   return isl::ctx(isl_basic_map_get_ctx(ptr));
6073 }
6074 
affine_hull()6075 isl::basic_map basic_map::affine_hull() const
6076 {
6077   if (!ptr)
6078     exception::throw_invalid("NULL input", __FILE__, __LINE__);
6079   auto saved_ctx = ctx();
6080   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6081   auto res = isl_basic_map_affine_hull(copy());
6082   if (!res)
6083     exception::throw_last_error(saved_ctx);
6084   return manage(res);
6085 }
6086 
apply_domain(isl::basic_map bmap2)6087 isl::basic_map basic_map::apply_domain(isl::basic_map bmap2) const
6088 {
6089   if (!ptr || bmap2.is_null())
6090     exception::throw_invalid("NULL input", __FILE__, __LINE__);
6091   auto saved_ctx = ctx();
6092   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6093   auto res = isl_basic_map_apply_domain(copy(), bmap2.release());
6094   if (!res)
6095     exception::throw_last_error(saved_ctx);
6096   return manage(res);
6097 }
6098 
apply_range(isl::basic_map bmap2)6099 isl::basic_map basic_map::apply_range(isl::basic_map bmap2) const
6100 {
6101   if (!ptr || bmap2.is_null())
6102     exception::throw_invalid("NULL input", __FILE__, __LINE__);
6103   auto saved_ctx = ctx();
6104   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6105   auto res = isl_basic_map_apply_range(copy(), bmap2.release());
6106   if (!res)
6107     exception::throw_last_error(saved_ctx);
6108   return manage(res);
6109 }
6110 
deltas()6111 isl::basic_set basic_map::deltas() const
6112 {
6113   if (!ptr)
6114     exception::throw_invalid("NULL input", __FILE__, __LINE__);
6115   auto saved_ctx = ctx();
6116   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6117   auto res = isl_basic_map_deltas(copy());
6118   if (!res)
6119     exception::throw_last_error(saved_ctx);
6120   return manage(res);
6121 }
6122 
detect_equalities()6123 isl::basic_map basic_map::detect_equalities() const
6124 {
6125   if (!ptr)
6126     exception::throw_invalid("NULL input", __FILE__, __LINE__);
6127   auto saved_ctx = ctx();
6128   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6129   auto res = isl_basic_map_detect_equalities(copy());
6130   if (!res)
6131     exception::throw_last_error(saved_ctx);
6132   return manage(res);
6133 }
6134 
flatten()6135 isl::basic_map basic_map::flatten() const
6136 {
6137   if (!ptr)
6138     exception::throw_invalid("NULL input", __FILE__, __LINE__);
6139   auto saved_ctx = ctx();
6140   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6141   auto res = isl_basic_map_flatten(copy());
6142   if (!res)
6143     exception::throw_last_error(saved_ctx);
6144   return manage(res);
6145 }
6146 
flatten_domain()6147 isl::basic_map basic_map::flatten_domain() const
6148 {
6149   if (!ptr)
6150     exception::throw_invalid("NULL input", __FILE__, __LINE__);
6151   auto saved_ctx = ctx();
6152   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6153   auto res = isl_basic_map_flatten_domain(copy());
6154   if (!res)
6155     exception::throw_last_error(saved_ctx);
6156   return manage(res);
6157 }
6158 
flatten_range()6159 isl::basic_map basic_map::flatten_range() const
6160 {
6161   if (!ptr)
6162     exception::throw_invalid("NULL input", __FILE__, __LINE__);
6163   auto saved_ctx = ctx();
6164   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6165   auto res = isl_basic_map_flatten_range(copy());
6166   if (!res)
6167     exception::throw_last_error(saved_ctx);
6168   return manage(res);
6169 }
6170 
gist(isl::basic_map context)6171 isl::basic_map basic_map::gist(isl::basic_map context) const
6172 {
6173   if (!ptr || context.is_null())
6174     exception::throw_invalid("NULL input", __FILE__, __LINE__);
6175   auto saved_ctx = ctx();
6176   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6177   auto res = isl_basic_map_gist(copy(), context.release());
6178   if (!res)
6179     exception::throw_last_error(saved_ctx);
6180   return manage(res);
6181 }
6182 
intersect(isl::basic_map bmap2)6183 isl::basic_map basic_map::intersect(isl::basic_map bmap2) const
6184 {
6185   if (!ptr || bmap2.is_null())
6186     exception::throw_invalid("NULL input", __FILE__, __LINE__);
6187   auto saved_ctx = ctx();
6188   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6189   auto res = isl_basic_map_intersect(copy(), bmap2.release());
6190   if (!res)
6191     exception::throw_last_error(saved_ctx);
6192   return manage(res);
6193 }
6194 
intersect_domain(isl::basic_set bset)6195 isl::basic_map basic_map::intersect_domain(isl::basic_set bset) const
6196 {
6197   if (!ptr || bset.is_null())
6198     exception::throw_invalid("NULL input", __FILE__, __LINE__);
6199   auto saved_ctx = ctx();
6200   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6201   auto res = isl_basic_map_intersect_domain(copy(), bset.release());
6202   if (!res)
6203     exception::throw_last_error(saved_ctx);
6204   return manage(res);
6205 }
6206 
intersect_range(isl::basic_set bset)6207 isl::basic_map basic_map::intersect_range(isl::basic_set bset) const
6208 {
6209   if (!ptr || bset.is_null())
6210     exception::throw_invalid("NULL input", __FILE__, __LINE__);
6211   auto saved_ctx = ctx();
6212   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6213   auto res = isl_basic_map_intersect_range(copy(), bset.release());
6214   if (!res)
6215     exception::throw_last_error(saved_ctx);
6216   return manage(res);
6217 }
6218 
is_empty()6219 bool basic_map::is_empty() const
6220 {
6221   if (!ptr)
6222     exception::throw_invalid("NULL input", __FILE__, __LINE__);
6223   auto saved_ctx = ctx();
6224   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6225   auto res = isl_basic_map_is_empty(get());
6226   if (res < 0)
6227     exception::throw_last_error(saved_ctx);
6228   return res;
6229 }
6230 
is_equal(const isl::basic_map & bmap2)6231 bool basic_map::is_equal(const isl::basic_map &bmap2) const
6232 {
6233   if (!ptr || bmap2.is_null())
6234     exception::throw_invalid("NULL input", __FILE__, __LINE__);
6235   auto saved_ctx = ctx();
6236   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6237   auto res = isl_basic_map_is_equal(get(), bmap2.get());
6238   if (res < 0)
6239     exception::throw_last_error(saved_ctx);
6240   return res;
6241 }
6242 
is_subset(const isl::basic_map & bmap2)6243 bool basic_map::is_subset(const isl::basic_map &bmap2) const
6244 {
6245   if (!ptr || bmap2.is_null())
6246     exception::throw_invalid("NULL input", __FILE__, __LINE__);
6247   auto saved_ctx = ctx();
6248   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6249   auto res = isl_basic_map_is_subset(get(), bmap2.get());
6250   if (res < 0)
6251     exception::throw_last_error(saved_ctx);
6252   return res;
6253 }
6254 
lexmax()6255 isl::map basic_map::lexmax() const
6256 {
6257   if (!ptr)
6258     exception::throw_invalid("NULL input", __FILE__, __LINE__);
6259   auto saved_ctx = ctx();
6260   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6261   auto res = isl_basic_map_lexmax(copy());
6262   if (!res)
6263     exception::throw_last_error(saved_ctx);
6264   return manage(res);
6265 }
6266 
lexmin()6267 isl::map basic_map::lexmin() const
6268 {
6269   if (!ptr)
6270     exception::throw_invalid("NULL input", __FILE__, __LINE__);
6271   auto saved_ctx = ctx();
6272   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6273   auto res = isl_basic_map_lexmin(copy());
6274   if (!res)
6275     exception::throw_last_error(saved_ctx);
6276   return manage(res);
6277 }
6278 
reverse()6279 isl::basic_map basic_map::reverse() const
6280 {
6281   if (!ptr)
6282     exception::throw_invalid("NULL input", __FILE__, __LINE__);
6283   auto saved_ctx = ctx();
6284   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6285   auto res = isl_basic_map_reverse(copy());
6286   if (!res)
6287     exception::throw_last_error(saved_ctx);
6288   return manage(res);
6289 }
6290 
sample()6291 isl::basic_map basic_map::sample() const
6292 {
6293   if (!ptr)
6294     exception::throw_invalid("NULL input", __FILE__, __LINE__);
6295   auto saved_ctx = ctx();
6296   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6297   auto res = isl_basic_map_sample(copy());
6298   if (!res)
6299     exception::throw_last_error(saved_ctx);
6300   return manage(res);
6301 }
6302 
unite(isl::basic_map bmap2)6303 isl::map basic_map::unite(isl::basic_map bmap2) const
6304 {
6305   if (!ptr || bmap2.is_null())
6306     exception::throw_invalid("NULL input", __FILE__, __LINE__);
6307   auto saved_ctx = ctx();
6308   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6309   auto res = isl_basic_map_union(copy(), bmap2.release());
6310   if (!res)
6311     exception::throw_last_error(saved_ctx);
6312   return manage(res);
6313 }
6314 
6315 inline std::ostream &operator<<(std::ostream &os, const basic_map &obj)
6316 {
6317   if (!obj.get())
6318     exception::throw_invalid("NULL input", __FILE__, __LINE__);
6319   auto saved_ctx = isl_basic_map_get_ctx(obj.get());
6320   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6321   char *str = isl_basic_map_to_str(obj.get());
6322   if (!str)
6323     exception::throw_last_error(saved_ctx);
6324   os << str;
6325   free(str);
6326   return os;
6327 }
6328 
6329 // implementations for isl::basic_set
manage(__isl_take isl_basic_set * ptr)6330 basic_set manage(__isl_take isl_basic_set *ptr) {
6331   if (!ptr)
6332     exception::throw_invalid("NULL input", __FILE__, __LINE__);
6333   return basic_set(ptr);
6334 }
manage_copy(__isl_keep isl_basic_set * ptr)6335 basic_set manage_copy(__isl_keep isl_basic_set *ptr) {
6336   if (!ptr)
6337     exception::throw_invalid("NULL input", __FILE__, __LINE__);
6338   auto saved_ctx = isl_basic_set_get_ctx(ptr);
6339   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6340   ptr = isl_basic_set_copy(ptr);
6341   if (!ptr)
6342     exception::throw_last_error(saved_ctx);
6343   return basic_set(ptr);
6344 }
6345 
basic_set()6346 basic_set::basic_set()
6347     : ptr(nullptr) {}
6348 
basic_set(const basic_set & obj)6349 basic_set::basic_set(const basic_set &obj)
6350     : ptr(nullptr)
6351 {
6352   if (!obj.ptr)
6353     exception::throw_invalid("NULL input", __FILE__, __LINE__);
6354   auto saved_ctx = isl_basic_set_get_ctx(obj.ptr);
6355   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6356   ptr = obj.copy();
6357   if (!ptr)
6358     exception::throw_last_error(saved_ctx);
6359 }
6360 
basic_set(__isl_take isl_basic_set * ptr)6361 basic_set::basic_set(__isl_take isl_basic_set *ptr)
6362     : ptr(ptr) {}
6363 
basic_set(isl::point pnt)6364 basic_set::basic_set(isl::point pnt)
6365 {
6366   if (pnt.is_null())
6367     exception::throw_invalid("NULL input", __FILE__, __LINE__);
6368   auto saved_ctx = pnt.ctx();
6369   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6370   auto res = isl_basic_set_from_point(pnt.release());
6371   if (!res)
6372     exception::throw_last_error(saved_ctx);
6373   ptr = res;
6374 }
6375 
basic_set(isl::ctx ctx,const std::string & str)6376 basic_set::basic_set(isl::ctx ctx, const std::string &str)
6377 {
6378   auto saved_ctx = ctx;
6379   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6380   auto res = isl_basic_set_read_from_str(ctx.release(), str.c_str());
6381   if (!res)
6382     exception::throw_last_error(saved_ctx);
6383   ptr = res;
6384 }
6385 
6386 basic_set &basic_set::operator=(basic_set obj) {
6387   std::swap(this->ptr, obj.ptr);
6388   return *this;
6389 }
6390 
~basic_set()6391 basic_set::~basic_set() {
6392   if (ptr)
6393     isl_basic_set_free(ptr);
6394 }
6395 
copy()6396 __isl_give isl_basic_set *basic_set::copy() const & {
6397   return isl_basic_set_copy(ptr);
6398 }
6399 
get()6400 __isl_keep isl_basic_set *basic_set::get() const {
6401   return ptr;
6402 }
6403 
release()6404 __isl_give isl_basic_set *basic_set::release() {
6405   isl_basic_set *tmp = ptr;
6406   ptr = nullptr;
6407   return tmp;
6408 }
6409 
is_null()6410 bool basic_set::is_null() const {
6411   return ptr == nullptr;
6412 }
6413 
ctx()6414 isl::ctx basic_set::ctx() const {
6415   return isl::ctx(isl_basic_set_get_ctx(ptr));
6416 }
6417 
affine_hull()6418 isl::basic_set basic_set::affine_hull() const
6419 {
6420   if (!ptr)
6421     exception::throw_invalid("NULL input", __FILE__, __LINE__);
6422   auto saved_ctx = ctx();
6423   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6424   auto res = isl_basic_set_affine_hull(copy());
6425   if (!res)
6426     exception::throw_last_error(saved_ctx);
6427   return manage(res);
6428 }
6429 
apply(isl::basic_map bmap)6430 isl::basic_set basic_set::apply(isl::basic_map bmap) const
6431 {
6432   if (!ptr || bmap.is_null())
6433     exception::throw_invalid("NULL input", __FILE__, __LINE__);
6434   auto saved_ctx = ctx();
6435   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6436   auto res = isl_basic_set_apply(copy(), bmap.release());
6437   if (!res)
6438     exception::throw_last_error(saved_ctx);
6439   return manage(res);
6440 }
6441 
detect_equalities()6442 isl::basic_set basic_set::detect_equalities() const
6443 {
6444   if (!ptr)
6445     exception::throw_invalid("NULL input", __FILE__, __LINE__);
6446   auto saved_ctx = ctx();
6447   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6448   auto res = isl_basic_set_detect_equalities(copy());
6449   if (!res)
6450     exception::throw_last_error(saved_ctx);
6451   return manage(res);
6452 }
6453 
dim_max_val(int pos)6454 isl::val basic_set::dim_max_val(int pos) const
6455 {
6456   if (!ptr)
6457     exception::throw_invalid("NULL input", __FILE__, __LINE__);
6458   auto saved_ctx = ctx();
6459   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6460   auto res = isl_basic_set_dim_max_val(copy(), pos);
6461   if (!res)
6462     exception::throw_last_error(saved_ctx);
6463   return manage(res);
6464 }
6465 
flatten()6466 isl::basic_set basic_set::flatten() const
6467 {
6468   if (!ptr)
6469     exception::throw_invalid("NULL input", __FILE__, __LINE__);
6470   auto saved_ctx = ctx();
6471   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6472   auto res = isl_basic_set_flatten(copy());
6473   if (!res)
6474     exception::throw_last_error(saved_ctx);
6475   return manage(res);
6476 }
6477 
gist(isl::basic_set context)6478 isl::basic_set basic_set::gist(isl::basic_set context) const
6479 {
6480   if (!ptr || context.is_null())
6481     exception::throw_invalid("NULL input", __FILE__, __LINE__);
6482   auto saved_ctx = ctx();
6483   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6484   auto res = isl_basic_set_gist(copy(), context.release());
6485   if (!res)
6486     exception::throw_last_error(saved_ctx);
6487   return manage(res);
6488 }
6489 
intersect(isl::basic_set bset2)6490 isl::basic_set basic_set::intersect(isl::basic_set bset2) const
6491 {
6492   if (!ptr || bset2.is_null())
6493     exception::throw_invalid("NULL input", __FILE__, __LINE__);
6494   auto saved_ctx = ctx();
6495   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6496   auto res = isl_basic_set_intersect(copy(), bset2.release());
6497   if (!res)
6498     exception::throw_last_error(saved_ctx);
6499   return manage(res);
6500 }
6501 
intersect_params(isl::basic_set bset2)6502 isl::basic_set basic_set::intersect_params(isl::basic_set bset2) const
6503 {
6504   if (!ptr || bset2.is_null())
6505     exception::throw_invalid("NULL input", __FILE__, __LINE__);
6506   auto saved_ctx = ctx();
6507   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6508   auto res = isl_basic_set_intersect_params(copy(), bset2.release());
6509   if (!res)
6510     exception::throw_last_error(saved_ctx);
6511   return manage(res);
6512 }
6513 
is_empty()6514 bool basic_set::is_empty() const
6515 {
6516   if (!ptr)
6517     exception::throw_invalid("NULL input", __FILE__, __LINE__);
6518   auto saved_ctx = ctx();
6519   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6520   auto res = isl_basic_set_is_empty(get());
6521   if (res < 0)
6522     exception::throw_last_error(saved_ctx);
6523   return res;
6524 }
6525 
is_equal(const isl::basic_set & bset2)6526 bool basic_set::is_equal(const isl::basic_set &bset2) const
6527 {
6528   if (!ptr || bset2.is_null())
6529     exception::throw_invalid("NULL input", __FILE__, __LINE__);
6530   auto saved_ctx = ctx();
6531   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6532   auto res = isl_basic_set_is_equal(get(), bset2.get());
6533   if (res < 0)
6534     exception::throw_last_error(saved_ctx);
6535   return res;
6536 }
6537 
is_subset(const isl::basic_set & bset2)6538 bool basic_set::is_subset(const isl::basic_set &bset2) const
6539 {
6540   if (!ptr || bset2.is_null())
6541     exception::throw_invalid("NULL input", __FILE__, __LINE__);
6542   auto saved_ctx = ctx();
6543   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6544   auto res = isl_basic_set_is_subset(get(), bset2.get());
6545   if (res < 0)
6546     exception::throw_last_error(saved_ctx);
6547   return res;
6548 }
6549 
is_wrapping()6550 bool basic_set::is_wrapping() const
6551 {
6552   if (!ptr)
6553     exception::throw_invalid("NULL input", __FILE__, __LINE__);
6554   auto saved_ctx = ctx();
6555   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6556   auto res = isl_basic_set_is_wrapping(get());
6557   if (res < 0)
6558     exception::throw_last_error(saved_ctx);
6559   return res;
6560 }
6561 
lexmax()6562 isl::set basic_set::lexmax() const
6563 {
6564   if (!ptr)
6565     exception::throw_invalid("NULL input", __FILE__, __LINE__);
6566   auto saved_ctx = ctx();
6567   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6568   auto res = isl_basic_set_lexmax(copy());
6569   if (!res)
6570     exception::throw_last_error(saved_ctx);
6571   return manage(res);
6572 }
6573 
lexmin()6574 isl::set basic_set::lexmin() const
6575 {
6576   if (!ptr)
6577     exception::throw_invalid("NULL input", __FILE__, __LINE__);
6578   auto saved_ctx = ctx();
6579   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6580   auto res = isl_basic_set_lexmin(copy());
6581   if (!res)
6582     exception::throw_last_error(saved_ctx);
6583   return manage(res);
6584 }
6585 
params()6586 isl::basic_set basic_set::params() const
6587 {
6588   if (!ptr)
6589     exception::throw_invalid("NULL input", __FILE__, __LINE__);
6590   auto saved_ctx = ctx();
6591   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6592   auto res = isl_basic_set_params(copy());
6593   if (!res)
6594     exception::throw_last_error(saved_ctx);
6595   return manage(res);
6596 }
6597 
sample()6598 isl::basic_set basic_set::sample() const
6599 {
6600   if (!ptr)
6601     exception::throw_invalid("NULL input", __FILE__, __LINE__);
6602   auto saved_ctx = ctx();
6603   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6604   auto res = isl_basic_set_sample(copy());
6605   if (!res)
6606     exception::throw_last_error(saved_ctx);
6607   return manage(res);
6608 }
6609 
sample_point()6610 isl::point basic_set::sample_point() const
6611 {
6612   if (!ptr)
6613     exception::throw_invalid("NULL input", __FILE__, __LINE__);
6614   auto saved_ctx = ctx();
6615   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6616   auto res = isl_basic_set_sample_point(copy());
6617   if (!res)
6618     exception::throw_last_error(saved_ctx);
6619   return manage(res);
6620 }
6621 
unite(isl::basic_set bset2)6622 isl::set basic_set::unite(isl::basic_set bset2) const
6623 {
6624   if (!ptr || bset2.is_null())
6625     exception::throw_invalid("NULL input", __FILE__, __LINE__);
6626   auto saved_ctx = ctx();
6627   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6628   auto res = isl_basic_set_union(copy(), bset2.release());
6629   if (!res)
6630     exception::throw_last_error(saved_ctx);
6631   return manage(res);
6632 }
6633 
6634 inline std::ostream &operator<<(std::ostream &os, const basic_set &obj)
6635 {
6636   if (!obj.get())
6637     exception::throw_invalid("NULL input", __FILE__, __LINE__);
6638   auto saved_ctx = isl_basic_set_get_ctx(obj.get());
6639   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6640   char *str = isl_basic_set_to_str(obj.get());
6641   if (!str)
6642     exception::throw_last_error(saved_ctx);
6643   os << str;
6644   free(str);
6645   return os;
6646 }
6647 
6648 // implementations for isl::fixed_box
manage(__isl_take isl_fixed_box * ptr)6649 fixed_box manage(__isl_take isl_fixed_box *ptr) {
6650   if (!ptr)
6651     exception::throw_invalid("NULL input", __FILE__, __LINE__);
6652   return fixed_box(ptr);
6653 }
manage_copy(__isl_keep isl_fixed_box * ptr)6654 fixed_box manage_copy(__isl_keep isl_fixed_box *ptr) {
6655   if (!ptr)
6656     exception::throw_invalid("NULL input", __FILE__, __LINE__);
6657   auto saved_ctx = isl_fixed_box_get_ctx(ptr);
6658   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6659   ptr = isl_fixed_box_copy(ptr);
6660   if (!ptr)
6661     exception::throw_last_error(saved_ctx);
6662   return fixed_box(ptr);
6663 }
6664 
fixed_box()6665 fixed_box::fixed_box()
6666     : ptr(nullptr) {}
6667 
fixed_box(const fixed_box & obj)6668 fixed_box::fixed_box(const fixed_box &obj)
6669     : ptr(nullptr)
6670 {
6671   if (!obj.ptr)
6672     exception::throw_invalid("NULL input", __FILE__, __LINE__);
6673   auto saved_ctx = isl_fixed_box_get_ctx(obj.ptr);
6674   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6675   ptr = obj.copy();
6676   if (!ptr)
6677     exception::throw_last_error(saved_ctx);
6678 }
6679 
fixed_box(__isl_take isl_fixed_box * ptr)6680 fixed_box::fixed_box(__isl_take isl_fixed_box *ptr)
6681     : ptr(ptr) {}
6682 
6683 fixed_box &fixed_box::operator=(fixed_box obj) {
6684   std::swap(this->ptr, obj.ptr);
6685   return *this;
6686 }
6687 
~fixed_box()6688 fixed_box::~fixed_box() {
6689   if (ptr)
6690     isl_fixed_box_free(ptr);
6691 }
6692 
copy()6693 __isl_give isl_fixed_box *fixed_box::copy() const & {
6694   return isl_fixed_box_copy(ptr);
6695 }
6696 
get()6697 __isl_keep isl_fixed_box *fixed_box::get() const {
6698   return ptr;
6699 }
6700 
release()6701 __isl_give isl_fixed_box *fixed_box::release() {
6702   isl_fixed_box *tmp = ptr;
6703   ptr = nullptr;
6704   return tmp;
6705 }
6706 
is_null()6707 bool fixed_box::is_null() const {
6708   return ptr == nullptr;
6709 }
6710 
ctx()6711 isl::ctx fixed_box::ctx() const {
6712   return isl::ctx(isl_fixed_box_get_ctx(ptr));
6713 }
6714 
offset()6715 isl::multi_aff fixed_box::offset() const
6716 {
6717   if (!ptr)
6718     exception::throw_invalid("NULL input", __FILE__, __LINE__);
6719   auto saved_ctx = ctx();
6720   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6721   auto res = isl_fixed_box_get_offset(get());
6722   if (!res)
6723     exception::throw_last_error(saved_ctx);
6724   return manage(res);
6725 }
6726 
get_offset()6727 isl::multi_aff fixed_box::get_offset() const
6728 {
6729   return offset();
6730 }
6731 
size()6732 isl::multi_val fixed_box::size() const
6733 {
6734   if (!ptr)
6735     exception::throw_invalid("NULL input", __FILE__, __LINE__);
6736   auto saved_ctx = ctx();
6737   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6738   auto res = isl_fixed_box_get_size(get());
6739   if (!res)
6740     exception::throw_last_error(saved_ctx);
6741   return manage(res);
6742 }
6743 
get_size()6744 isl::multi_val fixed_box::get_size() const
6745 {
6746   return size();
6747 }
6748 
space()6749 isl::space fixed_box::space() const
6750 {
6751   if (!ptr)
6752     exception::throw_invalid("NULL input", __FILE__, __LINE__);
6753   auto saved_ctx = ctx();
6754   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6755   auto res = isl_fixed_box_get_space(get());
6756   if (!res)
6757     exception::throw_last_error(saved_ctx);
6758   return manage(res);
6759 }
6760 
get_space()6761 isl::space fixed_box::get_space() const
6762 {
6763   return space();
6764 }
6765 
is_valid()6766 bool fixed_box::is_valid() const
6767 {
6768   if (!ptr)
6769     exception::throw_invalid("NULL input", __FILE__, __LINE__);
6770   auto saved_ctx = ctx();
6771   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6772   auto res = isl_fixed_box_is_valid(get());
6773   if (res < 0)
6774     exception::throw_last_error(saved_ctx);
6775   return res;
6776 }
6777 
6778 inline std::ostream &operator<<(std::ostream &os, const fixed_box &obj)
6779 {
6780   if (!obj.get())
6781     exception::throw_invalid("NULL input", __FILE__, __LINE__);
6782   auto saved_ctx = isl_fixed_box_get_ctx(obj.get());
6783   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6784   char *str = isl_fixed_box_to_str(obj.get());
6785   if (!str)
6786     exception::throw_last_error(saved_ctx);
6787   os << str;
6788   free(str);
6789   return os;
6790 }
6791 
6792 // implementations for isl::id
manage(__isl_take isl_id * ptr)6793 id manage(__isl_take isl_id *ptr) {
6794   if (!ptr)
6795     exception::throw_invalid("NULL input", __FILE__, __LINE__);
6796   return id(ptr);
6797 }
manage_copy(__isl_keep isl_id * ptr)6798 id manage_copy(__isl_keep isl_id *ptr) {
6799   if (!ptr)
6800     exception::throw_invalid("NULL input", __FILE__, __LINE__);
6801   auto saved_ctx = isl_id_get_ctx(ptr);
6802   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6803   ptr = isl_id_copy(ptr);
6804   if (!ptr)
6805     exception::throw_last_error(saved_ctx);
6806   return id(ptr);
6807 }
6808 
id()6809 id::id()
6810     : ptr(nullptr) {}
6811 
id(const id & obj)6812 id::id(const id &obj)
6813     : ptr(nullptr)
6814 {
6815   if (!obj.ptr)
6816     exception::throw_invalid("NULL input", __FILE__, __LINE__);
6817   auto saved_ctx = isl_id_get_ctx(obj.ptr);
6818   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6819   ptr = obj.copy();
6820   if (!ptr)
6821     exception::throw_last_error(saved_ctx);
6822 }
6823 
id(__isl_take isl_id * ptr)6824 id::id(__isl_take isl_id *ptr)
6825     : ptr(ptr) {}
6826 
id(isl::ctx ctx,const std::string & str)6827 id::id(isl::ctx ctx, const std::string &str)
6828 {
6829   auto saved_ctx = ctx;
6830   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6831   auto res = isl_id_read_from_str(ctx.release(), str.c_str());
6832   if (!res)
6833     exception::throw_last_error(saved_ctx);
6834   ptr = res;
6835 }
6836 
6837 id &id::operator=(id obj) {
6838   std::swap(this->ptr, obj.ptr);
6839   return *this;
6840 }
6841 
~id()6842 id::~id() {
6843   if (ptr)
6844     isl_id_free(ptr);
6845 }
6846 
copy()6847 __isl_give isl_id *id::copy() const & {
6848   return isl_id_copy(ptr);
6849 }
6850 
get()6851 __isl_keep isl_id *id::get() const {
6852   return ptr;
6853 }
6854 
release()6855 __isl_give isl_id *id::release() {
6856   isl_id *tmp = ptr;
6857   ptr = nullptr;
6858   return tmp;
6859 }
6860 
is_null()6861 bool id::is_null() const {
6862   return ptr == nullptr;
6863 }
6864 
ctx()6865 isl::ctx id::ctx() const {
6866   return isl::ctx(isl_id_get_ctx(ptr));
6867 }
6868 
name()6869 std::string id::name() const
6870 {
6871   if (!ptr)
6872     exception::throw_invalid("NULL input", __FILE__, __LINE__);
6873   auto saved_ctx = ctx();
6874   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6875   auto res = isl_id_get_name(get());
6876   std::string tmp(res);
6877   return tmp;
6878 }
6879 
get_name()6880 std::string id::get_name() const
6881 {
6882   return name();
6883 }
6884 
6885 inline std::ostream &operator<<(std::ostream &os, const id &obj)
6886 {
6887   if (!obj.get())
6888     exception::throw_invalid("NULL input", __FILE__, __LINE__);
6889   auto saved_ctx = isl_id_get_ctx(obj.get());
6890   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6891   char *str = isl_id_to_str(obj.get());
6892   if (!str)
6893     exception::throw_last_error(saved_ctx);
6894   os << str;
6895   free(str);
6896   return os;
6897 }
6898 
6899 // implementations for isl::id_list
manage(__isl_take isl_id_list * ptr)6900 id_list manage(__isl_take isl_id_list *ptr) {
6901   if (!ptr)
6902     exception::throw_invalid("NULL input", __FILE__, __LINE__);
6903   return id_list(ptr);
6904 }
manage_copy(__isl_keep isl_id_list * ptr)6905 id_list manage_copy(__isl_keep isl_id_list *ptr) {
6906   if (!ptr)
6907     exception::throw_invalid("NULL input", __FILE__, __LINE__);
6908   auto saved_ctx = isl_id_list_get_ctx(ptr);
6909   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6910   ptr = isl_id_list_copy(ptr);
6911   if (!ptr)
6912     exception::throw_last_error(saved_ctx);
6913   return id_list(ptr);
6914 }
6915 
id_list()6916 id_list::id_list()
6917     : ptr(nullptr) {}
6918 
id_list(const id_list & obj)6919 id_list::id_list(const id_list &obj)
6920     : ptr(nullptr)
6921 {
6922   if (!obj.ptr)
6923     exception::throw_invalid("NULL input", __FILE__, __LINE__);
6924   auto saved_ctx = isl_id_list_get_ctx(obj.ptr);
6925   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6926   ptr = obj.copy();
6927   if (!ptr)
6928     exception::throw_last_error(saved_ctx);
6929 }
6930 
id_list(__isl_take isl_id_list * ptr)6931 id_list::id_list(__isl_take isl_id_list *ptr)
6932     : ptr(ptr) {}
6933 
id_list(isl::ctx ctx,int n)6934 id_list::id_list(isl::ctx ctx, int n)
6935 {
6936   auto saved_ctx = ctx;
6937   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6938   auto res = isl_id_list_alloc(ctx.release(), n);
6939   if (!res)
6940     exception::throw_last_error(saved_ctx);
6941   ptr = res;
6942 }
6943 
id_list(isl::id el)6944 id_list::id_list(isl::id el)
6945 {
6946   if (el.is_null())
6947     exception::throw_invalid("NULL input", __FILE__, __LINE__);
6948   auto saved_ctx = el.ctx();
6949   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6950   auto res = isl_id_list_from_id(el.release());
6951   if (!res)
6952     exception::throw_last_error(saved_ctx);
6953   ptr = res;
6954 }
6955 
6956 id_list &id_list::operator=(id_list obj) {
6957   std::swap(this->ptr, obj.ptr);
6958   return *this;
6959 }
6960 
~id_list()6961 id_list::~id_list() {
6962   if (ptr)
6963     isl_id_list_free(ptr);
6964 }
6965 
copy()6966 __isl_give isl_id_list *id_list::copy() const & {
6967   return isl_id_list_copy(ptr);
6968 }
6969 
get()6970 __isl_keep isl_id_list *id_list::get() const {
6971   return ptr;
6972 }
6973 
release()6974 __isl_give isl_id_list *id_list::release() {
6975   isl_id_list *tmp = ptr;
6976   ptr = nullptr;
6977   return tmp;
6978 }
6979 
is_null()6980 bool id_list::is_null() const {
6981   return ptr == nullptr;
6982 }
6983 
ctx()6984 isl::ctx id_list::ctx() const {
6985   return isl::ctx(isl_id_list_get_ctx(ptr));
6986 }
6987 
add(isl::id el)6988 isl::id_list id_list::add(isl::id el) const
6989 {
6990   if (!ptr || el.is_null())
6991     exception::throw_invalid("NULL input", __FILE__, __LINE__);
6992   auto saved_ctx = ctx();
6993   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
6994   auto res = isl_id_list_add(copy(), el.release());
6995   if (!res)
6996     exception::throw_last_error(saved_ctx);
6997   return manage(res);
6998 }
6999 
add(const std::string & el)7000 isl::id_list id_list::add(const std::string &el) const
7001 {
7002   if (!ptr)
7003     exception::throw_invalid("NULL input", __FILE__, __LINE__);
7004   return this->add(isl::id(ctx(), el));
7005 }
7006 
clear()7007 isl::id_list id_list::clear() const
7008 {
7009   if (!ptr)
7010     exception::throw_invalid("NULL input", __FILE__, __LINE__);
7011   auto saved_ctx = ctx();
7012   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7013   auto res = isl_id_list_clear(copy());
7014   if (!res)
7015     exception::throw_last_error(saved_ctx);
7016   return manage(res);
7017 }
7018 
concat(isl::id_list list2)7019 isl::id_list id_list::concat(isl::id_list list2) const
7020 {
7021   if (!ptr || list2.is_null())
7022     exception::throw_invalid("NULL input", __FILE__, __LINE__);
7023   auto saved_ctx = ctx();
7024   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7025   auto res = isl_id_list_concat(copy(), list2.release());
7026   if (!res)
7027     exception::throw_last_error(saved_ctx);
7028   return manage(res);
7029 }
7030 
foreach(const std::function<void (isl::id)> & fn)7031 void id_list::foreach(const std::function<void(isl::id)> &fn) const
7032 {
7033   if (!ptr)
7034     exception::throw_invalid("NULL input", __FILE__, __LINE__);
7035   auto saved_ctx = ctx();
7036   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7037   struct fn_data {
7038     std::function<void(isl::id)> func;
7039     std::exception_ptr eptr;
7040   } fn_data = { fn };
7041   auto fn_lambda = [](isl_id *arg_0, void *arg_1) -> isl_stat {
7042     auto *data = static_cast<struct fn_data *>(arg_1);
7043     ISL_CPP_TRY {
7044       (data->func)(manage(arg_0));
7045       return isl_stat_ok;
7046     } ISL_CPP_CATCH_ALL {
7047       data->eptr = std::current_exception();
7048       return isl_stat_error;
7049     }
7050   };
7051   auto res = isl_id_list_foreach(get(), fn_lambda, &fn_data);
7052   if (fn_data.eptr)
7053     std::rethrow_exception(fn_data.eptr);
7054   if (res < 0)
7055     exception::throw_last_error(saved_ctx);
7056   return;
7057 }
7058 
at(int index)7059 isl::id id_list::at(int index) const
7060 {
7061   if (!ptr)
7062     exception::throw_invalid("NULL input", __FILE__, __LINE__);
7063   auto saved_ctx = ctx();
7064   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7065   auto res = isl_id_list_get_at(get(), index);
7066   if (!res)
7067     exception::throw_last_error(saved_ctx);
7068   return manage(res);
7069 }
7070 
get_at(int index)7071 isl::id id_list::get_at(int index) const
7072 {
7073   return at(index);
7074 }
7075 
size()7076 unsigned id_list::size() const
7077 {
7078   if (!ptr)
7079     exception::throw_invalid("NULL input", __FILE__, __LINE__);
7080   auto saved_ctx = ctx();
7081   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7082   auto res = isl_id_list_size(get());
7083   if (res < 0)
7084     exception::throw_last_error(saved_ctx);
7085   return res;
7086 }
7087 
7088 inline std::ostream &operator<<(std::ostream &os, const id_list &obj)
7089 {
7090   if (!obj.get())
7091     exception::throw_invalid("NULL input", __FILE__, __LINE__);
7092   auto saved_ctx = isl_id_list_get_ctx(obj.get());
7093   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7094   char *str = isl_id_list_to_str(obj.get());
7095   if (!str)
7096     exception::throw_last_error(saved_ctx);
7097   os << str;
7098   free(str);
7099   return os;
7100 }
7101 
7102 // implementations for isl::map
manage(__isl_take isl_map * ptr)7103 map manage(__isl_take isl_map *ptr) {
7104   if (!ptr)
7105     exception::throw_invalid("NULL input", __FILE__, __LINE__);
7106   return map(ptr);
7107 }
manage_copy(__isl_keep isl_map * ptr)7108 map manage_copy(__isl_keep isl_map *ptr) {
7109   if (!ptr)
7110     exception::throw_invalid("NULL input", __FILE__, __LINE__);
7111   auto saved_ctx = isl_map_get_ctx(ptr);
7112   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7113   ptr = isl_map_copy(ptr);
7114   if (!ptr)
7115     exception::throw_last_error(saved_ctx);
7116   return map(ptr);
7117 }
7118 
map()7119 map::map()
7120     : ptr(nullptr) {}
7121 
map(const map & obj)7122 map::map(const map &obj)
7123     : ptr(nullptr)
7124 {
7125   if (!obj.ptr)
7126     exception::throw_invalid("NULL input", __FILE__, __LINE__);
7127   auto saved_ctx = isl_map_get_ctx(obj.ptr);
7128   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7129   ptr = obj.copy();
7130   if (!ptr)
7131     exception::throw_last_error(saved_ctx);
7132 }
7133 
map(__isl_take isl_map * ptr)7134 map::map(__isl_take isl_map *ptr)
7135     : ptr(ptr) {}
7136 
map(isl::basic_map bmap)7137 map::map(isl::basic_map bmap)
7138 {
7139   if (bmap.is_null())
7140     exception::throw_invalid("NULL input", __FILE__, __LINE__);
7141   auto saved_ctx = bmap.ctx();
7142   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7143   auto res = isl_map_from_basic_map(bmap.release());
7144   if (!res)
7145     exception::throw_last_error(saved_ctx);
7146   ptr = res;
7147 }
7148 
map(isl::ctx ctx,const std::string & str)7149 map::map(isl::ctx ctx, const std::string &str)
7150 {
7151   auto saved_ctx = ctx;
7152   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7153   auto res = isl_map_read_from_str(ctx.release(), str.c_str());
7154   if (!res)
7155     exception::throw_last_error(saved_ctx);
7156   ptr = res;
7157 }
7158 
7159 map &map::operator=(map obj) {
7160   std::swap(this->ptr, obj.ptr);
7161   return *this;
7162 }
7163 
~map()7164 map::~map() {
7165   if (ptr)
7166     isl_map_free(ptr);
7167 }
7168 
copy()7169 __isl_give isl_map *map::copy() const & {
7170   return isl_map_copy(ptr);
7171 }
7172 
get()7173 __isl_keep isl_map *map::get() const {
7174   return ptr;
7175 }
7176 
release()7177 __isl_give isl_map *map::release() {
7178   isl_map *tmp = ptr;
7179   ptr = nullptr;
7180   return tmp;
7181 }
7182 
is_null()7183 bool map::is_null() const {
7184   return ptr == nullptr;
7185 }
7186 
ctx()7187 isl::ctx map::ctx() const {
7188   return isl::ctx(isl_map_get_ctx(ptr));
7189 }
7190 
affine_hull()7191 isl::basic_map map::affine_hull() const
7192 {
7193   if (!ptr)
7194     exception::throw_invalid("NULL input", __FILE__, __LINE__);
7195   auto saved_ctx = ctx();
7196   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7197   auto res = isl_map_affine_hull(copy());
7198   if (!res)
7199     exception::throw_last_error(saved_ctx);
7200   return manage(res);
7201 }
7202 
apply_domain(isl::map map2)7203 isl::map map::apply_domain(isl::map map2) const
7204 {
7205   if (!ptr || map2.is_null())
7206     exception::throw_invalid("NULL input", __FILE__, __LINE__);
7207   auto saved_ctx = ctx();
7208   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7209   auto res = isl_map_apply_domain(copy(), map2.release());
7210   if (!res)
7211     exception::throw_last_error(saved_ctx);
7212   return manage(res);
7213 }
7214 
apply_range(isl::map map2)7215 isl::map map::apply_range(isl::map map2) const
7216 {
7217   if (!ptr || map2.is_null())
7218     exception::throw_invalid("NULL input", __FILE__, __LINE__);
7219   auto saved_ctx = ctx();
7220   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7221   auto res = isl_map_apply_range(copy(), map2.release());
7222   if (!res)
7223     exception::throw_last_error(saved_ctx);
7224   return manage(res);
7225 }
7226 
bind_domain(isl::multi_id tuple)7227 isl::set map::bind_domain(isl::multi_id tuple) const
7228 {
7229   if (!ptr || tuple.is_null())
7230     exception::throw_invalid("NULL input", __FILE__, __LINE__);
7231   auto saved_ctx = ctx();
7232   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7233   auto res = isl_map_bind_domain(copy(), tuple.release());
7234   if (!res)
7235     exception::throw_last_error(saved_ctx);
7236   return manage(res);
7237 }
7238 
bind_range(isl::multi_id tuple)7239 isl::set map::bind_range(isl::multi_id tuple) const
7240 {
7241   if (!ptr || tuple.is_null())
7242     exception::throw_invalid("NULL input", __FILE__, __LINE__);
7243   auto saved_ctx = ctx();
7244   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7245   auto res = isl_map_bind_range(copy(), tuple.release());
7246   if (!res)
7247     exception::throw_last_error(saved_ctx);
7248   return manage(res);
7249 }
7250 
coalesce()7251 isl::map map::coalesce() const
7252 {
7253   if (!ptr)
7254     exception::throw_invalid("NULL input", __FILE__, __LINE__);
7255   auto saved_ctx = ctx();
7256   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7257   auto res = isl_map_coalesce(copy());
7258   if (!res)
7259     exception::throw_last_error(saved_ctx);
7260   return manage(res);
7261 }
7262 
complement()7263 isl::map map::complement() const
7264 {
7265   if (!ptr)
7266     exception::throw_invalid("NULL input", __FILE__, __LINE__);
7267   auto saved_ctx = ctx();
7268   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7269   auto res = isl_map_complement(copy());
7270   if (!res)
7271     exception::throw_last_error(saved_ctx);
7272   return manage(res);
7273 }
7274 
curry()7275 isl::map map::curry() const
7276 {
7277   if (!ptr)
7278     exception::throw_invalid("NULL input", __FILE__, __LINE__);
7279   auto saved_ctx = ctx();
7280   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7281   auto res = isl_map_curry(copy());
7282   if (!res)
7283     exception::throw_last_error(saved_ctx);
7284   return manage(res);
7285 }
7286 
deltas()7287 isl::set map::deltas() const
7288 {
7289   if (!ptr)
7290     exception::throw_invalid("NULL input", __FILE__, __LINE__);
7291   auto saved_ctx = ctx();
7292   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7293   auto res = isl_map_deltas(copy());
7294   if (!res)
7295     exception::throw_last_error(saved_ctx);
7296   return manage(res);
7297 }
7298 
detect_equalities()7299 isl::map map::detect_equalities() const
7300 {
7301   if (!ptr)
7302     exception::throw_invalid("NULL input", __FILE__, __LINE__);
7303   auto saved_ctx = ctx();
7304   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7305   auto res = isl_map_detect_equalities(copy());
7306   if (!res)
7307     exception::throw_last_error(saved_ctx);
7308   return manage(res);
7309 }
7310 
domain()7311 isl::set map::domain() const
7312 {
7313   if (!ptr)
7314     exception::throw_invalid("NULL input", __FILE__, __LINE__);
7315   auto saved_ctx = ctx();
7316   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7317   auto res = isl_map_domain(copy());
7318   if (!res)
7319     exception::throw_last_error(saved_ctx);
7320   return manage(res);
7321 }
7322 
domain_factor_domain()7323 isl::map map::domain_factor_domain() const
7324 {
7325   if (!ptr)
7326     exception::throw_invalid("NULL input", __FILE__, __LINE__);
7327   auto saved_ctx = ctx();
7328   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7329   auto res = isl_map_domain_factor_domain(copy());
7330   if (!res)
7331     exception::throw_last_error(saved_ctx);
7332   return manage(res);
7333 }
7334 
domain_factor_range()7335 isl::map map::domain_factor_range() const
7336 {
7337   if (!ptr)
7338     exception::throw_invalid("NULL input", __FILE__, __LINE__);
7339   auto saved_ctx = ctx();
7340   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7341   auto res = isl_map_domain_factor_range(copy());
7342   if (!res)
7343     exception::throw_last_error(saved_ctx);
7344   return manage(res);
7345 }
7346 
domain_product(isl::map map2)7347 isl::map map::domain_product(isl::map map2) const
7348 {
7349   if (!ptr || map2.is_null())
7350     exception::throw_invalid("NULL input", __FILE__, __LINE__);
7351   auto saved_ctx = ctx();
7352   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7353   auto res = isl_map_domain_product(copy(), map2.release());
7354   if (!res)
7355     exception::throw_last_error(saved_ctx);
7356   return manage(res);
7357 }
7358 
empty(isl::space space)7359 isl::map map::empty(isl::space space)
7360 {
7361   if (space.is_null())
7362     exception::throw_invalid("NULL input", __FILE__, __LINE__);
7363   auto saved_ctx = space.ctx();
7364   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7365   auto res = isl_map_empty(space.release());
7366   if (!res)
7367     exception::throw_last_error(saved_ctx);
7368   return manage(res);
7369 }
7370 
factor_domain()7371 isl::map map::factor_domain() const
7372 {
7373   if (!ptr)
7374     exception::throw_invalid("NULL input", __FILE__, __LINE__);
7375   auto saved_ctx = ctx();
7376   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7377   auto res = isl_map_factor_domain(copy());
7378   if (!res)
7379     exception::throw_last_error(saved_ctx);
7380   return manage(res);
7381 }
7382 
factor_range()7383 isl::map map::factor_range() const
7384 {
7385   if (!ptr)
7386     exception::throw_invalid("NULL input", __FILE__, __LINE__);
7387   auto saved_ctx = ctx();
7388   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7389   auto res = isl_map_factor_range(copy());
7390   if (!res)
7391     exception::throw_last_error(saved_ctx);
7392   return manage(res);
7393 }
7394 
flatten()7395 isl::map map::flatten() const
7396 {
7397   if (!ptr)
7398     exception::throw_invalid("NULL input", __FILE__, __LINE__);
7399   auto saved_ctx = ctx();
7400   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7401   auto res = isl_map_flatten(copy());
7402   if (!res)
7403     exception::throw_last_error(saved_ctx);
7404   return manage(res);
7405 }
7406 
flatten_domain()7407 isl::map map::flatten_domain() const
7408 {
7409   if (!ptr)
7410     exception::throw_invalid("NULL input", __FILE__, __LINE__);
7411   auto saved_ctx = ctx();
7412   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7413   auto res = isl_map_flatten_domain(copy());
7414   if (!res)
7415     exception::throw_last_error(saved_ctx);
7416   return manage(res);
7417 }
7418 
flatten_range()7419 isl::map map::flatten_range() const
7420 {
7421   if (!ptr)
7422     exception::throw_invalid("NULL input", __FILE__, __LINE__);
7423   auto saved_ctx = ctx();
7424   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7425   auto res = isl_map_flatten_range(copy());
7426   if (!res)
7427     exception::throw_last_error(saved_ctx);
7428   return manage(res);
7429 }
7430 
foreach_basic_map(const std::function<void (isl::basic_map)> & fn)7431 void map::foreach_basic_map(const std::function<void(isl::basic_map)> &fn) const
7432 {
7433   if (!ptr)
7434     exception::throw_invalid("NULL input", __FILE__, __LINE__);
7435   auto saved_ctx = ctx();
7436   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7437   struct fn_data {
7438     std::function<void(isl::basic_map)> func;
7439     std::exception_ptr eptr;
7440   } fn_data = { fn };
7441   auto fn_lambda = [](isl_basic_map *arg_0, void *arg_1) -> isl_stat {
7442     auto *data = static_cast<struct fn_data *>(arg_1);
7443     ISL_CPP_TRY {
7444       (data->func)(manage(arg_0));
7445       return isl_stat_ok;
7446     } ISL_CPP_CATCH_ALL {
7447       data->eptr = std::current_exception();
7448       return isl_stat_error;
7449     }
7450   };
7451   auto res = isl_map_foreach_basic_map(get(), fn_lambda, &fn_data);
7452   if (fn_data.eptr)
7453     std::rethrow_exception(fn_data.eptr);
7454   if (res < 0)
7455     exception::throw_last_error(saved_ctx);
7456   return;
7457 }
7458 
range_simple_fixed_box_hull()7459 isl::fixed_box map::range_simple_fixed_box_hull() const
7460 {
7461   if (!ptr)
7462     exception::throw_invalid("NULL input", __FILE__, __LINE__);
7463   auto saved_ctx = ctx();
7464   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7465   auto res = isl_map_get_range_simple_fixed_box_hull(get());
7466   if (!res)
7467     exception::throw_last_error(saved_ctx);
7468   return manage(res);
7469 }
7470 
get_range_simple_fixed_box_hull()7471 isl::fixed_box map::get_range_simple_fixed_box_hull() const
7472 {
7473   return range_simple_fixed_box_hull();
7474 }
7475 
space()7476 isl::space map::space() const
7477 {
7478   if (!ptr)
7479     exception::throw_invalid("NULL input", __FILE__, __LINE__);
7480   auto saved_ctx = ctx();
7481   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7482   auto res = isl_map_get_space(get());
7483   if (!res)
7484     exception::throw_last_error(saved_ctx);
7485   return manage(res);
7486 }
7487 
get_space()7488 isl::space map::get_space() const
7489 {
7490   return space();
7491 }
7492 
gist(isl::map context)7493 isl::map map::gist(isl::map context) const
7494 {
7495   if (!ptr || context.is_null())
7496     exception::throw_invalid("NULL input", __FILE__, __LINE__);
7497   auto saved_ctx = ctx();
7498   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7499   auto res = isl_map_gist(copy(), context.release());
7500   if (!res)
7501     exception::throw_last_error(saved_ctx);
7502   return manage(res);
7503 }
7504 
gist_domain(isl::set context)7505 isl::map map::gist_domain(isl::set context) const
7506 {
7507   if (!ptr || context.is_null())
7508     exception::throw_invalid("NULL input", __FILE__, __LINE__);
7509   auto saved_ctx = ctx();
7510   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7511   auto res = isl_map_gist_domain(copy(), context.release());
7512   if (!res)
7513     exception::throw_last_error(saved_ctx);
7514   return manage(res);
7515 }
7516 
intersect(isl::map map2)7517 isl::map map::intersect(isl::map map2) const
7518 {
7519   if (!ptr || map2.is_null())
7520     exception::throw_invalid("NULL input", __FILE__, __LINE__);
7521   auto saved_ctx = ctx();
7522   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7523   auto res = isl_map_intersect(copy(), map2.release());
7524   if (!res)
7525     exception::throw_last_error(saved_ctx);
7526   return manage(res);
7527 }
7528 
intersect_domain(isl::set set)7529 isl::map map::intersect_domain(isl::set set) const
7530 {
7531   if (!ptr || set.is_null())
7532     exception::throw_invalid("NULL input", __FILE__, __LINE__);
7533   auto saved_ctx = ctx();
7534   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7535   auto res = isl_map_intersect_domain(copy(), set.release());
7536   if (!res)
7537     exception::throw_last_error(saved_ctx);
7538   return manage(res);
7539 }
7540 
intersect_params(isl::set params)7541 isl::map map::intersect_params(isl::set params) const
7542 {
7543   if (!ptr || params.is_null())
7544     exception::throw_invalid("NULL input", __FILE__, __LINE__);
7545   auto saved_ctx = ctx();
7546   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7547   auto res = isl_map_intersect_params(copy(), params.release());
7548   if (!res)
7549     exception::throw_last_error(saved_ctx);
7550   return manage(res);
7551 }
7552 
intersect_range(isl::set set)7553 isl::map map::intersect_range(isl::set set) const
7554 {
7555   if (!ptr || set.is_null())
7556     exception::throw_invalid("NULL input", __FILE__, __LINE__);
7557   auto saved_ctx = ctx();
7558   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7559   auto res = isl_map_intersect_range(copy(), set.release());
7560   if (!res)
7561     exception::throw_last_error(saved_ctx);
7562   return manage(res);
7563 }
7564 
is_bijective()7565 bool map::is_bijective() const
7566 {
7567   if (!ptr)
7568     exception::throw_invalid("NULL input", __FILE__, __LINE__);
7569   auto saved_ctx = ctx();
7570   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7571   auto res = isl_map_is_bijective(get());
7572   if (res < 0)
7573     exception::throw_last_error(saved_ctx);
7574   return res;
7575 }
7576 
is_disjoint(const isl::map & map2)7577 bool map::is_disjoint(const isl::map &map2) const
7578 {
7579   if (!ptr || map2.is_null())
7580     exception::throw_invalid("NULL input", __FILE__, __LINE__);
7581   auto saved_ctx = ctx();
7582   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7583   auto res = isl_map_is_disjoint(get(), map2.get());
7584   if (res < 0)
7585     exception::throw_last_error(saved_ctx);
7586   return res;
7587 }
7588 
is_empty()7589 bool map::is_empty() const
7590 {
7591   if (!ptr)
7592     exception::throw_invalid("NULL input", __FILE__, __LINE__);
7593   auto saved_ctx = ctx();
7594   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7595   auto res = isl_map_is_empty(get());
7596   if (res < 0)
7597     exception::throw_last_error(saved_ctx);
7598   return res;
7599 }
7600 
is_equal(const isl::map & map2)7601 bool map::is_equal(const isl::map &map2) const
7602 {
7603   if (!ptr || map2.is_null())
7604     exception::throw_invalid("NULL input", __FILE__, __LINE__);
7605   auto saved_ctx = ctx();
7606   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7607   auto res = isl_map_is_equal(get(), map2.get());
7608   if (res < 0)
7609     exception::throw_last_error(saved_ctx);
7610   return res;
7611 }
7612 
is_injective()7613 bool map::is_injective() const
7614 {
7615   if (!ptr)
7616     exception::throw_invalid("NULL input", __FILE__, __LINE__);
7617   auto saved_ctx = ctx();
7618   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7619   auto res = isl_map_is_injective(get());
7620   if (res < 0)
7621     exception::throw_last_error(saved_ctx);
7622   return res;
7623 }
7624 
is_single_valued()7625 bool map::is_single_valued() const
7626 {
7627   if (!ptr)
7628     exception::throw_invalid("NULL input", __FILE__, __LINE__);
7629   auto saved_ctx = ctx();
7630   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7631   auto res = isl_map_is_single_valued(get());
7632   if (res < 0)
7633     exception::throw_last_error(saved_ctx);
7634   return res;
7635 }
7636 
is_strict_subset(const isl::map & map2)7637 bool map::is_strict_subset(const isl::map &map2) const
7638 {
7639   if (!ptr || map2.is_null())
7640     exception::throw_invalid("NULL input", __FILE__, __LINE__);
7641   auto saved_ctx = ctx();
7642   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7643   auto res = isl_map_is_strict_subset(get(), map2.get());
7644   if (res < 0)
7645     exception::throw_last_error(saved_ctx);
7646   return res;
7647 }
7648 
is_subset(const isl::map & map2)7649 bool map::is_subset(const isl::map &map2) const
7650 {
7651   if (!ptr || map2.is_null())
7652     exception::throw_invalid("NULL input", __FILE__, __LINE__);
7653   auto saved_ctx = ctx();
7654   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7655   auto res = isl_map_is_subset(get(), map2.get());
7656   if (res < 0)
7657     exception::throw_last_error(saved_ctx);
7658   return res;
7659 }
7660 
lexmax()7661 isl::map map::lexmax() const
7662 {
7663   if (!ptr)
7664     exception::throw_invalid("NULL input", __FILE__, __LINE__);
7665   auto saved_ctx = ctx();
7666   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7667   auto res = isl_map_lexmax(copy());
7668   if (!res)
7669     exception::throw_last_error(saved_ctx);
7670   return manage(res);
7671 }
7672 
lexmax_pw_multi_aff()7673 isl::pw_multi_aff map::lexmax_pw_multi_aff() const
7674 {
7675   if (!ptr)
7676     exception::throw_invalid("NULL input", __FILE__, __LINE__);
7677   auto saved_ctx = ctx();
7678   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7679   auto res = isl_map_lexmax_pw_multi_aff(copy());
7680   if (!res)
7681     exception::throw_last_error(saved_ctx);
7682   return manage(res);
7683 }
7684 
lexmin()7685 isl::map map::lexmin() const
7686 {
7687   if (!ptr)
7688     exception::throw_invalid("NULL input", __FILE__, __LINE__);
7689   auto saved_ctx = ctx();
7690   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7691   auto res = isl_map_lexmin(copy());
7692   if (!res)
7693     exception::throw_last_error(saved_ctx);
7694   return manage(res);
7695 }
7696 
lexmin_pw_multi_aff()7697 isl::pw_multi_aff map::lexmin_pw_multi_aff() const
7698 {
7699   if (!ptr)
7700     exception::throw_invalid("NULL input", __FILE__, __LINE__);
7701   auto saved_ctx = ctx();
7702   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7703   auto res = isl_map_lexmin_pw_multi_aff(copy());
7704   if (!res)
7705     exception::throw_last_error(saved_ctx);
7706   return manage(res);
7707 }
7708 
lower_bound(isl::multi_pw_aff lower)7709 isl::map map::lower_bound(isl::multi_pw_aff lower) const
7710 {
7711   if (!ptr || lower.is_null())
7712     exception::throw_invalid("NULL input", __FILE__, __LINE__);
7713   auto saved_ctx = ctx();
7714   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7715   auto res = isl_map_lower_bound_multi_pw_aff(copy(), lower.release());
7716   if (!res)
7717     exception::throw_last_error(saved_ctx);
7718   return manage(res);
7719 }
7720 
lower_bound(isl::multi_val lower)7721 isl::map map::lower_bound(isl::multi_val lower) const
7722 {
7723   if (!ptr || lower.is_null())
7724     exception::throw_invalid("NULL input", __FILE__, __LINE__);
7725   auto saved_ctx = ctx();
7726   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7727   auto res = isl_map_lower_bound_multi_val(copy(), lower.release());
7728   if (!res)
7729     exception::throw_last_error(saved_ctx);
7730   return manage(res);
7731 }
7732 
polyhedral_hull()7733 isl::basic_map map::polyhedral_hull() const
7734 {
7735   if (!ptr)
7736     exception::throw_invalid("NULL input", __FILE__, __LINE__);
7737   auto saved_ctx = ctx();
7738   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7739   auto res = isl_map_polyhedral_hull(copy());
7740   if (!res)
7741     exception::throw_last_error(saved_ctx);
7742   return manage(res);
7743 }
7744 
preimage_domain(isl::multi_aff ma)7745 isl::map map::preimage_domain(isl::multi_aff ma) const
7746 {
7747   if (!ptr || ma.is_null())
7748     exception::throw_invalid("NULL input", __FILE__, __LINE__);
7749   auto saved_ctx = ctx();
7750   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7751   auto res = isl_map_preimage_domain_multi_aff(copy(), ma.release());
7752   if (!res)
7753     exception::throw_last_error(saved_ctx);
7754   return manage(res);
7755 }
7756 
preimage_domain(isl::multi_pw_aff mpa)7757 isl::map map::preimage_domain(isl::multi_pw_aff mpa) const
7758 {
7759   if (!ptr || mpa.is_null())
7760     exception::throw_invalid("NULL input", __FILE__, __LINE__);
7761   auto saved_ctx = ctx();
7762   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7763   auto res = isl_map_preimage_domain_multi_pw_aff(copy(), mpa.release());
7764   if (!res)
7765     exception::throw_last_error(saved_ctx);
7766   return manage(res);
7767 }
7768 
preimage_domain(isl::pw_multi_aff pma)7769 isl::map map::preimage_domain(isl::pw_multi_aff pma) const
7770 {
7771   if (!ptr || pma.is_null())
7772     exception::throw_invalid("NULL input", __FILE__, __LINE__);
7773   auto saved_ctx = ctx();
7774   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7775   auto res = isl_map_preimage_domain_pw_multi_aff(copy(), pma.release());
7776   if (!res)
7777     exception::throw_last_error(saved_ctx);
7778   return manage(res);
7779 }
7780 
preimage_range(isl::multi_aff ma)7781 isl::map map::preimage_range(isl::multi_aff ma) const
7782 {
7783   if (!ptr || ma.is_null())
7784     exception::throw_invalid("NULL input", __FILE__, __LINE__);
7785   auto saved_ctx = ctx();
7786   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7787   auto res = isl_map_preimage_range_multi_aff(copy(), ma.release());
7788   if (!res)
7789     exception::throw_last_error(saved_ctx);
7790   return manage(res);
7791 }
7792 
preimage_range(isl::pw_multi_aff pma)7793 isl::map map::preimage_range(isl::pw_multi_aff pma) const
7794 {
7795   if (!ptr || pma.is_null())
7796     exception::throw_invalid("NULL input", __FILE__, __LINE__);
7797   auto saved_ctx = ctx();
7798   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7799   auto res = isl_map_preimage_range_pw_multi_aff(copy(), pma.release());
7800   if (!res)
7801     exception::throw_last_error(saved_ctx);
7802   return manage(res);
7803 }
7804 
project_out_all_params()7805 isl::map map::project_out_all_params() const
7806 {
7807   if (!ptr)
7808     exception::throw_invalid("NULL input", __FILE__, __LINE__);
7809   auto saved_ctx = ctx();
7810   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7811   auto res = isl_map_project_out_all_params(copy());
7812   if (!res)
7813     exception::throw_last_error(saved_ctx);
7814   return manage(res);
7815 }
7816 
range()7817 isl::set map::range() const
7818 {
7819   if (!ptr)
7820     exception::throw_invalid("NULL input", __FILE__, __LINE__);
7821   auto saved_ctx = ctx();
7822   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7823   auto res = isl_map_range(copy());
7824   if (!res)
7825     exception::throw_last_error(saved_ctx);
7826   return manage(res);
7827 }
7828 
range_factor_domain()7829 isl::map map::range_factor_domain() const
7830 {
7831   if (!ptr)
7832     exception::throw_invalid("NULL input", __FILE__, __LINE__);
7833   auto saved_ctx = ctx();
7834   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7835   auto res = isl_map_range_factor_domain(copy());
7836   if (!res)
7837     exception::throw_last_error(saved_ctx);
7838   return manage(res);
7839 }
7840 
range_factor_range()7841 isl::map map::range_factor_range() const
7842 {
7843   if (!ptr)
7844     exception::throw_invalid("NULL input", __FILE__, __LINE__);
7845   auto saved_ctx = ctx();
7846   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7847   auto res = isl_map_range_factor_range(copy());
7848   if (!res)
7849     exception::throw_last_error(saved_ctx);
7850   return manage(res);
7851 }
7852 
range_product(isl::map map2)7853 isl::map map::range_product(isl::map map2) const
7854 {
7855   if (!ptr || map2.is_null())
7856     exception::throw_invalid("NULL input", __FILE__, __LINE__);
7857   auto saved_ctx = ctx();
7858   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7859   auto res = isl_map_range_product(copy(), map2.release());
7860   if (!res)
7861     exception::throw_last_error(saved_ctx);
7862   return manage(res);
7863 }
7864 
range_reverse()7865 isl::map map::range_reverse() const
7866 {
7867   if (!ptr)
7868     exception::throw_invalid("NULL input", __FILE__, __LINE__);
7869   auto saved_ctx = ctx();
7870   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7871   auto res = isl_map_range_reverse(copy());
7872   if (!res)
7873     exception::throw_last_error(saved_ctx);
7874   return manage(res);
7875 }
7876 
reverse()7877 isl::map map::reverse() const
7878 {
7879   if (!ptr)
7880     exception::throw_invalid("NULL input", __FILE__, __LINE__);
7881   auto saved_ctx = ctx();
7882   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7883   auto res = isl_map_reverse(copy());
7884   if (!res)
7885     exception::throw_last_error(saved_ctx);
7886   return manage(res);
7887 }
7888 
sample()7889 isl::basic_map map::sample() const
7890 {
7891   if (!ptr)
7892     exception::throw_invalid("NULL input", __FILE__, __LINE__);
7893   auto saved_ctx = ctx();
7894   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7895   auto res = isl_map_sample(copy());
7896   if (!res)
7897     exception::throw_last_error(saved_ctx);
7898   return manage(res);
7899 }
7900 
subtract(isl::map map2)7901 isl::map map::subtract(isl::map map2) const
7902 {
7903   if (!ptr || map2.is_null())
7904     exception::throw_invalid("NULL input", __FILE__, __LINE__);
7905   auto saved_ctx = ctx();
7906   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7907   auto res = isl_map_subtract(copy(), map2.release());
7908   if (!res)
7909     exception::throw_last_error(saved_ctx);
7910   return manage(res);
7911 }
7912 
uncurry()7913 isl::map map::uncurry() const
7914 {
7915   if (!ptr)
7916     exception::throw_invalid("NULL input", __FILE__, __LINE__);
7917   auto saved_ctx = ctx();
7918   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7919   auto res = isl_map_uncurry(copy());
7920   if (!res)
7921     exception::throw_last_error(saved_ctx);
7922   return manage(res);
7923 }
7924 
unite(isl::map map2)7925 isl::map map::unite(isl::map map2) const
7926 {
7927   if (!ptr || map2.is_null())
7928     exception::throw_invalid("NULL input", __FILE__, __LINE__);
7929   auto saved_ctx = ctx();
7930   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7931   auto res = isl_map_union(copy(), map2.release());
7932   if (!res)
7933     exception::throw_last_error(saved_ctx);
7934   return manage(res);
7935 }
7936 
universe(isl::space space)7937 isl::map map::universe(isl::space space)
7938 {
7939   if (space.is_null())
7940     exception::throw_invalid("NULL input", __FILE__, __LINE__);
7941   auto saved_ctx = space.ctx();
7942   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7943   auto res = isl_map_universe(space.release());
7944   if (!res)
7945     exception::throw_last_error(saved_ctx);
7946   return manage(res);
7947 }
7948 
unshifted_simple_hull()7949 isl::basic_map map::unshifted_simple_hull() const
7950 {
7951   if (!ptr)
7952     exception::throw_invalid("NULL input", __FILE__, __LINE__);
7953   auto saved_ctx = ctx();
7954   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7955   auto res = isl_map_unshifted_simple_hull(copy());
7956   if (!res)
7957     exception::throw_last_error(saved_ctx);
7958   return manage(res);
7959 }
7960 
upper_bound(isl::multi_pw_aff upper)7961 isl::map map::upper_bound(isl::multi_pw_aff upper) const
7962 {
7963   if (!ptr || upper.is_null())
7964     exception::throw_invalid("NULL input", __FILE__, __LINE__);
7965   auto saved_ctx = ctx();
7966   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7967   auto res = isl_map_upper_bound_multi_pw_aff(copy(), upper.release());
7968   if (!res)
7969     exception::throw_last_error(saved_ctx);
7970   return manage(res);
7971 }
7972 
upper_bound(isl::multi_val upper)7973 isl::map map::upper_bound(isl::multi_val upper) const
7974 {
7975   if (!ptr || upper.is_null())
7976     exception::throw_invalid("NULL input", __FILE__, __LINE__);
7977   auto saved_ctx = ctx();
7978   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7979   auto res = isl_map_upper_bound_multi_val(copy(), upper.release());
7980   if (!res)
7981     exception::throw_last_error(saved_ctx);
7982   return manage(res);
7983 }
7984 
wrap()7985 isl::set map::wrap() const
7986 {
7987   if (!ptr)
7988     exception::throw_invalid("NULL input", __FILE__, __LINE__);
7989   auto saved_ctx = ctx();
7990   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
7991   auto res = isl_map_wrap(copy());
7992   if (!res)
7993     exception::throw_last_error(saved_ctx);
7994   return manage(res);
7995 }
7996 
7997 inline std::ostream &operator<<(std::ostream &os, const map &obj)
7998 {
7999   if (!obj.get())
8000     exception::throw_invalid("NULL input", __FILE__, __LINE__);
8001   auto saved_ctx = isl_map_get_ctx(obj.get());
8002   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8003   char *str = isl_map_to_str(obj.get());
8004   if (!str)
8005     exception::throw_last_error(saved_ctx);
8006   os << str;
8007   free(str);
8008   return os;
8009 }
8010 
8011 // implementations for isl::multi_aff
manage(__isl_take isl_multi_aff * ptr)8012 multi_aff manage(__isl_take isl_multi_aff *ptr) {
8013   if (!ptr)
8014     exception::throw_invalid("NULL input", __FILE__, __LINE__);
8015   return multi_aff(ptr);
8016 }
manage_copy(__isl_keep isl_multi_aff * ptr)8017 multi_aff manage_copy(__isl_keep isl_multi_aff *ptr) {
8018   if (!ptr)
8019     exception::throw_invalid("NULL input", __FILE__, __LINE__);
8020   auto saved_ctx = isl_multi_aff_get_ctx(ptr);
8021   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8022   ptr = isl_multi_aff_copy(ptr);
8023   if (!ptr)
8024     exception::throw_last_error(saved_ctx);
8025   return multi_aff(ptr);
8026 }
8027 
multi_aff()8028 multi_aff::multi_aff()
8029     : ptr(nullptr) {}
8030 
multi_aff(const multi_aff & obj)8031 multi_aff::multi_aff(const multi_aff &obj)
8032     : ptr(nullptr)
8033 {
8034   if (!obj.ptr)
8035     exception::throw_invalid("NULL input", __FILE__, __LINE__);
8036   auto saved_ctx = isl_multi_aff_get_ctx(obj.ptr);
8037   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8038   ptr = obj.copy();
8039   if (!ptr)
8040     exception::throw_last_error(saved_ctx);
8041 }
8042 
multi_aff(__isl_take isl_multi_aff * ptr)8043 multi_aff::multi_aff(__isl_take isl_multi_aff *ptr)
8044     : ptr(ptr) {}
8045 
multi_aff(isl::aff aff)8046 multi_aff::multi_aff(isl::aff aff)
8047 {
8048   if (aff.is_null())
8049     exception::throw_invalid("NULL input", __FILE__, __LINE__);
8050   auto saved_ctx = aff.ctx();
8051   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8052   auto res = isl_multi_aff_from_aff(aff.release());
8053   if (!res)
8054     exception::throw_last_error(saved_ctx);
8055   ptr = res;
8056 }
8057 
multi_aff(isl::space space,isl::aff_list list)8058 multi_aff::multi_aff(isl::space space, isl::aff_list list)
8059 {
8060   if (space.is_null() || list.is_null())
8061     exception::throw_invalid("NULL input", __FILE__, __LINE__);
8062   auto saved_ctx = space.ctx();
8063   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8064   auto res = isl_multi_aff_from_aff_list(space.release(), list.release());
8065   if (!res)
8066     exception::throw_last_error(saved_ctx);
8067   ptr = res;
8068 }
8069 
multi_aff(isl::ctx ctx,const std::string & str)8070 multi_aff::multi_aff(isl::ctx ctx, const std::string &str)
8071 {
8072   auto saved_ctx = ctx;
8073   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8074   auto res = isl_multi_aff_read_from_str(ctx.release(), str.c_str());
8075   if (!res)
8076     exception::throw_last_error(saved_ctx);
8077   ptr = res;
8078 }
8079 
8080 multi_aff &multi_aff::operator=(multi_aff obj) {
8081   std::swap(this->ptr, obj.ptr);
8082   return *this;
8083 }
8084 
~multi_aff()8085 multi_aff::~multi_aff() {
8086   if (ptr)
8087     isl_multi_aff_free(ptr);
8088 }
8089 
copy()8090 __isl_give isl_multi_aff *multi_aff::copy() const & {
8091   return isl_multi_aff_copy(ptr);
8092 }
8093 
get()8094 __isl_keep isl_multi_aff *multi_aff::get() const {
8095   return ptr;
8096 }
8097 
release()8098 __isl_give isl_multi_aff *multi_aff::release() {
8099   isl_multi_aff *tmp = ptr;
8100   ptr = nullptr;
8101   return tmp;
8102 }
8103 
is_null()8104 bool multi_aff::is_null() const {
8105   return ptr == nullptr;
8106 }
8107 
ctx()8108 isl::ctx multi_aff::ctx() const {
8109   return isl::ctx(isl_multi_aff_get_ctx(ptr));
8110 }
8111 
add(isl::multi_aff multi2)8112 isl::multi_aff multi_aff::add(isl::multi_aff multi2) const
8113 {
8114   if (!ptr || multi2.is_null())
8115     exception::throw_invalid("NULL input", __FILE__, __LINE__);
8116   auto saved_ctx = ctx();
8117   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8118   auto res = isl_multi_aff_add(copy(), multi2.release());
8119   if (!res)
8120     exception::throw_last_error(saved_ctx);
8121   return manage(res);
8122 }
8123 
add_constant(isl::multi_val mv)8124 isl::multi_aff multi_aff::add_constant(isl::multi_val mv) const
8125 {
8126   if (!ptr || mv.is_null())
8127     exception::throw_invalid("NULL input", __FILE__, __LINE__);
8128   auto saved_ctx = ctx();
8129   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8130   auto res = isl_multi_aff_add_constant_multi_val(copy(), mv.release());
8131   if (!res)
8132     exception::throw_last_error(saved_ctx);
8133   return manage(res);
8134 }
8135 
add_constant(isl::val v)8136 isl::multi_aff multi_aff::add_constant(isl::val v) const
8137 {
8138   if (!ptr || v.is_null())
8139     exception::throw_invalid("NULL input", __FILE__, __LINE__);
8140   auto saved_ctx = ctx();
8141   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8142   auto res = isl_multi_aff_add_constant_val(copy(), v.release());
8143   if (!res)
8144     exception::throw_last_error(saved_ctx);
8145   return manage(res);
8146 }
8147 
add_constant(long v)8148 isl::multi_aff multi_aff::add_constant(long v) const
8149 {
8150   if (!ptr)
8151     exception::throw_invalid("NULL input", __FILE__, __LINE__);
8152   return this->add_constant(isl::val(ctx(), v));
8153 }
8154 
bind(isl::multi_id tuple)8155 isl::basic_set multi_aff::bind(isl::multi_id tuple) const
8156 {
8157   if (!ptr || tuple.is_null())
8158     exception::throw_invalid("NULL input", __FILE__, __LINE__);
8159   auto saved_ctx = ctx();
8160   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8161   auto res = isl_multi_aff_bind(copy(), tuple.release());
8162   if (!res)
8163     exception::throw_last_error(saved_ctx);
8164   return manage(res);
8165 }
8166 
bind_domain(isl::multi_id tuple)8167 isl::multi_aff multi_aff::bind_domain(isl::multi_id tuple) const
8168 {
8169   if (!ptr || tuple.is_null())
8170     exception::throw_invalid("NULL input", __FILE__, __LINE__);
8171   auto saved_ctx = ctx();
8172   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8173   auto res = isl_multi_aff_bind_domain(copy(), tuple.release());
8174   if (!res)
8175     exception::throw_last_error(saved_ctx);
8176   return manage(res);
8177 }
8178 
bind_domain_wrapped_domain(isl::multi_id tuple)8179 isl::multi_aff multi_aff::bind_domain_wrapped_domain(isl::multi_id tuple) const
8180 {
8181   if (!ptr || tuple.is_null())
8182     exception::throw_invalid("NULL input", __FILE__, __LINE__);
8183   auto saved_ctx = ctx();
8184   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8185   auto res = isl_multi_aff_bind_domain_wrapped_domain(copy(), tuple.release());
8186   if (!res)
8187     exception::throw_last_error(saved_ctx);
8188   return manage(res);
8189 }
8190 
domain_map(isl::space space)8191 isl::multi_aff multi_aff::domain_map(isl::space space)
8192 {
8193   if (space.is_null())
8194     exception::throw_invalid("NULL input", __FILE__, __LINE__);
8195   auto saved_ctx = space.ctx();
8196   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8197   auto res = isl_multi_aff_domain_map(space.release());
8198   if (!res)
8199     exception::throw_last_error(saved_ctx);
8200   return manage(res);
8201 }
8202 
flat_range_product(isl::multi_aff multi2)8203 isl::multi_aff multi_aff::flat_range_product(isl::multi_aff multi2) const
8204 {
8205   if (!ptr || multi2.is_null())
8206     exception::throw_invalid("NULL input", __FILE__, __LINE__);
8207   auto saved_ctx = ctx();
8208   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8209   auto res = isl_multi_aff_flat_range_product(copy(), multi2.release());
8210   if (!res)
8211     exception::throw_last_error(saved_ctx);
8212   return manage(res);
8213 }
8214 
floor()8215 isl::multi_aff multi_aff::floor() const
8216 {
8217   if (!ptr)
8218     exception::throw_invalid("NULL input", __FILE__, __LINE__);
8219   auto saved_ctx = ctx();
8220   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8221   auto res = isl_multi_aff_floor(copy());
8222   if (!res)
8223     exception::throw_last_error(saved_ctx);
8224   return manage(res);
8225 }
8226 
at(int pos)8227 isl::aff multi_aff::at(int pos) const
8228 {
8229   if (!ptr)
8230     exception::throw_invalid("NULL input", __FILE__, __LINE__);
8231   auto saved_ctx = ctx();
8232   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8233   auto res = isl_multi_aff_get_at(get(), pos);
8234   if (!res)
8235     exception::throw_last_error(saved_ctx);
8236   return manage(res);
8237 }
8238 
get_at(int pos)8239 isl::aff multi_aff::get_at(int pos) const
8240 {
8241   return at(pos);
8242 }
8243 
constant_multi_val()8244 isl::multi_val multi_aff::constant_multi_val() const
8245 {
8246   if (!ptr)
8247     exception::throw_invalid("NULL input", __FILE__, __LINE__);
8248   auto saved_ctx = ctx();
8249   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8250   auto res = isl_multi_aff_get_constant_multi_val(get());
8251   if (!res)
8252     exception::throw_last_error(saved_ctx);
8253   return manage(res);
8254 }
8255 
get_constant_multi_val()8256 isl::multi_val multi_aff::get_constant_multi_val() const
8257 {
8258   return constant_multi_val();
8259 }
8260 
space()8261 isl::space multi_aff::space() const
8262 {
8263   if (!ptr)
8264     exception::throw_invalid("NULL input", __FILE__, __LINE__);
8265   auto saved_ctx = ctx();
8266   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8267   auto res = isl_multi_aff_get_space(get());
8268   if (!res)
8269     exception::throw_last_error(saved_ctx);
8270   return manage(res);
8271 }
8272 
get_space()8273 isl::space multi_aff::get_space() const
8274 {
8275   return space();
8276 }
8277 
gist(isl::set context)8278 isl::multi_aff multi_aff::gist(isl::set context) const
8279 {
8280   if (!ptr || context.is_null())
8281     exception::throw_invalid("NULL input", __FILE__, __LINE__);
8282   auto saved_ctx = ctx();
8283   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8284   auto res = isl_multi_aff_gist(copy(), context.release());
8285   if (!res)
8286     exception::throw_last_error(saved_ctx);
8287   return manage(res);
8288 }
8289 
identity()8290 isl::multi_aff multi_aff::identity() const
8291 {
8292   if (!ptr)
8293     exception::throw_invalid("NULL input", __FILE__, __LINE__);
8294   auto saved_ctx = ctx();
8295   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8296   auto res = isl_multi_aff_identity_multi_aff(copy());
8297   if (!res)
8298     exception::throw_last_error(saved_ctx);
8299   return manage(res);
8300 }
8301 
identity_on_domain(isl::space space)8302 isl::multi_aff multi_aff::identity_on_domain(isl::space space)
8303 {
8304   if (space.is_null())
8305     exception::throw_invalid("NULL input", __FILE__, __LINE__);
8306   auto saved_ctx = space.ctx();
8307   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8308   auto res = isl_multi_aff_identity_on_domain_space(space.release());
8309   if (!res)
8310     exception::throw_last_error(saved_ctx);
8311   return manage(res);
8312 }
8313 
involves_locals()8314 bool multi_aff::involves_locals() const
8315 {
8316   if (!ptr)
8317     exception::throw_invalid("NULL input", __FILE__, __LINE__);
8318   auto saved_ctx = ctx();
8319   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8320   auto res = isl_multi_aff_involves_locals(get());
8321   if (res < 0)
8322     exception::throw_last_error(saved_ctx);
8323   return res;
8324 }
8325 
neg()8326 isl::multi_aff multi_aff::neg() const
8327 {
8328   if (!ptr)
8329     exception::throw_invalid("NULL input", __FILE__, __LINE__);
8330   auto saved_ctx = ctx();
8331   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8332   auto res = isl_multi_aff_neg(copy());
8333   if (!res)
8334     exception::throw_last_error(saved_ctx);
8335   return manage(res);
8336 }
8337 
plain_is_equal(const isl::multi_aff & multi2)8338 bool multi_aff::plain_is_equal(const isl::multi_aff &multi2) const
8339 {
8340   if (!ptr || multi2.is_null())
8341     exception::throw_invalid("NULL input", __FILE__, __LINE__);
8342   auto saved_ctx = ctx();
8343   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8344   auto res = isl_multi_aff_plain_is_equal(get(), multi2.get());
8345   if (res < 0)
8346     exception::throw_last_error(saved_ctx);
8347   return res;
8348 }
8349 
product(isl::multi_aff multi2)8350 isl::multi_aff multi_aff::product(isl::multi_aff multi2) const
8351 {
8352   if (!ptr || multi2.is_null())
8353     exception::throw_invalid("NULL input", __FILE__, __LINE__);
8354   auto saved_ctx = ctx();
8355   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8356   auto res = isl_multi_aff_product(copy(), multi2.release());
8357   if (!res)
8358     exception::throw_last_error(saved_ctx);
8359   return manage(res);
8360 }
8361 
pullback(isl::multi_aff ma2)8362 isl::multi_aff multi_aff::pullback(isl::multi_aff ma2) const
8363 {
8364   if (!ptr || ma2.is_null())
8365     exception::throw_invalid("NULL input", __FILE__, __LINE__);
8366   auto saved_ctx = ctx();
8367   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8368   auto res = isl_multi_aff_pullback_multi_aff(copy(), ma2.release());
8369   if (!res)
8370     exception::throw_last_error(saved_ctx);
8371   return manage(res);
8372 }
8373 
range_map(isl::space space)8374 isl::multi_aff multi_aff::range_map(isl::space space)
8375 {
8376   if (space.is_null())
8377     exception::throw_invalid("NULL input", __FILE__, __LINE__);
8378   auto saved_ctx = space.ctx();
8379   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8380   auto res = isl_multi_aff_range_map(space.release());
8381   if (!res)
8382     exception::throw_last_error(saved_ctx);
8383   return manage(res);
8384 }
8385 
range_product(isl::multi_aff multi2)8386 isl::multi_aff multi_aff::range_product(isl::multi_aff multi2) const
8387 {
8388   if (!ptr || multi2.is_null())
8389     exception::throw_invalid("NULL input", __FILE__, __LINE__);
8390   auto saved_ctx = ctx();
8391   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8392   auto res = isl_multi_aff_range_product(copy(), multi2.release());
8393   if (!res)
8394     exception::throw_last_error(saved_ctx);
8395   return manage(res);
8396 }
8397 
scale(isl::multi_val mv)8398 isl::multi_aff multi_aff::scale(isl::multi_val mv) const
8399 {
8400   if (!ptr || mv.is_null())
8401     exception::throw_invalid("NULL input", __FILE__, __LINE__);
8402   auto saved_ctx = ctx();
8403   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8404   auto res = isl_multi_aff_scale_multi_val(copy(), mv.release());
8405   if (!res)
8406     exception::throw_last_error(saved_ctx);
8407   return manage(res);
8408 }
8409 
scale(isl::val v)8410 isl::multi_aff multi_aff::scale(isl::val v) const
8411 {
8412   if (!ptr || v.is_null())
8413     exception::throw_invalid("NULL input", __FILE__, __LINE__);
8414   auto saved_ctx = ctx();
8415   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8416   auto res = isl_multi_aff_scale_val(copy(), v.release());
8417   if (!res)
8418     exception::throw_last_error(saved_ctx);
8419   return manage(res);
8420 }
8421 
scale(long v)8422 isl::multi_aff multi_aff::scale(long v) const
8423 {
8424   if (!ptr)
8425     exception::throw_invalid("NULL input", __FILE__, __LINE__);
8426   return this->scale(isl::val(ctx(), v));
8427 }
8428 
scale_down(isl::multi_val mv)8429 isl::multi_aff multi_aff::scale_down(isl::multi_val mv) const
8430 {
8431   if (!ptr || mv.is_null())
8432     exception::throw_invalid("NULL input", __FILE__, __LINE__);
8433   auto saved_ctx = ctx();
8434   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8435   auto res = isl_multi_aff_scale_down_multi_val(copy(), mv.release());
8436   if (!res)
8437     exception::throw_last_error(saved_ctx);
8438   return manage(res);
8439 }
8440 
scale_down(isl::val v)8441 isl::multi_aff multi_aff::scale_down(isl::val v) const
8442 {
8443   if (!ptr || v.is_null())
8444     exception::throw_invalid("NULL input", __FILE__, __LINE__);
8445   auto saved_ctx = ctx();
8446   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8447   auto res = isl_multi_aff_scale_down_val(copy(), v.release());
8448   if (!res)
8449     exception::throw_last_error(saved_ctx);
8450   return manage(res);
8451 }
8452 
scale_down(long v)8453 isl::multi_aff multi_aff::scale_down(long v) const
8454 {
8455   if (!ptr)
8456     exception::throw_invalid("NULL input", __FILE__, __LINE__);
8457   return this->scale_down(isl::val(ctx(), v));
8458 }
8459 
set_at(int pos,isl::aff el)8460 isl::multi_aff multi_aff::set_at(int pos, isl::aff el) const
8461 {
8462   if (!ptr || el.is_null())
8463     exception::throw_invalid("NULL input", __FILE__, __LINE__);
8464   auto saved_ctx = ctx();
8465   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8466   auto res = isl_multi_aff_set_at(copy(), pos, el.release());
8467   if (!res)
8468     exception::throw_last_error(saved_ctx);
8469   return manage(res);
8470 }
8471 
size()8472 unsigned multi_aff::size() const
8473 {
8474   if (!ptr)
8475     exception::throw_invalid("NULL input", __FILE__, __LINE__);
8476   auto saved_ctx = ctx();
8477   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8478   auto res = isl_multi_aff_size(get());
8479   if (res < 0)
8480     exception::throw_last_error(saved_ctx);
8481   return res;
8482 }
8483 
sub(isl::multi_aff multi2)8484 isl::multi_aff multi_aff::sub(isl::multi_aff multi2) const
8485 {
8486   if (!ptr || multi2.is_null())
8487     exception::throw_invalid("NULL input", __FILE__, __LINE__);
8488   auto saved_ctx = ctx();
8489   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8490   auto res = isl_multi_aff_sub(copy(), multi2.release());
8491   if (!res)
8492     exception::throw_last_error(saved_ctx);
8493   return manage(res);
8494 }
8495 
zero(isl::space space)8496 isl::multi_aff multi_aff::zero(isl::space space)
8497 {
8498   if (space.is_null())
8499     exception::throw_invalid("NULL input", __FILE__, __LINE__);
8500   auto saved_ctx = space.ctx();
8501   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8502   auto res = isl_multi_aff_zero(space.release());
8503   if (!res)
8504     exception::throw_last_error(saved_ctx);
8505   return manage(res);
8506 }
8507 
8508 inline std::ostream &operator<<(std::ostream &os, const multi_aff &obj)
8509 {
8510   if (!obj.get())
8511     exception::throw_invalid("NULL input", __FILE__, __LINE__);
8512   auto saved_ctx = isl_multi_aff_get_ctx(obj.get());
8513   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8514   char *str = isl_multi_aff_to_str(obj.get());
8515   if (!str)
8516     exception::throw_last_error(saved_ctx);
8517   os << str;
8518   free(str);
8519   return os;
8520 }
8521 
8522 // implementations for isl::multi_id
manage(__isl_take isl_multi_id * ptr)8523 multi_id manage(__isl_take isl_multi_id *ptr) {
8524   if (!ptr)
8525     exception::throw_invalid("NULL input", __FILE__, __LINE__);
8526   return multi_id(ptr);
8527 }
manage_copy(__isl_keep isl_multi_id * ptr)8528 multi_id manage_copy(__isl_keep isl_multi_id *ptr) {
8529   if (!ptr)
8530     exception::throw_invalid("NULL input", __FILE__, __LINE__);
8531   auto saved_ctx = isl_multi_id_get_ctx(ptr);
8532   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8533   ptr = isl_multi_id_copy(ptr);
8534   if (!ptr)
8535     exception::throw_last_error(saved_ctx);
8536   return multi_id(ptr);
8537 }
8538 
multi_id()8539 multi_id::multi_id()
8540     : ptr(nullptr) {}
8541 
multi_id(const multi_id & obj)8542 multi_id::multi_id(const multi_id &obj)
8543     : ptr(nullptr)
8544 {
8545   if (!obj.ptr)
8546     exception::throw_invalid("NULL input", __FILE__, __LINE__);
8547   auto saved_ctx = isl_multi_id_get_ctx(obj.ptr);
8548   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8549   ptr = obj.copy();
8550   if (!ptr)
8551     exception::throw_last_error(saved_ctx);
8552 }
8553 
multi_id(__isl_take isl_multi_id * ptr)8554 multi_id::multi_id(__isl_take isl_multi_id *ptr)
8555     : ptr(ptr) {}
8556 
multi_id(isl::space space,isl::id_list list)8557 multi_id::multi_id(isl::space space, isl::id_list list)
8558 {
8559   if (space.is_null() || list.is_null())
8560     exception::throw_invalid("NULL input", __FILE__, __LINE__);
8561   auto saved_ctx = space.ctx();
8562   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8563   auto res = isl_multi_id_from_id_list(space.release(), list.release());
8564   if (!res)
8565     exception::throw_last_error(saved_ctx);
8566   ptr = res;
8567 }
8568 
multi_id(isl::ctx ctx,const std::string & str)8569 multi_id::multi_id(isl::ctx ctx, const std::string &str)
8570 {
8571   auto saved_ctx = ctx;
8572   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8573   auto res = isl_multi_id_read_from_str(ctx.release(), str.c_str());
8574   if (!res)
8575     exception::throw_last_error(saved_ctx);
8576   ptr = res;
8577 }
8578 
8579 multi_id &multi_id::operator=(multi_id obj) {
8580   std::swap(this->ptr, obj.ptr);
8581   return *this;
8582 }
8583 
~multi_id()8584 multi_id::~multi_id() {
8585   if (ptr)
8586     isl_multi_id_free(ptr);
8587 }
8588 
copy()8589 __isl_give isl_multi_id *multi_id::copy() const & {
8590   return isl_multi_id_copy(ptr);
8591 }
8592 
get()8593 __isl_keep isl_multi_id *multi_id::get() const {
8594   return ptr;
8595 }
8596 
release()8597 __isl_give isl_multi_id *multi_id::release() {
8598   isl_multi_id *tmp = ptr;
8599   ptr = nullptr;
8600   return tmp;
8601 }
8602 
is_null()8603 bool multi_id::is_null() const {
8604   return ptr == nullptr;
8605 }
8606 
ctx()8607 isl::ctx multi_id::ctx() const {
8608   return isl::ctx(isl_multi_id_get_ctx(ptr));
8609 }
8610 
flat_range_product(isl::multi_id multi2)8611 isl::multi_id multi_id::flat_range_product(isl::multi_id multi2) const
8612 {
8613   if (!ptr || multi2.is_null())
8614     exception::throw_invalid("NULL input", __FILE__, __LINE__);
8615   auto saved_ctx = ctx();
8616   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8617   auto res = isl_multi_id_flat_range_product(copy(), multi2.release());
8618   if (!res)
8619     exception::throw_last_error(saved_ctx);
8620   return manage(res);
8621 }
8622 
at(int pos)8623 isl::id multi_id::at(int pos) const
8624 {
8625   if (!ptr)
8626     exception::throw_invalid("NULL input", __FILE__, __LINE__);
8627   auto saved_ctx = ctx();
8628   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8629   auto res = isl_multi_id_get_at(get(), pos);
8630   if (!res)
8631     exception::throw_last_error(saved_ctx);
8632   return manage(res);
8633 }
8634 
get_at(int pos)8635 isl::id multi_id::get_at(int pos) const
8636 {
8637   return at(pos);
8638 }
8639 
space()8640 isl::space multi_id::space() const
8641 {
8642   if (!ptr)
8643     exception::throw_invalid("NULL input", __FILE__, __LINE__);
8644   auto saved_ctx = ctx();
8645   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8646   auto res = isl_multi_id_get_space(get());
8647   if (!res)
8648     exception::throw_last_error(saved_ctx);
8649   return manage(res);
8650 }
8651 
get_space()8652 isl::space multi_id::get_space() const
8653 {
8654   return space();
8655 }
8656 
plain_is_equal(const isl::multi_id & multi2)8657 bool multi_id::plain_is_equal(const isl::multi_id &multi2) const
8658 {
8659   if (!ptr || multi2.is_null())
8660     exception::throw_invalid("NULL input", __FILE__, __LINE__);
8661   auto saved_ctx = ctx();
8662   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8663   auto res = isl_multi_id_plain_is_equal(get(), multi2.get());
8664   if (res < 0)
8665     exception::throw_last_error(saved_ctx);
8666   return res;
8667 }
8668 
range_product(isl::multi_id multi2)8669 isl::multi_id multi_id::range_product(isl::multi_id multi2) const
8670 {
8671   if (!ptr || multi2.is_null())
8672     exception::throw_invalid("NULL input", __FILE__, __LINE__);
8673   auto saved_ctx = ctx();
8674   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8675   auto res = isl_multi_id_range_product(copy(), multi2.release());
8676   if (!res)
8677     exception::throw_last_error(saved_ctx);
8678   return manage(res);
8679 }
8680 
set_at(int pos,isl::id el)8681 isl::multi_id multi_id::set_at(int pos, isl::id el) const
8682 {
8683   if (!ptr || el.is_null())
8684     exception::throw_invalid("NULL input", __FILE__, __LINE__);
8685   auto saved_ctx = ctx();
8686   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8687   auto res = isl_multi_id_set_at(copy(), pos, el.release());
8688   if (!res)
8689     exception::throw_last_error(saved_ctx);
8690   return manage(res);
8691 }
8692 
set_at(int pos,const std::string & el)8693 isl::multi_id multi_id::set_at(int pos, const std::string &el) const
8694 {
8695   if (!ptr)
8696     exception::throw_invalid("NULL input", __FILE__, __LINE__);
8697   return this->set_at(pos, isl::id(ctx(), el));
8698 }
8699 
size()8700 unsigned multi_id::size() const
8701 {
8702   if (!ptr)
8703     exception::throw_invalid("NULL input", __FILE__, __LINE__);
8704   auto saved_ctx = ctx();
8705   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8706   auto res = isl_multi_id_size(get());
8707   if (res < 0)
8708     exception::throw_last_error(saved_ctx);
8709   return res;
8710 }
8711 
8712 inline std::ostream &operator<<(std::ostream &os, const multi_id &obj)
8713 {
8714   if (!obj.get())
8715     exception::throw_invalid("NULL input", __FILE__, __LINE__);
8716   auto saved_ctx = isl_multi_id_get_ctx(obj.get());
8717   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8718   char *str = isl_multi_id_to_str(obj.get());
8719   if (!str)
8720     exception::throw_last_error(saved_ctx);
8721   os << str;
8722   free(str);
8723   return os;
8724 }
8725 
8726 // implementations for isl::multi_pw_aff
manage(__isl_take isl_multi_pw_aff * ptr)8727 multi_pw_aff manage(__isl_take isl_multi_pw_aff *ptr) {
8728   if (!ptr)
8729     exception::throw_invalid("NULL input", __FILE__, __LINE__);
8730   return multi_pw_aff(ptr);
8731 }
manage_copy(__isl_keep isl_multi_pw_aff * ptr)8732 multi_pw_aff manage_copy(__isl_keep isl_multi_pw_aff *ptr) {
8733   if (!ptr)
8734     exception::throw_invalid("NULL input", __FILE__, __LINE__);
8735   auto saved_ctx = isl_multi_pw_aff_get_ctx(ptr);
8736   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8737   ptr = isl_multi_pw_aff_copy(ptr);
8738   if (!ptr)
8739     exception::throw_last_error(saved_ctx);
8740   return multi_pw_aff(ptr);
8741 }
8742 
multi_pw_aff()8743 multi_pw_aff::multi_pw_aff()
8744     : ptr(nullptr) {}
8745 
multi_pw_aff(const multi_pw_aff & obj)8746 multi_pw_aff::multi_pw_aff(const multi_pw_aff &obj)
8747     : ptr(nullptr)
8748 {
8749   if (!obj.ptr)
8750     exception::throw_invalid("NULL input", __FILE__, __LINE__);
8751   auto saved_ctx = isl_multi_pw_aff_get_ctx(obj.ptr);
8752   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8753   ptr = obj.copy();
8754   if (!ptr)
8755     exception::throw_last_error(saved_ctx);
8756 }
8757 
multi_pw_aff(__isl_take isl_multi_pw_aff * ptr)8758 multi_pw_aff::multi_pw_aff(__isl_take isl_multi_pw_aff *ptr)
8759     : ptr(ptr) {}
8760 
multi_pw_aff(isl::multi_aff ma)8761 multi_pw_aff::multi_pw_aff(isl::multi_aff ma)
8762 {
8763   if (ma.is_null())
8764     exception::throw_invalid("NULL input", __FILE__, __LINE__);
8765   auto saved_ctx = ma.ctx();
8766   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8767   auto res = isl_multi_pw_aff_from_multi_aff(ma.release());
8768   if (!res)
8769     exception::throw_last_error(saved_ctx);
8770   ptr = res;
8771 }
8772 
multi_pw_aff(isl::pw_aff pa)8773 multi_pw_aff::multi_pw_aff(isl::pw_aff pa)
8774 {
8775   if (pa.is_null())
8776     exception::throw_invalid("NULL input", __FILE__, __LINE__);
8777   auto saved_ctx = pa.ctx();
8778   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8779   auto res = isl_multi_pw_aff_from_pw_aff(pa.release());
8780   if (!res)
8781     exception::throw_last_error(saved_ctx);
8782   ptr = res;
8783 }
8784 
multi_pw_aff(isl::space space,isl::pw_aff_list list)8785 multi_pw_aff::multi_pw_aff(isl::space space, isl::pw_aff_list list)
8786 {
8787   if (space.is_null() || list.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_pw_aff_from_pw_aff_list(space.release(), list.release());
8792   if (!res)
8793     exception::throw_last_error(saved_ctx);
8794   ptr = res;
8795 }
8796 
multi_pw_aff(isl::pw_multi_aff pma)8797 multi_pw_aff::multi_pw_aff(isl::pw_multi_aff pma)
8798 {
8799   if (pma.is_null())
8800     exception::throw_invalid("NULL input", __FILE__, __LINE__);
8801   auto saved_ctx = pma.ctx();
8802   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8803   auto res = isl_multi_pw_aff_from_pw_multi_aff(pma.release());
8804   if (!res)
8805     exception::throw_last_error(saved_ctx);
8806   ptr = res;
8807 }
8808 
multi_pw_aff(isl::ctx ctx,const std::string & str)8809 multi_pw_aff::multi_pw_aff(isl::ctx ctx, const std::string &str)
8810 {
8811   auto saved_ctx = ctx;
8812   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8813   auto res = isl_multi_pw_aff_read_from_str(ctx.release(), str.c_str());
8814   if (!res)
8815     exception::throw_last_error(saved_ctx);
8816   ptr = res;
8817 }
8818 
8819 multi_pw_aff &multi_pw_aff::operator=(multi_pw_aff obj) {
8820   std::swap(this->ptr, obj.ptr);
8821   return *this;
8822 }
8823 
~multi_pw_aff()8824 multi_pw_aff::~multi_pw_aff() {
8825   if (ptr)
8826     isl_multi_pw_aff_free(ptr);
8827 }
8828 
copy()8829 __isl_give isl_multi_pw_aff *multi_pw_aff::copy() const & {
8830   return isl_multi_pw_aff_copy(ptr);
8831 }
8832 
get()8833 __isl_keep isl_multi_pw_aff *multi_pw_aff::get() const {
8834   return ptr;
8835 }
8836 
release()8837 __isl_give isl_multi_pw_aff *multi_pw_aff::release() {
8838   isl_multi_pw_aff *tmp = ptr;
8839   ptr = nullptr;
8840   return tmp;
8841 }
8842 
is_null()8843 bool multi_pw_aff::is_null() const {
8844   return ptr == nullptr;
8845 }
8846 
ctx()8847 isl::ctx multi_pw_aff::ctx() const {
8848   return isl::ctx(isl_multi_pw_aff_get_ctx(ptr));
8849 }
8850 
add(isl::multi_pw_aff multi2)8851 isl::multi_pw_aff multi_pw_aff::add(isl::multi_pw_aff multi2) const
8852 {
8853   if (!ptr || multi2.is_null())
8854     exception::throw_invalid("NULL input", __FILE__, __LINE__);
8855   auto saved_ctx = ctx();
8856   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8857   auto res = isl_multi_pw_aff_add(copy(), multi2.release());
8858   if (!res)
8859     exception::throw_last_error(saved_ctx);
8860   return manage(res);
8861 }
8862 
add_constant(isl::multi_val mv)8863 isl::multi_pw_aff multi_pw_aff::add_constant(isl::multi_val mv) const
8864 {
8865   if (!ptr || mv.is_null())
8866     exception::throw_invalid("NULL input", __FILE__, __LINE__);
8867   auto saved_ctx = ctx();
8868   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8869   auto res = isl_multi_pw_aff_add_constant_multi_val(copy(), mv.release());
8870   if (!res)
8871     exception::throw_last_error(saved_ctx);
8872   return manage(res);
8873 }
8874 
add_constant(isl::val v)8875 isl::multi_pw_aff multi_pw_aff::add_constant(isl::val v) const
8876 {
8877   if (!ptr || v.is_null())
8878     exception::throw_invalid("NULL input", __FILE__, __LINE__);
8879   auto saved_ctx = ctx();
8880   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8881   auto res = isl_multi_pw_aff_add_constant_val(copy(), v.release());
8882   if (!res)
8883     exception::throw_last_error(saved_ctx);
8884   return manage(res);
8885 }
8886 
add_constant(long v)8887 isl::multi_pw_aff multi_pw_aff::add_constant(long v) const
8888 {
8889   if (!ptr)
8890     exception::throw_invalid("NULL input", __FILE__, __LINE__);
8891   return this->add_constant(isl::val(ctx(), v));
8892 }
8893 
bind(isl::multi_id tuple)8894 isl::set multi_pw_aff::bind(isl::multi_id tuple) const
8895 {
8896   if (!ptr || tuple.is_null())
8897     exception::throw_invalid("NULL input", __FILE__, __LINE__);
8898   auto saved_ctx = ctx();
8899   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8900   auto res = isl_multi_pw_aff_bind(copy(), tuple.release());
8901   if (!res)
8902     exception::throw_last_error(saved_ctx);
8903   return manage(res);
8904 }
8905 
bind_domain(isl::multi_id tuple)8906 isl::multi_pw_aff multi_pw_aff::bind_domain(isl::multi_id tuple) const
8907 {
8908   if (!ptr || tuple.is_null())
8909     exception::throw_invalid("NULL input", __FILE__, __LINE__);
8910   auto saved_ctx = ctx();
8911   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8912   auto res = isl_multi_pw_aff_bind_domain(copy(), tuple.release());
8913   if (!res)
8914     exception::throw_last_error(saved_ctx);
8915   return manage(res);
8916 }
8917 
bind_domain_wrapped_domain(isl::multi_id tuple)8918 isl::multi_pw_aff multi_pw_aff::bind_domain_wrapped_domain(isl::multi_id tuple) const
8919 {
8920   if (!ptr || tuple.is_null())
8921     exception::throw_invalid("NULL input", __FILE__, __LINE__);
8922   auto saved_ctx = ctx();
8923   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8924   auto res = isl_multi_pw_aff_bind_domain_wrapped_domain(copy(), tuple.release());
8925   if (!res)
8926     exception::throw_last_error(saved_ctx);
8927   return manage(res);
8928 }
8929 
coalesce()8930 isl::multi_pw_aff multi_pw_aff::coalesce() const
8931 {
8932   if (!ptr)
8933     exception::throw_invalid("NULL input", __FILE__, __LINE__);
8934   auto saved_ctx = ctx();
8935   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8936   auto res = isl_multi_pw_aff_coalesce(copy());
8937   if (!res)
8938     exception::throw_last_error(saved_ctx);
8939   return manage(res);
8940 }
8941 
domain()8942 isl::set multi_pw_aff::domain() const
8943 {
8944   if (!ptr)
8945     exception::throw_invalid("NULL input", __FILE__, __LINE__);
8946   auto saved_ctx = ctx();
8947   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8948   auto res = isl_multi_pw_aff_domain(copy());
8949   if (!res)
8950     exception::throw_last_error(saved_ctx);
8951   return manage(res);
8952 }
8953 
flat_range_product(isl::multi_pw_aff multi2)8954 isl::multi_pw_aff multi_pw_aff::flat_range_product(isl::multi_pw_aff multi2) const
8955 {
8956   if (!ptr || multi2.is_null())
8957     exception::throw_invalid("NULL input", __FILE__, __LINE__);
8958   auto saved_ctx = ctx();
8959   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8960   auto res = isl_multi_pw_aff_flat_range_product(copy(), multi2.release());
8961   if (!res)
8962     exception::throw_last_error(saved_ctx);
8963   return manage(res);
8964 }
8965 
at(int pos)8966 isl::pw_aff multi_pw_aff::at(int pos) const
8967 {
8968   if (!ptr)
8969     exception::throw_invalid("NULL input", __FILE__, __LINE__);
8970   auto saved_ctx = ctx();
8971   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8972   auto res = isl_multi_pw_aff_get_at(get(), pos);
8973   if (!res)
8974     exception::throw_last_error(saved_ctx);
8975   return manage(res);
8976 }
8977 
get_at(int pos)8978 isl::pw_aff multi_pw_aff::get_at(int pos) const
8979 {
8980   return at(pos);
8981 }
8982 
space()8983 isl::space multi_pw_aff::space() const
8984 {
8985   if (!ptr)
8986     exception::throw_invalid("NULL input", __FILE__, __LINE__);
8987   auto saved_ctx = ctx();
8988   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
8989   auto res = isl_multi_pw_aff_get_space(get());
8990   if (!res)
8991     exception::throw_last_error(saved_ctx);
8992   return manage(res);
8993 }
8994 
get_space()8995 isl::space multi_pw_aff::get_space() const
8996 {
8997   return space();
8998 }
8999 
gist(isl::set set)9000 isl::multi_pw_aff multi_pw_aff::gist(isl::set set) const
9001 {
9002   if (!ptr || set.is_null())
9003     exception::throw_invalid("NULL input", __FILE__, __LINE__);
9004   auto saved_ctx = ctx();
9005   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9006   auto res = isl_multi_pw_aff_gist(copy(), set.release());
9007   if (!res)
9008     exception::throw_last_error(saved_ctx);
9009   return manage(res);
9010 }
9011 
identity()9012 isl::multi_pw_aff multi_pw_aff::identity() const
9013 {
9014   if (!ptr)
9015     exception::throw_invalid("NULL input", __FILE__, __LINE__);
9016   auto saved_ctx = ctx();
9017   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9018   auto res = isl_multi_pw_aff_identity_multi_pw_aff(copy());
9019   if (!res)
9020     exception::throw_last_error(saved_ctx);
9021   return manage(res);
9022 }
9023 
identity_on_domain(isl::space space)9024 isl::multi_pw_aff multi_pw_aff::identity_on_domain(isl::space space)
9025 {
9026   if (space.is_null())
9027     exception::throw_invalid("NULL input", __FILE__, __LINE__);
9028   auto saved_ctx = space.ctx();
9029   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9030   auto res = isl_multi_pw_aff_identity_on_domain_space(space.release());
9031   if (!res)
9032     exception::throw_last_error(saved_ctx);
9033   return manage(res);
9034 }
9035 
intersect_domain(isl::set domain)9036 isl::multi_pw_aff multi_pw_aff::intersect_domain(isl::set domain) const
9037 {
9038   if (!ptr || domain.is_null())
9039     exception::throw_invalid("NULL input", __FILE__, __LINE__);
9040   auto saved_ctx = ctx();
9041   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9042   auto res = isl_multi_pw_aff_intersect_domain(copy(), domain.release());
9043   if (!res)
9044     exception::throw_last_error(saved_ctx);
9045   return manage(res);
9046 }
9047 
intersect_params(isl::set set)9048 isl::multi_pw_aff multi_pw_aff::intersect_params(isl::set set) const
9049 {
9050   if (!ptr || set.is_null())
9051     exception::throw_invalid("NULL input", __FILE__, __LINE__);
9052   auto saved_ctx = ctx();
9053   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9054   auto res = isl_multi_pw_aff_intersect_params(copy(), set.release());
9055   if (!res)
9056     exception::throw_last_error(saved_ctx);
9057   return manage(res);
9058 }
9059 
involves_param(const isl::id & id)9060 bool multi_pw_aff::involves_param(const isl::id &id) const
9061 {
9062   if (!ptr || id.is_null())
9063     exception::throw_invalid("NULL input", __FILE__, __LINE__);
9064   auto saved_ctx = ctx();
9065   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9066   auto res = isl_multi_pw_aff_involves_param_id(get(), id.get());
9067   if (res < 0)
9068     exception::throw_last_error(saved_ctx);
9069   return res;
9070 }
9071 
involves_param(const std::string & id)9072 bool multi_pw_aff::involves_param(const std::string &id) const
9073 {
9074   if (!ptr)
9075     exception::throw_invalid("NULL input", __FILE__, __LINE__);
9076   return this->involves_param(isl::id(ctx(), id));
9077 }
9078 
involves_param(const isl::id_list & list)9079 bool multi_pw_aff::involves_param(const isl::id_list &list) const
9080 {
9081   if (!ptr || list.is_null())
9082     exception::throw_invalid("NULL input", __FILE__, __LINE__);
9083   auto saved_ctx = ctx();
9084   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9085   auto res = isl_multi_pw_aff_involves_param_id_list(get(), list.get());
9086   if (res < 0)
9087     exception::throw_last_error(saved_ctx);
9088   return res;
9089 }
9090 
neg()9091 isl::multi_pw_aff multi_pw_aff::neg() const
9092 {
9093   if (!ptr)
9094     exception::throw_invalid("NULL input", __FILE__, __LINE__);
9095   auto saved_ctx = ctx();
9096   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9097   auto res = isl_multi_pw_aff_neg(copy());
9098   if (!res)
9099     exception::throw_last_error(saved_ctx);
9100   return manage(res);
9101 }
9102 
plain_is_equal(const isl::multi_pw_aff & multi2)9103 bool multi_pw_aff::plain_is_equal(const isl::multi_pw_aff &multi2) const
9104 {
9105   if (!ptr || multi2.is_null())
9106     exception::throw_invalid("NULL input", __FILE__, __LINE__);
9107   auto saved_ctx = ctx();
9108   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9109   auto res = isl_multi_pw_aff_plain_is_equal(get(), multi2.get());
9110   if (res < 0)
9111     exception::throw_last_error(saved_ctx);
9112   return res;
9113 }
9114 
product(isl::multi_pw_aff multi2)9115 isl::multi_pw_aff multi_pw_aff::product(isl::multi_pw_aff multi2) const
9116 {
9117   if (!ptr || multi2.is_null())
9118     exception::throw_invalid("NULL input", __FILE__, __LINE__);
9119   auto saved_ctx = ctx();
9120   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9121   auto res = isl_multi_pw_aff_product(copy(), multi2.release());
9122   if (!res)
9123     exception::throw_last_error(saved_ctx);
9124   return manage(res);
9125 }
9126 
pullback(isl::multi_aff ma)9127 isl::multi_pw_aff multi_pw_aff::pullback(isl::multi_aff ma) const
9128 {
9129   if (!ptr || ma.is_null())
9130     exception::throw_invalid("NULL input", __FILE__, __LINE__);
9131   auto saved_ctx = ctx();
9132   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9133   auto res = isl_multi_pw_aff_pullback_multi_aff(copy(), ma.release());
9134   if (!res)
9135     exception::throw_last_error(saved_ctx);
9136   return manage(res);
9137 }
9138 
pullback(isl::multi_pw_aff mpa2)9139 isl::multi_pw_aff multi_pw_aff::pullback(isl::multi_pw_aff mpa2) const
9140 {
9141   if (!ptr || mpa2.is_null())
9142     exception::throw_invalid("NULL input", __FILE__, __LINE__);
9143   auto saved_ctx = ctx();
9144   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9145   auto res = isl_multi_pw_aff_pullback_multi_pw_aff(copy(), mpa2.release());
9146   if (!res)
9147     exception::throw_last_error(saved_ctx);
9148   return manage(res);
9149 }
9150 
pullback(isl::pw_multi_aff pma)9151 isl::multi_pw_aff multi_pw_aff::pullback(isl::pw_multi_aff pma) const
9152 {
9153   if (!ptr || pma.is_null())
9154     exception::throw_invalid("NULL input", __FILE__, __LINE__);
9155   auto saved_ctx = ctx();
9156   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9157   auto res = isl_multi_pw_aff_pullback_pw_multi_aff(copy(), pma.release());
9158   if (!res)
9159     exception::throw_last_error(saved_ctx);
9160   return manage(res);
9161 }
9162 
range_product(isl::multi_pw_aff multi2)9163 isl::multi_pw_aff multi_pw_aff::range_product(isl::multi_pw_aff multi2) const
9164 {
9165   if (!ptr || multi2.is_null())
9166     exception::throw_invalid("NULL input", __FILE__, __LINE__);
9167   auto saved_ctx = ctx();
9168   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9169   auto res = isl_multi_pw_aff_range_product(copy(), multi2.release());
9170   if (!res)
9171     exception::throw_last_error(saved_ctx);
9172   return manage(res);
9173 }
9174 
scale(isl::multi_val mv)9175 isl::multi_pw_aff multi_pw_aff::scale(isl::multi_val mv) const
9176 {
9177   if (!ptr || mv.is_null())
9178     exception::throw_invalid("NULL input", __FILE__, __LINE__);
9179   auto saved_ctx = ctx();
9180   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9181   auto res = isl_multi_pw_aff_scale_multi_val(copy(), mv.release());
9182   if (!res)
9183     exception::throw_last_error(saved_ctx);
9184   return manage(res);
9185 }
9186 
scale(isl::val v)9187 isl::multi_pw_aff multi_pw_aff::scale(isl::val v) const
9188 {
9189   if (!ptr || v.is_null())
9190     exception::throw_invalid("NULL input", __FILE__, __LINE__);
9191   auto saved_ctx = ctx();
9192   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9193   auto res = isl_multi_pw_aff_scale_val(copy(), v.release());
9194   if (!res)
9195     exception::throw_last_error(saved_ctx);
9196   return manage(res);
9197 }
9198 
scale(long v)9199 isl::multi_pw_aff multi_pw_aff::scale(long v) const
9200 {
9201   if (!ptr)
9202     exception::throw_invalid("NULL input", __FILE__, __LINE__);
9203   return this->scale(isl::val(ctx(), v));
9204 }
9205 
scale_down(isl::multi_val mv)9206 isl::multi_pw_aff multi_pw_aff::scale_down(isl::multi_val mv) const
9207 {
9208   if (!ptr || mv.is_null())
9209     exception::throw_invalid("NULL input", __FILE__, __LINE__);
9210   auto saved_ctx = ctx();
9211   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9212   auto res = isl_multi_pw_aff_scale_down_multi_val(copy(), mv.release());
9213   if (!res)
9214     exception::throw_last_error(saved_ctx);
9215   return manage(res);
9216 }
9217 
scale_down(isl::val v)9218 isl::multi_pw_aff multi_pw_aff::scale_down(isl::val v) const
9219 {
9220   if (!ptr || v.is_null())
9221     exception::throw_invalid("NULL input", __FILE__, __LINE__);
9222   auto saved_ctx = ctx();
9223   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9224   auto res = isl_multi_pw_aff_scale_down_val(copy(), v.release());
9225   if (!res)
9226     exception::throw_last_error(saved_ctx);
9227   return manage(res);
9228 }
9229 
scale_down(long v)9230 isl::multi_pw_aff multi_pw_aff::scale_down(long v) const
9231 {
9232   if (!ptr)
9233     exception::throw_invalid("NULL input", __FILE__, __LINE__);
9234   return this->scale_down(isl::val(ctx(), v));
9235 }
9236 
set_at(int pos,isl::pw_aff el)9237 isl::multi_pw_aff multi_pw_aff::set_at(int pos, isl::pw_aff el) const
9238 {
9239   if (!ptr || el.is_null())
9240     exception::throw_invalid("NULL input", __FILE__, __LINE__);
9241   auto saved_ctx = ctx();
9242   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9243   auto res = isl_multi_pw_aff_set_at(copy(), pos, el.release());
9244   if (!res)
9245     exception::throw_last_error(saved_ctx);
9246   return manage(res);
9247 }
9248 
size()9249 unsigned multi_pw_aff::size() const
9250 {
9251   if (!ptr)
9252     exception::throw_invalid("NULL input", __FILE__, __LINE__);
9253   auto saved_ctx = ctx();
9254   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9255   auto res = isl_multi_pw_aff_size(get());
9256   if (res < 0)
9257     exception::throw_last_error(saved_ctx);
9258   return res;
9259 }
9260 
sub(isl::multi_pw_aff multi2)9261 isl::multi_pw_aff multi_pw_aff::sub(isl::multi_pw_aff multi2) const
9262 {
9263   if (!ptr || multi2.is_null())
9264     exception::throw_invalid("NULL input", __FILE__, __LINE__);
9265   auto saved_ctx = ctx();
9266   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9267   auto res = isl_multi_pw_aff_sub(copy(), multi2.release());
9268   if (!res)
9269     exception::throw_last_error(saved_ctx);
9270   return manage(res);
9271 }
9272 
zero(isl::space space)9273 isl::multi_pw_aff multi_pw_aff::zero(isl::space space)
9274 {
9275   if (space.is_null())
9276     exception::throw_invalid("NULL input", __FILE__, __LINE__);
9277   auto saved_ctx = space.ctx();
9278   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9279   auto res = isl_multi_pw_aff_zero(space.release());
9280   if (!res)
9281     exception::throw_last_error(saved_ctx);
9282   return manage(res);
9283 }
9284 
9285 inline std::ostream &operator<<(std::ostream &os, const multi_pw_aff &obj)
9286 {
9287   if (!obj.get())
9288     exception::throw_invalid("NULL input", __FILE__, __LINE__);
9289   auto saved_ctx = isl_multi_pw_aff_get_ctx(obj.get());
9290   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9291   char *str = isl_multi_pw_aff_to_str(obj.get());
9292   if (!str)
9293     exception::throw_last_error(saved_ctx);
9294   os << str;
9295   free(str);
9296   return os;
9297 }
9298 
9299 // implementations for isl::multi_union_pw_aff
manage(__isl_take isl_multi_union_pw_aff * ptr)9300 multi_union_pw_aff manage(__isl_take isl_multi_union_pw_aff *ptr) {
9301   if (!ptr)
9302     exception::throw_invalid("NULL input", __FILE__, __LINE__);
9303   return multi_union_pw_aff(ptr);
9304 }
manage_copy(__isl_keep isl_multi_union_pw_aff * ptr)9305 multi_union_pw_aff manage_copy(__isl_keep isl_multi_union_pw_aff *ptr) {
9306   if (!ptr)
9307     exception::throw_invalid("NULL input", __FILE__, __LINE__);
9308   auto saved_ctx = isl_multi_union_pw_aff_get_ctx(ptr);
9309   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9310   ptr = isl_multi_union_pw_aff_copy(ptr);
9311   if (!ptr)
9312     exception::throw_last_error(saved_ctx);
9313   return multi_union_pw_aff(ptr);
9314 }
9315 
multi_union_pw_aff()9316 multi_union_pw_aff::multi_union_pw_aff()
9317     : ptr(nullptr) {}
9318 
multi_union_pw_aff(const multi_union_pw_aff & obj)9319 multi_union_pw_aff::multi_union_pw_aff(const multi_union_pw_aff &obj)
9320     : ptr(nullptr)
9321 {
9322   if (!obj.ptr)
9323     exception::throw_invalid("NULL input", __FILE__, __LINE__);
9324   auto saved_ctx = isl_multi_union_pw_aff_get_ctx(obj.ptr);
9325   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9326   ptr = obj.copy();
9327   if (!ptr)
9328     exception::throw_last_error(saved_ctx);
9329 }
9330 
multi_union_pw_aff(__isl_take isl_multi_union_pw_aff * ptr)9331 multi_union_pw_aff::multi_union_pw_aff(__isl_take isl_multi_union_pw_aff *ptr)
9332     : ptr(ptr) {}
9333 
multi_union_pw_aff(isl::multi_pw_aff mpa)9334 multi_union_pw_aff::multi_union_pw_aff(isl::multi_pw_aff mpa)
9335 {
9336   if (mpa.is_null())
9337     exception::throw_invalid("NULL input", __FILE__, __LINE__);
9338   auto saved_ctx = mpa.ctx();
9339   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9340   auto res = isl_multi_union_pw_aff_from_multi_pw_aff(mpa.release());
9341   if (!res)
9342     exception::throw_last_error(saved_ctx);
9343   ptr = res;
9344 }
9345 
multi_union_pw_aff(isl::union_pw_aff upa)9346 multi_union_pw_aff::multi_union_pw_aff(isl::union_pw_aff upa)
9347 {
9348   if (upa.is_null())
9349     exception::throw_invalid("NULL input", __FILE__, __LINE__);
9350   auto saved_ctx = upa.ctx();
9351   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9352   auto res = isl_multi_union_pw_aff_from_union_pw_aff(upa.release());
9353   if (!res)
9354     exception::throw_last_error(saved_ctx);
9355   ptr = res;
9356 }
9357 
multi_union_pw_aff(isl::space space,isl::union_pw_aff_list list)9358 multi_union_pw_aff::multi_union_pw_aff(isl::space space, isl::union_pw_aff_list list)
9359 {
9360   if (space.is_null() || list.is_null())
9361     exception::throw_invalid("NULL input", __FILE__, __LINE__);
9362   auto saved_ctx = space.ctx();
9363   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9364   auto res = isl_multi_union_pw_aff_from_union_pw_aff_list(space.release(), list.release());
9365   if (!res)
9366     exception::throw_last_error(saved_ctx);
9367   ptr = res;
9368 }
9369 
multi_union_pw_aff(isl::ctx ctx,const std::string & str)9370 multi_union_pw_aff::multi_union_pw_aff(isl::ctx ctx, const std::string &str)
9371 {
9372   auto saved_ctx = ctx;
9373   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9374   auto res = isl_multi_union_pw_aff_read_from_str(ctx.release(), str.c_str());
9375   if (!res)
9376     exception::throw_last_error(saved_ctx);
9377   ptr = res;
9378 }
9379 
9380 multi_union_pw_aff &multi_union_pw_aff::operator=(multi_union_pw_aff obj) {
9381   std::swap(this->ptr, obj.ptr);
9382   return *this;
9383 }
9384 
~multi_union_pw_aff()9385 multi_union_pw_aff::~multi_union_pw_aff() {
9386   if (ptr)
9387     isl_multi_union_pw_aff_free(ptr);
9388 }
9389 
copy()9390 __isl_give isl_multi_union_pw_aff *multi_union_pw_aff::copy() const & {
9391   return isl_multi_union_pw_aff_copy(ptr);
9392 }
9393 
get()9394 __isl_keep isl_multi_union_pw_aff *multi_union_pw_aff::get() const {
9395   return ptr;
9396 }
9397 
release()9398 __isl_give isl_multi_union_pw_aff *multi_union_pw_aff::release() {
9399   isl_multi_union_pw_aff *tmp = ptr;
9400   ptr = nullptr;
9401   return tmp;
9402 }
9403 
is_null()9404 bool multi_union_pw_aff::is_null() const {
9405   return ptr == nullptr;
9406 }
9407 
ctx()9408 isl::ctx multi_union_pw_aff::ctx() const {
9409   return isl::ctx(isl_multi_union_pw_aff_get_ctx(ptr));
9410 }
9411 
add(isl::multi_union_pw_aff multi2)9412 isl::multi_union_pw_aff multi_union_pw_aff::add(isl::multi_union_pw_aff multi2) const
9413 {
9414   if (!ptr || multi2.is_null())
9415     exception::throw_invalid("NULL input", __FILE__, __LINE__);
9416   auto saved_ctx = ctx();
9417   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9418   auto res = isl_multi_union_pw_aff_add(copy(), multi2.release());
9419   if (!res)
9420     exception::throw_last_error(saved_ctx);
9421   return manage(res);
9422 }
9423 
bind(isl::multi_id tuple)9424 isl::union_set multi_union_pw_aff::bind(isl::multi_id tuple) const
9425 {
9426   if (!ptr || tuple.is_null())
9427     exception::throw_invalid("NULL input", __FILE__, __LINE__);
9428   auto saved_ctx = ctx();
9429   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9430   auto res = isl_multi_union_pw_aff_bind(copy(), tuple.release());
9431   if (!res)
9432     exception::throw_last_error(saved_ctx);
9433   return manage(res);
9434 }
9435 
coalesce()9436 isl::multi_union_pw_aff multi_union_pw_aff::coalesce() const
9437 {
9438   if (!ptr)
9439     exception::throw_invalid("NULL input", __FILE__, __LINE__);
9440   auto saved_ctx = ctx();
9441   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9442   auto res = isl_multi_union_pw_aff_coalesce(copy());
9443   if (!res)
9444     exception::throw_last_error(saved_ctx);
9445   return manage(res);
9446 }
9447 
domain()9448 isl::union_set multi_union_pw_aff::domain() const
9449 {
9450   if (!ptr)
9451     exception::throw_invalid("NULL input", __FILE__, __LINE__);
9452   auto saved_ctx = ctx();
9453   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9454   auto res = isl_multi_union_pw_aff_domain(copy());
9455   if (!res)
9456     exception::throw_last_error(saved_ctx);
9457   return manage(res);
9458 }
9459 
flat_range_product(isl::multi_union_pw_aff multi2)9460 isl::multi_union_pw_aff multi_union_pw_aff::flat_range_product(isl::multi_union_pw_aff multi2) const
9461 {
9462   if (!ptr || multi2.is_null())
9463     exception::throw_invalid("NULL input", __FILE__, __LINE__);
9464   auto saved_ctx = ctx();
9465   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9466   auto res = isl_multi_union_pw_aff_flat_range_product(copy(), multi2.release());
9467   if (!res)
9468     exception::throw_last_error(saved_ctx);
9469   return manage(res);
9470 }
9471 
at(int pos)9472 isl::union_pw_aff multi_union_pw_aff::at(int pos) const
9473 {
9474   if (!ptr)
9475     exception::throw_invalid("NULL input", __FILE__, __LINE__);
9476   auto saved_ctx = ctx();
9477   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9478   auto res = isl_multi_union_pw_aff_get_at(get(), pos);
9479   if (!res)
9480     exception::throw_last_error(saved_ctx);
9481   return manage(res);
9482 }
9483 
get_at(int pos)9484 isl::union_pw_aff multi_union_pw_aff::get_at(int pos) const
9485 {
9486   return at(pos);
9487 }
9488 
space()9489 isl::space multi_union_pw_aff::space() const
9490 {
9491   if (!ptr)
9492     exception::throw_invalid("NULL input", __FILE__, __LINE__);
9493   auto saved_ctx = ctx();
9494   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9495   auto res = isl_multi_union_pw_aff_get_space(get());
9496   if (!res)
9497     exception::throw_last_error(saved_ctx);
9498   return manage(res);
9499 }
9500 
get_space()9501 isl::space multi_union_pw_aff::get_space() const
9502 {
9503   return space();
9504 }
9505 
gist(isl::union_set context)9506 isl::multi_union_pw_aff multi_union_pw_aff::gist(isl::union_set context) const
9507 {
9508   if (!ptr || context.is_null())
9509     exception::throw_invalid("NULL input", __FILE__, __LINE__);
9510   auto saved_ctx = ctx();
9511   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9512   auto res = isl_multi_union_pw_aff_gist(copy(), context.release());
9513   if (!res)
9514     exception::throw_last_error(saved_ctx);
9515   return manage(res);
9516 }
9517 
intersect_domain(isl::union_set uset)9518 isl::multi_union_pw_aff multi_union_pw_aff::intersect_domain(isl::union_set uset) const
9519 {
9520   if (!ptr || uset.is_null())
9521     exception::throw_invalid("NULL input", __FILE__, __LINE__);
9522   auto saved_ctx = ctx();
9523   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9524   auto res = isl_multi_union_pw_aff_intersect_domain(copy(), uset.release());
9525   if (!res)
9526     exception::throw_last_error(saved_ctx);
9527   return manage(res);
9528 }
9529 
intersect_params(isl::set params)9530 isl::multi_union_pw_aff multi_union_pw_aff::intersect_params(isl::set params) const
9531 {
9532   if (!ptr || params.is_null())
9533     exception::throw_invalid("NULL input", __FILE__, __LINE__);
9534   auto saved_ctx = ctx();
9535   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9536   auto res = isl_multi_union_pw_aff_intersect_params(copy(), params.release());
9537   if (!res)
9538     exception::throw_last_error(saved_ctx);
9539   return manage(res);
9540 }
9541 
neg()9542 isl::multi_union_pw_aff multi_union_pw_aff::neg() const
9543 {
9544   if (!ptr)
9545     exception::throw_invalid("NULL input", __FILE__, __LINE__);
9546   auto saved_ctx = ctx();
9547   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9548   auto res = isl_multi_union_pw_aff_neg(copy());
9549   if (!res)
9550     exception::throw_last_error(saved_ctx);
9551   return manage(res);
9552 }
9553 
plain_is_equal(const isl::multi_union_pw_aff & multi2)9554 bool multi_union_pw_aff::plain_is_equal(const isl::multi_union_pw_aff &multi2) const
9555 {
9556   if (!ptr || multi2.is_null())
9557     exception::throw_invalid("NULL input", __FILE__, __LINE__);
9558   auto saved_ctx = ctx();
9559   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9560   auto res = isl_multi_union_pw_aff_plain_is_equal(get(), multi2.get());
9561   if (res < 0)
9562     exception::throw_last_error(saved_ctx);
9563   return res;
9564 }
9565 
pullback(isl::union_pw_multi_aff upma)9566 isl::multi_union_pw_aff multi_union_pw_aff::pullback(isl::union_pw_multi_aff upma) const
9567 {
9568   if (!ptr || upma.is_null())
9569     exception::throw_invalid("NULL input", __FILE__, __LINE__);
9570   auto saved_ctx = ctx();
9571   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9572   auto res = isl_multi_union_pw_aff_pullback_union_pw_multi_aff(copy(), upma.release());
9573   if (!res)
9574     exception::throw_last_error(saved_ctx);
9575   return manage(res);
9576 }
9577 
range_product(isl::multi_union_pw_aff multi2)9578 isl::multi_union_pw_aff multi_union_pw_aff::range_product(isl::multi_union_pw_aff multi2) const
9579 {
9580   if (!ptr || multi2.is_null())
9581     exception::throw_invalid("NULL input", __FILE__, __LINE__);
9582   auto saved_ctx = ctx();
9583   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9584   auto res = isl_multi_union_pw_aff_range_product(copy(), multi2.release());
9585   if (!res)
9586     exception::throw_last_error(saved_ctx);
9587   return manage(res);
9588 }
9589 
scale(isl::multi_val mv)9590 isl::multi_union_pw_aff multi_union_pw_aff::scale(isl::multi_val mv) const
9591 {
9592   if (!ptr || mv.is_null())
9593     exception::throw_invalid("NULL input", __FILE__, __LINE__);
9594   auto saved_ctx = ctx();
9595   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9596   auto res = isl_multi_union_pw_aff_scale_multi_val(copy(), mv.release());
9597   if (!res)
9598     exception::throw_last_error(saved_ctx);
9599   return manage(res);
9600 }
9601 
scale(isl::val v)9602 isl::multi_union_pw_aff multi_union_pw_aff::scale(isl::val v) const
9603 {
9604   if (!ptr || v.is_null())
9605     exception::throw_invalid("NULL input", __FILE__, __LINE__);
9606   auto saved_ctx = ctx();
9607   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9608   auto res = isl_multi_union_pw_aff_scale_val(copy(), v.release());
9609   if (!res)
9610     exception::throw_last_error(saved_ctx);
9611   return manage(res);
9612 }
9613 
scale(long v)9614 isl::multi_union_pw_aff multi_union_pw_aff::scale(long v) const
9615 {
9616   if (!ptr)
9617     exception::throw_invalid("NULL input", __FILE__, __LINE__);
9618   return this->scale(isl::val(ctx(), v));
9619 }
9620 
scale_down(isl::multi_val mv)9621 isl::multi_union_pw_aff multi_union_pw_aff::scale_down(isl::multi_val mv) const
9622 {
9623   if (!ptr || mv.is_null())
9624     exception::throw_invalid("NULL input", __FILE__, __LINE__);
9625   auto saved_ctx = ctx();
9626   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9627   auto res = isl_multi_union_pw_aff_scale_down_multi_val(copy(), mv.release());
9628   if (!res)
9629     exception::throw_last_error(saved_ctx);
9630   return manage(res);
9631 }
9632 
scale_down(isl::val v)9633 isl::multi_union_pw_aff multi_union_pw_aff::scale_down(isl::val v) const
9634 {
9635   if (!ptr || v.is_null())
9636     exception::throw_invalid("NULL input", __FILE__, __LINE__);
9637   auto saved_ctx = ctx();
9638   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9639   auto res = isl_multi_union_pw_aff_scale_down_val(copy(), v.release());
9640   if (!res)
9641     exception::throw_last_error(saved_ctx);
9642   return manage(res);
9643 }
9644 
scale_down(long v)9645 isl::multi_union_pw_aff multi_union_pw_aff::scale_down(long v) const
9646 {
9647   if (!ptr)
9648     exception::throw_invalid("NULL input", __FILE__, __LINE__);
9649   return this->scale_down(isl::val(ctx(), v));
9650 }
9651 
set_at(int pos,isl::union_pw_aff el)9652 isl::multi_union_pw_aff multi_union_pw_aff::set_at(int pos, isl::union_pw_aff el) const
9653 {
9654   if (!ptr || el.is_null())
9655     exception::throw_invalid("NULL input", __FILE__, __LINE__);
9656   auto saved_ctx = ctx();
9657   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9658   auto res = isl_multi_union_pw_aff_set_at(copy(), pos, el.release());
9659   if (!res)
9660     exception::throw_last_error(saved_ctx);
9661   return manage(res);
9662 }
9663 
size()9664 unsigned multi_union_pw_aff::size() const
9665 {
9666   if (!ptr)
9667     exception::throw_invalid("NULL input", __FILE__, __LINE__);
9668   auto saved_ctx = ctx();
9669   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9670   auto res = isl_multi_union_pw_aff_size(get());
9671   if (res < 0)
9672     exception::throw_last_error(saved_ctx);
9673   return res;
9674 }
9675 
sub(isl::multi_union_pw_aff multi2)9676 isl::multi_union_pw_aff multi_union_pw_aff::sub(isl::multi_union_pw_aff multi2) const
9677 {
9678   if (!ptr || multi2.is_null())
9679     exception::throw_invalid("NULL input", __FILE__, __LINE__);
9680   auto saved_ctx = ctx();
9681   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9682   auto res = isl_multi_union_pw_aff_sub(copy(), multi2.release());
9683   if (!res)
9684     exception::throw_last_error(saved_ctx);
9685   return manage(res);
9686 }
9687 
union_add(isl::multi_union_pw_aff mupa2)9688 isl::multi_union_pw_aff multi_union_pw_aff::union_add(isl::multi_union_pw_aff mupa2) const
9689 {
9690   if (!ptr || mupa2.is_null())
9691     exception::throw_invalid("NULL input", __FILE__, __LINE__);
9692   auto saved_ctx = ctx();
9693   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9694   auto res = isl_multi_union_pw_aff_union_add(copy(), mupa2.release());
9695   if (!res)
9696     exception::throw_last_error(saved_ctx);
9697   return manage(res);
9698 }
9699 
zero(isl::space space)9700 isl::multi_union_pw_aff multi_union_pw_aff::zero(isl::space space)
9701 {
9702   if (space.is_null())
9703     exception::throw_invalid("NULL input", __FILE__, __LINE__);
9704   auto saved_ctx = space.ctx();
9705   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9706   auto res = isl_multi_union_pw_aff_zero(space.release());
9707   if (!res)
9708     exception::throw_last_error(saved_ctx);
9709   return manage(res);
9710 }
9711 
9712 inline std::ostream &operator<<(std::ostream &os, const multi_union_pw_aff &obj)
9713 {
9714   if (!obj.get())
9715     exception::throw_invalid("NULL input", __FILE__, __LINE__);
9716   auto saved_ctx = isl_multi_union_pw_aff_get_ctx(obj.get());
9717   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9718   char *str = isl_multi_union_pw_aff_to_str(obj.get());
9719   if (!str)
9720     exception::throw_last_error(saved_ctx);
9721   os << str;
9722   free(str);
9723   return os;
9724 }
9725 
9726 // implementations for isl::multi_val
manage(__isl_take isl_multi_val * ptr)9727 multi_val manage(__isl_take isl_multi_val *ptr) {
9728   if (!ptr)
9729     exception::throw_invalid("NULL input", __FILE__, __LINE__);
9730   return multi_val(ptr);
9731 }
manage_copy(__isl_keep isl_multi_val * ptr)9732 multi_val manage_copy(__isl_keep isl_multi_val *ptr) {
9733   if (!ptr)
9734     exception::throw_invalid("NULL input", __FILE__, __LINE__);
9735   auto saved_ctx = isl_multi_val_get_ctx(ptr);
9736   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9737   ptr = isl_multi_val_copy(ptr);
9738   if (!ptr)
9739     exception::throw_last_error(saved_ctx);
9740   return multi_val(ptr);
9741 }
9742 
multi_val()9743 multi_val::multi_val()
9744     : ptr(nullptr) {}
9745 
multi_val(const multi_val & obj)9746 multi_val::multi_val(const multi_val &obj)
9747     : ptr(nullptr)
9748 {
9749   if (!obj.ptr)
9750     exception::throw_invalid("NULL input", __FILE__, __LINE__);
9751   auto saved_ctx = isl_multi_val_get_ctx(obj.ptr);
9752   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9753   ptr = obj.copy();
9754   if (!ptr)
9755     exception::throw_last_error(saved_ctx);
9756 }
9757 
multi_val(__isl_take isl_multi_val * ptr)9758 multi_val::multi_val(__isl_take isl_multi_val *ptr)
9759     : ptr(ptr) {}
9760 
multi_val(isl::space space,isl::val_list list)9761 multi_val::multi_val(isl::space space, isl::val_list list)
9762 {
9763   if (space.is_null() || list.is_null())
9764     exception::throw_invalid("NULL input", __FILE__, __LINE__);
9765   auto saved_ctx = space.ctx();
9766   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9767   auto res = isl_multi_val_from_val_list(space.release(), list.release());
9768   if (!res)
9769     exception::throw_last_error(saved_ctx);
9770   ptr = res;
9771 }
9772 
multi_val(isl::ctx ctx,const std::string & str)9773 multi_val::multi_val(isl::ctx ctx, const std::string &str)
9774 {
9775   auto saved_ctx = ctx;
9776   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9777   auto res = isl_multi_val_read_from_str(ctx.release(), str.c_str());
9778   if (!res)
9779     exception::throw_last_error(saved_ctx);
9780   ptr = res;
9781 }
9782 
9783 multi_val &multi_val::operator=(multi_val obj) {
9784   std::swap(this->ptr, obj.ptr);
9785   return *this;
9786 }
9787 
~multi_val()9788 multi_val::~multi_val() {
9789   if (ptr)
9790     isl_multi_val_free(ptr);
9791 }
9792 
copy()9793 __isl_give isl_multi_val *multi_val::copy() const & {
9794   return isl_multi_val_copy(ptr);
9795 }
9796 
get()9797 __isl_keep isl_multi_val *multi_val::get() const {
9798   return ptr;
9799 }
9800 
release()9801 __isl_give isl_multi_val *multi_val::release() {
9802   isl_multi_val *tmp = ptr;
9803   ptr = nullptr;
9804   return tmp;
9805 }
9806 
is_null()9807 bool multi_val::is_null() const {
9808   return ptr == nullptr;
9809 }
9810 
ctx()9811 isl::ctx multi_val::ctx() const {
9812   return isl::ctx(isl_multi_val_get_ctx(ptr));
9813 }
9814 
add(isl::multi_val multi2)9815 isl::multi_val multi_val::add(isl::multi_val multi2) const
9816 {
9817   if (!ptr || multi2.is_null())
9818     exception::throw_invalid("NULL input", __FILE__, __LINE__);
9819   auto saved_ctx = ctx();
9820   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9821   auto res = isl_multi_val_add(copy(), multi2.release());
9822   if (!res)
9823     exception::throw_last_error(saved_ctx);
9824   return manage(res);
9825 }
9826 
add(isl::val v)9827 isl::multi_val multi_val::add(isl::val v) const
9828 {
9829   if (!ptr || v.is_null())
9830     exception::throw_invalid("NULL input", __FILE__, __LINE__);
9831   auto saved_ctx = ctx();
9832   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9833   auto res = isl_multi_val_add_val(copy(), v.release());
9834   if (!res)
9835     exception::throw_last_error(saved_ctx);
9836   return manage(res);
9837 }
9838 
add(long v)9839 isl::multi_val multi_val::add(long v) const
9840 {
9841   if (!ptr)
9842     exception::throw_invalid("NULL input", __FILE__, __LINE__);
9843   return this->add(isl::val(ctx(), v));
9844 }
9845 
flat_range_product(isl::multi_val multi2)9846 isl::multi_val multi_val::flat_range_product(isl::multi_val multi2) const
9847 {
9848   if (!ptr || multi2.is_null())
9849     exception::throw_invalid("NULL input", __FILE__, __LINE__);
9850   auto saved_ctx = ctx();
9851   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9852   auto res = isl_multi_val_flat_range_product(copy(), multi2.release());
9853   if (!res)
9854     exception::throw_last_error(saved_ctx);
9855   return manage(res);
9856 }
9857 
at(int pos)9858 isl::val multi_val::at(int pos) const
9859 {
9860   if (!ptr)
9861     exception::throw_invalid("NULL input", __FILE__, __LINE__);
9862   auto saved_ctx = ctx();
9863   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9864   auto res = isl_multi_val_get_at(get(), pos);
9865   if (!res)
9866     exception::throw_last_error(saved_ctx);
9867   return manage(res);
9868 }
9869 
get_at(int pos)9870 isl::val multi_val::get_at(int pos) const
9871 {
9872   return at(pos);
9873 }
9874 
space()9875 isl::space multi_val::space() const
9876 {
9877   if (!ptr)
9878     exception::throw_invalid("NULL input", __FILE__, __LINE__);
9879   auto saved_ctx = ctx();
9880   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9881   auto res = isl_multi_val_get_space(get());
9882   if (!res)
9883     exception::throw_last_error(saved_ctx);
9884   return manage(res);
9885 }
9886 
get_space()9887 isl::space multi_val::get_space() const
9888 {
9889   return space();
9890 }
9891 
neg()9892 isl::multi_val multi_val::neg() const
9893 {
9894   if (!ptr)
9895     exception::throw_invalid("NULL input", __FILE__, __LINE__);
9896   auto saved_ctx = ctx();
9897   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9898   auto res = isl_multi_val_neg(copy());
9899   if (!res)
9900     exception::throw_last_error(saved_ctx);
9901   return manage(res);
9902 }
9903 
plain_is_equal(const isl::multi_val & multi2)9904 bool multi_val::plain_is_equal(const isl::multi_val &multi2) const
9905 {
9906   if (!ptr || multi2.is_null())
9907     exception::throw_invalid("NULL input", __FILE__, __LINE__);
9908   auto saved_ctx = ctx();
9909   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9910   auto res = isl_multi_val_plain_is_equal(get(), multi2.get());
9911   if (res < 0)
9912     exception::throw_last_error(saved_ctx);
9913   return res;
9914 }
9915 
product(isl::multi_val multi2)9916 isl::multi_val multi_val::product(isl::multi_val multi2) const
9917 {
9918   if (!ptr || multi2.is_null())
9919     exception::throw_invalid("NULL input", __FILE__, __LINE__);
9920   auto saved_ctx = ctx();
9921   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9922   auto res = isl_multi_val_product(copy(), multi2.release());
9923   if (!res)
9924     exception::throw_last_error(saved_ctx);
9925   return manage(res);
9926 }
9927 
range_product(isl::multi_val multi2)9928 isl::multi_val multi_val::range_product(isl::multi_val multi2) const
9929 {
9930   if (!ptr || multi2.is_null())
9931     exception::throw_invalid("NULL input", __FILE__, __LINE__);
9932   auto saved_ctx = ctx();
9933   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9934   auto res = isl_multi_val_range_product(copy(), multi2.release());
9935   if (!res)
9936     exception::throw_last_error(saved_ctx);
9937   return manage(res);
9938 }
9939 
scale(isl::multi_val mv)9940 isl::multi_val multi_val::scale(isl::multi_val mv) const
9941 {
9942   if (!ptr || mv.is_null())
9943     exception::throw_invalid("NULL input", __FILE__, __LINE__);
9944   auto saved_ctx = ctx();
9945   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9946   auto res = isl_multi_val_scale_multi_val(copy(), mv.release());
9947   if (!res)
9948     exception::throw_last_error(saved_ctx);
9949   return manage(res);
9950 }
9951 
scale(isl::val v)9952 isl::multi_val multi_val::scale(isl::val v) const
9953 {
9954   if (!ptr || v.is_null())
9955     exception::throw_invalid("NULL input", __FILE__, __LINE__);
9956   auto saved_ctx = ctx();
9957   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9958   auto res = isl_multi_val_scale_val(copy(), v.release());
9959   if (!res)
9960     exception::throw_last_error(saved_ctx);
9961   return manage(res);
9962 }
9963 
scale(long v)9964 isl::multi_val multi_val::scale(long v) const
9965 {
9966   if (!ptr)
9967     exception::throw_invalid("NULL input", __FILE__, __LINE__);
9968   return this->scale(isl::val(ctx(), v));
9969 }
9970 
scale_down(isl::multi_val mv)9971 isl::multi_val multi_val::scale_down(isl::multi_val mv) const
9972 {
9973   if (!ptr || mv.is_null())
9974     exception::throw_invalid("NULL input", __FILE__, __LINE__);
9975   auto saved_ctx = ctx();
9976   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9977   auto res = isl_multi_val_scale_down_multi_val(copy(), mv.release());
9978   if (!res)
9979     exception::throw_last_error(saved_ctx);
9980   return manage(res);
9981 }
9982 
scale_down(isl::val v)9983 isl::multi_val multi_val::scale_down(isl::val v) const
9984 {
9985   if (!ptr || v.is_null())
9986     exception::throw_invalid("NULL input", __FILE__, __LINE__);
9987   auto saved_ctx = ctx();
9988   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
9989   auto res = isl_multi_val_scale_down_val(copy(), v.release());
9990   if (!res)
9991     exception::throw_last_error(saved_ctx);
9992   return manage(res);
9993 }
9994 
scale_down(long v)9995 isl::multi_val multi_val::scale_down(long v) const
9996 {
9997   if (!ptr)
9998     exception::throw_invalid("NULL input", __FILE__, __LINE__);
9999   return this->scale_down(isl::val(ctx(), v));
10000 }
10001 
set_at(int pos,isl::val el)10002 isl::multi_val multi_val::set_at(int pos, isl::val el) const
10003 {
10004   if (!ptr || el.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_val_set_at(copy(), pos, el.release());
10009   if (!res)
10010     exception::throw_last_error(saved_ctx);
10011   return manage(res);
10012 }
10013 
set_at(int pos,long el)10014 isl::multi_val multi_val::set_at(int pos, long el) const
10015 {
10016   if (!ptr)
10017     exception::throw_invalid("NULL input", __FILE__, __LINE__);
10018   return this->set_at(pos, isl::val(ctx(), el));
10019 }
10020 
size()10021 unsigned multi_val::size() const
10022 {
10023   if (!ptr)
10024     exception::throw_invalid("NULL input", __FILE__, __LINE__);
10025   auto saved_ctx = ctx();
10026   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10027   auto res = isl_multi_val_size(get());
10028   if (res < 0)
10029     exception::throw_last_error(saved_ctx);
10030   return res;
10031 }
10032 
sub(isl::multi_val multi2)10033 isl::multi_val multi_val::sub(isl::multi_val multi2) const
10034 {
10035   if (!ptr || multi2.is_null())
10036     exception::throw_invalid("NULL input", __FILE__, __LINE__);
10037   auto saved_ctx = ctx();
10038   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10039   auto res = isl_multi_val_sub(copy(), multi2.release());
10040   if (!res)
10041     exception::throw_last_error(saved_ctx);
10042   return manage(res);
10043 }
10044 
zero(isl::space space)10045 isl::multi_val multi_val::zero(isl::space space)
10046 {
10047   if (space.is_null())
10048     exception::throw_invalid("NULL input", __FILE__, __LINE__);
10049   auto saved_ctx = space.ctx();
10050   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10051   auto res = isl_multi_val_zero(space.release());
10052   if (!res)
10053     exception::throw_last_error(saved_ctx);
10054   return manage(res);
10055 }
10056 
10057 inline std::ostream &operator<<(std::ostream &os, const multi_val &obj)
10058 {
10059   if (!obj.get())
10060     exception::throw_invalid("NULL input", __FILE__, __LINE__);
10061   auto saved_ctx = isl_multi_val_get_ctx(obj.get());
10062   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10063   char *str = isl_multi_val_to_str(obj.get());
10064   if (!str)
10065     exception::throw_last_error(saved_ctx);
10066   os << str;
10067   free(str);
10068   return os;
10069 }
10070 
10071 // implementations for isl::point
manage(__isl_take isl_point * ptr)10072 point manage(__isl_take isl_point *ptr) {
10073   if (!ptr)
10074     exception::throw_invalid("NULL input", __FILE__, __LINE__);
10075   return point(ptr);
10076 }
manage_copy(__isl_keep isl_point * ptr)10077 point manage_copy(__isl_keep isl_point *ptr) {
10078   if (!ptr)
10079     exception::throw_invalid("NULL input", __FILE__, __LINE__);
10080   auto saved_ctx = isl_point_get_ctx(ptr);
10081   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10082   ptr = isl_point_copy(ptr);
10083   if (!ptr)
10084     exception::throw_last_error(saved_ctx);
10085   return point(ptr);
10086 }
10087 
point()10088 point::point()
10089     : ptr(nullptr) {}
10090 
point(const point & obj)10091 point::point(const point &obj)
10092     : ptr(nullptr)
10093 {
10094   if (!obj.ptr)
10095     exception::throw_invalid("NULL input", __FILE__, __LINE__);
10096   auto saved_ctx = isl_point_get_ctx(obj.ptr);
10097   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10098   ptr = obj.copy();
10099   if (!ptr)
10100     exception::throw_last_error(saved_ctx);
10101 }
10102 
point(__isl_take isl_point * ptr)10103 point::point(__isl_take isl_point *ptr)
10104     : ptr(ptr) {}
10105 
10106 point &point::operator=(point obj) {
10107   std::swap(this->ptr, obj.ptr);
10108   return *this;
10109 }
10110 
~point()10111 point::~point() {
10112   if (ptr)
10113     isl_point_free(ptr);
10114 }
10115 
copy()10116 __isl_give isl_point *point::copy() const & {
10117   return isl_point_copy(ptr);
10118 }
10119 
get()10120 __isl_keep isl_point *point::get() const {
10121   return ptr;
10122 }
10123 
release()10124 __isl_give isl_point *point::release() {
10125   isl_point *tmp = ptr;
10126   ptr = nullptr;
10127   return tmp;
10128 }
10129 
is_null()10130 bool point::is_null() const {
10131   return ptr == nullptr;
10132 }
10133 
ctx()10134 isl::ctx point::ctx() const {
10135   return isl::ctx(isl_point_get_ctx(ptr));
10136 }
10137 
multi_val()10138 isl::multi_val point::multi_val() const
10139 {
10140   if (!ptr)
10141     exception::throw_invalid("NULL input", __FILE__, __LINE__);
10142   auto saved_ctx = ctx();
10143   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10144   auto res = isl_point_get_multi_val(get());
10145   if (!res)
10146     exception::throw_last_error(saved_ctx);
10147   return manage(res);
10148 }
10149 
get_multi_val()10150 isl::multi_val point::get_multi_val() const
10151 {
10152   return multi_val();
10153 }
10154 
10155 inline std::ostream &operator<<(std::ostream &os, const point &obj)
10156 {
10157   if (!obj.get())
10158     exception::throw_invalid("NULL input", __FILE__, __LINE__);
10159   auto saved_ctx = isl_point_get_ctx(obj.get());
10160   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10161   char *str = isl_point_to_str(obj.get());
10162   if (!str)
10163     exception::throw_last_error(saved_ctx);
10164   os << str;
10165   free(str);
10166   return os;
10167 }
10168 
10169 // implementations for isl::pw_aff
manage(__isl_take isl_pw_aff * ptr)10170 pw_aff manage(__isl_take isl_pw_aff *ptr) {
10171   if (!ptr)
10172     exception::throw_invalid("NULL input", __FILE__, __LINE__);
10173   return pw_aff(ptr);
10174 }
manage_copy(__isl_keep isl_pw_aff * ptr)10175 pw_aff manage_copy(__isl_keep isl_pw_aff *ptr) {
10176   if (!ptr)
10177     exception::throw_invalid("NULL input", __FILE__, __LINE__);
10178   auto saved_ctx = isl_pw_aff_get_ctx(ptr);
10179   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10180   ptr = isl_pw_aff_copy(ptr);
10181   if (!ptr)
10182     exception::throw_last_error(saved_ctx);
10183   return pw_aff(ptr);
10184 }
10185 
pw_aff()10186 pw_aff::pw_aff()
10187     : ptr(nullptr) {}
10188 
pw_aff(const pw_aff & obj)10189 pw_aff::pw_aff(const pw_aff &obj)
10190     : ptr(nullptr)
10191 {
10192   if (!obj.ptr)
10193     exception::throw_invalid("NULL input", __FILE__, __LINE__);
10194   auto saved_ctx = isl_pw_aff_get_ctx(obj.ptr);
10195   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10196   ptr = obj.copy();
10197   if (!ptr)
10198     exception::throw_last_error(saved_ctx);
10199 }
10200 
pw_aff(__isl_take isl_pw_aff * ptr)10201 pw_aff::pw_aff(__isl_take isl_pw_aff *ptr)
10202     : ptr(ptr) {}
10203 
pw_aff(isl::aff aff)10204 pw_aff::pw_aff(isl::aff aff)
10205 {
10206   if (aff.is_null())
10207     exception::throw_invalid("NULL input", __FILE__, __LINE__);
10208   auto saved_ctx = aff.ctx();
10209   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10210   auto res = isl_pw_aff_from_aff(aff.release());
10211   if (!res)
10212     exception::throw_last_error(saved_ctx);
10213   ptr = res;
10214 }
10215 
pw_aff(isl::ctx ctx,const std::string & str)10216 pw_aff::pw_aff(isl::ctx ctx, const std::string &str)
10217 {
10218   auto saved_ctx = ctx;
10219   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10220   auto res = isl_pw_aff_read_from_str(ctx.release(), str.c_str());
10221   if (!res)
10222     exception::throw_last_error(saved_ctx);
10223   ptr = res;
10224 }
10225 
10226 pw_aff &pw_aff::operator=(pw_aff obj) {
10227   std::swap(this->ptr, obj.ptr);
10228   return *this;
10229 }
10230 
~pw_aff()10231 pw_aff::~pw_aff() {
10232   if (ptr)
10233     isl_pw_aff_free(ptr);
10234 }
10235 
copy()10236 __isl_give isl_pw_aff *pw_aff::copy() const & {
10237   return isl_pw_aff_copy(ptr);
10238 }
10239 
get()10240 __isl_keep isl_pw_aff *pw_aff::get() const {
10241   return ptr;
10242 }
10243 
release()10244 __isl_give isl_pw_aff *pw_aff::release() {
10245   isl_pw_aff *tmp = ptr;
10246   ptr = nullptr;
10247   return tmp;
10248 }
10249 
is_null()10250 bool pw_aff::is_null() const {
10251   return ptr == nullptr;
10252 }
10253 
ctx()10254 isl::ctx pw_aff::ctx() const {
10255   return isl::ctx(isl_pw_aff_get_ctx(ptr));
10256 }
10257 
add(isl::pw_aff pwaff2)10258 isl::pw_aff pw_aff::add(isl::pw_aff pwaff2) const
10259 {
10260   if (!ptr || pwaff2.is_null())
10261     exception::throw_invalid("NULL input", __FILE__, __LINE__);
10262   auto saved_ctx = ctx();
10263   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10264   auto res = isl_pw_aff_add(copy(), pwaff2.release());
10265   if (!res)
10266     exception::throw_last_error(saved_ctx);
10267   return manage(res);
10268 }
10269 
add_constant(isl::val v)10270 isl::pw_aff pw_aff::add_constant(isl::val v) const
10271 {
10272   if (!ptr || v.is_null())
10273     exception::throw_invalid("NULL input", __FILE__, __LINE__);
10274   auto saved_ctx = ctx();
10275   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10276   auto res = isl_pw_aff_add_constant_val(copy(), v.release());
10277   if (!res)
10278     exception::throw_last_error(saved_ctx);
10279   return manage(res);
10280 }
10281 
add_constant(long v)10282 isl::pw_aff pw_aff::add_constant(long v) const
10283 {
10284   if (!ptr)
10285     exception::throw_invalid("NULL input", __FILE__, __LINE__);
10286   return this->add_constant(isl::val(ctx(), v));
10287 }
10288 
as_aff()10289 isl::aff pw_aff::as_aff() const
10290 {
10291   if (!ptr)
10292     exception::throw_invalid("NULL input", __FILE__, __LINE__);
10293   auto saved_ctx = ctx();
10294   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10295   auto res = isl_pw_aff_as_aff(copy());
10296   if (!res)
10297     exception::throw_last_error(saved_ctx);
10298   return manage(res);
10299 }
10300 
bind(isl::id id)10301 isl::set pw_aff::bind(isl::id id) const
10302 {
10303   if (!ptr || id.is_null())
10304     exception::throw_invalid("NULL input", __FILE__, __LINE__);
10305   auto saved_ctx = ctx();
10306   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10307   auto res = isl_pw_aff_bind_id(copy(), id.release());
10308   if (!res)
10309     exception::throw_last_error(saved_ctx);
10310   return manage(res);
10311 }
10312 
bind(const std::string & id)10313 isl::set pw_aff::bind(const std::string &id) const
10314 {
10315   if (!ptr)
10316     exception::throw_invalid("NULL input", __FILE__, __LINE__);
10317   return this->bind(isl::id(ctx(), id));
10318 }
10319 
bind_domain(isl::multi_id tuple)10320 isl::pw_aff pw_aff::bind_domain(isl::multi_id tuple) const
10321 {
10322   if (!ptr || tuple.is_null())
10323     exception::throw_invalid("NULL input", __FILE__, __LINE__);
10324   auto saved_ctx = ctx();
10325   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10326   auto res = isl_pw_aff_bind_domain(copy(), tuple.release());
10327   if (!res)
10328     exception::throw_last_error(saved_ctx);
10329   return manage(res);
10330 }
10331 
bind_domain_wrapped_domain(isl::multi_id tuple)10332 isl::pw_aff pw_aff::bind_domain_wrapped_domain(isl::multi_id tuple) const
10333 {
10334   if (!ptr || tuple.is_null())
10335     exception::throw_invalid("NULL input", __FILE__, __LINE__);
10336   auto saved_ctx = ctx();
10337   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10338   auto res = isl_pw_aff_bind_domain_wrapped_domain(copy(), tuple.release());
10339   if (!res)
10340     exception::throw_last_error(saved_ctx);
10341   return manage(res);
10342 }
10343 
ceil()10344 isl::pw_aff pw_aff::ceil() const
10345 {
10346   if (!ptr)
10347     exception::throw_invalid("NULL input", __FILE__, __LINE__);
10348   auto saved_ctx = ctx();
10349   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10350   auto res = isl_pw_aff_ceil(copy());
10351   if (!res)
10352     exception::throw_last_error(saved_ctx);
10353   return manage(res);
10354 }
10355 
coalesce()10356 isl::pw_aff pw_aff::coalesce() const
10357 {
10358   if (!ptr)
10359     exception::throw_invalid("NULL input", __FILE__, __LINE__);
10360   auto saved_ctx = ctx();
10361   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10362   auto res = isl_pw_aff_coalesce(copy());
10363   if (!res)
10364     exception::throw_last_error(saved_ctx);
10365   return manage(res);
10366 }
10367 
cond(isl::pw_aff pwaff_true,isl::pw_aff pwaff_false)10368 isl::pw_aff pw_aff::cond(isl::pw_aff pwaff_true, isl::pw_aff pwaff_false) const
10369 {
10370   if (!ptr || pwaff_true.is_null() || pwaff_false.is_null())
10371     exception::throw_invalid("NULL input", __FILE__, __LINE__);
10372   auto saved_ctx = ctx();
10373   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10374   auto res = isl_pw_aff_cond(copy(), pwaff_true.release(), pwaff_false.release());
10375   if (!res)
10376     exception::throw_last_error(saved_ctx);
10377   return manage(res);
10378 }
10379 
div(isl::pw_aff pa2)10380 isl::pw_aff pw_aff::div(isl::pw_aff pa2) const
10381 {
10382   if (!ptr || pa2.is_null())
10383     exception::throw_invalid("NULL input", __FILE__, __LINE__);
10384   auto saved_ctx = ctx();
10385   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10386   auto res = isl_pw_aff_div(copy(), pa2.release());
10387   if (!res)
10388     exception::throw_last_error(saved_ctx);
10389   return manage(res);
10390 }
10391 
domain()10392 isl::set pw_aff::domain() const
10393 {
10394   if (!ptr)
10395     exception::throw_invalid("NULL input", __FILE__, __LINE__);
10396   auto saved_ctx = ctx();
10397   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10398   auto res = isl_pw_aff_domain(copy());
10399   if (!res)
10400     exception::throw_last_error(saved_ctx);
10401   return manage(res);
10402 }
10403 
eq_set(isl::pw_aff pwaff2)10404 isl::set pw_aff::eq_set(isl::pw_aff pwaff2) const
10405 {
10406   if (!ptr || pwaff2.is_null())
10407     exception::throw_invalid("NULL input", __FILE__, __LINE__);
10408   auto saved_ctx = ctx();
10409   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10410   auto res = isl_pw_aff_eq_set(copy(), pwaff2.release());
10411   if (!res)
10412     exception::throw_last_error(saved_ctx);
10413   return manage(res);
10414 }
10415 
eval(isl::point pnt)10416 isl::val pw_aff::eval(isl::point pnt) const
10417 {
10418   if (!ptr || pnt.is_null())
10419     exception::throw_invalid("NULL input", __FILE__, __LINE__);
10420   auto saved_ctx = ctx();
10421   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10422   auto res = isl_pw_aff_eval(copy(), pnt.release());
10423   if (!res)
10424     exception::throw_last_error(saved_ctx);
10425   return manage(res);
10426 }
10427 
floor()10428 isl::pw_aff pw_aff::floor() const
10429 {
10430   if (!ptr)
10431     exception::throw_invalid("NULL input", __FILE__, __LINE__);
10432   auto saved_ctx = ctx();
10433   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10434   auto res = isl_pw_aff_floor(copy());
10435   if (!res)
10436     exception::throw_last_error(saved_ctx);
10437   return manage(res);
10438 }
10439 
ge_set(isl::pw_aff pwaff2)10440 isl::set pw_aff::ge_set(isl::pw_aff pwaff2) const
10441 {
10442   if (!ptr || pwaff2.is_null())
10443     exception::throw_invalid("NULL input", __FILE__, __LINE__);
10444   auto saved_ctx = ctx();
10445   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10446   auto res = isl_pw_aff_ge_set(copy(), pwaff2.release());
10447   if (!res)
10448     exception::throw_last_error(saved_ctx);
10449   return manage(res);
10450 }
10451 
gist(isl::set context)10452 isl::pw_aff pw_aff::gist(isl::set context) const
10453 {
10454   if (!ptr || context.is_null())
10455     exception::throw_invalid("NULL input", __FILE__, __LINE__);
10456   auto saved_ctx = ctx();
10457   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10458   auto res = isl_pw_aff_gist(copy(), context.release());
10459   if (!res)
10460     exception::throw_last_error(saved_ctx);
10461   return manage(res);
10462 }
10463 
gt_set(isl::pw_aff pwaff2)10464 isl::set pw_aff::gt_set(isl::pw_aff pwaff2) const
10465 {
10466   if (!ptr || pwaff2.is_null())
10467     exception::throw_invalid("NULL input", __FILE__, __LINE__);
10468   auto saved_ctx = ctx();
10469   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10470   auto res = isl_pw_aff_gt_set(copy(), pwaff2.release());
10471   if (!res)
10472     exception::throw_last_error(saved_ctx);
10473   return manage(res);
10474 }
10475 
intersect_domain(isl::set set)10476 isl::pw_aff pw_aff::intersect_domain(isl::set set) const
10477 {
10478   if (!ptr || set.is_null())
10479     exception::throw_invalid("NULL input", __FILE__, __LINE__);
10480   auto saved_ctx = ctx();
10481   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10482   auto res = isl_pw_aff_intersect_domain(copy(), set.release());
10483   if (!res)
10484     exception::throw_last_error(saved_ctx);
10485   return manage(res);
10486 }
10487 
intersect_params(isl::set set)10488 isl::pw_aff pw_aff::intersect_params(isl::set set) const
10489 {
10490   if (!ptr || set.is_null())
10491     exception::throw_invalid("NULL input", __FILE__, __LINE__);
10492   auto saved_ctx = ctx();
10493   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10494   auto res = isl_pw_aff_intersect_params(copy(), set.release());
10495   if (!res)
10496     exception::throw_last_error(saved_ctx);
10497   return manage(res);
10498 }
10499 
isa_aff()10500 bool pw_aff::isa_aff() const
10501 {
10502   if (!ptr)
10503     exception::throw_invalid("NULL input", __FILE__, __LINE__);
10504   auto saved_ctx = ctx();
10505   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10506   auto res = isl_pw_aff_isa_aff(get());
10507   if (res < 0)
10508     exception::throw_last_error(saved_ctx);
10509   return res;
10510 }
10511 
le_set(isl::pw_aff pwaff2)10512 isl::set pw_aff::le_set(isl::pw_aff pwaff2) const
10513 {
10514   if (!ptr || pwaff2.is_null())
10515     exception::throw_invalid("NULL input", __FILE__, __LINE__);
10516   auto saved_ctx = ctx();
10517   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10518   auto res = isl_pw_aff_le_set(copy(), pwaff2.release());
10519   if (!res)
10520     exception::throw_last_error(saved_ctx);
10521   return manage(res);
10522 }
10523 
lt_set(isl::pw_aff pwaff2)10524 isl::set pw_aff::lt_set(isl::pw_aff pwaff2) const
10525 {
10526   if (!ptr || pwaff2.is_null())
10527     exception::throw_invalid("NULL input", __FILE__, __LINE__);
10528   auto saved_ctx = ctx();
10529   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10530   auto res = isl_pw_aff_lt_set(copy(), pwaff2.release());
10531   if (!res)
10532     exception::throw_last_error(saved_ctx);
10533   return manage(res);
10534 }
10535 
max(isl::pw_aff pwaff2)10536 isl::pw_aff pw_aff::max(isl::pw_aff pwaff2) const
10537 {
10538   if (!ptr || pwaff2.is_null())
10539     exception::throw_invalid("NULL input", __FILE__, __LINE__);
10540   auto saved_ctx = ctx();
10541   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10542   auto res = isl_pw_aff_max(copy(), pwaff2.release());
10543   if (!res)
10544     exception::throw_last_error(saved_ctx);
10545   return manage(res);
10546 }
10547 
min(isl::pw_aff pwaff2)10548 isl::pw_aff pw_aff::min(isl::pw_aff pwaff2) const
10549 {
10550   if (!ptr || pwaff2.is_null())
10551     exception::throw_invalid("NULL input", __FILE__, __LINE__);
10552   auto saved_ctx = ctx();
10553   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10554   auto res = isl_pw_aff_min(copy(), pwaff2.release());
10555   if (!res)
10556     exception::throw_last_error(saved_ctx);
10557   return manage(res);
10558 }
10559 
mod(isl::val mod)10560 isl::pw_aff pw_aff::mod(isl::val mod) const
10561 {
10562   if (!ptr || mod.is_null())
10563     exception::throw_invalid("NULL input", __FILE__, __LINE__);
10564   auto saved_ctx = ctx();
10565   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10566   auto res = isl_pw_aff_mod_val(copy(), mod.release());
10567   if (!res)
10568     exception::throw_last_error(saved_ctx);
10569   return manage(res);
10570 }
10571 
mod(long mod)10572 isl::pw_aff pw_aff::mod(long mod) const
10573 {
10574   if (!ptr)
10575     exception::throw_invalid("NULL input", __FILE__, __LINE__);
10576   return this->mod(isl::val(ctx(), mod));
10577 }
10578 
mul(isl::pw_aff pwaff2)10579 isl::pw_aff pw_aff::mul(isl::pw_aff pwaff2) const
10580 {
10581   if (!ptr || pwaff2.is_null())
10582     exception::throw_invalid("NULL input", __FILE__, __LINE__);
10583   auto saved_ctx = ctx();
10584   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10585   auto res = isl_pw_aff_mul(copy(), pwaff2.release());
10586   if (!res)
10587     exception::throw_last_error(saved_ctx);
10588   return manage(res);
10589 }
10590 
ne_set(isl::pw_aff pwaff2)10591 isl::set pw_aff::ne_set(isl::pw_aff pwaff2) const
10592 {
10593   if (!ptr || pwaff2.is_null())
10594     exception::throw_invalid("NULL input", __FILE__, __LINE__);
10595   auto saved_ctx = ctx();
10596   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10597   auto res = isl_pw_aff_ne_set(copy(), pwaff2.release());
10598   if (!res)
10599     exception::throw_last_error(saved_ctx);
10600   return manage(res);
10601 }
10602 
neg()10603 isl::pw_aff pw_aff::neg() const
10604 {
10605   if (!ptr)
10606     exception::throw_invalid("NULL input", __FILE__, __LINE__);
10607   auto saved_ctx = ctx();
10608   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10609   auto res = isl_pw_aff_neg(copy());
10610   if (!res)
10611     exception::throw_last_error(saved_ctx);
10612   return manage(res);
10613 }
10614 
param_on_domain(isl::set domain,isl::id id)10615 isl::pw_aff pw_aff::param_on_domain(isl::set domain, isl::id id)
10616 {
10617   if (domain.is_null() || id.is_null())
10618     exception::throw_invalid("NULL input", __FILE__, __LINE__);
10619   auto saved_ctx = domain.ctx();
10620   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10621   auto res = isl_pw_aff_param_on_domain_id(domain.release(), id.release());
10622   if (!res)
10623     exception::throw_last_error(saved_ctx);
10624   return manage(res);
10625 }
10626 
pullback(isl::multi_aff ma)10627 isl::pw_aff pw_aff::pullback(isl::multi_aff ma) const
10628 {
10629   if (!ptr || ma.is_null())
10630     exception::throw_invalid("NULL input", __FILE__, __LINE__);
10631   auto saved_ctx = ctx();
10632   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10633   auto res = isl_pw_aff_pullback_multi_aff(copy(), ma.release());
10634   if (!res)
10635     exception::throw_last_error(saved_ctx);
10636   return manage(res);
10637 }
10638 
pullback(isl::multi_pw_aff mpa)10639 isl::pw_aff pw_aff::pullback(isl::multi_pw_aff mpa) const
10640 {
10641   if (!ptr || mpa.is_null())
10642     exception::throw_invalid("NULL input", __FILE__, __LINE__);
10643   auto saved_ctx = ctx();
10644   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10645   auto res = isl_pw_aff_pullback_multi_pw_aff(copy(), mpa.release());
10646   if (!res)
10647     exception::throw_last_error(saved_ctx);
10648   return manage(res);
10649 }
10650 
pullback(isl::pw_multi_aff pma)10651 isl::pw_aff pw_aff::pullback(isl::pw_multi_aff pma) const
10652 {
10653   if (!ptr || pma.is_null())
10654     exception::throw_invalid("NULL input", __FILE__, __LINE__);
10655   auto saved_ctx = ctx();
10656   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10657   auto res = isl_pw_aff_pullback_pw_multi_aff(copy(), pma.release());
10658   if (!res)
10659     exception::throw_last_error(saved_ctx);
10660   return manage(res);
10661 }
10662 
scale(isl::val v)10663 isl::pw_aff pw_aff::scale(isl::val v) const
10664 {
10665   if (!ptr || v.is_null())
10666     exception::throw_invalid("NULL input", __FILE__, __LINE__);
10667   auto saved_ctx = ctx();
10668   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10669   auto res = isl_pw_aff_scale_val(copy(), v.release());
10670   if (!res)
10671     exception::throw_last_error(saved_ctx);
10672   return manage(res);
10673 }
10674 
scale(long v)10675 isl::pw_aff pw_aff::scale(long v) const
10676 {
10677   if (!ptr)
10678     exception::throw_invalid("NULL input", __FILE__, __LINE__);
10679   return this->scale(isl::val(ctx(), v));
10680 }
10681 
scale_down(isl::val f)10682 isl::pw_aff pw_aff::scale_down(isl::val f) const
10683 {
10684   if (!ptr || f.is_null())
10685     exception::throw_invalid("NULL input", __FILE__, __LINE__);
10686   auto saved_ctx = ctx();
10687   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10688   auto res = isl_pw_aff_scale_down_val(copy(), f.release());
10689   if (!res)
10690     exception::throw_last_error(saved_ctx);
10691   return manage(res);
10692 }
10693 
scale_down(long f)10694 isl::pw_aff pw_aff::scale_down(long f) const
10695 {
10696   if (!ptr)
10697     exception::throw_invalid("NULL input", __FILE__, __LINE__);
10698   return this->scale_down(isl::val(ctx(), f));
10699 }
10700 
sub(isl::pw_aff pwaff2)10701 isl::pw_aff pw_aff::sub(isl::pw_aff pwaff2) const
10702 {
10703   if (!ptr || pwaff2.is_null())
10704     exception::throw_invalid("NULL input", __FILE__, __LINE__);
10705   auto saved_ctx = ctx();
10706   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10707   auto res = isl_pw_aff_sub(copy(), pwaff2.release());
10708   if (!res)
10709     exception::throw_last_error(saved_ctx);
10710   return manage(res);
10711 }
10712 
subtract_domain(isl::set set)10713 isl::pw_aff pw_aff::subtract_domain(isl::set set) const
10714 {
10715   if (!ptr || set.is_null())
10716     exception::throw_invalid("NULL input", __FILE__, __LINE__);
10717   auto saved_ctx = ctx();
10718   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10719   auto res = isl_pw_aff_subtract_domain(copy(), set.release());
10720   if (!res)
10721     exception::throw_last_error(saved_ctx);
10722   return manage(res);
10723 }
10724 
tdiv_q(isl::pw_aff pa2)10725 isl::pw_aff pw_aff::tdiv_q(isl::pw_aff pa2) const
10726 {
10727   if (!ptr || pa2.is_null())
10728     exception::throw_invalid("NULL input", __FILE__, __LINE__);
10729   auto saved_ctx = ctx();
10730   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10731   auto res = isl_pw_aff_tdiv_q(copy(), pa2.release());
10732   if (!res)
10733     exception::throw_last_error(saved_ctx);
10734   return manage(res);
10735 }
10736 
tdiv_r(isl::pw_aff pa2)10737 isl::pw_aff pw_aff::tdiv_r(isl::pw_aff pa2) const
10738 {
10739   if (!ptr || pa2.is_null())
10740     exception::throw_invalid("NULL input", __FILE__, __LINE__);
10741   auto saved_ctx = ctx();
10742   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10743   auto res = isl_pw_aff_tdiv_r(copy(), pa2.release());
10744   if (!res)
10745     exception::throw_last_error(saved_ctx);
10746   return manage(res);
10747 }
10748 
union_add(isl::pw_aff pwaff2)10749 isl::pw_aff pw_aff::union_add(isl::pw_aff pwaff2) const
10750 {
10751   if (!ptr || pwaff2.is_null())
10752     exception::throw_invalid("NULL input", __FILE__, __LINE__);
10753   auto saved_ctx = ctx();
10754   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10755   auto res = isl_pw_aff_union_add(copy(), pwaff2.release());
10756   if (!res)
10757     exception::throw_last_error(saved_ctx);
10758   return manage(res);
10759 }
10760 
10761 inline std::ostream &operator<<(std::ostream &os, const pw_aff &obj)
10762 {
10763   if (!obj.get())
10764     exception::throw_invalid("NULL input", __FILE__, __LINE__);
10765   auto saved_ctx = isl_pw_aff_get_ctx(obj.get());
10766   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10767   char *str = isl_pw_aff_to_str(obj.get());
10768   if (!str)
10769     exception::throw_last_error(saved_ctx);
10770   os << str;
10771   free(str);
10772   return os;
10773 }
10774 
10775 // implementations for isl::pw_aff_list
manage(__isl_take isl_pw_aff_list * ptr)10776 pw_aff_list manage(__isl_take isl_pw_aff_list *ptr) {
10777   if (!ptr)
10778     exception::throw_invalid("NULL input", __FILE__, __LINE__);
10779   return pw_aff_list(ptr);
10780 }
manage_copy(__isl_keep isl_pw_aff_list * ptr)10781 pw_aff_list manage_copy(__isl_keep isl_pw_aff_list *ptr) {
10782   if (!ptr)
10783     exception::throw_invalid("NULL input", __FILE__, __LINE__);
10784   auto saved_ctx = isl_pw_aff_list_get_ctx(ptr);
10785   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10786   ptr = isl_pw_aff_list_copy(ptr);
10787   if (!ptr)
10788     exception::throw_last_error(saved_ctx);
10789   return pw_aff_list(ptr);
10790 }
10791 
pw_aff_list()10792 pw_aff_list::pw_aff_list()
10793     : ptr(nullptr) {}
10794 
pw_aff_list(const pw_aff_list & obj)10795 pw_aff_list::pw_aff_list(const pw_aff_list &obj)
10796     : ptr(nullptr)
10797 {
10798   if (!obj.ptr)
10799     exception::throw_invalid("NULL input", __FILE__, __LINE__);
10800   auto saved_ctx = isl_pw_aff_list_get_ctx(obj.ptr);
10801   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10802   ptr = obj.copy();
10803   if (!ptr)
10804     exception::throw_last_error(saved_ctx);
10805 }
10806 
pw_aff_list(__isl_take isl_pw_aff_list * ptr)10807 pw_aff_list::pw_aff_list(__isl_take isl_pw_aff_list *ptr)
10808     : ptr(ptr) {}
10809 
pw_aff_list(isl::ctx ctx,int n)10810 pw_aff_list::pw_aff_list(isl::ctx ctx, int n)
10811 {
10812   auto saved_ctx = ctx;
10813   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10814   auto res = isl_pw_aff_list_alloc(ctx.release(), n);
10815   if (!res)
10816     exception::throw_last_error(saved_ctx);
10817   ptr = res;
10818 }
10819 
pw_aff_list(isl::pw_aff el)10820 pw_aff_list::pw_aff_list(isl::pw_aff el)
10821 {
10822   if (el.is_null())
10823     exception::throw_invalid("NULL input", __FILE__, __LINE__);
10824   auto saved_ctx = el.ctx();
10825   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10826   auto res = isl_pw_aff_list_from_pw_aff(el.release());
10827   if (!res)
10828     exception::throw_last_error(saved_ctx);
10829   ptr = res;
10830 }
10831 
10832 pw_aff_list &pw_aff_list::operator=(pw_aff_list obj) {
10833   std::swap(this->ptr, obj.ptr);
10834   return *this;
10835 }
10836 
~pw_aff_list()10837 pw_aff_list::~pw_aff_list() {
10838   if (ptr)
10839     isl_pw_aff_list_free(ptr);
10840 }
10841 
copy()10842 __isl_give isl_pw_aff_list *pw_aff_list::copy() const & {
10843   return isl_pw_aff_list_copy(ptr);
10844 }
10845 
get()10846 __isl_keep isl_pw_aff_list *pw_aff_list::get() const {
10847   return ptr;
10848 }
10849 
release()10850 __isl_give isl_pw_aff_list *pw_aff_list::release() {
10851   isl_pw_aff_list *tmp = ptr;
10852   ptr = nullptr;
10853   return tmp;
10854 }
10855 
is_null()10856 bool pw_aff_list::is_null() const {
10857   return ptr == nullptr;
10858 }
10859 
ctx()10860 isl::ctx pw_aff_list::ctx() const {
10861   return isl::ctx(isl_pw_aff_list_get_ctx(ptr));
10862 }
10863 
add(isl::pw_aff el)10864 isl::pw_aff_list pw_aff_list::add(isl::pw_aff el) const
10865 {
10866   if (!ptr || el.is_null())
10867     exception::throw_invalid("NULL input", __FILE__, __LINE__);
10868   auto saved_ctx = ctx();
10869   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10870   auto res = isl_pw_aff_list_add(copy(), el.release());
10871   if (!res)
10872     exception::throw_last_error(saved_ctx);
10873   return manage(res);
10874 }
10875 
clear()10876 isl::pw_aff_list pw_aff_list::clear() const
10877 {
10878   if (!ptr)
10879     exception::throw_invalid("NULL input", __FILE__, __LINE__);
10880   auto saved_ctx = ctx();
10881   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10882   auto res = isl_pw_aff_list_clear(copy());
10883   if (!res)
10884     exception::throw_last_error(saved_ctx);
10885   return manage(res);
10886 }
10887 
concat(isl::pw_aff_list list2)10888 isl::pw_aff_list pw_aff_list::concat(isl::pw_aff_list list2) const
10889 {
10890   if (!ptr || list2.is_null())
10891     exception::throw_invalid("NULL input", __FILE__, __LINE__);
10892   auto saved_ctx = ctx();
10893   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10894   auto res = isl_pw_aff_list_concat(copy(), list2.release());
10895   if (!res)
10896     exception::throw_last_error(saved_ctx);
10897   return manage(res);
10898 }
10899 
foreach(const std::function<void (isl::pw_aff)> & fn)10900 void pw_aff_list::foreach(const std::function<void(isl::pw_aff)> &fn) const
10901 {
10902   if (!ptr)
10903     exception::throw_invalid("NULL input", __FILE__, __LINE__);
10904   auto saved_ctx = ctx();
10905   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10906   struct fn_data {
10907     std::function<void(isl::pw_aff)> func;
10908     std::exception_ptr eptr;
10909   } fn_data = { fn };
10910   auto fn_lambda = [](isl_pw_aff *arg_0, void *arg_1) -> isl_stat {
10911     auto *data = static_cast<struct fn_data *>(arg_1);
10912     ISL_CPP_TRY {
10913       (data->func)(manage(arg_0));
10914       return isl_stat_ok;
10915     } ISL_CPP_CATCH_ALL {
10916       data->eptr = std::current_exception();
10917       return isl_stat_error;
10918     }
10919   };
10920   auto res = isl_pw_aff_list_foreach(get(), fn_lambda, &fn_data);
10921   if (fn_data.eptr)
10922     std::rethrow_exception(fn_data.eptr);
10923   if (res < 0)
10924     exception::throw_last_error(saved_ctx);
10925   return;
10926 }
10927 
at(int index)10928 isl::pw_aff pw_aff_list::at(int index) const
10929 {
10930   if (!ptr)
10931     exception::throw_invalid("NULL input", __FILE__, __LINE__);
10932   auto saved_ctx = ctx();
10933   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10934   auto res = isl_pw_aff_list_get_at(get(), index);
10935   if (!res)
10936     exception::throw_last_error(saved_ctx);
10937   return manage(res);
10938 }
10939 
get_at(int index)10940 isl::pw_aff pw_aff_list::get_at(int index) const
10941 {
10942   return at(index);
10943 }
10944 
size()10945 unsigned pw_aff_list::size() const
10946 {
10947   if (!ptr)
10948     exception::throw_invalid("NULL input", __FILE__, __LINE__);
10949   auto saved_ctx = ctx();
10950   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10951   auto res = isl_pw_aff_list_size(get());
10952   if (res < 0)
10953     exception::throw_last_error(saved_ctx);
10954   return res;
10955 }
10956 
10957 inline std::ostream &operator<<(std::ostream &os, const pw_aff_list &obj)
10958 {
10959   if (!obj.get())
10960     exception::throw_invalid("NULL input", __FILE__, __LINE__);
10961   auto saved_ctx = isl_pw_aff_list_get_ctx(obj.get());
10962   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10963   char *str = isl_pw_aff_list_to_str(obj.get());
10964   if (!str)
10965     exception::throw_last_error(saved_ctx);
10966   os << str;
10967   free(str);
10968   return os;
10969 }
10970 
10971 // implementations for isl::pw_multi_aff
manage(__isl_take isl_pw_multi_aff * ptr)10972 pw_multi_aff manage(__isl_take isl_pw_multi_aff *ptr) {
10973   if (!ptr)
10974     exception::throw_invalid("NULL input", __FILE__, __LINE__);
10975   return pw_multi_aff(ptr);
10976 }
manage_copy(__isl_keep isl_pw_multi_aff * ptr)10977 pw_multi_aff manage_copy(__isl_keep isl_pw_multi_aff *ptr) {
10978   if (!ptr)
10979     exception::throw_invalid("NULL input", __FILE__, __LINE__);
10980   auto saved_ctx = isl_pw_multi_aff_get_ctx(ptr);
10981   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10982   ptr = isl_pw_multi_aff_copy(ptr);
10983   if (!ptr)
10984     exception::throw_last_error(saved_ctx);
10985   return pw_multi_aff(ptr);
10986 }
10987 
pw_multi_aff()10988 pw_multi_aff::pw_multi_aff()
10989     : ptr(nullptr) {}
10990 
pw_multi_aff(const pw_multi_aff & obj)10991 pw_multi_aff::pw_multi_aff(const pw_multi_aff &obj)
10992     : ptr(nullptr)
10993 {
10994   if (!obj.ptr)
10995     exception::throw_invalid("NULL input", __FILE__, __LINE__);
10996   auto saved_ctx = isl_pw_multi_aff_get_ctx(obj.ptr);
10997   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
10998   ptr = obj.copy();
10999   if (!ptr)
11000     exception::throw_last_error(saved_ctx);
11001 }
11002 
pw_multi_aff(__isl_take isl_pw_multi_aff * ptr)11003 pw_multi_aff::pw_multi_aff(__isl_take isl_pw_multi_aff *ptr)
11004     : ptr(ptr) {}
11005 
pw_multi_aff(isl::multi_aff ma)11006 pw_multi_aff::pw_multi_aff(isl::multi_aff ma)
11007 {
11008   if (ma.is_null())
11009     exception::throw_invalid("NULL input", __FILE__, __LINE__);
11010   auto saved_ctx = ma.ctx();
11011   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11012   auto res = isl_pw_multi_aff_from_multi_aff(ma.release());
11013   if (!res)
11014     exception::throw_last_error(saved_ctx);
11015   ptr = res;
11016 }
11017 
pw_multi_aff(isl::pw_aff pa)11018 pw_multi_aff::pw_multi_aff(isl::pw_aff pa)
11019 {
11020   if (pa.is_null())
11021     exception::throw_invalid("NULL input", __FILE__, __LINE__);
11022   auto saved_ctx = pa.ctx();
11023   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11024   auto res = isl_pw_multi_aff_from_pw_aff(pa.release());
11025   if (!res)
11026     exception::throw_last_error(saved_ctx);
11027   ptr = res;
11028 }
11029 
pw_multi_aff(isl::ctx ctx,const std::string & str)11030 pw_multi_aff::pw_multi_aff(isl::ctx ctx, const std::string &str)
11031 {
11032   auto saved_ctx = ctx;
11033   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11034   auto res = isl_pw_multi_aff_read_from_str(ctx.release(), str.c_str());
11035   if (!res)
11036     exception::throw_last_error(saved_ctx);
11037   ptr = res;
11038 }
11039 
11040 pw_multi_aff &pw_multi_aff::operator=(pw_multi_aff obj) {
11041   std::swap(this->ptr, obj.ptr);
11042   return *this;
11043 }
11044 
~pw_multi_aff()11045 pw_multi_aff::~pw_multi_aff() {
11046   if (ptr)
11047     isl_pw_multi_aff_free(ptr);
11048 }
11049 
copy()11050 __isl_give isl_pw_multi_aff *pw_multi_aff::copy() const & {
11051   return isl_pw_multi_aff_copy(ptr);
11052 }
11053 
get()11054 __isl_keep isl_pw_multi_aff *pw_multi_aff::get() const {
11055   return ptr;
11056 }
11057 
release()11058 __isl_give isl_pw_multi_aff *pw_multi_aff::release() {
11059   isl_pw_multi_aff *tmp = ptr;
11060   ptr = nullptr;
11061   return tmp;
11062 }
11063 
is_null()11064 bool pw_multi_aff::is_null() const {
11065   return ptr == nullptr;
11066 }
11067 
ctx()11068 isl::ctx pw_multi_aff::ctx() const {
11069   return isl::ctx(isl_pw_multi_aff_get_ctx(ptr));
11070 }
11071 
add(isl::pw_multi_aff pma2)11072 isl::pw_multi_aff pw_multi_aff::add(isl::pw_multi_aff pma2) const
11073 {
11074   if (!ptr || pma2.is_null())
11075     exception::throw_invalid("NULL input", __FILE__, __LINE__);
11076   auto saved_ctx = ctx();
11077   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11078   auto res = isl_pw_multi_aff_add(copy(), pma2.release());
11079   if (!res)
11080     exception::throw_last_error(saved_ctx);
11081   return manage(res);
11082 }
11083 
add_constant(isl::multi_val mv)11084 isl::pw_multi_aff pw_multi_aff::add_constant(isl::multi_val mv) const
11085 {
11086   if (!ptr || mv.is_null())
11087     exception::throw_invalid("NULL input", __FILE__, __LINE__);
11088   auto saved_ctx = ctx();
11089   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11090   auto res = isl_pw_multi_aff_add_constant_multi_val(copy(), mv.release());
11091   if (!res)
11092     exception::throw_last_error(saved_ctx);
11093   return manage(res);
11094 }
11095 
add_constant(isl::val v)11096 isl::pw_multi_aff pw_multi_aff::add_constant(isl::val v) const
11097 {
11098   if (!ptr || v.is_null())
11099     exception::throw_invalid("NULL input", __FILE__, __LINE__);
11100   auto saved_ctx = ctx();
11101   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11102   auto res = isl_pw_multi_aff_add_constant_val(copy(), v.release());
11103   if (!res)
11104     exception::throw_last_error(saved_ctx);
11105   return manage(res);
11106 }
11107 
add_constant(long v)11108 isl::pw_multi_aff pw_multi_aff::add_constant(long v) const
11109 {
11110   if (!ptr)
11111     exception::throw_invalid("NULL input", __FILE__, __LINE__);
11112   return this->add_constant(isl::val(ctx(), v));
11113 }
11114 
as_multi_aff()11115 isl::multi_aff pw_multi_aff::as_multi_aff() const
11116 {
11117   if (!ptr)
11118     exception::throw_invalid("NULL input", __FILE__, __LINE__);
11119   auto saved_ctx = ctx();
11120   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11121   auto res = isl_pw_multi_aff_as_multi_aff(copy());
11122   if (!res)
11123     exception::throw_last_error(saved_ctx);
11124   return manage(res);
11125 }
11126 
bind_domain(isl::multi_id tuple)11127 isl::pw_multi_aff pw_multi_aff::bind_domain(isl::multi_id tuple) const
11128 {
11129   if (!ptr || tuple.is_null())
11130     exception::throw_invalid("NULL input", __FILE__, __LINE__);
11131   auto saved_ctx = ctx();
11132   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11133   auto res = isl_pw_multi_aff_bind_domain(copy(), tuple.release());
11134   if (!res)
11135     exception::throw_last_error(saved_ctx);
11136   return manage(res);
11137 }
11138 
bind_domain_wrapped_domain(isl::multi_id tuple)11139 isl::pw_multi_aff pw_multi_aff::bind_domain_wrapped_domain(isl::multi_id tuple) const
11140 {
11141   if (!ptr || tuple.is_null())
11142     exception::throw_invalid("NULL input", __FILE__, __LINE__);
11143   auto saved_ctx = ctx();
11144   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11145   auto res = isl_pw_multi_aff_bind_domain_wrapped_domain(copy(), tuple.release());
11146   if (!res)
11147     exception::throw_last_error(saved_ctx);
11148   return manage(res);
11149 }
11150 
coalesce()11151 isl::pw_multi_aff pw_multi_aff::coalesce() const
11152 {
11153   if (!ptr)
11154     exception::throw_invalid("NULL input", __FILE__, __LINE__);
11155   auto saved_ctx = ctx();
11156   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11157   auto res = isl_pw_multi_aff_coalesce(copy());
11158   if (!res)
11159     exception::throw_last_error(saved_ctx);
11160   return manage(res);
11161 }
11162 
domain()11163 isl::set pw_multi_aff::domain() const
11164 {
11165   if (!ptr)
11166     exception::throw_invalid("NULL input", __FILE__, __LINE__);
11167   auto saved_ctx = ctx();
11168   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11169   auto res = isl_pw_multi_aff_domain(copy());
11170   if (!res)
11171     exception::throw_last_error(saved_ctx);
11172   return manage(res);
11173 }
11174 
flat_range_product(isl::pw_multi_aff pma2)11175 isl::pw_multi_aff pw_multi_aff::flat_range_product(isl::pw_multi_aff pma2) const
11176 {
11177   if (!ptr || pma2.is_null())
11178     exception::throw_invalid("NULL input", __FILE__, __LINE__);
11179   auto saved_ctx = ctx();
11180   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11181   auto res = isl_pw_multi_aff_flat_range_product(copy(), pma2.release());
11182   if (!res)
11183     exception::throw_last_error(saved_ctx);
11184   return manage(res);
11185 }
11186 
foreach_piece(const std::function<void (isl::set,isl::multi_aff)> & fn)11187 void pw_multi_aff::foreach_piece(const std::function<void(isl::set, isl::multi_aff)> &fn) const
11188 {
11189   if (!ptr)
11190     exception::throw_invalid("NULL input", __FILE__, __LINE__);
11191   auto saved_ctx = ctx();
11192   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11193   struct fn_data {
11194     std::function<void(isl::set, isl::multi_aff)> func;
11195     std::exception_ptr eptr;
11196   } fn_data = { fn };
11197   auto fn_lambda = [](isl_set *arg_0, isl_multi_aff *arg_1, void *arg_2) -> isl_stat {
11198     auto *data = static_cast<struct fn_data *>(arg_2);
11199     ISL_CPP_TRY {
11200       (data->func)(manage(arg_0), manage(arg_1));
11201       return isl_stat_ok;
11202     } ISL_CPP_CATCH_ALL {
11203       data->eptr = std::current_exception();
11204       return isl_stat_error;
11205     }
11206   };
11207   auto res = isl_pw_multi_aff_foreach_piece(get(), fn_lambda, &fn_data);
11208   if (fn_data.eptr)
11209     std::rethrow_exception(fn_data.eptr);
11210   if (res < 0)
11211     exception::throw_last_error(saved_ctx);
11212   return;
11213 }
11214 
space()11215 isl::space pw_multi_aff::space() const
11216 {
11217   if (!ptr)
11218     exception::throw_invalid("NULL input", __FILE__, __LINE__);
11219   auto saved_ctx = ctx();
11220   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11221   auto res = isl_pw_multi_aff_get_space(get());
11222   if (!res)
11223     exception::throw_last_error(saved_ctx);
11224   return manage(res);
11225 }
11226 
get_space()11227 isl::space pw_multi_aff::get_space() const
11228 {
11229   return space();
11230 }
11231 
gist(isl::set set)11232 isl::pw_multi_aff pw_multi_aff::gist(isl::set set) const
11233 {
11234   if (!ptr || set.is_null())
11235     exception::throw_invalid("NULL input", __FILE__, __LINE__);
11236   auto saved_ctx = ctx();
11237   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11238   auto res = isl_pw_multi_aff_gist(copy(), set.release());
11239   if (!res)
11240     exception::throw_last_error(saved_ctx);
11241   return manage(res);
11242 }
11243 
intersect_domain(isl::set set)11244 isl::pw_multi_aff pw_multi_aff::intersect_domain(isl::set set) const
11245 {
11246   if (!ptr || set.is_null())
11247     exception::throw_invalid("NULL input", __FILE__, __LINE__);
11248   auto saved_ctx = ctx();
11249   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11250   auto res = isl_pw_multi_aff_intersect_domain(copy(), set.release());
11251   if (!res)
11252     exception::throw_last_error(saved_ctx);
11253   return manage(res);
11254 }
11255 
intersect_params(isl::set set)11256 isl::pw_multi_aff pw_multi_aff::intersect_params(isl::set set) const
11257 {
11258   if (!ptr || set.is_null())
11259     exception::throw_invalid("NULL input", __FILE__, __LINE__);
11260   auto saved_ctx = ctx();
11261   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11262   auto res = isl_pw_multi_aff_intersect_params(copy(), set.release());
11263   if (!res)
11264     exception::throw_last_error(saved_ctx);
11265   return manage(res);
11266 }
11267 
isa_multi_aff()11268 bool pw_multi_aff::isa_multi_aff() const
11269 {
11270   if (!ptr)
11271     exception::throw_invalid("NULL input", __FILE__, __LINE__);
11272   auto saved_ctx = ctx();
11273   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11274   auto res = isl_pw_multi_aff_isa_multi_aff(get());
11275   if (res < 0)
11276     exception::throw_last_error(saved_ctx);
11277   return res;
11278 }
11279 
n_piece()11280 unsigned pw_multi_aff::n_piece() const
11281 {
11282   if (!ptr)
11283     exception::throw_invalid("NULL input", __FILE__, __LINE__);
11284   auto saved_ctx = ctx();
11285   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11286   auto res = isl_pw_multi_aff_n_piece(get());
11287   if (res < 0)
11288     exception::throw_last_error(saved_ctx);
11289   return res;
11290 }
11291 
product(isl::pw_multi_aff pma2)11292 isl::pw_multi_aff pw_multi_aff::product(isl::pw_multi_aff pma2) const
11293 {
11294   if (!ptr || pma2.is_null())
11295     exception::throw_invalid("NULL input", __FILE__, __LINE__);
11296   auto saved_ctx = ctx();
11297   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11298   auto res = isl_pw_multi_aff_product(copy(), pma2.release());
11299   if (!res)
11300     exception::throw_last_error(saved_ctx);
11301   return manage(res);
11302 }
11303 
pullback(isl::multi_aff ma)11304 isl::pw_multi_aff pw_multi_aff::pullback(isl::multi_aff ma) const
11305 {
11306   if (!ptr || ma.is_null())
11307     exception::throw_invalid("NULL input", __FILE__, __LINE__);
11308   auto saved_ctx = ctx();
11309   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11310   auto res = isl_pw_multi_aff_pullback_multi_aff(copy(), ma.release());
11311   if (!res)
11312     exception::throw_last_error(saved_ctx);
11313   return manage(res);
11314 }
11315 
pullback(isl::pw_multi_aff pma2)11316 isl::pw_multi_aff pw_multi_aff::pullback(isl::pw_multi_aff pma2) const
11317 {
11318   if (!ptr || pma2.is_null())
11319     exception::throw_invalid("NULL input", __FILE__, __LINE__);
11320   auto saved_ctx = ctx();
11321   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11322   auto res = isl_pw_multi_aff_pullback_pw_multi_aff(copy(), pma2.release());
11323   if (!res)
11324     exception::throw_last_error(saved_ctx);
11325   return manage(res);
11326 }
11327 
range_factor_domain()11328 isl::pw_multi_aff pw_multi_aff::range_factor_domain() const
11329 {
11330   if (!ptr)
11331     exception::throw_invalid("NULL input", __FILE__, __LINE__);
11332   auto saved_ctx = ctx();
11333   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11334   auto res = isl_pw_multi_aff_range_factor_domain(copy());
11335   if (!res)
11336     exception::throw_last_error(saved_ctx);
11337   return manage(res);
11338 }
11339 
range_factor_range()11340 isl::pw_multi_aff pw_multi_aff::range_factor_range() const
11341 {
11342   if (!ptr)
11343     exception::throw_invalid("NULL input", __FILE__, __LINE__);
11344   auto saved_ctx = ctx();
11345   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11346   auto res = isl_pw_multi_aff_range_factor_range(copy());
11347   if (!res)
11348     exception::throw_last_error(saved_ctx);
11349   return manage(res);
11350 }
11351 
range_product(isl::pw_multi_aff pma2)11352 isl::pw_multi_aff pw_multi_aff::range_product(isl::pw_multi_aff pma2) const
11353 {
11354   if (!ptr || pma2.is_null())
11355     exception::throw_invalid("NULL input", __FILE__, __LINE__);
11356   auto saved_ctx = ctx();
11357   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11358   auto res = isl_pw_multi_aff_range_product(copy(), pma2.release());
11359   if (!res)
11360     exception::throw_last_error(saved_ctx);
11361   return manage(res);
11362 }
11363 
scale(isl::val v)11364 isl::pw_multi_aff pw_multi_aff::scale(isl::val v) const
11365 {
11366   if (!ptr || v.is_null())
11367     exception::throw_invalid("NULL input", __FILE__, __LINE__);
11368   auto saved_ctx = ctx();
11369   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11370   auto res = isl_pw_multi_aff_scale_val(copy(), v.release());
11371   if (!res)
11372     exception::throw_last_error(saved_ctx);
11373   return manage(res);
11374 }
11375 
scale(long v)11376 isl::pw_multi_aff pw_multi_aff::scale(long v) const
11377 {
11378   if (!ptr)
11379     exception::throw_invalid("NULL input", __FILE__, __LINE__);
11380   return this->scale(isl::val(ctx(), v));
11381 }
11382 
scale_down(isl::val v)11383 isl::pw_multi_aff pw_multi_aff::scale_down(isl::val v) const
11384 {
11385   if (!ptr || v.is_null())
11386     exception::throw_invalid("NULL input", __FILE__, __LINE__);
11387   auto saved_ctx = ctx();
11388   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11389   auto res = isl_pw_multi_aff_scale_down_val(copy(), v.release());
11390   if (!res)
11391     exception::throw_last_error(saved_ctx);
11392   return manage(res);
11393 }
11394 
scale_down(long v)11395 isl::pw_multi_aff pw_multi_aff::scale_down(long v) const
11396 {
11397   if (!ptr)
11398     exception::throw_invalid("NULL input", __FILE__, __LINE__);
11399   return this->scale_down(isl::val(ctx(), v));
11400 }
11401 
sub(isl::pw_multi_aff pma2)11402 isl::pw_multi_aff pw_multi_aff::sub(isl::pw_multi_aff pma2) const
11403 {
11404   if (!ptr || pma2.is_null())
11405     exception::throw_invalid("NULL input", __FILE__, __LINE__);
11406   auto saved_ctx = ctx();
11407   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11408   auto res = isl_pw_multi_aff_sub(copy(), pma2.release());
11409   if (!res)
11410     exception::throw_last_error(saved_ctx);
11411   return manage(res);
11412 }
11413 
subtract_domain(isl::set set)11414 isl::pw_multi_aff pw_multi_aff::subtract_domain(isl::set set) const
11415 {
11416   if (!ptr || set.is_null())
11417     exception::throw_invalid("NULL input", __FILE__, __LINE__);
11418   auto saved_ctx = ctx();
11419   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11420   auto res = isl_pw_multi_aff_subtract_domain(copy(), set.release());
11421   if (!res)
11422     exception::throw_last_error(saved_ctx);
11423   return manage(res);
11424 }
11425 
union_add(isl::pw_multi_aff pma2)11426 isl::pw_multi_aff pw_multi_aff::union_add(isl::pw_multi_aff pma2) const
11427 {
11428   if (!ptr || pma2.is_null())
11429     exception::throw_invalid("NULL input", __FILE__, __LINE__);
11430   auto saved_ctx = ctx();
11431   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11432   auto res = isl_pw_multi_aff_union_add(copy(), pma2.release());
11433   if (!res)
11434     exception::throw_last_error(saved_ctx);
11435   return manage(res);
11436 }
11437 
zero(isl::space space)11438 isl::pw_multi_aff pw_multi_aff::zero(isl::space space)
11439 {
11440   if (space.is_null())
11441     exception::throw_invalid("NULL input", __FILE__, __LINE__);
11442   auto saved_ctx = space.ctx();
11443   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11444   auto res = isl_pw_multi_aff_zero(space.release());
11445   if (!res)
11446     exception::throw_last_error(saved_ctx);
11447   return manage(res);
11448 }
11449 
11450 inline std::ostream &operator<<(std::ostream &os, const pw_multi_aff &obj)
11451 {
11452   if (!obj.get())
11453     exception::throw_invalid("NULL input", __FILE__, __LINE__);
11454   auto saved_ctx = isl_pw_multi_aff_get_ctx(obj.get());
11455   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11456   char *str = isl_pw_multi_aff_to_str(obj.get());
11457   if (!str)
11458     exception::throw_last_error(saved_ctx);
11459   os << str;
11460   free(str);
11461   return os;
11462 }
11463 
11464 // implementations for isl::pw_multi_aff_list
manage(__isl_take isl_pw_multi_aff_list * ptr)11465 pw_multi_aff_list manage(__isl_take isl_pw_multi_aff_list *ptr) {
11466   if (!ptr)
11467     exception::throw_invalid("NULL input", __FILE__, __LINE__);
11468   return pw_multi_aff_list(ptr);
11469 }
manage_copy(__isl_keep isl_pw_multi_aff_list * ptr)11470 pw_multi_aff_list manage_copy(__isl_keep isl_pw_multi_aff_list *ptr) {
11471   if (!ptr)
11472     exception::throw_invalid("NULL input", __FILE__, __LINE__);
11473   auto saved_ctx = isl_pw_multi_aff_list_get_ctx(ptr);
11474   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11475   ptr = isl_pw_multi_aff_list_copy(ptr);
11476   if (!ptr)
11477     exception::throw_last_error(saved_ctx);
11478   return pw_multi_aff_list(ptr);
11479 }
11480 
pw_multi_aff_list()11481 pw_multi_aff_list::pw_multi_aff_list()
11482     : ptr(nullptr) {}
11483 
pw_multi_aff_list(const pw_multi_aff_list & obj)11484 pw_multi_aff_list::pw_multi_aff_list(const pw_multi_aff_list &obj)
11485     : ptr(nullptr)
11486 {
11487   if (!obj.ptr)
11488     exception::throw_invalid("NULL input", __FILE__, __LINE__);
11489   auto saved_ctx = isl_pw_multi_aff_list_get_ctx(obj.ptr);
11490   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11491   ptr = obj.copy();
11492   if (!ptr)
11493     exception::throw_last_error(saved_ctx);
11494 }
11495 
pw_multi_aff_list(__isl_take isl_pw_multi_aff_list * ptr)11496 pw_multi_aff_list::pw_multi_aff_list(__isl_take isl_pw_multi_aff_list *ptr)
11497     : ptr(ptr) {}
11498 
pw_multi_aff_list(isl::ctx ctx,int n)11499 pw_multi_aff_list::pw_multi_aff_list(isl::ctx ctx, int n)
11500 {
11501   auto saved_ctx = ctx;
11502   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11503   auto res = isl_pw_multi_aff_list_alloc(ctx.release(), n);
11504   if (!res)
11505     exception::throw_last_error(saved_ctx);
11506   ptr = res;
11507 }
11508 
pw_multi_aff_list(isl::pw_multi_aff el)11509 pw_multi_aff_list::pw_multi_aff_list(isl::pw_multi_aff el)
11510 {
11511   if (el.is_null())
11512     exception::throw_invalid("NULL input", __FILE__, __LINE__);
11513   auto saved_ctx = el.ctx();
11514   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11515   auto res = isl_pw_multi_aff_list_from_pw_multi_aff(el.release());
11516   if (!res)
11517     exception::throw_last_error(saved_ctx);
11518   ptr = res;
11519 }
11520 
11521 pw_multi_aff_list &pw_multi_aff_list::operator=(pw_multi_aff_list obj) {
11522   std::swap(this->ptr, obj.ptr);
11523   return *this;
11524 }
11525 
~pw_multi_aff_list()11526 pw_multi_aff_list::~pw_multi_aff_list() {
11527   if (ptr)
11528     isl_pw_multi_aff_list_free(ptr);
11529 }
11530 
copy()11531 __isl_give isl_pw_multi_aff_list *pw_multi_aff_list::copy() const & {
11532   return isl_pw_multi_aff_list_copy(ptr);
11533 }
11534 
get()11535 __isl_keep isl_pw_multi_aff_list *pw_multi_aff_list::get() const {
11536   return ptr;
11537 }
11538 
release()11539 __isl_give isl_pw_multi_aff_list *pw_multi_aff_list::release() {
11540   isl_pw_multi_aff_list *tmp = ptr;
11541   ptr = nullptr;
11542   return tmp;
11543 }
11544 
is_null()11545 bool pw_multi_aff_list::is_null() const {
11546   return ptr == nullptr;
11547 }
11548 
ctx()11549 isl::ctx pw_multi_aff_list::ctx() const {
11550   return isl::ctx(isl_pw_multi_aff_list_get_ctx(ptr));
11551 }
11552 
add(isl::pw_multi_aff el)11553 isl::pw_multi_aff_list pw_multi_aff_list::add(isl::pw_multi_aff el) const
11554 {
11555   if (!ptr || el.is_null())
11556     exception::throw_invalid("NULL input", __FILE__, __LINE__);
11557   auto saved_ctx = ctx();
11558   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11559   auto res = isl_pw_multi_aff_list_add(copy(), el.release());
11560   if (!res)
11561     exception::throw_last_error(saved_ctx);
11562   return manage(res);
11563 }
11564 
clear()11565 isl::pw_multi_aff_list pw_multi_aff_list::clear() const
11566 {
11567   if (!ptr)
11568     exception::throw_invalid("NULL input", __FILE__, __LINE__);
11569   auto saved_ctx = ctx();
11570   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11571   auto res = isl_pw_multi_aff_list_clear(copy());
11572   if (!res)
11573     exception::throw_last_error(saved_ctx);
11574   return manage(res);
11575 }
11576 
concat(isl::pw_multi_aff_list list2)11577 isl::pw_multi_aff_list pw_multi_aff_list::concat(isl::pw_multi_aff_list list2) const
11578 {
11579   if (!ptr || list2.is_null())
11580     exception::throw_invalid("NULL input", __FILE__, __LINE__);
11581   auto saved_ctx = ctx();
11582   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11583   auto res = isl_pw_multi_aff_list_concat(copy(), list2.release());
11584   if (!res)
11585     exception::throw_last_error(saved_ctx);
11586   return manage(res);
11587 }
11588 
foreach(const std::function<void (isl::pw_multi_aff)> & fn)11589 void pw_multi_aff_list::foreach(const std::function<void(isl::pw_multi_aff)> &fn) const
11590 {
11591   if (!ptr)
11592     exception::throw_invalid("NULL input", __FILE__, __LINE__);
11593   auto saved_ctx = ctx();
11594   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11595   struct fn_data {
11596     std::function<void(isl::pw_multi_aff)> func;
11597     std::exception_ptr eptr;
11598   } fn_data = { fn };
11599   auto fn_lambda = [](isl_pw_multi_aff *arg_0, void *arg_1) -> isl_stat {
11600     auto *data = static_cast<struct fn_data *>(arg_1);
11601     ISL_CPP_TRY {
11602       (data->func)(manage(arg_0));
11603       return isl_stat_ok;
11604     } ISL_CPP_CATCH_ALL {
11605       data->eptr = std::current_exception();
11606       return isl_stat_error;
11607     }
11608   };
11609   auto res = isl_pw_multi_aff_list_foreach(get(), fn_lambda, &fn_data);
11610   if (fn_data.eptr)
11611     std::rethrow_exception(fn_data.eptr);
11612   if (res < 0)
11613     exception::throw_last_error(saved_ctx);
11614   return;
11615 }
11616 
at(int index)11617 isl::pw_multi_aff pw_multi_aff_list::at(int index) const
11618 {
11619   if (!ptr)
11620     exception::throw_invalid("NULL input", __FILE__, __LINE__);
11621   auto saved_ctx = ctx();
11622   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11623   auto res = isl_pw_multi_aff_list_get_at(get(), index);
11624   if (!res)
11625     exception::throw_last_error(saved_ctx);
11626   return manage(res);
11627 }
11628 
get_at(int index)11629 isl::pw_multi_aff pw_multi_aff_list::get_at(int index) const
11630 {
11631   return at(index);
11632 }
11633 
size()11634 unsigned pw_multi_aff_list::size() const
11635 {
11636   if (!ptr)
11637     exception::throw_invalid("NULL input", __FILE__, __LINE__);
11638   auto saved_ctx = ctx();
11639   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11640   auto res = isl_pw_multi_aff_list_size(get());
11641   if (res < 0)
11642     exception::throw_last_error(saved_ctx);
11643   return res;
11644 }
11645 
11646 inline std::ostream &operator<<(std::ostream &os, const pw_multi_aff_list &obj)
11647 {
11648   if (!obj.get())
11649     exception::throw_invalid("NULL input", __FILE__, __LINE__);
11650   auto saved_ctx = isl_pw_multi_aff_list_get_ctx(obj.get());
11651   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11652   char *str = isl_pw_multi_aff_list_to_str(obj.get());
11653   if (!str)
11654     exception::throw_last_error(saved_ctx);
11655   os << str;
11656   free(str);
11657   return os;
11658 }
11659 
11660 // implementations for isl::schedule
manage(__isl_take isl_schedule * ptr)11661 schedule manage(__isl_take isl_schedule *ptr) {
11662   if (!ptr)
11663     exception::throw_invalid("NULL input", __FILE__, __LINE__);
11664   return schedule(ptr);
11665 }
manage_copy(__isl_keep isl_schedule * ptr)11666 schedule manage_copy(__isl_keep isl_schedule *ptr) {
11667   if (!ptr)
11668     exception::throw_invalid("NULL input", __FILE__, __LINE__);
11669   auto saved_ctx = isl_schedule_get_ctx(ptr);
11670   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11671   ptr = isl_schedule_copy(ptr);
11672   if (!ptr)
11673     exception::throw_last_error(saved_ctx);
11674   return schedule(ptr);
11675 }
11676 
schedule()11677 schedule::schedule()
11678     : ptr(nullptr) {}
11679 
schedule(const schedule & obj)11680 schedule::schedule(const schedule &obj)
11681     : ptr(nullptr)
11682 {
11683   if (!obj.ptr)
11684     exception::throw_invalid("NULL input", __FILE__, __LINE__);
11685   auto saved_ctx = isl_schedule_get_ctx(obj.ptr);
11686   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11687   ptr = obj.copy();
11688   if (!ptr)
11689     exception::throw_last_error(saved_ctx);
11690 }
11691 
schedule(__isl_take isl_schedule * ptr)11692 schedule::schedule(__isl_take isl_schedule *ptr)
11693     : ptr(ptr) {}
11694 
schedule(isl::ctx ctx,const std::string & str)11695 schedule::schedule(isl::ctx ctx, const std::string &str)
11696 {
11697   auto saved_ctx = ctx;
11698   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11699   auto res = isl_schedule_read_from_str(ctx.release(), str.c_str());
11700   if (!res)
11701     exception::throw_last_error(saved_ctx);
11702   ptr = res;
11703 }
11704 
11705 schedule &schedule::operator=(schedule obj) {
11706   std::swap(this->ptr, obj.ptr);
11707   return *this;
11708 }
11709 
~schedule()11710 schedule::~schedule() {
11711   if (ptr)
11712     isl_schedule_free(ptr);
11713 }
11714 
copy()11715 __isl_give isl_schedule *schedule::copy() const & {
11716   return isl_schedule_copy(ptr);
11717 }
11718 
get()11719 __isl_keep isl_schedule *schedule::get() const {
11720   return ptr;
11721 }
11722 
release()11723 __isl_give isl_schedule *schedule::release() {
11724   isl_schedule *tmp = ptr;
11725   ptr = nullptr;
11726   return tmp;
11727 }
11728 
is_null()11729 bool schedule::is_null() const {
11730   return ptr == nullptr;
11731 }
11732 
ctx()11733 isl::ctx schedule::ctx() const {
11734   return isl::ctx(isl_schedule_get_ctx(ptr));
11735 }
11736 
from_domain(isl::union_set domain)11737 isl::schedule schedule::from_domain(isl::union_set domain)
11738 {
11739   if (domain.is_null())
11740     exception::throw_invalid("NULL input", __FILE__, __LINE__);
11741   auto saved_ctx = domain.ctx();
11742   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11743   auto res = isl_schedule_from_domain(domain.release());
11744   if (!res)
11745     exception::throw_last_error(saved_ctx);
11746   return manage(res);
11747 }
11748 
map()11749 isl::union_map schedule::map() const
11750 {
11751   if (!ptr)
11752     exception::throw_invalid("NULL input", __FILE__, __LINE__);
11753   auto saved_ctx = ctx();
11754   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11755   auto res = isl_schedule_get_map(get());
11756   if (!res)
11757     exception::throw_last_error(saved_ctx);
11758   return manage(res);
11759 }
11760 
get_map()11761 isl::union_map schedule::get_map() const
11762 {
11763   return map();
11764 }
11765 
root()11766 isl::schedule_node schedule::root() const
11767 {
11768   if (!ptr)
11769     exception::throw_invalid("NULL input", __FILE__, __LINE__);
11770   auto saved_ctx = ctx();
11771   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11772   auto res = isl_schedule_get_root(get());
11773   if (!res)
11774     exception::throw_last_error(saved_ctx);
11775   return manage(res);
11776 }
11777 
get_root()11778 isl::schedule_node schedule::get_root() const
11779 {
11780   return root();
11781 }
11782 
pullback(isl::union_pw_multi_aff upma)11783 isl::schedule schedule::pullback(isl::union_pw_multi_aff upma) const
11784 {
11785   if (!ptr || upma.is_null())
11786     exception::throw_invalid("NULL input", __FILE__, __LINE__);
11787   auto saved_ctx = ctx();
11788   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11789   auto res = isl_schedule_pullback_union_pw_multi_aff(copy(), upma.release());
11790   if (!res)
11791     exception::throw_last_error(saved_ctx);
11792   return manage(res);
11793 }
11794 
11795 inline std::ostream &operator<<(std::ostream &os, const schedule &obj)
11796 {
11797   if (!obj.get())
11798     exception::throw_invalid("NULL input", __FILE__, __LINE__);
11799   auto saved_ctx = isl_schedule_get_ctx(obj.get());
11800   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11801   char *str = isl_schedule_to_str(obj.get());
11802   if (!str)
11803     exception::throw_last_error(saved_ctx);
11804   os << str;
11805   free(str);
11806   return os;
11807 }
11808 
11809 // implementations for isl::schedule_constraints
manage(__isl_take isl_schedule_constraints * ptr)11810 schedule_constraints manage(__isl_take isl_schedule_constraints *ptr) {
11811   if (!ptr)
11812     exception::throw_invalid("NULL input", __FILE__, __LINE__);
11813   return schedule_constraints(ptr);
11814 }
manage_copy(__isl_keep isl_schedule_constraints * ptr)11815 schedule_constraints manage_copy(__isl_keep isl_schedule_constraints *ptr) {
11816   if (!ptr)
11817     exception::throw_invalid("NULL input", __FILE__, __LINE__);
11818   auto saved_ctx = isl_schedule_constraints_get_ctx(ptr);
11819   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11820   ptr = isl_schedule_constraints_copy(ptr);
11821   if (!ptr)
11822     exception::throw_last_error(saved_ctx);
11823   return schedule_constraints(ptr);
11824 }
11825 
schedule_constraints()11826 schedule_constraints::schedule_constraints()
11827     : ptr(nullptr) {}
11828 
schedule_constraints(const schedule_constraints & obj)11829 schedule_constraints::schedule_constraints(const schedule_constraints &obj)
11830     : ptr(nullptr)
11831 {
11832   if (!obj.ptr)
11833     exception::throw_invalid("NULL input", __FILE__, __LINE__);
11834   auto saved_ctx = isl_schedule_constraints_get_ctx(obj.ptr);
11835   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11836   ptr = obj.copy();
11837   if (!ptr)
11838     exception::throw_last_error(saved_ctx);
11839 }
11840 
schedule_constraints(__isl_take isl_schedule_constraints * ptr)11841 schedule_constraints::schedule_constraints(__isl_take isl_schedule_constraints *ptr)
11842     : ptr(ptr) {}
11843 
schedule_constraints(isl::ctx ctx,const std::string & str)11844 schedule_constraints::schedule_constraints(isl::ctx ctx, const std::string &str)
11845 {
11846   auto saved_ctx = ctx;
11847   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11848   auto res = isl_schedule_constraints_read_from_str(ctx.release(), str.c_str());
11849   if (!res)
11850     exception::throw_last_error(saved_ctx);
11851   ptr = res;
11852 }
11853 
11854 schedule_constraints &schedule_constraints::operator=(schedule_constraints obj) {
11855   std::swap(this->ptr, obj.ptr);
11856   return *this;
11857 }
11858 
~schedule_constraints()11859 schedule_constraints::~schedule_constraints() {
11860   if (ptr)
11861     isl_schedule_constraints_free(ptr);
11862 }
11863 
copy()11864 __isl_give isl_schedule_constraints *schedule_constraints::copy() const & {
11865   return isl_schedule_constraints_copy(ptr);
11866 }
11867 
get()11868 __isl_keep isl_schedule_constraints *schedule_constraints::get() const {
11869   return ptr;
11870 }
11871 
release()11872 __isl_give isl_schedule_constraints *schedule_constraints::release() {
11873   isl_schedule_constraints *tmp = ptr;
11874   ptr = nullptr;
11875   return tmp;
11876 }
11877 
is_null()11878 bool schedule_constraints::is_null() const {
11879   return ptr == nullptr;
11880 }
11881 
ctx()11882 isl::ctx schedule_constraints::ctx() const {
11883   return isl::ctx(isl_schedule_constraints_get_ctx(ptr));
11884 }
11885 
compute_schedule()11886 isl::schedule schedule_constraints::compute_schedule() const
11887 {
11888   if (!ptr)
11889     exception::throw_invalid("NULL input", __FILE__, __LINE__);
11890   auto saved_ctx = ctx();
11891   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11892   auto res = isl_schedule_constraints_compute_schedule(copy());
11893   if (!res)
11894     exception::throw_last_error(saved_ctx);
11895   return manage(res);
11896 }
11897 
coincidence()11898 isl::union_map schedule_constraints::coincidence() const
11899 {
11900   if (!ptr)
11901     exception::throw_invalid("NULL input", __FILE__, __LINE__);
11902   auto saved_ctx = ctx();
11903   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11904   auto res = isl_schedule_constraints_get_coincidence(get());
11905   if (!res)
11906     exception::throw_last_error(saved_ctx);
11907   return manage(res);
11908 }
11909 
get_coincidence()11910 isl::union_map schedule_constraints::get_coincidence() const
11911 {
11912   return coincidence();
11913 }
11914 
conditional_validity()11915 isl::union_map schedule_constraints::conditional_validity() const
11916 {
11917   if (!ptr)
11918     exception::throw_invalid("NULL input", __FILE__, __LINE__);
11919   auto saved_ctx = ctx();
11920   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11921   auto res = isl_schedule_constraints_get_conditional_validity(get());
11922   if (!res)
11923     exception::throw_last_error(saved_ctx);
11924   return manage(res);
11925 }
11926 
get_conditional_validity()11927 isl::union_map schedule_constraints::get_conditional_validity() const
11928 {
11929   return conditional_validity();
11930 }
11931 
conditional_validity_condition()11932 isl::union_map schedule_constraints::conditional_validity_condition() const
11933 {
11934   if (!ptr)
11935     exception::throw_invalid("NULL input", __FILE__, __LINE__);
11936   auto saved_ctx = ctx();
11937   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11938   auto res = isl_schedule_constraints_get_conditional_validity_condition(get());
11939   if (!res)
11940     exception::throw_last_error(saved_ctx);
11941   return manage(res);
11942 }
11943 
get_conditional_validity_condition()11944 isl::union_map schedule_constraints::get_conditional_validity_condition() const
11945 {
11946   return conditional_validity_condition();
11947 }
11948 
context()11949 isl::set schedule_constraints::context() const
11950 {
11951   if (!ptr)
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_schedule_constraints_get_context(get());
11956   if (!res)
11957     exception::throw_last_error(saved_ctx);
11958   return manage(res);
11959 }
11960 
get_context()11961 isl::set schedule_constraints::get_context() const
11962 {
11963   return context();
11964 }
11965 
domain()11966 isl::union_set schedule_constraints::domain() const
11967 {
11968   if (!ptr)
11969     exception::throw_invalid("NULL input", __FILE__, __LINE__);
11970   auto saved_ctx = ctx();
11971   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11972   auto res = isl_schedule_constraints_get_domain(get());
11973   if (!res)
11974     exception::throw_last_error(saved_ctx);
11975   return manage(res);
11976 }
11977 
get_domain()11978 isl::union_set schedule_constraints::get_domain() const
11979 {
11980   return domain();
11981 }
11982 
proximity()11983 isl::union_map schedule_constraints::proximity() const
11984 {
11985   if (!ptr)
11986     exception::throw_invalid("NULL input", __FILE__, __LINE__);
11987   auto saved_ctx = ctx();
11988   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
11989   auto res = isl_schedule_constraints_get_proximity(get());
11990   if (!res)
11991     exception::throw_last_error(saved_ctx);
11992   return manage(res);
11993 }
11994 
get_proximity()11995 isl::union_map schedule_constraints::get_proximity() const
11996 {
11997   return proximity();
11998 }
11999 
validity()12000 isl::union_map schedule_constraints::validity() const
12001 {
12002   if (!ptr)
12003     exception::throw_invalid("NULL input", __FILE__, __LINE__);
12004   auto saved_ctx = ctx();
12005   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12006   auto res = isl_schedule_constraints_get_validity(get());
12007   if (!res)
12008     exception::throw_last_error(saved_ctx);
12009   return manage(res);
12010 }
12011 
get_validity()12012 isl::union_map schedule_constraints::get_validity() const
12013 {
12014   return validity();
12015 }
12016 
on_domain(isl::union_set domain)12017 isl::schedule_constraints schedule_constraints::on_domain(isl::union_set domain)
12018 {
12019   if (domain.is_null())
12020     exception::throw_invalid("NULL input", __FILE__, __LINE__);
12021   auto saved_ctx = domain.ctx();
12022   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12023   auto res = isl_schedule_constraints_on_domain(domain.release());
12024   if (!res)
12025     exception::throw_last_error(saved_ctx);
12026   return manage(res);
12027 }
12028 
set_coincidence(isl::union_map coincidence)12029 isl::schedule_constraints schedule_constraints::set_coincidence(isl::union_map coincidence) const
12030 {
12031   if (!ptr || coincidence.is_null())
12032     exception::throw_invalid("NULL input", __FILE__, __LINE__);
12033   auto saved_ctx = ctx();
12034   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12035   auto res = isl_schedule_constraints_set_coincidence(copy(), coincidence.release());
12036   if (!res)
12037     exception::throw_last_error(saved_ctx);
12038   return manage(res);
12039 }
12040 
set_conditional_validity(isl::union_map condition,isl::union_map validity)12041 isl::schedule_constraints schedule_constraints::set_conditional_validity(isl::union_map condition, isl::union_map validity) const
12042 {
12043   if (!ptr || condition.is_null() || validity.is_null())
12044     exception::throw_invalid("NULL input", __FILE__, __LINE__);
12045   auto saved_ctx = ctx();
12046   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12047   auto res = isl_schedule_constraints_set_conditional_validity(copy(), condition.release(), validity.release());
12048   if (!res)
12049     exception::throw_last_error(saved_ctx);
12050   return manage(res);
12051 }
12052 
set_context(isl::set context)12053 isl::schedule_constraints schedule_constraints::set_context(isl::set context) const
12054 {
12055   if (!ptr || context.is_null())
12056     exception::throw_invalid("NULL input", __FILE__, __LINE__);
12057   auto saved_ctx = ctx();
12058   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12059   auto res = isl_schedule_constraints_set_context(copy(), context.release());
12060   if (!res)
12061     exception::throw_last_error(saved_ctx);
12062   return manage(res);
12063 }
12064 
set_proximity(isl::union_map proximity)12065 isl::schedule_constraints schedule_constraints::set_proximity(isl::union_map proximity) const
12066 {
12067   if (!ptr || proximity.is_null())
12068     exception::throw_invalid("NULL input", __FILE__, __LINE__);
12069   auto saved_ctx = ctx();
12070   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12071   auto res = isl_schedule_constraints_set_proximity(copy(), proximity.release());
12072   if (!res)
12073     exception::throw_last_error(saved_ctx);
12074   return manage(res);
12075 }
12076 
set_validity(isl::union_map validity)12077 isl::schedule_constraints schedule_constraints::set_validity(isl::union_map validity) const
12078 {
12079   if (!ptr || validity.is_null())
12080     exception::throw_invalid("NULL input", __FILE__, __LINE__);
12081   auto saved_ctx = ctx();
12082   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12083   auto res = isl_schedule_constraints_set_validity(copy(), validity.release());
12084   if (!res)
12085     exception::throw_last_error(saved_ctx);
12086   return manage(res);
12087 }
12088 
12089 inline std::ostream &operator<<(std::ostream &os, const schedule_constraints &obj)
12090 {
12091   if (!obj.get())
12092     exception::throw_invalid("NULL input", __FILE__, __LINE__);
12093   auto saved_ctx = isl_schedule_constraints_get_ctx(obj.get());
12094   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12095   char *str = isl_schedule_constraints_to_str(obj.get());
12096   if (!str)
12097     exception::throw_last_error(saved_ctx);
12098   os << str;
12099   free(str);
12100   return os;
12101 }
12102 
12103 // implementations for isl::schedule_node
manage(__isl_take isl_schedule_node * ptr)12104 schedule_node manage(__isl_take isl_schedule_node *ptr) {
12105   if (!ptr)
12106     exception::throw_invalid("NULL input", __FILE__, __LINE__);
12107   return schedule_node(ptr);
12108 }
manage_copy(__isl_keep isl_schedule_node * ptr)12109 schedule_node manage_copy(__isl_keep isl_schedule_node *ptr) {
12110   if (!ptr)
12111     exception::throw_invalid("NULL input", __FILE__, __LINE__);
12112   auto saved_ctx = isl_schedule_node_get_ctx(ptr);
12113   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12114   ptr = isl_schedule_node_copy(ptr);
12115   if (!ptr)
12116     exception::throw_last_error(saved_ctx);
12117   return schedule_node(ptr);
12118 }
12119 
schedule_node()12120 schedule_node::schedule_node()
12121     : ptr(nullptr) {}
12122 
schedule_node(const schedule_node & obj)12123 schedule_node::schedule_node(const schedule_node &obj)
12124     : ptr(nullptr)
12125 {
12126   if (!obj.ptr)
12127     exception::throw_invalid("NULL input", __FILE__, __LINE__);
12128   auto saved_ctx = isl_schedule_node_get_ctx(obj.ptr);
12129   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12130   ptr = obj.copy();
12131   if (!ptr)
12132     exception::throw_last_error(saved_ctx);
12133 }
12134 
schedule_node(__isl_take isl_schedule_node * ptr)12135 schedule_node::schedule_node(__isl_take isl_schedule_node *ptr)
12136     : ptr(ptr) {}
12137 
12138 schedule_node &schedule_node::operator=(schedule_node obj) {
12139   std::swap(this->ptr, obj.ptr);
12140   return *this;
12141 }
12142 
~schedule_node()12143 schedule_node::~schedule_node() {
12144   if (ptr)
12145     isl_schedule_node_free(ptr);
12146 }
12147 
copy()12148 __isl_give isl_schedule_node *schedule_node::copy() const & {
12149   return isl_schedule_node_copy(ptr);
12150 }
12151 
get()12152 __isl_keep isl_schedule_node *schedule_node::get() const {
12153   return ptr;
12154 }
12155 
release()12156 __isl_give isl_schedule_node *schedule_node::release() {
12157   isl_schedule_node *tmp = ptr;
12158   ptr = nullptr;
12159   return tmp;
12160 }
12161 
is_null()12162 bool schedule_node::is_null() const {
12163   return ptr == nullptr;
12164 }
12165 
12166 template <typename T, typename>
isa_type(T subtype)12167 bool schedule_node::isa_type(T subtype) const
12168 {
12169   if (is_null())
12170     exception::throw_invalid("NULL input", __FILE__, __LINE__);
12171   return isl_schedule_node_get_type(get()) == subtype;
12172 }
12173 template <class T>
isa()12174 bool schedule_node::isa() const
12175 {
12176   return isa_type<decltype(T::type)>(T::type);
12177 }
12178 template <class T>
as()12179 T schedule_node::as() const
12180 {
12181  if (!isa<T>())
12182     exception::throw_invalid("not an object of the requested subtype", __FILE__, __LINE__);
12183   return T(copy());
12184 }
12185 
ctx()12186 isl::ctx schedule_node::ctx() const {
12187   return isl::ctx(isl_schedule_node_get_ctx(ptr));
12188 }
12189 
ancestor(int generation)12190 isl::schedule_node schedule_node::ancestor(int generation) const
12191 {
12192   if (!ptr)
12193     exception::throw_invalid("NULL input", __FILE__, __LINE__);
12194   auto saved_ctx = ctx();
12195   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12196   auto res = isl_schedule_node_ancestor(copy(), generation);
12197   if (!res)
12198     exception::throw_last_error(saved_ctx);
12199   return manage(res);
12200 }
12201 
child(int pos)12202 isl::schedule_node schedule_node::child(int pos) const
12203 {
12204   if (!ptr)
12205     exception::throw_invalid("NULL input", __FILE__, __LINE__);
12206   auto saved_ctx = ctx();
12207   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12208   auto res = isl_schedule_node_child(copy(), pos);
12209   if (!res)
12210     exception::throw_last_error(saved_ctx);
12211   return manage(res);
12212 }
12213 
every_descendant(const std::function<bool (isl::schedule_node)> & test)12214 bool schedule_node::every_descendant(const std::function<bool(isl::schedule_node)> &test) 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   struct test_data {
12221     std::function<bool(isl::schedule_node)> func;
12222     std::exception_ptr eptr;
12223   } test_data = { test };
12224   auto test_lambda = [](isl_schedule_node *arg_0, void *arg_1) -> isl_bool {
12225     auto *data = static_cast<struct test_data *>(arg_1);
12226     ISL_CPP_TRY {
12227       auto ret = (data->func)(manage_copy(arg_0));
12228       return ret ? isl_bool_true : isl_bool_false;
12229     } ISL_CPP_CATCH_ALL {
12230       data->eptr = std::current_exception();
12231       return isl_bool_error;
12232     }
12233   };
12234   auto res = isl_schedule_node_every_descendant(get(), test_lambda, &test_data);
12235   if (test_data.eptr)
12236     std::rethrow_exception(test_data.eptr);
12237   if (res < 0)
12238     exception::throw_last_error(saved_ctx);
12239   return res;
12240 }
12241 
first_child()12242 isl::schedule_node schedule_node::first_child() const
12243 {
12244   if (!ptr)
12245     exception::throw_invalid("NULL input", __FILE__, __LINE__);
12246   auto saved_ctx = ctx();
12247   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12248   auto res = isl_schedule_node_first_child(copy());
12249   if (!res)
12250     exception::throw_last_error(saved_ctx);
12251   return manage(res);
12252 }
12253 
foreach_ancestor_top_down(const std::function<void (isl::schedule_node)> & fn)12254 void schedule_node::foreach_ancestor_top_down(const std::function<void(isl::schedule_node)> &fn) const
12255 {
12256   if (!ptr)
12257     exception::throw_invalid("NULL input", __FILE__, __LINE__);
12258   auto saved_ctx = ctx();
12259   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12260   struct fn_data {
12261     std::function<void(isl::schedule_node)> func;
12262     std::exception_ptr eptr;
12263   } fn_data = { fn };
12264   auto fn_lambda = [](isl_schedule_node *arg_0, void *arg_1) -> isl_stat {
12265     auto *data = static_cast<struct fn_data *>(arg_1);
12266     ISL_CPP_TRY {
12267       (data->func)(manage_copy(arg_0));
12268       return isl_stat_ok;
12269     } ISL_CPP_CATCH_ALL {
12270       data->eptr = std::current_exception();
12271       return isl_stat_error;
12272     }
12273   };
12274   auto res = isl_schedule_node_foreach_ancestor_top_down(get(), fn_lambda, &fn_data);
12275   if (fn_data.eptr)
12276     std::rethrow_exception(fn_data.eptr);
12277   if (res < 0)
12278     exception::throw_last_error(saved_ctx);
12279   return;
12280 }
12281 
foreach_descendant_top_down(const std::function<bool (isl::schedule_node)> & fn)12282 void schedule_node::foreach_descendant_top_down(const std::function<bool(isl::schedule_node)> &fn) const
12283 {
12284   if (!ptr)
12285     exception::throw_invalid("NULL input", __FILE__, __LINE__);
12286   auto saved_ctx = ctx();
12287   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12288   struct fn_data {
12289     std::function<bool(isl::schedule_node)> func;
12290     std::exception_ptr eptr;
12291   } fn_data = { fn };
12292   auto fn_lambda = [](isl_schedule_node *arg_0, void *arg_1) -> isl_bool {
12293     auto *data = static_cast<struct fn_data *>(arg_1);
12294     ISL_CPP_TRY {
12295       auto ret = (data->func)(manage_copy(arg_0));
12296       return ret ? isl_bool_true : isl_bool_false;
12297     } ISL_CPP_CATCH_ALL {
12298       data->eptr = std::current_exception();
12299       return isl_bool_error;
12300     }
12301   };
12302   auto res = isl_schedule_node_foreach_descendant_top_down(get(), fn_lambda, &fn_data);
12303   if (fn_data.eptr)
12304     std::rethrow_exception(fn_data.eptr);
12305   if (res < 0)
12306     exception::throw_last_error(saved_ctx);
12307   return;
12308 }
12309 
from_domain(isl::union_set domain)12310 isl::schedule_node schedule_node::from_domain(isl::union_set domain)
12311 {
12312   if (domain.is_null())
12313     exception::throw_invalid("NULL input", __FILE__, __LINE__);
12314   auto saved_ctx = domain.ctx();
12315   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12316   auto res = isl_schedule_node_from_domain(domain.release());
12317   if (!res)
12318     exception::throw_last_error(saved_ctx);
12319   return manage(res);
12320 }
12321 
from_extension(isl::union_map extension)12322 isl::schedule_node schedule_node::from_extension(isl::union_map extension)
12323 {
12324   if (extension.is_null())
12325     exception::throw_invalid("NULL input", __FILE__, __LINE__);
12326   auto saved_ctx = extension.ctx();
12327   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12328   auto res = isl_schedule_node_from_extension(extension.release());
12329   if (!res)
12330     exception::throw_last_error(saved_ctx);
12331   return manage(res);
12332 }
12333 
ancestor_child_position(const isl::schedule_node & ancestor)12334 unsigned schedule_node::ancestor_child_position(const isl::schedule_node &ancestor) const
12335 {
12336   if (!ptr || ancestor.is_null())
12337     exception::throw_invalid("NULL input", __FILE__, __LINE__);
12338   auto saved_ctx = ctx();
12339   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12340   auto res = isl_schedule_node_get_ancestor_child_position(get(), ancestor.get());
12341   if (res < 0)
12342     exception::throw_last_error(saved_ctx);
12343   return res;
12344 }
12345 
get_ancestor_child_position(const isl::schedule_node & ancestor)12346 unsigned schedule_node::get_ancestor_child_position(const isl::schedule_node &ancestor) const
12347 {
12348   return ancestor_child_position(ancestor);
12349 }
12350 
child_position()12351 unsigned schedule_node::child_position() const
12352 {
12353   if (!ptr)
12354     exception::throw_invalid("NULL input", __FILE__, __LINE__);
12355   auto saved_ctx = ctx();
12356   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12357   auto res = isl_schedule_node_get_child_position(get());
12358   if (res < 0)
12359     exception::throw_last_error(saved_ctx);
12360   return res;
12361 }
12362 
get_child_position()12363 unsigned schedule_node::get_child_position() const
12364 {
12365   return child_position();
12366 }
12367 
prefix_schedule_multi_union_pw_aff()12368 isl::multi_union_pw_aff schedule_node::prefix_schedule_multi_union_pw_aff() const
12369 {
12370   if (!ptr)
12371     exception::throw_invalid("NULL input", __FILE__, __LINE__);
12372   auto saved_ctx = ctx();
12373   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12374   auto res = isl_schedule_node_get_prefix_schedule_multi_union_pw_aff(get());
12375   if (!res)
12376     exception::throw_last_error(saved_ctx);
12377   return manage(res);
12378 }
12379 
get_prefix_schedule_multi_union_pw_aff()12380 isl::multi_union_pw_aff schedule_node::get_prefix_schedule_multi_union_pw_aff() const
12381 {
12382   return prefix_schedule_multi_union_pw_aff();
12383 }
12384 
prefix_schedule_union_map()12385 isl::union_map schedule_node::prefix_schedule_union_map() const
12386 {
12387   if (!ptr)
12388     exception::throw_invalid("NULL input", __FILE__, __LINE__);
12389   auto saved_ctx = ctx();
12390   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12391   auto res = isl_schedule_node_get_prefix_schedule_union_map(get());
12392   if (!res)
12393     exception::throw_last_error(saved_ctx);
12394   return manage(res);
12395 }
12396 
get_prefix_schedule_union_map()12397 isl::union_map schedule_node::get_prefix_schedule_union_map() const
12398 {
12399   return prefix_schedule_union_map();
12400 }
12401 
prefix_schedule_union_pw_multi_aff()12402 isl::union_pw_multi_aff schedule_node::prefix_schedule_union_pw_multi_aff() const
12403 {
12404   if (!ptr)
12405     exception::throw_invalid("NULL input", __FILE__, __LINE__);
12406   auto saved_ctx = ctx();
12407   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12408   auto res = isl_schedule_node_get_prefix_schedule_union_pw_multi_aff(get());
12409   if (!res)
12410     exception::throw_last_error(saved_ctx);
12411   return manage(res);
12412 }
12413 
get_prefix_schedule_union_pw_multi_aff()12414 isl::union_pw_multi_aff schedule_node::get_prefix_schedule_union_pw_multi_aff() const
12415 {
12416   return prefix_schedule_union_pw_multi_aff();
12417 }
12418 
schedule()12419 isl::schedule schedule_node::schedule() const
12420 {
12421   if (!ptr)
12422     exception::throw_invalid("NULL input", __FILE__, __LINE__);
12423   auto saved_ctx = ctx();
12424   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12425   auto res = isl_schedule_node_get_schedule(get());
12426   if (!res)
12427     exception::throw_last_error(saved_ctx);
12428   return manage(res);
12429 }
12430 
get_schedule()12431 isl::schedule schedule_node::get_schedule() const
12432 {
12433   return schedule();
12434 }
12435 
shared_ancestor(const isl::schedule_node & node2)12436 isl::schedule_node schedule_node::shared_ancestor(const isl::schedule_node &node2) const
12437 {
12438   if (!ptr || node2.is_null())
12439     exception::throw_invalid("NULL input", __FILE__, __LINE__);
12440   auto saved_ctx = ctx();
12441   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12442   auto res = isl_schedule_node_get_shared_ancestor(get(), node2.get());
12443   if (!res)
12444     exception::throw_last_error(saved_ctx);
12445   return manage(res);
12446 }
12447 
get_shared_ancestor(const isl::schedule_node & node2)12448 isl::schedule_node schedule_node::get_shared_ancestor(const isl::schedule_node &node2) const
12449 {
12450   return shared_ancestor(node2);
12451 }
12452 
tree_depth()12453 unsigned schedule_node::tree_depth() const
12454 {
12455   if (!ptr)
12456     exception::throw_invalid("NULL input", __FILE__, __LINE__);
12457   auto saved_ctx = ctx();
12458   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12459   auto res = isl_schedule_node_get_tree_depth(get());
12460   if (res < 0)
12461     exception::throw_last_error(saved_ctx);
12462   return res;
12463 }
12464 
get_tree_depth()12465 unsigned schedule_node::get_tree_depth() const
12466 {
12467   return tree_depth();
12468 }
12469 
graft_after(isl::schedule_node graft)12470 isl::schedule_node schedule_node::graft_after(isl::schedule_node graft) const
12471 {
12472   if (!ptr || graft.is_null())
12473     exception::throw_invalid("NULL input", __FILE__, __LINE__);
12474   auto saved_ctx = ctx();
12475   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12476   auto res = isl_schedule_node_graft_after(copy(), graft.release());
12477   if (!res)
12478     exception::throw_last_error(saved_ctx);
12479   return manage(res);
12480 }
12481 
graft_before(isl::schedule_node graft)12482 isl::schedule_node schedule_node::graft_before(isl::schedule_node graft) const
12483 {
12484   if (!ptr || graft.is_null())
12485     exception::throw_invalid("NULL input", __FILE__, __LINE__);
12486   auto saved_ctx = ctx();
12487   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12488   auto res = isl_schedule_node_graft_before(copy(), graft.release());
12489   if (!res)
12490     exception::throw_last_error(saved_ctx);
12491   return manage(res);
12492 }
12493 
has_children()12494 bool schedule_node::has_children() const
12495 {
12496   if (!ptr)
12497     exception::throw_invalid("NULL input", __FILE__, __LINE__);
12498   auto saved_ctx = ctx();
12499   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12500   auto res = isl_schedule_node_has_children(get());
12501   if (res < 0)
12502     exception::throw_last_error(saved_ctx);
12503   return res;
12504 }
12505 
has_next_sibling()12506 bool schedule_node::has_next_sibling() const
12507 {
12508   if (!ptr)
12509     exception::throw_invalid("NULL input", __FILE__, __LINE__);
12510   auto saved_ctx = ctx();
12511   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12512   auto res = isl_schedule_node_has_next_sibling(get());
12513   if (res < 0)
12514     exception::throw_last_error(saved_ctx);
12515   return res;
12516 }
12517 
has_parent()12518 bool schedule_node::has_parent() const
12519 {
12520   if (!ptr)
12521     exception::throw_invalid("NULL input", __FILE__, __LINE__);
12522   auto saved_ctx = ctx();
12523   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12524   auto res = isl_schedule_node_has_parent(get());
12525   if (res < 0)
12526     exception::throw_last_error(saved_ctx);
12527   return res;
12528 }
12529 
has_previous_sibling()12530 bool schedule_node::has_previous_sibling() const
12531 {
12532   if (!ptr)
12533     exception::throw_invalid("NULL input", __FILE__, __LINE__);
12534   auto saved_ctx = ctx();
12535   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12536   auto res = isl_schedule_node_has_previous_sibling(get());
12537   if (res < 0)
12538     exception::throw_last_error(saved_ctx);
12539   return res;
12540 }
12541 
insert_context(isl::set context)12542 isl::schedule_node schedule_node::insert_context(isl::set context) const
12543 {
12544   if (!ptr || context.is_null())
12545     exception::throw_invalid("NULL input", __FILE__, __LINE__);
12546   auto saved_ctx = ctx();
12547   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12548   auto res = isl_schedule_node_insert_context(copy(), context.release());
12549   if (!res)
12550     exception::throw_last_error(saved_ctx);
12551   return manage(res);
12552 }
12553 
insert_filter(isl::union_set filter)12554 isl::schedule_node schedule_node::insert_filter(isl::union_set filter) const
12555 {
12556   if (!ptr || filter.is_null())
12557     exception::throw_invalid("NULL input", __FILE__, __LINE__);
12558   auto saved_ctx = ctx();
12559   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12560   auto res = isl_schedule_node_insert_filter(copy(), filter.release());
12561   if (!res)
12562     exception::throw_last_error(saved_ctx);
12563   return manage(res);
12564 }
12565 
insert_guard(isl::set context)12566 isl::schedule_node schedule_node::insert_guard(isl::set context) const
12567 {
12568   if (!ptr || context.is_null())
12569     exception::throw_invalid("NULL input", __FILE__, __LINE__);
12570   auto saved_ctx = ctx();
12571   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12572   auto res = isl_schedule_node_insert_guard(copy(), context.release());
12573   if (!res)
12574     exception::throw_last_error(saved_ctx);
12575   return manage(res);
12576 }
12577 
insert_mark(isl::id mark)12578 isl::schedule_node schedule_node::insert_mark(isl::id mark) const
12579 {
12580   if (!ptr || mark.is_null())
12581     exception::throw_invalid("NULL input", __FILE__, __LINE__);
12582   auto saved_ctx = ctx();
12583   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12584   auto res = isl_schedule_node_insert_mark(copy(), mark.release());
12585   if (!res)
12586     exception::throw_last_error(saved_ctx);
12587   return manage(res);
12588 }
12589 
insert_mark(const std::string & mark)12590 isl::schedule_node schedule_node::insert_mark(const std::string &mark) const
12591 {
12592   if (!ptr)
12593     exception::throw_invalid("NULL input", __FILE__, __LINE__);
12594   return this->insert_mark(isl::id(ctx(), mark));
12595 }
12596 
insert_partial_schedule(isl::multi_union_pw_aff schedule)12597 isl::schedule_node schedule_node::insert_partial_schedule(isl::multi_union_pw_aff schedule) const
12598 {
12599   if (!ptr || schedule.is_null())
12600     exception::throw_invalid("NULL input", __FILE__, __LINE__);
12601   auto saved_ctx = ctx();
12602   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12603   auto res = isl_schedule_node_insert_partial_schedule(copy(), schedule.release());
12604   if (!res)
12605     exception::throw_last_error(saved_ctx);
12606   return manage(res);
12607 }
12608 
insert_sequence(isl::union_set_list filters)12609 isl::schedule_node schedule_node::insert_sequence(isl::union_set_list filters) const
12610 {
12611   if (!ptr || filters.is_null())
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_node_insert_sequence(copy(), filters.release());
12616   if (!res)
12617     exception::throw_last_error(saved_ctx);
12618   return manage(res);
12619 }
12620 
insert_set(isl::union_set_list filters)12621 isl::schedule_node schedule_node::insert_set(isl::union_set_list filters) const
12622 {
12623   if (!ptr || filters.is_null())
12624     exception::throw_invalid("NULL input", __FILE__, __LINE__);
12625   auto saved_ctx = ctx();
12626   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12627   auto res = isl_schedule_node_insert_set(copy(), filters.release());
12628   if (!res)
12629     exception::throw_last_error(saved_ctx);
12630   return manage(res);
12631 }
12632 
is_equal(const isl::schedule_node & node2)12633 bool schedule_node::is_equal(const isl::schedule_node &node2) const
12634 {
12635   if (!ptr || node2.is_null())
12636     exception::throw_invalid("NULL input", __FILE__, __LINE__);
12637   auto saved_ctx = ctx();
12638   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12639   auto res = isl_schedule_node_is_equal(get(), node2.get());
12640   if (res < 0)
12641     exception::throw_last_error(saved_ctx);
12642   return res;
12643 }
12644 
is_subtree_anchored()12645 bool schedule_node::is_subtree_anchored() const
12646 {
12647   if (!ptr)
12648     exception::throw_invalid("NULL input", __FILE__, __LINE__);
12649   auto saved_ctx = ctx();
12650   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12651   auto res = isl_schedule_node_is_subtree_anchored(get());
12652   if (res < 0)
12653     exception::throw_last_error(saved_ctx);
12654   return res;
12655 }
12656 
map_descendant_bottom_up(const std::function<isl::schedule_node (isl::schedule_node)> & fn)12657 isl::schedule_node schedule_node::map_descendant_bottom_up(const std::function<isl::schedule_node(isl::schedule_node)> &fn) const
12658 {
12659   if (!ptr)
12660     exception::throw_invalid("NULL input", __FILE__, __LINE__);
12661   auto saved_ctx = ctx();
12662   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12663   struct fn_data {
12664     std::function<isl::schedule_node(isl::schedule_node)> func;
12665     std::exception_ptr eptr;
12666   } fn_data = { fn };
12667   auto fn_lambda = [](isl_schedule_node *arg_0, void *arg_1) -> isl_schedule_node * {
12668     auto *data = static_cast<struct fn_data *>(arg_1);
12669     ISL_CPP_TRY {
12670       auto ret = (data->func)(manage(arg_0));
12671       return ret.release();
12672     } ISL_CPP_CATCH_ALL {
12673       data->eptr = std::current_exception();
12674       return NULL;
12675     }
12676   };
12677   auto res = isl_schedule_node_map_descendant_bottom_up(copy(), fn_lambda, &fn_data);
12678   if (fn_data.eptr)
12679     std::rethrow_exception(fn_data.eptr);
12680   if (!res)
12681     exception::throw_last_error(saved_ctx);
12682   return manage(res);
12683 }
12684 
n_children()12685 unsigned schedule_node::n_children() const
12686 {
12687   if (!ptr)
12688     exception::throw_invalid("NULL input", __FILE__, __LINE__);
12689   auto saved_ctx = ctx();
12690   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12691   auto res = isl_schedule_node_n_children(get());
12692   if (res < 0)
12693     exception::throw_last_error(saved_ctx);
12694   return res;
12695 }
12696 
next_sibling()12697 isl::schedule_node schedule_node::next_sibling() const
12698 {
12699   if (!ptr)
12700     exception::throw_invalid("NULL input", __FILE__, __LINE__);
12701   auto saved_ctx = ctx();
12702   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12703   auto res = isl_schedule_node_next_sibling(copy());
12704   if (!res)
12705     exception::throw_last_error(saved_ctx);
12706   return manage(res);
12707 }
12708 
order_after(isl::union_set filter)12709 isl::schedule_node schedule_node::order_after(isl::union_set filter) const
12710 {
12711   if (!ptr || filter.is_null())
12712     exception::throw_invalid("NULL input", __FILE__, __LINE__);
12713   auto saved_ctx = ctx();
12714   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12715   auto res = isl_schedule_node_order_after(copy(), filter.release());
12716   if (!res)
12717     exception::throw_last_error(saved_ctx);
12718   return manage(res);
12719 }
12720 
order_before(isl::union_set filter)12721 isl::schedule_node schedule_node::order_before(isl::union_set filter) const
12722 {
12723   if (!ptr || filter.is_null())
12724     exception::throw_invalid("NULL input", __FILE__, __LINE__);
12725   auto saved_ctx = ctx();
12726   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12727   auto res = isl_schedule_node_order_before(copy(), filter.release());
12728   if (!res)
12729     exception::throw_last_error(saved_ctx);
12730   return manage(res);
12731 }
12732 
parent()12733 isl::schedule_node schedule_node::parent() const
12734 {
12735   if (!ptr)
12736     exception::throw_invalid("NULL input", __FILE__, __LINE__);
12737   auto saved_ctx = ctx();
12738   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12739   auto res = isl_schedule_node_parent(copy());
12740   if (!res)
12741     exception::throw_last_error(saved_ctx);
12742   return manage(res);
12743 }
12744 
previous_sibling()12745 isl::schedule_node schedule_node::previous_sibling() const
12746 {
12747   if (!ptr)
12748     exception::throw_invalid("NULL input", __FILE__, __LINE__);
12749   auto saved_ctx = ctx();
12750   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12751   auto res = isl_schedule_node_previous_sibling(copy());
12752   if (!res)
12753     exception::throw_last_error(saved_ctx);
12754   return manage(res);
12755 }
12756 
root()12757 isl::schedule_node schedule_node::root() const
12758 {
12759   if (!ptr)
12760     exception::throw_invalid("NULL input", __FILE__, __LINE__);
12761   auto saved_ctx = ctx();
12762   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12763   auto res = isl_schedule_node_root(copy());
12764   if (!res)
12765     exception::throw_last_error(saved_ctx);
12766   return manage(res);
12767 }
12768 
12769 inline std::ostream &operator<<(std::ostream &os, const schedule_node &obj)
12770 {
12771   if (!obj.get())
12772     exception::throw_invalid("NULL input", __FILE__, __LINE__);
12773   auto saved_ctx = isl_schedule_node_get_ctx(obj.get());
12774   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12775   char *str = isl_schedule_node_to_str(obj.get());
12776   if (!str)
12777     exception::throw_last_error(saved_ctx);
12778   os << str;
12779   free(str);
12780   return os;
12781 }
12782 
12783 // implementations for isl::schedule_node_band
schedule_node_band()12784 schedule_node_band::schedule_node_band()
12785     : schedule_node() {}
12786 
schedule_node_band(const schedule_node_band & obj)12787 schedule_node_band::schedule_node_band(const schedule_node_band &obj)
12788     : schedule_node(obj)
12789 {
12790 }
12791 
schedule_node_band(__isl_take isl_schedule_node * ptr)12792 schedule_node_band::schedule_node_band(__isl_take isl_schedule_node *ptr)
12793     : schedule_node(ptr) {}
12794 
12795 schedule_node_band &schedule_node_band::operator=(schedule_node_band obj) {
12796   std::swap(this->ptr, obj.ptr);
12797   return *this;
12798 }
12799 
ctx()12800 isl::ctx schedule_node_band::ctx() const {
12801   return isl::ctx(isl_schedule_node_get_ctx(ptr));
12802 }
12803 
ast_build_options()12804 isl::union_set schedule_node_band::ast_build_options() const
12805 {
12806   if (!ptr)
12807     exception::throw_invalid("NULL input", __FILE__, __LINE__);
12808   auto saved_ctx = ctx();
12809   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12810   auto res = isl_schedule_node_band_get_ast_build_options(get());
12811   if (!res)
12812     exception::throw_last_error(saved_ctx);
12813   return manage(res);
12814 }
12815 
get_ast_build_options()12816 isl::union_set schedule_node_band::get_ast_build_options() const
12817 {
12818   return ast_build_options();
12819 }
12820 
ast_isolate_option()12821 isl::set schedule_node_band::ast_isolate_option() const
12822 {
12823   if (!ptr)
12824     exception::throw_invalid("NULL input", __FILE__, __LINE__);
12825   auto saved_ctx = ctx();
12826   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12827   auto res = isl_schedule_node_band_get_ast_isolate_option(get());
12828   if (!res)
12829     exception::throw_last_error(saved_ctx);
12830   return manage(res);
12831 }
12832 
get_ast_isolate_option()12833 isl::set schedule_node_band::get_ast_isolate_option() const
12834 {
12835   return ast_isolate_option();
12836 }
12837 
partial_schedule()12838 isl::multi_union_pw_aff schedule_node_band::partial_schedule() const
12839 {
12840   if (!ptr)
12841     exception::throw_invalid("NULL input", __FILE__, __LINE__);
12842   auto saved_ctx = ctx();
12843   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12844   auto res = isl_schedule_node_band_get_partial_schedule(get());
12845   if (!res)
12846     exception::throw_last_error(saved_ctx);
12847   return manage(res);
12848 }
12849 
get_partial_schedule()12850 isl::multi_union_pw_aff schedule_node_band::get_partial_schedule() const
12851 {
12852   return partial_schedule();
12853 }
12854 
permutable()12855 bool schedule_node_band::permutable() const
12856 {
12857   if (!ptr)
12858     exception::throw_invalid("NULL input", __FILE__, __LINE__);
12859   auto saved_ctx = ctx();
12860   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12861   auto res = isl_schedule_node_band_get_permutable(get());
12862   if (res < 0)
12863     exception::throw_last_error(saved_ctx);
12864   return res;
12865 }
12866 
get_permutable()12867 bool schedule_node_band::get_permutable() const
12868 {
12869   return permutable();
12870 }
12871 
member_get_coincident(int pos)12872 bool schedule_node_band::member_get_coincident(int pos) const
12873 {
12874   if (!ptr)
12875     exception::throw_invalid("NULL input", __FILE__, __LINE__);
12876   auto saved_ctx = ctx();
12877   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12878   auto res = isl_schedule_node_band_member_get_coincident(get(), pos);
12879   if (res < 0)
12880     exception::throw_last_error(saved_ctx);
12881   return res;
12882 }
12883 
member_set_coincident(int pos,int coincident)12884 schedule_node_band schedule_node_band::member_set_coincident(int pos, int coincident) const
12885 {
12886   if (!ptr)
12887     exception::throw_invalid("NULL input", __FILE__, __LINE__);
12888   auto saved_ctx = ctx();
12889   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12890   auto res = isl_schedule_node_band_member_set_coincident(copy(), pos, coincident);
12891   if (!res)
12892     exception::throw_last_error(saved_ctx);
12893   return manage(res).as<schedule_node_band>();
12894 }
12895 
mod(isl::multi_val mv)12896 schedule_node_band schedule_node_band::mod(isl::multi_val mv) const
12897 {
12898   if (!ptr || mv.is_null())
12899     exception::throw_invalid("NULL input", __FILE__, __LINE__);
12900   auto saved_ctx = ctx();
12901   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12902   auto res = isl_schedule_node_band_mod(copy(), mv.release());
12903   if (!res)
12904     exception::throw_last_error(saved_ctx);
12905   return manage(res).as<schedule_node_band>();
12906 }
12907 
n_member()12908 unsigned schedule_node_band::n_member() const
12909 {
12910   if (!ptr)
12911     exception::throw_invalid("NULL input", __FILE__, __LINE__);
12912   auto saved_ctx = ctx();
12913   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12914   auto res = isl_schedule_node_band_n_member(get());
12915   if (res < 0)
12916     exception::throw_last_error(saved_ctx);
12917   return res;
12918 }
12919 
scale(isl::multi_val mv)12920 schedule_node_band schedule_node_band::scale(isl::multi_val mv) const
12921 {
12922   if (!ptr || mv.is_null())
12923     exception::throw_invalid("NULL input", __FILE__, __LINE__);
12924   auto saved_ctx = ctx();
12925   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12926   auto res = isl_schedule_node_band_scale(copy(), mv.release());
12927   if (!res)
12928     exception::throw_last_error(saved_ctx);
12929   return manage(res).as<schedule_node_band>();
12930 }
12931 
scale_down(isl::multi_val mv)12932 schedule_node_band schedule_node_band::scale_down(isl::multi_val mv) const
12933 {
12934   if (!ptr || mv.is_null())
12935     exception::throw_invalid("NULL input", __FILE__, __LINE__);
12936   auto saved_ctx = ctx();
12937   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12938   auto res = isl_schedule_node_band_scale_down(copy(), mv.release());
12939   if (!res)
12940     exception::throw_last_error(saved_ctx);
12941   return manage(res).as<schedule_node_band>();
12942 }
12943 
set_ast_build_options(isl::union_set options)12944 schedule_node_band schedule_node_band::set_ast_build_options(isl::union_set options) const
12945 {
12946   if (!ptr || options.is_null())
12947     exception::throw_invalid("NULL input", __FILE__, __LINE__);
12948   auto saved_ctx = ctx();
12949   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12950   auto res = isl_schedule_node_band_set_ast_build_options(copy(), options.release());
12951   if (!res)
12952     exception::throw_last_error(saved_ctx);
12953   return manage(res).as<schedule_node_band>();
12954 }
12955 
set_permutable(int permutable)12956 schedule_node_band schedule_node_band::set_permutable(int permutable) const
12957 {
12958   if (!ptr)
12959     exception::throw_invalid("NULL input", __FILE__, __LINE__);
12960   auto saved_ctx = ctx();
12961   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12962   auto res = isl_schedule_node_band_set_permutable(copy(), permutable);
12963   if (!res)
12964     exception::throw_last_error(saved_ctx);
12965   return manage(res).as<schedule_node_band>();
12966 }
12967 
shift(isl::multi_union_pw_aff shift)12968 schedule_node_band schedule_node_band::shift(isl::multi_union_pw_aff shift) const
12969 {
12970   if (!ptr || shift.is_null())
12971     exception::throw_invalid("NULL input", __FILE__, __LINE__);
12972   auto saved_ctx = ctx();
12973   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12974   auto res = isl_schedule_node_band_shift(copy(), shift.release());
12975   if (!res)
12976     exception::throw_last_error(saved_ctx);
12977   return manage(res).as<schedule_node_band>();
12978 }
12979 
split(int pos)12980 schedule_node_band schedule_node_band::split(int pos) const
12981 {
12982   if (!ptr)
12983     exception::throw_invalid("NULL input", __FILE__, __LINE__);
12984   auto saved_ctx = ctx();
12985   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12986   auto res = isl_schedule_node_band_split(copy(), pos);
12987   if (!res)
12988     exception::throw_last_error(saved_ctx);
12989   return manage(res).as<schedule_node_band>();
12990 }
12991 
tile(isl::multi_val sizes)12992 schedule_node_band schedule_node_band::tile(isl::multi_val sizes) const
12993 {
12994   if (!ptr || sizes.is_null())
12995     exception::throw_invalid("NULL input", __FILE__, __LINE__);
12996   auto saved_ctx = ctx();
12997   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
12998   auto res = isl_schedule_node_band_tile(copy(), sizes.release());
12999   if (!res)
13000     exception::throw_last_error(saved_ctx);
13001   return manage(res).as<schedule_node_band>();
13002 }
13003 
13004 
member_set_ast_loop_default(int pos)13005 schedule_node_band schedule_node_band::member_set_ast_loop_default(int pos) const
13006 {
13007   if (!ptr)
13008     exception::throw_invalid("NULL input", __FILE__, __LINE__);
13009   auto saved_ctx = ctx();
13010   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13011   auto res = isl_schedule_node_band_member_set_ast_loop_type(copy(), pos, isl_ast_loop_default);
13012   if (!res)
13013     exception::throw_last_error(saved_ctx);
13014   return manage(res).as<schedule_node_band>();
13015 }
13016 
13017 
member_set_ast_loop_atomic(int pos)13018 schedule_node_band schedule_node_band::member_set_ast_loop_atomic(int pos) const
13019 {
13020   if (!ptr)
13021     exception::throw_invalid("NULL input", __FILE__, __LINE__);
13022   auto saved_ctx = ctx();
13023   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13024   auto res = isl_schedule_node_band_member_set_ast_loop_type(copy(), pos, isl_ast_loop_atomic);
13025   if (!res)
13026     exception::throw_last_error(saved_ctx);
13027   return manage(res).as<schedule_node_band>();
13028 }
13029 
13030 
member_set_ast_loop_unroll(int pos)13031 schedule_node_band schedule_node_band::member_set_ast_loop_unroll(int pos) const
13032 {
13033   if (!ptr)
13034     exception::throw_invalid("NULL input", __FILE__, __LINE__);
13035   auto saved_ctx = ctx();
13036   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13037   auto res = isl_schedule_node_band_member_set_ast_loop_type(copy(), pos, isl_ast_loop_unroll);
13038   if (!res)
13039     exception::throw_last_error(saved_ctx);
13040   return manage(res).as<schedule_node_band>();
13041 }
13042 
13043 
member_set_ast_loop_separate(int pos)13044 schedule_node_band schedule_node_band::member_set_ast_loop_separate(int pos) const
13045 {
13046   if (!ptr)
13047     exception::throw_invalid("NULL input", __FILE__, __LINE__);
13048   auto saved_ctx = ctx();
13049   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13050   auto res = isl_schedule_node_band_member_set_ast_loop_type(copy(), pos, isl_ast_loop_separate);
13051   if (!res)
13052     exception::throw_last_error(saved_ctx);
13053   return manage(res).as<schedule_node_band>();
13054 }
13055 
13056 inline std::ostream &operator<<(std::ostream &os, const schedule_node_band &obj)
13057 {
13058   if (!obj.get())
13059     exception::throw_invalid("NULL input", __FILE__, __LINE__);
13060   auto saved_ctx = isl_schedule_node_get_ctx(obj.get());
13061   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13062   char *str = isl_schedule_node_to_str(obj.get());
13063   if (!str)
13064     exception::throw_last_error(saved_ctx);
13065   os << str;
13066   free(str);
13067   return os;
13068 }
13069 
13070 // implementations for isl::schedule_node_context
schedule_node_context()13071 schedule_node_context::schedule_node_context()
13072     : schedule_node() {}
13073 
schedule_node_context(const schedule_node_context & obj)13074 schedule_node_context::schedule_node_context(const schedule_node_context &obj)
13075     : schedule_node(obj)
13076 {
13077 }
13078 
schedule_node_context(__isl_take isl_schedule_node * ptr)13079 schedule_node_context::schedule_node_context(__isl_take isl_schedule_node *ptr)
13080     : schedule_node(ptr) {}
13081 
13082 schedule_node_context &schedule_node_context::operator=(schedule_node_context obj) {
13083   std::swap(this->ptr, obj.ptr);
13084   return *this;
13085 }
13086 
ctx()13087 isl::ctx schedule_node_context::ctx() const {
13088   return isl::ctx(isl_schedule_node_get_ctx(ptr));
13089 }
13090 
context()13091 isl::set schedule_node_context::context() const
13092 {
13093   if (!ptr)
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_context_get_context(get());
13098   if (!res)
13099     exception::throw_last_error(saved_ctx);
13100   return manage(res);
13101 }
13102 
get_context()13103 isl::set schedule_node_context::get_context() const
13104 {
13105   return context();
13106 }
13107 
13108 inline std::ostream &operator<<(std::ostream &os, const schedule_node_context &obj)
13109 {
13110   if (!obj.get())
13111     exception::throw_invalid("NULL input", __FILE__, __LINE__);
13112   auto saved_ctx = isl_schedule_node_get_ctx(obj.get());
13113   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13114   char *str = isl_schedule_node_to_str(obj.get());
13115   if (!str)
13116     exception::throw_last_error(saved_ctx);
13117   os << str;
13118   free(str);
13119   return os;
13120 }
13121 
13122 // implementations for isl::schedule_node_domain
schedule_node_domain()13123 schedule_node_domain::schedule_node_domain()
13124     : schedule_node() {}
13125 
schedule_node_domain(const schedule_node_domain & obj)13126 schedule_node_domain::schedule_node_domain(const schedule_node_domain &obj)
13127     : schedule_node(obj)
13128 {
13129 }
13130 
schedule_node_domain(__isl_take isl_schedule_node * ptr)13131 schedule_node_domain::schedule_node_domain(__isl_take isl_schedule_node *ptr)
13132     : schedule_node(ptr) {}
13133 
13134 schedule_node_domain &schedule_node_domain::operator=(schedule_node_domain obj) {
13135   std::swap(this->ptr, obj.ptr);
13136   return *this;
13137 }
13138 
ctx()13139 isl::ctx schedule_node_domain::ctx() const {
13140   return isl::ctx(isl_schedule_node_get_ctx(ptr));
13141 }
13142 
domain()13143 isl::union_set schedule_node_domain::domain() const
13144 {
13145   if (!ptr)
13146     exception::throw_invalid("NULL input", __FILE__, __LINE__);
13147   auto saved_ctx = ctx();
13148   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13149   auto res = isl_schedule_node_domain_get_domain(get());
13150   if (!res)
13151     exception::throw_last_error(saved_ctx);
13152   return manage(res);
13153 }
13154 
get_domain()13155 isl::union_set schedule_node_domain::get_domain() const
13156 {
13157   return domain();
13158 }
13159 
13160 inline std::ostream &operator<<(std::ostream &os, const schedule_node_domain &obj)
13161 {
13162   if (!obj.get())
13163     exception::throw_invalid("NULL input", __FILE__, __LINE__);
13164   auto saved_ctx = isl_schedule_node_get_ctx(obj.get());
13165   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13166   char *str = isl_schedule_node_to_str(obj.get());
13167   if (!str)
13168     exception::throw_last_error(saved_ctx);
13169   os << str;
13170   free(str);
13171   return os;
13172 }
13173 
13174 // implementations for isl::schedule_node_expansion
schedule_node_expansion()13175 schedule_node_expansion::schedule_node_expansion()
13176     : schedule_node() {}
13177 
schedule_node_expansion(const schedule_node_expansion & obj)13178 schedule_node_expansion::schedule_node_expansion(const schedule_node_expansion &obj)
13179     : schedule_node(obj)
13180 {
13181 }
13182 
schedule_node_expansion(__isl_take isl_schedule_node * ptr)13183 schedule_node_expansion::schedule_node_expansion(__isl_take isl_schedule_node *ptr)
13184     : schedule_node(ptr) {}
13185 
13186 schedule_node_expansion &schedule_node_expansion::operator=(schedule_node_expansion obj) {
13187   std::swap(this->ptr, obj.ptr);
13188   return *this;
13189 }
13190 
ctx()13191 isl::ctx schedule_node_expansion::ctx() const {
13192   return isl::ctx(isl_schedule_node_get_ctx(ptr));
13193 }
13194 
contraction()13195 isl::union_pw_multi_aff schedule_node_expansion::contraction() const
13196 {
13197   if (!ptr)
13198     exception::throw_invalid("NULL input", __FILE__, __LINE__);
13199   auto saved_ctx = ctx();
13200   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13201   auto res = isl_schedule_node_expansion_get_contraction(get());
13202   if (!res)
13203     exception::throw_last_error(saved_ctx);
13204   return manage(res);
13205 }
13206 
get_contraction()13207 isl::union_pw_multi_aff schedule_node_expansion::get_contraction() const
13208 {
13209   return contraction();
13210 }
13211 
expansion()13212 isl::union_map schedule_node_expansion::expansion() const
13213 {
13214   if (!ptr)
13215     exception::throw_invalid("NULL input", __FILE__, __LINE__);
13216   auto saved_ctx = ctx();
13217   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13218   auto res = isl_schedule_node_expansion_get_expansion(get());
13219   if (!res)
13220     exception::throw_last_error(saved_ctx);
13221   return manage(res);
13222 }
13223 
get_expansion()13224 isl::union_map schedule_node_expansion::get_expansion() const
13225 {
13226   return expansion();
13227 }
13228 
13229 inline std::ostream &operator<<(std::ostream &os, const schedule_node_expansion &obj)
13230 {
13231   if (!obj.get())
13232     exception::throw_invalid("NULL input", __FILE__, __LINE__);
13233   auto saved_ctx = isl_schedule_node_get_ctx(obj.get());
13234   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13235   char *str = isl_schedule_node_to_str(obj.get());
13236   if (!str)
13237     exception::throw_last_error(saved_ctx);
13238   os << str;
13239   free(str);
13240   return os;
13241 }
13242 
13243 // implementations for isl::schedule_node_extension
schedule_node_extension()13244 schedule_node_extension::schedule_node_extension()
13245     : schedule_node() {}
13246 
schedule_node_extension(const schedule_node_extension & obj)13247 schedule_node_extension::schedule_node_extension(const schedule_node_extension &obj)
13248     : schedule_node(obj)
13249 {
13250 }
13251 
schedule_node_extension(__isl_take isl_schedule_node * ptr)13252 schedule_node_extension::schedule_node_extension(__isl_take isl_schedule_node *ptr)
13253     : schedule_node(ptr) {}
13254 
13255 schedule_node_extension &schedule_node_extension::operator=(schedule_node_extension obj) {
13256   std::swap(this->ptr, obj.ptr);
13257   return *this;
13258 }
13259 
ctx()13260 isl::ctx schedule_node_extension::ctx() const {
13261   return isl::ctx(isl_schedule_node_get_ctx(ptr));
13262 }
13263 
extension()13264 isl::union_map schedule_node_extension::extension() const
13265 {
13266   if (!ptr)
13267     exception::throw_invalid("NULL input", __FILE__, __LINE__);
13268   auto saved_ctx = ctx();
13269   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13270   auto res = isl_schedule_node_extension_get_extension(get());
13271   if (!res)
13272     exception::throw_last_error(saved_ctx);
13273   return manage(res);
13274 }
13275 
get_extension()13276 isl::union_map schedule_node_extension::get_extension() const
13277 {
13278   return extension();
13279 }
13280 
13281 inline std::ostream &operator<<(std::ostream &os, const schedule_node_extension &obj)
13282 {
13283   if (!obj.get())
13284     exception::throw_invalid("NULL input", __FILE__, __LINE__);
13285   auto saved_ctx = isl_schedule_node_get_ctx(obj.get());
13286   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13287   char *str = isl_schedule_node_to_str(obj.get());
13288   if (!str)
13289     exception::throw_last_error(saved_ctx);
13290   os << str;
13291   free(str);
13292   return os;
13293 }
13294 
13295 // implementations for isl::schedule_node_filter
schedule_node_filter()13296 schedule_node_filter::schedule_node_filter()
13297     : schedule_node() {}
13298 
schedule_node_filter(const schedule_node_filter & obj)13299 schedule_node_filter::schedule_node_filter(const schedule_node_filter &obj)
13300     : schedule_node(obj)
13301 {
13302 }
13303 
schedule_node_filter(__isl_take isl_schedule_node * ptr)13304 schedule_node_filter::schedule_node_filter(__isl_take isl_schedule_node *ptr)
13305     : schedule_node(ptr) {}
13306 
13307 schedule_node_filter &schedule_node_filter::operator=(schedule_node_filter obj) {
13308   std::swap(this->ptr, obj.ptr);
13309   return *this;
13310 }
13311 
ctx()13312 isl::ctx schedule_node_filter::ctx() const {
13313   return isl::ctx(isl_schedule_node_get_ctx(ptr));
13314 }
13315 
filter()13316 isl::union_set schedule_node_filter::filter() const
13317 {
13318   if (!ptr)
13319     exception::throw_invalid("NULL input", __FILE__, __LINE__);
13320   auto saved_ctx = ctx();
13321   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13322   auto res = isl_schedule_node_filter_get_filter(get());
13323   if (!res)
13324     exception::throw_last_error(saved_ctx);
13325   return manage(res);
13326 }
13327 
get_filter()13328 isl::union_set schedule_node_filter::get_filter() const
13329 {
13330   return filter();
13331 }
13332 
13333 inline std::ostream &operator<<(std::ostream &os, const schedule_node_filter &obj)
13334 {
13335   if (!obj.get())
13336     exception::throw_invalid("NULL input", __FILE__, __LINE__);
13337   auto saved_ctx = isl_schedule_node_get_ctx(obj.get());
13338   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13339   char *str = isl_schedule_node_to_str(obj.get());
13340   if (!str)
13341     exception::throw_last_error(saved_ctx);
13342   os << str;
13343   free(str);
13344   return os;
13345 }
13346 
13347 // implementations for isl::schedule_node_guard
schedule_node_guard()13348 schedule_node_guard::schedule_node_guard()
13349     : schedule_node() {}
13350 
schedule_node_guard(const schedule_node_guard & obj)13351 schedule_node_guard::schedule_node_guard(const schedule_node_guard &obj)
13352     : schedule_node(obj)
13353 {
13354 }
13355 
schedule_node_guard(__isl_take isl_schedule_node * ptr)13356 schedule_node_guard::schedule_node_guard(__isl_take isl_schedule_node *ptr)
13357     : schedule_node(ptr) {}
13358 
13359 schedule_node_guard &schedule_node_guard::operator=(schedule_node_guard obj) {
13360   std::swap(this->ptr, obj.ptr);
13361   return *this;
13362 }
13363 
ctx()13364 isl::ctx schedule_node_guard::ctx() const {
13365   return isl::ctx(isl_schedule_node_get_ctx(ptr));
13366 }
13367 
guard()13368 isl::set schedule_node_guard::guard() const
13369 {
13370   if (!ptr)
13371     exception::throw_invalid("NULL input", __FILE__, __LINE__);
13372   auto saved_ctx = ctx();
13373   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13374   auto res = isl_schedule_node_guard_get_guard(get());
13375   if (!res)
13376     exception::throw_last_error(saved_ctx);
13377   return manage(res);
13378 }
13379 
get_guard()13380 isl::set schedule_node_guard::get_guard() const
13381 {
13382   return guard();
13383 }
13384 
13385 inline std::ostream &operator<<(std::ostream &os, const schedule_node_guard &obj)
13386 {
13387   if (!obj.get())
13388     exception::throw_invalid("NULL input", __FILE__, __LINE__);
13389   auto saved_ctx = isl_schedule_node_get_ctx(obj.get());
13390   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13391   char *str = isl_schedule_node_to_str(obj.get());
13392   if (!str)
13393     exception::throw_last_error(saved_ctx);
13394   os << str;
13395   free(str);
13396   return os;
13397 }
13398 
13399 // implementations for isl::schedule_node_leaf
schedule_node_leaf()13400 schedule_node_leaf::schedule_node_leaf()
13401     : schedule_node() {}
13402 
schedule_node_leaf(const schedule_node_leaf & obj)13403 schedule_node_leaf::schedule_node_leaf(const schedule_node_leaf &obj)
13404     : schedule_node(obj)
13405 {
13406 }
13407 
schedule_node_leaf(__isl_take isl_schedule_node * ptr)13408 schedule_node_leaf::schedule_node_leaf(__isl_take isl_schedule_node *ptr)
13409     : schedule_node(ptr) {}
13410 
13411 schedule_node_leaf &schedule_node_leaf::operator=(schedule_node_leaf obj) {
13412   std::swap(this->ptr, obj.ptr);
13413   return *this;
13414 }
13415 
ctx()13416 isl::ctx schedule_node_leaf::ctx() const {
13417   return isl::ctx(isl_schedule_node_get_ctx(ptr));
13418 }
13419 
13420 inline std::ostream &operator<<(std::ostream &os, const schedule_node_leaf &obj)
13421 {
13422   if (!obj.get())
13423     exception::throw_invalid("NULL input", __FILE__, __LINE__);
13424   auto saved_ctx = isl_schedule_node_get_ctx(obj.get());
13425   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13426   char *str = isl_schedule_node_to_str(obj.get());
13427   if (!str)
13428     exception::throw_last_error(saved_ctx);
13429   os << str;
13430   free(str);
13431   return os;
13432 }
13433 
13434 // implementations for isl::schedule_node_mark
schedule_node_mark()13435 schedule_node_mark::schedule_node_mark()
13436     : schedule_node() {}
13437 
schedule_node_mark(const schedule_node_mark & obj)13438 schedule_node_mark::schedule_node_mark(const schedule_node_mark &obj)
13439     : schedule_node(obj)
13440 {
13441 }
13442 
schedule_node_mark(__isl_take isl_schedule_node * ptr)13443 schedule_node_mark::schedule_node_mark(__isl_take isl_schedule_node *ptr)
13444     : schedule_node(ptr) {}
13445 
13446 schedule_node_mark &schedule_node_mark::operator=(schedule_node_mark obj) {
13447   std::swap(this->ptr, obj.ptr);
13448   return *this;
13449 }
13450 
ctx()13451 isl::ctx schedule_node_mark::ctx() const {
13452   return isl::ctx(isl_schedule_node_get_ctx(ptr));
13453 }
13454 
13455 inline std::ostream &operator<<(std::ostream &os, const schedule_node_mark &obj)
13456 {
13457   if (!obj.get())
13458     exception::throw_invalid("NULL input", __FILE__, __LINE__);
13459   auto saved_ctx = isl_schedule_node_get_ctx(obj.get());
13460   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13461   char *str = isl_schedule_node_to_str(obj.get());
13462   if (!str)
13463     exception::throw_last_error(saved_ctx);
13464   os << str;
13465   free(str);
13466   return os;
13467 }
13468 
13469 // implementations for isl::schedule_node_sequence
schedule_node_sequence()13470 schedule_node_sequence::schedule_node_sequence()
13471     : schedule_node() {}
13472 
schedule_node_sequence(const schedule_node_sequence & obj)13473 schedule_node_sequence::schedule_node_sequence(const schedule_node_sequence &obj)
13474     : schedule_node(obj)
13475 {
13476 }
13477 
schedule_node_sequence(__isl_take isl_schedule_node * ptr)13478 schedule_node_sequence::schedule_node_sequence(__isl_take isl_schedule_node *ptr)
13479     : schedule_node(ptr) {}
13480 
13481 schedule_node_sequence &schedule_node_sequence::operator=(schedule_node_sequence obj) {
13482   std::swap(this->ptr, obj.ptr);
13483   return *this;
13484 }
13485 
ctx()13486 isl::ctx schedule_node_sequence::ctx() const {
13487   return isl::ctx(isl_schedule_node_get_ctx(ptr));
13488 }
13489 
13490 inline std::ostream &operator<<(std::ostream &os, const schedule_node_sequence &obj)
13491 {
13492   if (!obj.get())
13493     exception::throw_invalid("NULL input", __FILE__, __LINE__);
13494   auto saved_ctx = isl_schedule_node_get_ctx(obj.get());
13495   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13496   char *str = isl_schedule_node_to_str(obj.get());
13497   if (!str)
13498     exception::throw_last_error(saved_ctx);
13499   os << str;
13500   free(str);
13501   return os;
13502 }
13503 
13504 // implementations for isl::schedule_node_set
schedule_node_set()13505 schedule_node_set::schedule_node_set()
13506     : schedule_node() {}
13507 
schedule_node_set(const schedule_node_set & obj)13508 schedule_node_set::schedule_node_set(const schedule_node_set &obj)
13509     : schedule_node(obj)
13510 {
13511 }
13512 
schedule_node_set(__isl_take isl_schedule_node * ptr)13513 schedule_node_set::schedule_node_set(__isl_take isl_schedule_node *ptr)
13514     : schedule_node(ptr) {}
13515 
13516 schedule_node_set &schedule_node_set::operator=(schedule_node_set obj) {
13517   std::swap(this->ptr, obj.ptr);
13518   return *this;
13519 }
13520 
ctx()13521 isl::ctx schedule_node_set::ctx() const {
13522   return isl::ctx(isl_schedule_node_get_ctx(ptr));
13523 }
13524 
13525 inline std::ostream &operator<<(std::ostream &os, const schedule_node_set &obj)
13526 {
13527   if (!obj.get())
13528     exception::throw_invalid("NULL input", __FILE__, __LINE__);
13529   auto saved_ctx = isl_schedule_node_get_ctx(obj.get());
13530   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13531   char *str = isl_schedule_node_to_str(obj.get());
13532   if (!str)
13533     exception::throw_last_error(saved_ctx);
13534   os << str;
13535   free(str);
13536   return os;
13537 }
13538 
13539 // implementations for isl::set
manage(__isl_take isl_set * ptr)13540 set manage(__isl_take isl_set *ptr) {
13541   if (!ptr)
13542     exception::throw_invalid("NULL input", __FILE__, __LINE__);
13543   return set(ptr);
13544 }
manage_copy(__isl_keep isl_set * ptr)13545 set manage_copy(__isl_keep isl_set *ptr) {
13546   if (!ptr)
13547     exception::throw_invalid("NULL input", __FILE__, __LINE__);
13548   auto saved_ctx = isl_set_get_ctx(ptr);
13549   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13550   ptr = isl_set_copy(ptr);
13551   if (!ptr)
13552     exception::throw_last_error(saved_ctx);
13553   return set(ptr);
13554 }
13555 
set()13556 set::set()
13557     : ptr(nullptr) {}
13558 
set(const set & obj)13559 set::set(const set &obj)
13560     : ptr(nullptr)
13561 {
13562   if (!obj.ptr)
13563     exception::throw_invalid("NULL input", __FILE__, __LINE__);
13564   auto saved_ctx = isl_set_get_ctx(obj.ptr);
13565   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13566   ptr = obj.copy();
13567   if (!ptr)
13568     exception::throw_last_error(saved_ctx);
13569 }
13570 
set(__isl_take isl_set * ptr)13571 set::set(__isl_take isl_set *ptr)
13572     : ptr(ptr) {}
13573 
set(isl::basic_set bset)13574 set::set(isl::basic_set bset)
13575 {
13576   if (bset.is_null())
13577     exception::throw_invalid("NULL input", __FILE__, __LINE__);
13578   auto saved_ctx = bset.ctx();
13579   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13580   auto res = isl_set_from_basic_set(bset.release());
13581   if (!res)
13582     exception::throw_last_error(saved_ctx);
13583   ptr = res;
13584 }
13585 
set(isl::point pnt)13586 set::set(isl::point pnt)
13587 {
13588   if (pnt.is_null())
13589     exception::throw_invalid("NULL input", __FILE__, __LINE__);
13590   auto saved_ctx = pnt.ctx();
13591   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13592   auto res = isl_set_from_point(pnt.release());
13593   if (!res)
13594     exception::throw_last_error(saved_ctx);
13595   ptr = res;
13596 }
13597 
set(isl::ctx ctx,const std::string & str)13598 set::set(isl::ctx ctx, const std::string &str)
13599 {
13600   auto saved_ctx = ctx;
13601   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13602   auto res = isl_set_read_from_str(ctx.release(), str.c_str());
13603   if (!res)
13604     exception::throw_last_error(saved_ctx);
13605   ptr = res;
13606 }
13607 
13608 set &set::operator=(set obj) {
13609   std::swap(this->ptr, obj.ptr);
13610   return *this;
13611 }
13612 
~set()13613 set::~set() {
13614   if (ptr)
13615     isl_set_free(ptr);
13616 }
13617 
copy()13618 __isl_give isl_set *set::copy() const & {
13619   return isl_set_copy(ptr);
13620 }
13621 
get()13622 __isl_keep isl_set *set::get() const {
13623   return ptr;
13624 }
13625 
release()13626 __isl_give isl_set *set::release() {
13627   isl_set *tmp = ptr;
13628   ptr = nullptr;
13629   return tmp;
13630 }
13631 
is_null()13632 bool set::is_null() const {
13633   return ptr == nullptr;
13634 }
13635 
ctx()13636 isl::ctx set::ctx() const {
13637   return isl::ctx(isl_set_get_ctx(ptr));
13638 }
13639 
affine_hull()13640 isl::basic_set set::affine_hull() 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_set_affine_hull(copy());
13647   if (!res)
13648     exception::throw_last_error(saved_ctx);
13649   return manage(res);
13650 }
13651 
apply(isl::map map)13652 isl::set set::apply(isl::map map) const
13653 {
13654   if (!ptr || map.is_null())
13655     exception::throw_invalid("NULL input", __FILE__, __LINE__);
13656   auto saved_ctx = ctx();
13657   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13658   auto res = isl_set_apply(copy(), map.release());
13659   if (!res)
13660     exception::throw_last_error(saved_ctx);
13661   return manage(res);
13662 }
13663 
bind(isl::multi_id tuple)13664 isl::set set::bind(isl::multi_id tuple) const
13665 {
13666   if (!ptr || tuple.is_null())
13667     exception::throw_invalid("NULL input", __FILE__, __LINE__);
13668   auto saved_ctx = ctx();
13669   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13670   auto res = isl_set_bind(copy(), tuple.release());
13671   if (!res)
13672     exception::throw_last_error(saved_ctx);
13673   return manage(res);
13674 }
13675 
coalesce()13676 isl::set set::coalesce() const
13677 {
13678   if (!ptr)
13679     exception::throw_invalid("NULL input", __FILE__, __LINE__);
13680   auto saved_ctx = ctx();
13681   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13682   auto res = isl_set_coalesce(copy());
13683   if (!res)
13684     exception::throw_last_error(saved_ctx);
13685   return manage(res);
13686 }
13687 
complement()13688 isl::set set::complement() const
13689 {
13690   if (!ptr)
13691     exception::throw_invalid("NULL input", __FILE__, __LINE__);
13692   auto saved_ctx = ctx();
13693   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13694   auto res = isl_set_complement(copy());
13695   if (!res)
13696     exception::throw_last_error(saved_ctx);
13697   return manage(res);
13698 }
13699 
detect_equalities()13700 isl::set set::detect_equalities() 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_set_detect_equalities(copy());
13707   if (!res)
13708     exception::throw_last_error(saved_ctx);
13709   return manage(res);
13710 }
13711 
empty(isl::space space)13712 isl::set set::empty(isl::space space)
13713 {
13714   if (space.is_null())
13715     exception::throw_invalid("NULL input", __FILE__, __LINE__);
13716   auto saved_ctx = space.ctx();
13717   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13718   auto res = isl_set_empty(space.release());
13719   if (!res)
13720     exception::throw_last_error(saved_ctx);
13721   return manage(res);
13722 }
13723 
flatten()13724 isl::set set::flatten() const
13725 {
13726   if (!ptr)
13727     exception::throw_invalid("NULL input", __FILE__, __LINE__);
13728   auto saved_ctx = ctx();
13729   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13730   auto res = isl_set_flatten(copy());
13731   if (!res)
13732     exception::throw_last_error(saved_ctx);
13733   return manage(res);
13734 }
13735 
foreach_basic_set(const std::function<void (isl::basic_set)> & fn)13736 void set::foreach_basic_set(const std::function<void(isl::basic_set)> &fn) const
13737 {
13738   if (!ptr)
13739     exception::throw_invalid("NULL input", __FILE__, __LINE__);
13740   auto saved_ctx = ctx();
13741   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13742   struct fn_data {
13743     std::function<void(isl::basic_set)> func;
13744     std::exception_ptr eptr;
13745   } fn_data = { fn };
13746   auto fn_lambda = [](isl_basic_set *arg_0, void *arg_1) -> isl_stat {
13747     auto *data = static_cast<struct fn_data *>(arg_1);
13748     ISL_CPP_TRY {
13749       (data->func)(manage(arg_0));
13750       return isl_stat_ok;
13751     } ISL_CPP_CATCH_ALL {
13752       data->eptr = std::current_exception();
13753       return isl_stat_error;
13754     }
13755   };
13756   auto res = isl_set_foreach_basic_set(get(), fn_lambda, &fn_data);
13757   if (fn_data.eptr)
13758     std::rethrow_exception(fn_data.eptr);
13759   if (res < 0)
13760     exception::throw_last_error(saved_ctx);
13761   return;
13762 }
13763 
foreach_point(const std::function<void (isl::point)> & fn)13764 void set::foreach_point(const std::function<void(isl::point)> &fn) const
13765 {
13766   if (!ptr)
13767     exception::throw_invalid("NULL input", __FILE__, __LINE__);
13768   auto saved_ctx = ctx();
13769   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13770   struct fn_data {
13771     std::function<void(isl::point)> func;
13772     std::exception_ptr eptr;
13773   } fn_data = { fn };
13774   auto fn_lambda = [](isl_point *arg_0, void *arg_1) -> isl_stat {
13775     auto *data = static_cast<struct fn_data *>(arg_1);
13776     ISL_CPP_TRY {
13777       (data->func)(manage(arg_0));
13778       return isl_stat_ok;
13779     } ISL_CPP_CATCH_ALL {
13780       data->eptr = std::current_exception();
13781       return isl_stat_error;
13782     }
13783   };
13784   auto res = isl_set_foreach_point(get(), fn_lambda, &fn_data);
13785   if (fn_data.eptr)
13786     std::rethrow_exception(fn_data.eptr);
13787   if (res < 0)
13788     exception::throw_last_error(saved_ctx);
13789   return;
13790 }
13791 
plain_multi_val_if_fixed()13792 isl::multi_val set::plain_multi_val_if_fixed() const
13793 {
13794   if (!ptr)
13795     exception::throw_invalid("NULL input", __FILE__, __LINE__);
13796   auto saved_ctx = ctx();
13797   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13798   auto res = isl_set_get_plain_multi_val_if_fixed(get());
13799   if (!res)
13800     exception::throw_last_error(saved_ctx);
13801   return manage(res);
13802 }
13803 
get_plain_multi_val_if_fixed()13804 isl::multi_val set::get_plain_multi_val_if_fixed() const
13805 {
13806   return plain_multi_val_if_fixed();
13807 }
13808 
simple_fixed_box_hull()13809 isl::fixed_box set::simple_fixed_box_hull() const
13810 {
13811   if (!ptr)
13812     exception::throw_invalid("NULL input", __FILE__, __LINE__);
13813   auto saved_ctx = ctx();
13814   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13815   auto res = isl_set_get_simple_fixed_box_hull(get());
13816   if (!res)
13817     exception::throw_last_error(saved_ctx);
13818   return manage(res);
13819 }
13820 
get_simple_fixed_box_hull()13821 isl::fixed_box set::get_simple_fixed_box_hull() const
13822 {
13823   return simple_fixed_box_hull();
13824 }
13825 
space()13826 isl::space set::space() const
13827 {
13828   if (!ptr)
13829     exception::throw_invalid("NULL input", __FILE__, __LINE__);
13830   auto saved_ctx = ctx();
13831   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13832   auto res = isl_set_get_space(get());
13833   if (!res)
13834     exception::throw_last_error(saved_ctx);
13835   return manage(res);
13836 }
13837 
get_space()13838 isl::space set::get_space() const
13839 {
13840   return space();
13841 }
13842 
stride(int pos)13843 isl::val set::stride(int pos) const
13844 {
13845   if (!ptr)
13846     exception::throw_invalid("NULL input", __FILE__, __LINE__);
13847   auto saved_ctx = ctx();
13848   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13849   auto res = isl_set_get_stride(get(), pos);
13850   if (!res)
13851     exception::throw_last_error(saved_ctx);
13852   return manage(res);
13853 }
13854 
get_stride(int pos)13855 isl::val set::get_stride(int pos) const
13856 {
13857   return stride(pos);
13858 }
13859 
gist(isl::set context)13860 isl::set set::gist(isl::set context) const
13861 {
13862   if (!ptr || context.is_null())
13863     exception::throw_invalid("NULL input", __FILE__, __LINE__);
13864   auto saved_ctx = ctx();
13865   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13866   auto res = isl_set_gist(copy(), context.release());
13867   if (!res)
13868     exception::throw_last_error(saved_ctx);
13869   return manage(res);
13870 }
13871 
identity()13872 isl::map set::identity() const
13873 {
13874   if (!ptr)
13875     exception::throw_invalid("NULL input", __FILE__, __LINE__);
13876   auto saved_ctx = ctx();
13877   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13878   auto res = isl_set_identity(copy());
13879   if (!res)
13880     exception::throw_last_error(saved_ctx);
13881   return manage(res);
13882 }
13883 
indicator_function()13884 isl::pw_aff set::indicator_function() const
13885 {
13886   if (!ptr)
13887     exception::throw_invalid("NULL input", __FILE__, __LINE__);
13888   auto saved_ctx = ctx();
13889   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13890   auto res = isl_set_indicator_function(copy());
13891   if (!res)
13892     exception::throw_last_error(saved_ctx);
13893   return manage(res);
13894 }
13895 
intersect(isl::set set2)13896 isl::set set::intersect(isl::set set2) const
13897 {
13898   if (!ptr || set2.is_null())
13899     exception::throw_invalid("NULL input", __FILE__, __LINE__);
13900   auto saved_ctx = ctx();
13901   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13902   auto res = isl_set_intersect(copy(), set2.release());
13903   if (!res)
13904     exception::throw_last_error(saved_ctx);
13905   return manage(res);
13906 }
13907 
intersect_params(isl::set params)13908 isl::set set::intersect_params(isl::set params) const
13909 {
13910   if (!ptr || params.is_null())
13911     exception::throw_invalid("NULL input", __FILE__, __LINE__);
13912   auto saved_ctx = ctx();
13913   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13914   auto res = isl_set_intersect_params(copy(), params.release());
13915   if (!res)
13916     exception::throw_last_error(saved_ctx);
13917   return manage(res);
13918 }
13919 
is_disjoint(const isl::set & set2)13920 bool set::is_disjoint(const isl::set &set2) const
13921 {
13922   if (!ptr || set2.is_null())
13923     exception::throw_invalid("NULL input", __FILE__, __LINE__);
13924   auto saved_ctx = ctx();
13925   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13926   auto res = isl_set_is_disjoint(get(), set2.get());
13927   if (res < 0)
13928     exception::throw_last_error(saved_ctx);
13929   return res;
13930 }
13931 
is_empty()13932 bool set::is_empty() const
13933 {
13934   if (!ptr)
13935     exception::throw_invalid("NULL input", __FILE__, __LINE__);
13936   auto saved_ctx = ctx();
13937   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13938   auto res = isl_set_is_empty(get());
13939   if (res < 0)
13940     exception::throw_last_error(saved_ctx);
13941   return res;
13942 }
13943 
is_equal(const isl::set & set2)13944 bool set::is_equal(const isl::set &set2) const
13945 {
13946   if (!ptr || set2.is_null())
13947     exception::throw_invalid("NULL input", __FILE__, __LINE__);
13948   auto saved_ctx = ctx();
13949   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13950   auto res = isl_set_is_equal(get(), set2.get());
13951   if (res < 0)
13952     exception::throw_last_error(saved_ctx);
13953   return res;
13954 }
13955 
is_singleton()13956 bool set::is_singleton() const
13957 {
13958   if (!ptr)
13959     exception::throw_invalid("NULL input", __FILE__, __LINE__);
13960   auto saved_ctx = ctx();
13961   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13962   auto res = isl_set_is_singleton(get());
13963   if (res < 0)
13964     exception::throw_last_error(saved_ctx);
13965   return res;
13966 }
13967 
is_strict_subset(const isl::set & set2)13968 bool set::is_strict_subset(const isl::set &set2) const
13969 {
13970   if (!ptr || set2.is_null())
13971     exception::throw_invalid("NULL input", __FILE__, __LINE__);
13972   auto saved_ctx = ctx();
13973   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13974   auto res = isl_set_is_strict_subset(get(), set2.get());
13975   if (res < 0)
13976     exception::throw_last_error(saved_ctx);
13977   return res;
13978 }
13979 
is_subset(const isl::set & set2)13980 bool set::is_subset(const isl::set &set2) const
13981 {
13982   if (!ptr || set2.is_null())
13983     exception::throw_invalid("NULL input", __FILE__, __LINE__);
13984   auto saved_ctx = ctx();
13985   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13986   auto res = isl_set_is_subset(get(), set2.get());
13987   if (res < 0)
13988     exception::throw_last_error(saved_ctx);
13989   return res;
13990 }
13991 
is_wrapping()13992 bool set::is_wrapping() const
13993 {
13994   if (!ptr)
13995     exception::throw_invalid("NULL input", __FILE__, __LINE__);
13996   auto saved_ctx = ctx();
13997   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
13998   auto res = isl_set_is_wrapping(get());
13999   if (res < 0)
14000     exception::throw_last_error(saved_ctx);
14001   return res;
14002 }
14003 
lexmax()14004 isl::set set::lexmax() const
14005 {
14006   if (!ptr)
14007     exception::throw_invalid("NULL input", __FILE__, __LINE__);
14008   auto saved_ctx = ctx();
14009   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14010   auto res = isl_set_lexmax(copy());
14011   if (!res)
14012     exception::throw_last_error(saved_ctx);
14013   return manage(res);
14014 }
14015 
lexmax_pw_multi_aff()14016 isl::pw_multi_aff set::lexmax_pw_multi_aff() const
14017 {
14018   if (!ptr)
14019     exception::throw_invalid("NULL input", __FILE__, __LINE__);
14020   auto saved_ctx = ctx();
14021   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14022   auto res = isl_set_lexmax_pw_multi_aff(copy());
14023   if (!res)
14024     exception::throw_last_error(saved_ctx);
14025   return manage(res);
14026 }
14027 
lexmin()14028 isl::set set::lexmin() const
14029 {
14030   if (!ptr)
14031     exception::throw_invalid("NULL input", __FILE__, __LINE__);
14032   auto saved_ctx = ctx();
14033   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14034   auto res = isl_set_lexmin(copy());
14035   if (!res)
14036     exception::throw_last_error(saved_ctx);
14037   return manage(res);
14038 }
14039 
lexmin_pw_multi_aff()14040 isl::pw_multi_aff set::lexmin_pw_multi_aff() const
14041 {
14042   if (!ptr)
14043     exception::throw_invalid("NULL input", __FILE__, __LINE__);
14044   auto saved_ctx = ctx();
14045   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14046   auto res = isl_set_lexmin_pw_multi_aff(copy());
14047   if (!res)
14048     exception::throw_last_error(saved_ctx);
14049   return manage(res);
14050 }
14051 
lower_bound(isl::multi_pw_aff lower)14052 isl::set set::lower_bound(isl::multi_pw_aff lower) const
14053 {
14054   if (!ptr || lower.is_null())
14055     exception::throw_invalid("NULL input", __FILE__, __LINE__);
14056   auto saved_ctx = ctx();
14057   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14058   auto res = isl_set_lower_bound_multi_pw_aff(copy(), lower.release());
14059   if (!res)
14060     exception::throw_last_error(saved_ctx);
14061   return manage(res);
14062 }
14063 
lower_bound(isl::multi_val lower)14064 isl::set set::lower_bound(isl::multi_val lower) const
14065 {
14066   if (!ptr || lower.is_null())
14067     exception::throw_invalid("NULL input", __FILE__, __LINE__);
14068   auto saved_ctx = ctx();
14069   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14070   auto res = isl_set_lower_bound_multi_val(copy(), lower.release());
14071   if (!res)
14072     exception::throw_last_error(saved_ctx);
14073   return manage(res);
14074 }
14075 
max_val(const isl::aff & obj)14076 isl::val set::max_val(const isl::aff &obj) const
14077 {
14078   if (!ptr || obj.is_null())
14079     exception::throw_invalid("NULL input", __FILE__, __LINE__);
14080   auto saved_ctx = ctx();
14081   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14082   auto res = isl_set_max_val(get(), obj.get());
14083   if (!res)
14084     exception::throw_last_error(saved_ctx);
14085   return manage(res);
14086 }
14087 
min_val(const isl::aff & obj)14088 isl::val set::min_val(const isl::aff &obj) const
14089 {
14090   if (!ptr || obj.is_null())
14091     exception::throw_invalid("NULL input", __FILE__, __LINE__);
14092   auto saved_ctx = ctx();
14093   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14094   auto res = isl_set_min_val(get(), obj.get());
14095   if (!res)
14096     exception::throw_last_error(saved_ctx);
14097   return manage(res);
14098 }
14099 
params()14100 isl::set set::params() const
14101 {
14102   if (!ptr)
14103     exception::throw_invalid("NULL input", __FILE__, __LINE__);
14104   auto saved_ctx = ctx();
14105   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14106   auto res = isl_set_params(copy());
14107   if (!res)
14108     exception::throw_last_error(saved_ctx);
14109   return manage(res);
14110 }
14111 
polyhedral_hull()14112 isl::basic_set set::polyhedral_hull() const
14113 {
14114   if (!ptr)
14115     exception::throw_invalid("NULL input", __FILE__, __LINE__);
14116   auto saved_ctx = ctx();
14117   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14118   auto res = isl_set_polyhedral_hull(copy());
14119   if (!res)
14120     exception::throw_last_error(saved_ctx);
14121   return manage(res);
14122 }
14123 
preimage(isl::multi_aff ma)14124 isl::set set::preimage(isl::multi_aff ma) const
14125 {
14126   if (!ptr || ma.is_null())
14127     exception::throw_invalid("NULL input", __FILE__, __LINE__);
14128   auto saved_ctx = ctx();
14129   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14130   auto res = isl_set_preimage_multi_aff(copy(), ma.release());
14131   if (!res)
14132     exception::throw_last_error(saved_ctx);
14133   return manage(res);
14134 }
14135 
preimage(isl::multi_pw_aff mpa)14136 isl::set set::preimage(isl::multi_pw_aff mpa) const
14137 {
14138   if (!ptr || mpa.is_null())
14139     exception::throw_invalid("NULL input", __FILE__, __LINE__);
14140   auto saved_ctx = ctx();
14141   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14142   auto res = isl_set_preimage_multi_pw_aff(copy(), mpa.release());
14143   if (!res)
14144     exception::throw_last_error(saved_ctx);
14145   return manage(res);
14146 }
14147 
preimage(isl::pw_multi_aff pma)14148 isl::set set::preimage(isl::pw_multi_aff pma) const
14149 {
14150   if (!ptr || pma.is_null())
14151     exception::throw_invalid("NULL input", __FILE__, __LINE__);
14152   auto saved_ctx = ctx();
14153   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14154   auto res = isl_set_preimage_pw_multi_aff(copy(), pma.release());
14155   if (!res)
14156     exception::throw_last_error(saved_ctx);
14157   return manage(res);
14158 }
14159 
product(isl::set set2)14160 isl::set set::product(isl::set set2) const
14161 {
14162   if (!ptr || set2.is_null())
14163     exception::throw_invalid("NULL input", __FILE__, __LINE__);
14164   auto saved_ctx = ctx();
14165   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14166   auto res = isl_set_product(copy(), set2.release());
14167   if (!res)
14168     exception::throw_last_error(saved_ctx);
14169   return manage(res);
14170 }
14171 
project_out_all_params()14172 isl::set set::project_out_all_params() const
14173 {
14174   if (!ptr)
14175     exception::throw_invalid("NULL input", __FILE__, __LINE__);
14176   auto saved_ctx = ctx();
14177   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14178   auto res = isl_set_project_out_all_params(copy());
14179   if (!res)
14180     exception::throw_last_error(saved_ctx);
14181   return manage(res);
14182 }
14183 
project_out_param(isl::id id)14184 isl::set set::project_out_param(isl::id id) const
14185 {
14186   if (!ptr || id.is_null())
14187     exception::throw_invalid("NULL input", __FILE__, __LINE__);
14188   auto saved_ctx = ctx();
14189   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14190   auto res = isl_set_project_out_param_id(copy(), id.release());
14191   if (!res)
14192     exception::throw_last_error(saved_ctx);
14193   return manage(res);
14194 }
14195 
project_out_param(const std::string & id)14196 isl::set set::project_out_param(const std::string &id) const
14197 {
14198   if (!ptr)
14199     exception::throw_invalid("NULL input", __FILE__, __LINE__);
14200   return this->project_out_param(isl::id(ctx(), id));
14201 }
14202 
project_out_param(isl::id_list list)14203 isl::set set::project_out_param(isl::id_list list) const
14204 {
14205   if (!ptr || list.is_null())
14206     exception::throw_invalid("NULL input", __FILE__, __LINE__);
14207   auto saved_ctx = ctx();
14208   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14209   auto res = isl_set_project_out_param_id_list(copy(), list.release());
14210   if (!res)
14211     exception::throw_last_error(saved_ctx);
14212   return manage(res);
14213 }
14214 
sample()14215 isl::basic_set set::sample() const
14216 {
14217   if (!ptr)
14218     exception::throw_invalid("NULL input", __FILE__, __LINE__);
14219   auto saved_ctx = ctx();
14220   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14221   auto res = isl_set_sample(copy());
14222   if (!res)
14223     exception::throw_last_error(saved_ctx);
14224   return manage(res);
14225 }
14226 
sample_point()14227 isl::point set::sample_point() const
14228 {
14229   if (!ptr)
14230     exception::throw_invalid("NULL input", __FILE__, __LINE__);
14231   auto saved_ctx = ctx();
14232   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14233   auto res = isl_set_sample_point(copy());
14234   if (!res)
14235     exception::throw_last_error(saved_ctx);
14236   return manage(res);
14237 }
14238 
subtract(isl::set set2)14239 isl::set set::subtract(isl::set set2) const
14240 {
14241   if (!ptr || set2.is_null())
14242     exception::throw_invalid("NULL input", __FILE__, __LINE__);
14243   auto saved_ctx = ctx();
14244   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14245   auto res = isl_set_subtract(copy(), set2.release());
14246   if (!res)
14247     exception::throw_last_error(saved_ctx);
14248   return manage(res);
14249 }
14250 
unbind_params(isl::multi_id tuple)14251 isl::set set::unbind_params(isl::multi_id tuple) const
14252 {
14253   if (!ptr || tuple.is_null())
14254     exception::throw_invalid("NULL input", __FILE__, __LINE__);
14255   auto saved_ctx = ctx();
14256   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14257   auto res = isl_set_unbind_params(copy(), tuple.release());
14258   if (!res)
14259     exception::throw_last_error(saved_ctx);
14260   return manage(res);
14261 }
14262 
unbind_params_insert_domain(isl::multi_id domain)14263 isl::map set::unbind_params_insert_domain(isl::multi_id domain) const
14264 {
14265   if (!ptr || domain.is_null())
14266     exception::throw_invalid("NULL input", __FILE__, __LINE__);
14267   auto saved_ctx = ctx();
14268   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14269   auto res = isl_set_unbind_params_insert_domain(copy(), domain.release());
14270   if (!res)
14271     exception::throw_last_error(saved_ctx);
14272   return manage(res);
14273 }
14274 
unite(isl::set set2)14275 isl::set set::unite(isl::set set2) const
14276 {
14277   if (!ptr || set2.is_null())
14278     exception::throw_invalid("NULL input", __FILE__, __LINE__);
14279   auto saved_ctx = ctx();
14280   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14281   auto res = isl_set_union(copy(), set2.release());
14282   if (!res)
14283     exception::throw_last_error(saved_ctx);
14284   return manage(res);
14285 }
14286 
universe(isl::space space)14287 isl::set set::universe(isl::space space)
14288 {
14289   if (space.is_null())
14290     exception::throw_invalid("NULL input", __FILE__, __LINE__);
14291   auto saved_ctx = space.ctx();
14292   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14293   auto res = isl_set_universe(space.release());
14294   if (!res)
14295     exception::throw_last_error(saved_ctx);
14296   return manage(res);
14297 }
14298 
unshifted_simple_hull()14299 isl::basic_set set::unshifted_simple_hull() const
14300 {
14301   if (!ptr)
14302     exception::throw_invalid("NULL input", __FILE__, __LINE__);
14303   auto saved_ctx = ctx();
14304   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14305   auto res = isl_set_unshifted_simple_hull(copy());
14306   if (!res)
14307     exception::throw_last_error(saved_ctx);
14308   return manage(res);
14309 }
14310 
unwrap()14311 isl::map set::unwrap() const
14312 {
14313   if (!ptr)
14314     exception::throw_invalid("NULL input", __FILE__, __LINE__);
14315   auto saved_ctx = ctx();
14316   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14317   auto res = isl_set_unwrap(copy());
14318   if (!res)
14319     exception::throw_last_error(saved_ctx);
14320   return manage(res);
14321 }
14322 
upper_bound(isl::multi_pw_aff upper)14323 isl::set set::upper_bound(isl::multi_pw_aff upper) const
14324 {
14325   if (!ptr || upper.is_null())
14326     exception::throw_invalid("NULL input", __FILE__, __LINE__);
14327   auto saved_ctx = ctx();
14328   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14329   auto res = isl_set_upper_bound_multi_pw_aff(copy(), upper.release());
14330   if (!res)
14331     exception::throw_last_error(saved_ctx);
14332   return manage(res);
14333 }
14334 
upper_bound(isl::multi_val upper)14335 isl::set set::upper_bound(isl::multi_val upper) const
14336 {
14337   if (!ptr || upper.is_null())
14338     exception::throw_invalid("NULL input", __FILE__, __LINE__);
14339   auto saved_ctx = ctx();
14340   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14341   auto res = isl_set_upper_bound_multi_val(copy(), upper.release());
14342   if (!res)
14343     exception::throw_last_error(saved_ctx);
14344   return manage(res);
14345 }
14346 
14347 inline std::ostream &operator<<(std::ostream &os, const set &obj)
14348 {
14349   if (!obj.get())
14350     exception::throw_invalid("NULL input", __FILE__, __LINE__);
14351   auto saved_ctx = isl_set_get_ctx(obj.get());
14352   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14353   char *str = isl_set_to_str(obj.get());
14354   if (!str)
14355     exception::throw_last_error(saved_ctx);
14356   os << str;
14357   free(str);
14358   return os;
14359 }
14360 
14361 // implementations for isl::space
manage(__isl_take isl_space * ptr)14362 space manage(__isl_take isl_space *ptr) {
14363   if (!ptr)
14364     exception::throw_invalid("NULL input", __FILE__, __LINE__);
14365   return space(ptr);
14366 }
manage_copy(__isl_keep isl_space * ptr)14367 space manage_copy(__isl_keep isl_space *ptr) {
14368   if (!ptr)
14369     exception::throw_invalid("NULL input", __FILE__, __LINE__);
14370   auto saved_ctx = isl_space_get_ctx(ptr);
14371   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14372   ptr = isl_space_copy(ptr);
14373   if (!ptr)
14374     exception::throw_last_error(saved_ctx);
14375   return space(ptr);
14376 }
14377 
space()14378 space::space()
14379     : ptr(nullptr) {}
14380 
space(const space & obj)14381 space::space(const space &obj)
14382     : ptr(nullptr)
14383 {
14384   if (!obj.ptr)
14385     exception::throw_invalid("NULL input", __FILE__, __LINE__);
14386   auto saved_ctx = isl_space_get_ctx(obj.ptr);
14387   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14388   ptr = obj.copy();
14389   if (!ptr)
14390     exception::throw_last_error(saved_ctx);
14391 }
14392 
space(__isl_take isl_space * ptr)14393 space::space(__isl_take isl_space *ptr)
14394     : ptr(ptr) {}
14395 
14396 space &space::operator=(space obj) {
14397   std::swap(this->ptr, obj.ptr);
14398   return *this;
14399 }
14400 
~space()14401 space::~space() {
14402   if (ptr)
14403     isl_space_free(ptr);
14404 }
14405 
copy()14406 __isl_give isl_space *space::copy() const & {
14407   return isl_space_copy(ptr);
14408 }
14409 
get()14410 __isl_keep isl_space *space::get() const {
14411   return ptr;
14412 }
14413 
release()14414 __isl_give isl_space *space::release() {
14415   isl_space *tmp = ptr;
14416   ptr = nullptr;
14417   return tmp;
14418 }
14419 
is_null()14420 bool space::is_null() const {
14421   return ptr == nullptr;
14422 }
14423 
ctx()14424 isl::ctx space::ctx() const {
14425   return isl::ctx(isl_space_get_ctx(ptr));
14426 }
14427 
add_named_tuple(isl::id tuple_id,unsigned int dim)14428 isl::space space::add_named_tuple(isl::id tuple_id, unsigned int dim) const
14429 {
14430   if (!ptr || tuple_id.is_null())
14431     exception::throw_invalid("NULL input", __FILE__, __LINE__);
14432   auto saved_ctx = ctx();
14433   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14434   auto res = isl_space_add_named_tuple_id_ui(copy(), tuple_id.release(), dim);
14435   if (!res)
14436     exception::throw_last_error(saved_ctx);
14437   return manage(res);
14438 }
14439 
add_named_tuple(const std::string & tuple_id,unsigned int dim)14440 isl::space space::add_named_tuple(const std::string &tuple_id, unsigned int dim) const
14441 {
14442   if (!ptr)
14443     exception::throw_invalid("NULL input", __FILE__, __LINE__);
14444   return this->add_named_tuple(isl::id(ctx(), tuple_id), dim);
14445 }
14446 
add_unnamed_tuple(unsigned int dim)14447 isl::space space::add_unnamed_tuple(unsigned int dim) const
14448 {
14449   if (!ptr)
14450     exception::throw_invalid("NULL input", __FILE__, __LINE__);
14451   auto saved_ctx = ctx();
14452   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14453   auto res = isl_space_add_unnamed_tuple_ui(copy(), dim);
14454   if (!res)
14455     exception::throw_last_error(saved_ctx);
14456   return manage(res);
14457 }
14458 
domain()14459 isl::space space::domain() 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_space_domain(copy());
14466   if (!res)
14467     exception::throw_last_error(saved_ctx);
14468   return manage(res);
14469 }
14470 
flatten_domain()14471 isl::space space::flatten_domain() const
14472 {
14473   if (!ptr)
14474     exception::throw_invalid("NULL input", __FILE__, __LINE__);
14475   auto saved_ctx = ctx();
14476   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14477   auto res = isl_space_flatten_domain(copy());
14478   if (!res)
14479     exception::throw_last_error(saved_ctx);
14480   return manage(res);
14481 }
14482 
flatten_range()14483 isl::space space::flatten_range() const
14484 {
14485   if (!ptr)
14486     exception::throw_invalid("NULL input", __FILE__, __LINE__);
14487   auto saved_ctx = ctx();
14488   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14489   auto res = isl_space_flatten_range(copy());
14490   if (!res)
14491     exception::throw_last_error(saved_ctx);
14492   return manage(res);
14493 }
14494 
is_equal(const isl::space & space2)14495 bool space::is_equal(const isl::space &space2) const
14496 {
14497   if (!ptr || space2.is_null())
14498     exception::throw_invalid("NULL input", __FILE__, __LINE__);
14499   auto saved_ctx = ctx();
14500   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14501   auto res = isl_space_is_equal(get(), space2.get());
14502   if (res < 0)
14503     exception::throw_last_error(saved_ctx);
14504   return res;
14505 }
14506 
is_wrapping()14507 bool space::is_wrapping() const
14508 {
14509   if (!ptr)
14510     exception::throw_invalid("NULL input", __FILE__, __LINE__);
14511   auto saved_ctx = ctx();
14512   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14513   auto res = isl_space_is_wrapping(get());
14514   if (res < 0)
14515     exception::throw_last_error(saved_ctx);
14516   return res;
14517 }
14518 
map_from_set()14519 isl::space space::map_from_set() const
14520 {
14521   if (!ptr)
14522     exception::throw_invalid("NULL input", __FILE__, __LINE__);
14523   auto saved_ctx = ctx();
14524   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14525   auto res = isl_space_map_from_set(copy());
14526   if (!res)
14527     exception::throw_last_error(saved_ctx);
14528   return manage(res);
14529 }
14530 
params()14531 isl::space space::params() const
14532 {
14533   if (!ptr)
14534     exception::throw_invalid("NULL input", __FILE__, __LINE__);
14535   auto saved_ctx = ctx();
14536   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14537   auto res = isl_space_params(copy());
14538   if (!res)
14539     exception::throw_last_error(saved_ctx);
14540   return manage(res);
14541 }
14542 
range()14543 isl::space space::range() const
14544 {
14545   if (!ptr)
14546     exception::throw_invalid("NULL input", __FILE__, __LINE__);
14547   auto saved_ctx = ctx();
14548   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14549   auto res = isl_space_range(copy());
14550   if (!res)
14551     exception::throw_last_error(saved_ctx);
14552   return manage(res);
14553 }
14554 
unit(isl::ctx ctx)14555 isl::space space::unit(isl::ctx ctx)
14556 {
14557   auto saved_ctx = ctx;
14558   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14559   auto res = isl_space_unit(ctx.release());
14560   if (!res)
14561     exception::throw_last_error(saved_ctx);
14562   return manage(res);
14563 }
14564 
unwrap()14565 isl::space space::unwrap() 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_space_unwrap(copy());
14572   if (!res)
14573     exception::throw_last_error(saved_ctx);
14574   return manage(res);
14575 }
14576 
wrap()14577 isl::space space::wrap() const
14578 {
14579   if (!ptr)
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_space_wrap(copy());
14584   if (!res)
14585     exception::throw_last_error(saved_ctx);
14586   return manage(res);
14587 }
14588 
14589 inline std::ostream &operator<<(std::ostream &os, const space &obj)
14590 {
14591   if (!obj.get())
14592     exception::throw_invalid("NULL input", __FILE__, __LINE__);
14593   auto saved_ctx = isl_space_get_ctx(obj.get());
14594   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14595   char *str = isl_space_to_str(obj.get());
14596   if (!str)
14597     exception::throw_last_error(saved_ctx);
14598   os << str;
14599   free(str);
14600   return os;
14601 }
14602 
14603 // implementations for isl::union_access_info
manage(__isl_take isl_union_access_info * ptr)14604 union_access_info manage(__isl_take isl_union_access_info *ptr) {
14605   if (!ptr)
14606     exception::throw_invalid("NULL input", __FILE__, __LINE__);
14607   return union_access_info(ptr);
14608 }
manage_copy(__isl_keep isl_union_access_info * ptr)14609 union_access_info manage_copy(__isl_keep isl_union_access_info *ptr) {
14610   if (!ptr)
14611     exception::throw_invalid("NULL input", __FILE__, __LINE__);
14612   auto saved_ctx = isl_union_access_info_get_ctx(ptr);
14613   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14614   ptr = isl_union_access_info_copy(ptr);
14615   if (!ptr)
14616     exception::throw_last_error(saved_ctx);
14617   return union_access_info(ptr);
14618 }
14619 
union_access_info()14620 union_access_info::union_access_info()
14621     : ptr(nullptr) {}
14622 
union_access_info(const union_access_info & obj)14623 union_access_info::union_access_info(const union_access_info &obj)
14624     : ptr(nullptr)
14625 {
14626   if (!obj.ptr)
14627     exception::throw_invalid("NULL input", __FILE__, __LINE__);
14628   auto saved_ctx = isl_union_access_info_get_ctx(obj.ptr);
14629   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14630   ptr = obj.copy();
14631   if (!ptr)
14632     exception::throw_last_error(saved_ctx);
14633 }
14634 
union_access_info(__isl_take isl_union_access_info * ptr)14635 union_access_info::union_access_info(__isl_take isl_union_access_info *ptr)
14636     : ptr(ptr) {}
14637 
union_access_info(isl::union_map sink)14638 union_access_info::union_access_info(isl::union_map sink)
14639 {
14640   if (sink.is_null())
14641     exception::throw_invalid("NULL input", __FILE__, __LINE__);
14642   auto saved_ctx = sink.ctx();
14643   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14644   auto res = isl_union_access_info_from_sink(sink.release());
14645   if (!res)
14646     exception::throw_last_error(saved_ctx);
14647   ptr = res;
14648 }
14649 
14650 union_access_info &union_access_info::operator=(union_access_info obj) {
14651   std::swap(this->ptr, obj.ptr);
14652   return *this;
14653 }
14654 
~union_access_info()14655 union_access_info::~union_access_info() {
14656   if (ptr)
14657     isl_union_access_info_free(ptr);
14658 }
14659 
copy()14660 __isl_give isl_union_access_info *union_access_info::copy() const & {
14661   return isl_union_access_info_copy(ptr);
14662 }
14663 
get()14664 __isl_keep isl_union_access_info *union_access_info::get() const {
14665   return ptr;
14666 }
14667 
release()14668 __isl_give isl_union_access_info *union_access_info::release() {
14669   isl_union_access_info *tmp = ptr;
14670   ptr = nullptr;
14671   return tmp;
14672 }
14673 
is_null()14674 bool union_access_info::is_null() const {
14675   return ptr == nullptr;
14676 }
14677 
ctx()14678 isl::ctx union_access_info::ctx() const {
14679   return isl::ctx(isl_union_access_info_get_ctx(ptr));
14680 }
14681 
compute_flow()14682 isl::union_flow union_access_info::compute_flow() const
14683 {
14684   if (!ptr)
14685     exception::throw_invalid("NULL input", __FILE__, __LINE__);
14686   auto saved_ctx = ctx();
14687   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14688   auto res = isl_union_access_info_compute_flow(copy());
14689   if (!res)
14690     exception::throw_last_error(saved_ctx);
14691   return manage(res);
14692 }
14693 
set_kill(isl::union_map kill)14694 isl::union_access_info union_access_info::set_kill(isl::union_map kill) const
14695 {
14696   if (!ptr || kill.is_null())
14697     exception::throw_invalid("NULL input", __FILE__, __LINE__);
14698   auto saved_ctx = ctx();
14699   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14700   auto res = isl_union_access_info_set_kill(copy(), kill.release());
14701   if (!res)
14702     exception::throw_last_error(saved_ctx);
14703   return manage(res);
14704 }
14705 
set_may_source(isl::union_map may_source)14706 isl::union_access_info union_access_info::set_may_source(isl::union_map may_source) const
14707 {
14708   if (!ptr || may_source.is_null())
14709     exception::throw_invalid("NULL input", __FILE__, __LINE__);
14710   auto saved_ctx = ctx();
14711   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14712   auto res = isl_union_access_info_set_may_source(copy(), may_source.release());
14713   if (!res)
14714     exception::throw_last_error(saved_ctx);
14715   return manage(res);
14716 }
14717 
set_must_source(isl::union_map must_source)14718 isl::union_access_info union_access_info::set_must_source(isl::union_map must_source) const
14719 {
14720   if (!ptr || must_source.is_null())
14721     exception::throw_invalid("NULL input", __FILE__, __LINE__);
14722   auto saved_ctx = ctx();
14723   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14724   auto res = isl_union_access_info_set_must_source(copy(), must_source.release());
14725   if (!res)
14726     exception::throw_last_error(saved_ctx);
14727   return manage(res);
14728 }
14729 
set_schedule(isl::schedule schedule)14730 isl::union_access_info union_access_info::set_schedule(isl::schedule schedule) const
14731 {
14732   if (!ptr || schedule.is_null())
14733     exception::throw_invalid("NULL input", __FILE__, __LINE__);
14734   auto saved_ctx = ctx();
14735   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14736   auto res = isl_union_access_info_set_schedule(copy(), schedule.release());
14737   if (!res)
14738     exception::throw_last_error(saved_ctx);
14739   return manage(res);
14740 }
14741 
set_schedule_map(isl::union_map schedule_map)14742 isl::union_access_info union_access_info::set_schedule_map(isl::union_map schedule_map) const
14743 {
14744   if (!ptr || schedule_map.is_null())
14745     exception::throw_invalid("NULL input", __FILE__, __LINE__);
14746   auto saved_ctx = ctx();
14747   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14748   auto res = isl_union_access_info_set_schedule_map(copy(), schedule_map.release());
14749   if (!res)
14750     exception::throw_last_error(saved_ctx);
14751   return manage(res);
14752 }
14753 
14754 inline std::ostream &operator<<(std::ostream &os, const union_access_info &obj)
14755 {
14756   if (!obj.get())
14757     exception::throw_invalid("NULL input", __FILE__, __LINE__);
14758   auto saved_ctx = isl_union_access_info_get_ctx(obj.get());
14759   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14760   char *str = isl_union_access_info_to_str(obj.get());
14761   if (!str)
14762     exception::throw_last_error(saved_ctx);
14763   os << str;
14764   free(str);
14765   return os;
14766 }
14767 
14768 // implementations for isl::union_flow
manage(__isl_take isl_union_flow * ptr)14769 union_flow manage(__isl_take isl_union_flow *ptr) {
14770   if (!ptr)
14771     exception::throw_invalid("NULL input", __FILE__, __LINE__);
14772   return union_flow(ptr);
14773 }
manage_copy(__isl_keep isl_union_flow * ptr)14774 union_flow manage_copy(__isl_keep isl_union_flow *ptr) {
14775   if (!ptr)
14776     exception::throw_invalid("NULL input", __FILE__, __LINE__);
14777   auto saved_ctx = isl_union_flow_get_ctx(ptr);
14778   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14779   ptr = isl_union_flow_copy(ptr);
14780   if (!ptr)
14781     exception::throw_last_error(saved_ctx);
14782   return union_flow(ptr);
14783 }
14784 
union_flow()14785 union_flow::union_flow()
14786     : ptr(nullptr) {}
14787 
union_flow(const union_flow & obj)14788 union_flow::union_flow(const union_flow &obj)
14789     : ptr(nullptr)
14790 {
14791   if (!obj.ptr)
14792     exception::throw_invalid("NULL input", __FILE__, __LINE__);
14793   auto saved_ctx = isl_union_flow_get_ctx(obj.ptr);
14794   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14795   ptr = obj.copy();
14796   if (!ptr)
14797     exception::throw_last_error(saved_ctx);
14798 }
14799 
union_flow(__isl_take isl_union_flow * ptr)14800 union_flow::union_flow(__isl_take isl_union_flow *ptr)
14801     : ptr(ptr) {}
14802 
14803 union_flow &union_flow::operator=(union_flow obj) {
14804   std::swap(this->ptr, obj.ptr);
14805   return *this;
14806 }
14807 
~union_flow()14808 union_flow::~union_flow() {
14809   if (ptr)
14810     isl_union_flow_free(ptr);
14811 }
14812 
copy()14813 __isl_give isl_union_flow *union_flow::copy() const & {
14814   return isl_union_flow_copy(ptr);
14815 }
14816 
get()14817 __isl_keep isl_union_flow *union_flow::get() const {
14818   return ptr;
14819 }
14820 
release()14821 __isl_give isl_union_flow *union_flow::release() {
14822   isl_union_flow *tmp = ptr;
14823   ptr = nullptr;
14824   return tmp;
14825 }
14826 
is_null()14827 bool union_flow::is_null() const {
14828   return ptr == nullptr;
14829 }
14830 
ctx()14831 isl::ctx union_flow::ctx() const {
14832   return isl::ctx(isl_union_flow_get_ctx(ptr));
14833 }
14834 
full_may_dependence()14835 isl::union_map union_flow::full_may_dependence() const
14836 {
14837   if (!ptr)
14838     exception::throw_invalid("NULL input", __FILE__, __LINE__);
14839   auto saved_ctx = ctx();
14840   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14841   auto res = isl_union_flow_get_full_may_dependence(get());
14842   if (!res)
14843     exception::throw_last_error(saved_ctx);
14844   return manage(res);
14845 }
14846 
get_full_may_dependence()14847 isl::union_map union_flow::get_full_may_dependence() const
14848 {
14849   return full_may_dependence();
14850 }
14851 
full_must_dependence()14852 isl::union_map union_flow::full_must_dependence() const
14853 {
14854   if (!ptr)
14855     exception::throw_invalid("NULL input", __FILE__, __LINE__);
14856   auto saved_ctx = ctx();
14857   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14858   auto res = isl_union_flow_get_full_must_dependence(get());
14859   if (!res)
14860     exception::throw_last_error(saved_ctx);
14861   return manage(res);
14862 }
14863 
get_full_must_dependence()14864 isl::union_map union_flow::get_full_must_dependence() const
14865 {
14866   return full_must_dependence();
14867 }
14868 
may_dependence()14869 isl::union_map union_flow::may_dependence() const
14870 {
14871   if (!ptr)
14872     exception::throw_invalid("NULL input", __FILE__, __LINE__);
14873   auto saved_ctx = ctx();
14874   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14875   auto res = isl_union_flow_get_may_dependence(get());
14876   if (!res)
14877     exception::throw_last_error(saved_ctx);
14878   return manage(res);
14879 }
14880 
get_may_dependence()14881 isl::union_map union_flow::get_may_dependence() const
14882 {
14883   return may_dependence();
14884 }
14885 
may_no_source()14886 isl::union_map union_flow::may_no_source() const
14887 {
14888   if (!ptr)
14889     exception::throw_invalid("NULL input", __FILE__, __LINE__);
14890   auto saved_ctx = ctx();
14891   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14892   auto res = isl_union_flow_get_may_no_source(get());
14893   if (!res)
14894     exception::throw_last_error(saved_ctx);
14895   return manage(res);
14896 }
14897 
get_may_no_source()14898 isl::union_map union_flow::get_may_no_source() const
14899 {
14900   return may_no_source();
14901 }
14902 
must_dependence()14903 isl::union_map union_flow::must_dependence() const
14904 {
14905   if (!ptr)
14906     exception::throw_invalid("NULL input", __FILE__, __LINE__);
14907   auto saved_ctx = ctx();
14908   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14909   auto res = isl_union_flow_get_must_dependence(get());
14910   if (!res)
14911     exception::throw_last_error(saved_ctx);
14912   return manage(res);
14913 }
14914 
get_must_dependence()14915 isl::union_map union_flow::get_must_dependence() const
14916 {
14917   return must_dependence();
14918 }
14919 
must_no_source()14920 isl::union_map union_flow::must_no_source() const
14921 {
14922   if (!ptr)
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_union_flow_get_must_no_source(get());
14927   if (!res)
14928     exception::throw_last_error(saved_ctx);
14929   return manage(res);
14930 }
14931 
get_must_no_source()14932 isl::union_map union_flow::get_must_no_source() const
14933 {
14934   return must_no_source();
14935 }
14936 
14937 inline std::ostream &operator<<(std::ostream &os, const union_flow &obj)
14938 {
14939   if (!obj.get())
14940     exception::throw_invalid("NULL input", __FILE__, __LINE__);
14941   auto saved_ctx = isl_union_flow_get_ctx(obj.get());
14942   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14943   char *str = isl_union_flow_to_str(obj.get());
14944   if (!str)
14945     exception::throw_last_error(saved_ctx);
14946   os << str;
14947   free(str);
14948   return os;
14949 }
14950 
14951 // implementations for isl::union_map
manage(__isl_take isl_union_map * ptr)14952 union_map manage(__isl_take isl_union_map *ptr) {
14953   if (!ptr)
14954     exception::throw_invalid("NULL input", __FILE__, __LINE__);
14955   return union_map(ptr);
14956 }
manage_copy(__isl_keep isl_union_map * ptr)14957 union_map manage_copy(__isl_keep isl_union_map *ptr) {
14958   if (!ptr)
14959     exception::throw_invalid("NULL input", __FILE__, __LINE__);
14960   auto saved_ctx = isl_union_map_get_ctx(ptr);
14961   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14962   ptr = isl_union_map_copy(ptr);
14963   if (!ptr)
14964     exception::throw_last_error(saved_ctx);
14965   return union_map(ptr);
14966 }
14967 
union_map()14968 union_map::union_map()
14969     : ptr(nullptr) {}
14970 
union_map(const union_map & obj)14971 union_map::union_map(const union_map &obj)
14972     : ptr(nullptr)
14973 {
14974   if (!obj.ptr)
14975     exception::throw_invalid("NULL input", __FILE__, __LINE__);
14976   auto saved_ctx = isl_union_map_get_ctx(obj.ptr);
14977   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14978   ptr = obj.copy();
14979   if (!ptr)
14980     exception::throw_last_error(saved_ctx);
14981 }
14982 
union_map(__isl_take isl_union_map * ptr)14983 union_map::union_map(__isl_take isl_union_map *ptr)
14984     : ptr(ptr) {}
14985 
union_map(isl::basic_map bmap)14986 union_map::union_map(isl::basic_map bmap)
14987 {
14988   if (bmap.is_null())
14989     exception::throw_invalid("NULL input", __FILE__, __LINE__);
14990   auto saved_ctx = bmap.ctx();
14991   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
14992   auto res = isl_union_map_from_basic_map(bmap.release());
14993   if (!res)
14994     exception::throw_last_error(saved_ctx);
14995   ptr = res;
14996 }
14997 
union_map(isl::map map)14998 union_map::union_map(isl::map map)
14999 {
15000   if (map.is_null())
15001     exception::throw_invalid("NULL input", __FILE__, __LINE__);
15002   auto saved_ctx = map.ctx();
15003   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15004   auto res = isl_union_map_from_map(map.release());
15005   if (!res)
15006     exception::throw_last_error(saved_ctx);
15007   ptr = res;
15008 }
15009 
union_map(isl::ctx ctx,const std::string & str)15010 union_map::union_map(isl::ctx ctx, const std::string &str)
15011 {
15012   auto saved_ctx = ctx;
15013   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15014   auto res = isl_union_map_read_from_str(ctx.release(), str.c_str());
15015   if (!res)
15016     exception::throw_last_error(saved_ctx);
15017   ptr = res;
15018 }
15019 
15020 union_map &union_map::operator=(union_map obj) {
15021   std::swap(this->ptr, obj.ptr);
15022   return *this;
15023 }
15024 
~union_map()15025 union_map::~union_map() {
15026   if (ptr)
15027     isl_union_map_free(ptr);
15028 }
15029 
copy()15030 __isl_give isl_union_map *union_map::copy() const & {
15031   return isl_union_map_copy(ptr);
15032 }
15033 
get()15034 __isl_keep isl_union_map *union_map::get() const {
15035   return ptr;
15036 }
15037 
release()15038 __isl_give isl_union_map *union_map::release() {
15039   isl_union_map *tmp = ptr;
15040   ptr = nullptr;
15041   return tmp;
15042 }
15043 
is_null()15044 bool union_map::is_null() const {
15045   return ptr == nullptr;
15046 }
15047 
ctx()15048 isl::ctx union_map::ctx() const {
15049   return isl::ctx(isl_union_map_get_ctx(ptr));
15050 }
15051 
affine_hull()15052 isl::union_map union_map::affine_hull() const
15053 {
15054   if (!ptr)
15055     exception::throw_invalid("NULL input", __FILE__, __LINE__);
15056   auto saved_ctx = ctx();
15057   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15058   auto res = isl_union_map_affine_hull(copy());
15059   if (!res)
15060     exception::throw_last_error(saved_ctx);
15061   return manage(res);
15062 }
15063 
apply_domain(isl::union_map umap2)15064 isl::union_map union_map::apply_domain(isl::union_map umap2) const
15065 {
15066   if (!ptr || umap2.is_null())
15067     exception::throw_invalid("NULL input", __FILE__, __LINE__);
15068   auto saved_ctx = ctx();
15069   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15070   auto res = isl_union_map_apply_domain(copy(), umap2.release());
15071   if (!res)
15072     exception::throw_last_error(saved_ctx);
15073   return manage(res);
15074 }
15075 
apply_range(isl::union_map umap2)15076 isl::union_map union_map::apply_range(isl::union_map umap2) const
15077 {
15078   if (!ptr || umap2.is_null())
15079     exception::throw_invalid("NULL input", __FILE__, __LINE__);
15080   auto saved_ctx = ctx();
15081   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15082   auto res = isl_union_map_apply_range(copy(), umap2.release());
15083   if (!res)
15084     exception::throw_last_error(saved_ctx);
15085   return manage(res);
15086 }
15087 
bind_range(isl::multi_id tuple)15088 isl::union_set union_map::bind_range(isl::multi_id tuple) const
15089 {
15090   if (!ptr || tuple.is_null())
15091     exception::throw_invalid("NULL input", __FILE__, __LINE__);
15092   auto saved_ctx = ctx();
15093   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15094   auto res = isl_union_map_bind_range(copy(), tuple.release());
15095   if (!res)
15096     exception::throw_last_error(saved_ctx);
15097   return manage(res);
15098 }
15099 
coalesce()15100 isl::union_map union_map::coalesce() const
15101 {
15102   if (!ptr)
15103     exception::throw_invalid("NULL input", __FILE__, __LINE__);
15104   auto saved_ctx = ctx();
15105   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15106   auto res = isl_union_map_coalesce(copy());
15107   if (!res)
15108     exception::throw_last_error(saved_ctx);
15109   return manage(res);
15110 }
15111 
compute_divs()15112 isl::union_map union_map::compute_divs() const
15113 {
15114   if (!ptr)
15115     exception::throw_invalid("NULL input", __FILE__, __LINE__);
15116   auto saved_ctx = ctx();
15117   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15118   auto res = isl_union_map_compute_divs(copy());
15119   if (!res)
15120     exception::throw_last_error(saved_ctx);
15121   return manage(res);
15122 }
15123 
curry()15124 isl::union_map union_map::curry() const
15125 {
15126   if (!ptr)
15127     exception::throw_invalid("NULL input", __FILE__, __LINE__);
15128   auto saved_ctx = ctx();
15129   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15130   auto res = isl_union_map_curry(copy());
15131   if (!res)
15132     exception::throw_last_error(saved_ctx);
15133   return manage(res);
15134 }
15135 
deltas()15136 isl::union_set union_map::deltas() const
15137 {
15138   if (!ptr)
15139     exception::throw_invalid("NULL input", __FILE__, __LINE__);
15140   auto saved_ctx = ctx();
15141   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15142   auto res = isl_union_map_deltas(copy());
15143   if (!res)
15144     exception::throw_last_error(saved_ctx);
15145   return manage(res);
15146 }
15147 
detect_equalities()15148 isl::union_map union_map::detect_equalities() const
15149 {
15150   if (!ptr)
15151     exception::throw_invalid("NULL input", __FILE__, __LINE__);
15152   auto saved_ctx = ctx();
15153   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15154   auto res = isl_union_map_detect_equalities(copy());
15155   if (!res)
15156     exception::throw_last_error(saved_ctx);
15157   return manage(res);
15158 }
15159 
domain()15160 isl::union_set union_map::domain() const
15161 {
15162   if (!ptr)
15163     exception::throw_invalid("NULL input", __FILE__, __LINE__);
15164   auto saved_ctx = ctx();
15165   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15166   auto res = isl_union_map_domain(copy());
15167   if (!res)
15168     exception::throw_last_error(saved_ctx);
15169   return manage(res);
15170 }
15171 
domain_factor_domain()15172 isl::union_map union_map::domain_factor_domain() const
15173 {
15174   if (!ptr)
15175     exception::throw_invalid("NULL input", __FILE__, __LINE__);
15176   auto saved_ctx = ctx();
15177   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15178   auto res = isl_union_map_domain_factor_domain(copy());
15179   if (!res)
15180     exception::throw_last_error(saved_ctx);
15181   return manage(res);
15182 }
15183 
domain_factor_range()15184 isl::union_map union_map::domain_factor_range() const
15185 {
15186   if (!ptr)
15187     exception::throw_invalid("NULL input", __FILE__, __LINE__);
15188   auto saved_ctx = ctx();
15189   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15190   auto res = isl_union_map_domain_factor_range(copy());
15191   if (!res)
15192     exception::throw_last_error(saved_ctx);
15193   return manage(res);
15194 }
15195 
domain_map()15196 isl::union_map union_map::domain_map() const
15197 {
15198   if (!ptr)
15199     exception::throw_invalid("NULL input", __FILE__, __LINE__);
15200   auto saved_ctx = ctx();
15201   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15202   auto res = isl_union_map_domain_map(copy());
15203   if (!res)
15204     exception::throw_last_error(saved_ctx);
15205   return manage(res);
15206 }
15207 
domain_map_union_pw_multi_aff()15208 isl::union_pw_multi_aff union_map::domain_map_union_pw_multi_aff() const
15209 {
15210   if (!ptr)
15211     exception::throw_invalid("NULL input", __FILE__, __LINE__);
15212   auto saved_ctx = ctx();
15213   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15214   auto res = isl_union_map_domain_map_union_pw_multi_aff(copy());
15215   if (!res)
15216     exception::throw_last_error(saved_ctx);
15217   return manage(res);
15218 }
15219 
domain_product(isl::union_map umap2)15220 isl::union_map union_map::domain_product(isl::union_map umap2) const
15221 {
15222   if (!ptr || umap2.is_null())
15223     exception::throw_invalid("NULL input", __FILE__, __LINE__);
15224   auto saved_ctx = ctx();
15225   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15226   auto res = isl_union_map_domain_product(copy(), umap2.release());
15227   if (!res)
15228     exception::throw_last_error(saved_ctx);
15229   return manage(res);
15230 }
15231 
empty(isl::ctx ctx)15232 isl::union_map union_map::empty(isl::ctx ctx)
15233 {
15234   auto saved_ctx = ctx;
15235   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15236   auto res = isl_union_map_empty_ctx(ctx.release());
15237   if (!res)
15238     exception::throw_last_error(saved_ctx);
15239   return manage(res);
15240 }
15241 
eq_at(isl::multi_union_pw_aff mupa)15242 isl::union_map union_map::eq_at(isl::multi_union_pw_aff mupa) const
15243 {
15244   if (!ptr || mupa.is_null())
15245     exception::throw_invalid("NULL input", __FILE__, __LINE__);
15246   auto saved_ctx = ctx();
15247   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15248   auto res = isl_union_map_eq_at_multi_union_pw_aff(copy(), mupa.release());
15249   if (!res)
15250     exception::throw_last_error(saved_ctx);
15251   return manage(res);
15252 }
15253 
every_map(const std::function<bool (isl::map)> & test)15254 bool union_map::every_map(const std::function<bool(isl::map)> &test) const
15255 {
15256   if (!ptr)
15257     exception::throw_invalid("NULL input", __FILE__, __LINE__);
15258   auto saved_ctx = ctx();
15259   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15260   struct test_data {
15261     std::function<bool(isl::map)> func;
15262     std::exception_ptr eptr;
15263   } test_data = { test };
15264   auto test_lambda = [](isl_map *arg_0, void *arg_1) -> isl_bool {
15265     auto *data = static_cast<struct test_data *>(arg_1);
15266     ISL_CPP_TRY {
15267       auto ret = (data->func)(manage_copy(arg_0));
15268       return ret ? isl_bool_true : isl_bool_false;
15269     } ISL_CPP_CATCH_ALL {
15270       data->eptr = std::current_exception();
15271       return isl_bool_error;
15272     }
15273   };
15274   auto res = isl_union_map_every_map(get(), test_lambda, &test_data);
15275   if (test_data.eptr)
15276     std::rethrow_exception(test_data.eptr);
15277   if (res < 0)
15278     exception::throw_last_error(saved_ctx);
15279   return res;
15280 }
15281 
extract_map(isl::space space)15282 isl::map union_map::extract_map(isl::space space) const
15283 {
15284   if (!ptr || space.is_null())
15285     exception::throw_invalid("NULL input", __FILE__, __LINE__);
15286   auto saved_ctx = ctx();
15287   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15288   auto res = isl_union_map_extract_map(get(), space.release());
15289   if (!res)
15290     exception::throw_last_error(saved_ctx);
15291   return manage(res);
15292 }
15293 
factor_domain()15294 isl::union_map union_map::factor_domain() const
15295 {
15296   if (!ptr)
15297     exception::throw_invalid("NULL input", __FILE__, __LINE__);
15298   auto saved_ctx = ctx();
15299   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15300   auto res = isl_union_map_factor_domain(copy());
15301   if (!res)
15302     exception::throw_last_error(saved_ctx);
15303   return manage(res);
15304 }
15305 
factor_range()15306 isl::union_map union_map::factor_range() const
15307 {
15308   if (!ptr)
15309     exception::throw_invalid("NULL input", __FILE__, __LINE__);
15310   auto saved_ctx = ctx();
15311   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15312   auto res = isl_union_map_factor_range(copy());
15313   if (!res)
15314     exception::throw_last_error(saved_ctx);
15315   return manage(res);
15316 }
15317 
fixed_power(isl::val exp)15318 isl::union_map union_map::fixed_power(isl::val exp) const
15319 {
15320   if (!ptr || exp.is_null())
15321     exception::throw_invalid("NULL input", __FILE__, __LINE__);
15322   auto saved_ctx = ctx();
15323   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15324   auto res = isl_union_map_fixed_power_val(copy(), exp.release());
15325   if (!res)
15326     exception::throw_last_error(saved_ctx);
15327   return manage(res);
15328 }
15329 
fixed_power(long exp)15330 isl::union_map union_map::fixed_power(long exp) const
15331 {
15332   if (!ptr)
15333     exception::throw_invalid("NULL input", __FILE__, __LINE__);
15334   return this->fixed_power(isl::val(ctx(), exp));
15335 }
15336 
foreach_map(const std::function<void (isl::map)> & fn)15337 void union_map::foreach_map(const std::function<void(isl::map)> &fn) const
15338 {
15339   if (!ptr)
15340     exception::throw_invalid("NULL input", __FILE__, __LINE__);
15341   auto saved_ctx = ctx();
15342   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15343   struct fn_data {
15344     std::function<void(isl::map)> func;
15345     std::exception_ptr eptr;
15346   } fn_data = { fn };
15347   auto fn_lambda = [](isl_map *arg_0, void *arg_1) -> isl_stat {
15348     auto *data = static_cast<struct fn_data *>(arg_1);
15349     ISL_CPP_TRY {
15350       (data->func)(manage(arg_0));
15351       return isl_stat_ok;
15352     } ISL_CPP_CATCH_ALL {
15353       data->eptr = std::current_exception();
15354       return isl_stat_error;
15355     }
15356   };
15357   auto res = isl_union_map_foreach_map(get(), fn_lambda, &fn_data);
15358   if (fn_data.eptr)
15359     std::rethrow_exception(fn_data.eptr);
15360   if (res < 0)
15361     exception::throw_last_error(saved_ctx);
15362   return;
15363 }
15364 
from(isl::multi_union_pw_aff mupa)15365 isl::union_map union_map::from(isl::multi_union_pw_aff mupa)
15366 {
15367   if (mupa.is_null())
15368     exception::throw_invalid("NULL input", __FILE__, __LINE__);
15369   auto saved_ctx = mupa.ctx();
15370   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15371   auto res = isl_union_map_from_multi_union_pw_aff(mupa.release());
15372   if (!res)
15373     exception::throw_last_error(saved_ctx);
15374   return manage(res);
15375 }
15376 
from(isl::union_pw_multi_aff upma)15377 isl::union_map union_map::from(isl::union_pw_multi_aff upma)
15378 {
15379   if (upma.is_null())
15380     exception::throw_invalid("NULL input", __FILE__, __LINE__);
15381   auto saved_ctx = upma.ctx();
15382   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15383   auto res = isl_union_map_from_union_pw_multi_aff(upma.release());
15384   if (!res)
15385     exception::throw_last_error(saved_ctx);
15386   return manage(res);
15387 }
15388 
from_domain(isl::union_set uset)15389 isl::union_map union_map::from_domain(isl::union_set uset)
15390 {
15391   if (uset.is_null())
15392     exception::throw_invalid("NULL input", __FILE__, __LINE__);
15393   auto saved_ctx = uset.ctx();
15394   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15395   auto res = isl_union_map_from_domain(uset.release());
15396   if (!res)
15397     exception::throw_last_error(saved_ctx);
15398   return manage(res);
15399 }
15400 
from_domain_and_range(isl::union_set domain,isl::union_set range)15401 isl::union_map union_map::from_domain_and_range(isl::union_set domain, isl::union_set range)
15402 {
15403   if (domain.is_null() || range.is_null())
15404     exception::throw_invalid("NULL input", __FILE__, __LINE__);
15405   auto saved_ctx = domain.ctx();
15406   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15407   auto res = isl_union_map_from_domain_and_range(domain.release(), range.release());
15408   if (!res)
15409     exception::throw_last_error(saved_ctx);
15410   return manage(res);
15411 }
15412 
from_range(isl::union_set uset)15413 isl::union_map union_map::from_range(isl::union_set uset)
15414 {
15415   if (uset.is_null())
15416     exception::throw_invalid("NULL input", __FILE__, __LINE__);
15417   auto saved_ctx = uset.ctx();
15418   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15419   auto res = isl_union_map_from_range(uset.release());
15420   if (!res)
15421     exception::throw_last_error(saved_ctx);
15422   return manage(res);
15423 }
15424 
space()15425 isl::space union_map::space() const
15426 {
15427   if (!ptr)
15428     exception::throw_invalid("NULL input", __FILE__, __LINE__);
15429   auto saved_ctx = ctx();
15430   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15431   auto res = isl_union_map_get_space(get());
15432   if (!res)
15433     exception::throw_last_error(saved_ctx);
15434   return manage(res);
15435 }
15436 
get_space()15437 isl::space union_map::get_space() const
15438 {
15439   return space();
15440 }
15441 
gist(isl::union_map context)15442 isl::union_map union_map::gist(isl::union_map context) const
15443 {
15444   if (!ptr || context.is_null())
15445     exception::throw_invalid("NULL input", __FILE__, __LINE__);
15446   auto saved_ctx = ctx();
15447   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15448   auto res = isl_union_map_gist(copy(), context.release());
15449   if (!res)
15450     exception::throw_last_error(saved_ctx);
15451   return manage(res);
15452 }
15453 
gist_domain(isl::union_set uset)15454 isl::union_map union_map::gist_domain(isl::union_set uset) const
15455 {
15456   if (!ptr || uset.is_null())
15457     exception::throw_invalid("NULL input", __FILE__, __LINE__);
15458   auto saved_ctx = ctx();
15459   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15460   auto res = isl_union_map_gist_domain(copy(), uset.release());
15461   if (!res)
15462     exception::throw_last_error(saved_ctx);
15463   return manage(res);
15464 }
15465 
gist_params(isl::set set)15466 isl::union_map union_map::gist_params(isl::set set) const
15467 {
15468   if (!ptr || set.is_null())
15469     exception::throw_invalid("NULL input", __FILE__, __LINE__);
15470   auto saved_ctx = ctx();
15471   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15472   auto res = isl_union_map_gist_params(copy(), set.release());
15473   if (!res)
15474     exception::throw_last_error(saved_ctx);
15475   return manage(res);
15476 }
15477 
gist_range(isl::union_set uset)15478 isl::union_map union_map::gist_range(isl::union_set uset) const
15479 {
15480   if (!ptr || uset.is_null())
15481     exception::throw_invalid("NULL input", __FILE__, __LINE__);
15482   auto saved_ctx = ctx();
15483   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15484   auto res = isl_union_map_gist_range(copy(), uset.release());
15485   if (!res)
15486     exception::throw_last_error(saved_ctx);
15487   return manage(res);
15488 }
15489 
intersect(isl::union_map umap2)15490 isl::union_map union_map::intersect(isl::union_map umap2) const
15491 {
15492   if (!ptr || umap2.is_null())
15493     exception::throw_invalid("NULL input", __FILE__, __LINE__);
15494   auto saved_ctx = ctx();
15495   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15496   auto res = isl_union_map_intersect(copy(), umap2.release());
15497   if (!res)
15498     exception::throw_last_error(saved_ctx);
15499   return manage(res);
15500 }
15501 
intersect_domain(isl::union_set uset)15502 isl::union_map union_map::intersect_domain(isl::union_set uset) const
15503 {
15504   if (!ptr || uset.is_null())
15505     exception::throw_invalid("NULL input", __FILE__, __LINE__);
15506   auto saved_ctx = ctx();
15507   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15508   auto res = isl_union_map_intersect_domain(copy(), uset.release());
15509   if (!res)
15510     exception::throw_last_error(saved_ctx);
15511   return manage(res);
15512 }
15513 
intersect_params(isl::set set)15514 isl::union_map union_map::intersect_params(isl::set set) const
15515 {
15516   if (!ptr || set.is_null())
15517     exception::throw_invalid("NULL input", __FILE__, __LINE__);
15518   auto saved_ctx = ctx();
15519   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15520   auto res = isl_union_map_intersect_params(copy(), set.release());
15521   if (!res)
15522     exception::throw_last_error(saved_ctx);
15523   return manage(res);
15524 }
15525 
intersect_range(isl::union_set uset)15526 isl::union_map union_map::intersect_range(isl::union_set uset) const
15527 {
15528   if (!ptr || uset.is_null())
15529     exception::throw_invalid("NULL input", __FILE__, __LINE__);
15530   auto saved_ctx = ctx();
15531   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15532   auto res = isl_union_map_intersect_range(copy(), uset.release());
15533   if (!res)
15534     exception::throw_last_error(saved_ctx);
15535   return manage(res);
15536 }
15537 
is_bijective()15538 bool union_map::is_bijective() const
15539 {
15540   if (!ptr)
15541     exception::throw_invalid("NULL input", __FILE__, __LINE__);
15542   auto saved_ctx = ctx();
15543   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15544   auto res = isl_union_map_is_bijective(get());
15545   if (res < 0)
15546     exception::throw_last_error(saved_ctx);
15547   return res;
15548 }
15549 
is_disjoint(const isl::union_map & umap2)15550 bool union_map::is_disjoint(const isl::union_map &umap2) const
15551 {
15552   if (!ptr || umap2.is_null())
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_map_is_disjoint(get(), umap2.get());
15557   if (res < 0)
15558     exception::throw_last_error(saved_ctx);
15559   return res;
15560 }
15561 
is_empty()15562 bool union_map::is_empty() const
15563 {
15564   if (!ptr)
15565     exception::throw_invalid("NULL input", __FILE__, __LINE__);
15566   auto saved_ctx = ctx();
15567   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15568   auto res = isl_union_map_is_empty(get());
15569   if (res < 0)
15570     exception::throw_last_error(saved_ctx);
15571   return res;
15572 }
15573 
is_equal(const isl::union_map & umap2)15574 bool union_map::is_equal(const isl::union_map &umap2) const
15575 {
15576   if (!ptr || umap2.is_null())
15577     exception::throw_invalid("NULL input", __FILE__, __LINE__);
15578   auto saved_ctx = ctx();
15579   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15580   auto res = isl_union_map_is_equal(get(), umap2.get());
15581   if (res < 0)
15582     exception::throw_last_error(saved_ctx);
15583   return res;
15584 }
15585 
is_injective()15586 bool union_map::is_injective() const
15587 {
15588   if (!ptr)
15589     exception::throw_invalid("NULL input", __FILE__, __LINE__);
15590   auto saved_ctx = ctx();
15591   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15592   auto res = isl_union_map_is_injective(get());
15593   if (res < 0)
15594     exception::throw_last_error(saved_ctx);
15595   return res;
15596 }
15597 
is_single_valued()15598 bool union_map::is_single_valued() const
15599 {
15600   if (!ptr)
15601     exception::throw_invalid("NULL input", __FILE__, __LINE__);
15602   auto saved_ctx = ctx();
15603   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15604   auto res = isl_union_map_is_single_valued(get());
15605   if (res < 0)
15606     exception::throw_last_error(saved_ctx);
15607   return res;
15608 }
15609 
is_strict_subset(const isl::union_map & umap2)15610 bool union_map::is_strict_subset(const isl::union_map &umap2) const
15611 {
15612   if (!ptr || umap2.is_null())
15613     exception::throw_invalid("NULL input", __FILE__, __LINE__);
15614   auto saved_ctx = ctx();
15615   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15616   auto res = isl_union_map_is_strict_subset(get(), umap2.get());
15617   if (res < 0)
15618     exception::throw_last_error(saved_ctx);
15619   return res;
15620 }
15621 
is_subset(const isl::union_map & umap2)15622 bool union_map::is_subset(const isl::union_map &umap2) const
15623 {
15624   if (!ptr || umap2.is_null())
15625     exception::throw_invalid("NULL input", __FILE__, __LINE__);
15626   auto saved_ctx = ctx();
15627   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15628   auto res = isl_union_map_is_subset(get(), umap2.get());
15629   if (res < 0)
15630     exception::throw_last_error(saved_ctx);
15631   return res;
15632 }
15633 
isa_map()15634 bool union_map::isa_map() const
15635 {
15636   if (!ptr)
15637     exception::throw_invalid("NULL input", __FILE__, __LINE__);
15638   auto saved_ctx = ctx();
15639   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15640   auto res = isl_union_map_isa_map(get());
15641   if (res < 0)
15642     exception::throw_last_error(saved_ctx);
15643   return res;
15644 }
15645 
lexmax()15646 isl::union_map union_map::lexmax() const
15647 {
15648   if (!ptr)
15649     exception::throw_invalid("NULL input", __FILE__, __LINE__);
15650   auto saved_ctx = ctx();
15651   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15652   auto res = isl_union_map_lexmax(copy());
15653   if (!res)
15654     exception::throw_last_error(saved_ctx);
15655   return manage(res);
15656 }
15657 
lexmin()15658 isl::union_map union_map::lexmin() const
15659 {
15660   if (!ptr)
15661     exception::throw_invalid("NULL input", __FILE__, __LINE__);
15662   auto saved_ctx = ctx();
15663   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15664   auto res = isl_union_map_lexmin(copy());
15665   if (!res)
15666     exception::throw_last_error(saved_ctx);
15667   return manage(res);
15668 }
15669 
polyhedral_hull()15670 isl::union_map union_map::polyhedral_hull() const
15671 {
15672   if (!ptr)
15673     exception::throw_invalid("NULL input", __FILE__, __LINE__);
15674   auto saved_ctx = ctx();
15675   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15676   auto res = isl_union_map_polyhedral_hull(copy());
15677   if (!res)
15678     exception::throw_last_error(saved_ctx);
15679   return manage(res);
15680 }
15681 
preimage_domain(isl::multi_aff ma)15682 isl::union_map union_map::preimage_domain(isl::multi_aff ma) const
15683 {
15684   if (!ptr || ma.is_null())
15685     exception::throw_invalid("NULL input", __FILE__, __LINE__);
15686   auto saved_ctx = ctx();
15687   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15688   auto res = isl_union_map_preimage_domain_multi_aff(copy(), ma.release());
15689   if (!res)
15690     exception::throw_last_error(saved_ctx);
15691   return manage(res);
15692 }
15693 
preimage_domain(isl::multi_pw_aff mpa)15694 isl::union_map union_map::preimage_domain(isl::multi_pw_aff mpa) const
15695 {
15696   if (!ptr || mpa.is_null())
15697     exception::throw_invalid("NULL input", __FILE__, __LINE__);
15698   auto saved_ctx = ctx();
15699   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15700   auto res = isl_union_map_preimage_domain_multi_pw_aff(copy(), mpa.release());
15701   if (!res)
15702     exception::throw_last_error(saved_ctx);
15703   return manage(res);
15704 }
15705 
preimage_domain(isl::pw_multi_aff pma)15706 isl::union_map union_map::preimage_domain(isl::pw_multi_aff pma) const
15707 {
15708   if (!ptr || pma.is_null())
15709     exception::throw_invalid("NULL input", __FILE__, __LINE__);
15710   auto saved_ctx = ctx();
15711   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15712   auto res = isl_union_map_preimage_domain_pw_multi_aff(copy(), pma.release());
15713   if (!res)
15714     exception::throw_last_error(saved_ctx);
15715   return manage(res);
15716 }
15717 
preimage_domain(isl::union_pw_multi_aff upma)15718 isl::union_map union_map::preimage_domain(isl::union_pw_multi_aff upma) const
15719 {
15720   if (!ptr || upma.is_null())
15721     exception::throw_invalid("NULL input", __FILE__, __LINE__);
15722   auto saved_ctx = ctx();
15723   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15724   auto res = isl_union_map_preimage_domain_union_pw_multi_aff(copy(), upma.release());
15725   if (!res)
15726     exception::throw_last_error(saved_ctx);
15727   return manage(res);
15728 }
15729 
preimage_range(isl::multi_aff ma)15730 isl::union_map union_map::preimage_range(isl::multi_aff ma) const
15731 {
15732   if (!ptr || ma.is_null())
15733     exception::throw_invalid("NULL input", __FILE__, __LINE__);
15734   auto saved_ctx = ctx();
15735   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15736   auto res = isl_union_map_preimage_range_multi_aff(copy(), ma.release());
15737   if (!res)
15738     exception::throw_last_error(saved_ctx);
15739   return manage(res);
15740 }
15741 
preimage_range(isl::pw_multi_aff pma)15742 isl::union_map union_map::preimage_range(isl::pw_multi_aff pma) const
15743 {
15744   if (!ptr || pma.is_null())
15745     exception::throw_invalid("NULL input", __FILE__, __LINE__);
15746   auto saved_ctx = ctx();
15747   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15748   auto res = isl_union_map_preimage_range_pw_multi_aff(copy(), pma.release());
15749   if (!res)
15750     exception::throw_last_error(saved_ctx);
15751   return manage(res);
15752 }
15753 
preimage_range(isl::union_pw_multi_aff upma)15754 isl::union_map union_map::preimage_range(isl::union_pw_multi_aff upma) const
15755 {
15756   if (!ptr || upma.is_null())
15757     exception::throw_invalid("NULL input", __FILE__, __LINE__);
15758   auto saved_ctx = ctx();
15759   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15760   auto res = isl_union_map_preimage_range_union_pw_multi_aff(copy(), upma.release());
15761   if (!res)
15762     exception::throw_last_error(saved_ctx);
15763   return manage(res);
15764 }
15765 
product(isl::union_map umap2)15766 isl::union_map union_map::product(isl::union_map umap2) const
15767 {
15768   if (!ptr || umap2.is_null())
15769     exception::throw_invalid("NULL input", __FILE__, __LINE__);
15770   auto saved_ctx = ctx();
15771   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15772   auto res = isl_union_map_product(copy(), umap2.release());
15773   if (!res)
15774     exception::throw_last_error(saved_ctx);
15775   return manage(res);
15776 }
15777 
project_out_all_params()15778 isl::union_map union_map::project_out_all_params() const
15779 {
15780   if (!ptr)
15781     exception::throw_invalid("NULL input", __FILE__, __LINE__);
15782   auto saved_ctx = ctx();
15783   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15784   auto res = isl_union_map_project_out_all_params(copy());
15785   if (!res)
15786     exception::throw_last_error(saved_ctx);
15787   return manage(res);
15788 }
15789 
range()15790 isl::union_set union_map::range() const
15791 {
15792   if (!ptr)
15793     exception::throw_invalid("NULL input", __FILE__, __LINE__);
15794   auto saved_ctx = ctx();
15795   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15796   auto res = isl_union_map_range(copy());
15797   if (!res)
15798     exception::throw_last_error(saved_ctx);
15799   return manage(res);
15800 }
15801 
range_factor_domain()15802 isl::union_map union_map::range_factor_domain() const
15803 {
15804   if (!ptr)
15805     exception::throw_invalid("NULL input", __FILE__, __LINE__);
15806   auto saved_ctx = ctx();
15807   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15808   auto res = isl_union_map_range_factor_domain(copy());
15809   if (!res)
15810     exception::throw_last_error(saved_ctx);
15811   return manage(res);
15812 }
15813 
range_factor_range()15814 isl::union_map union_map::range_factor_range() const
15815 {
15816   if (!ptr)
15817     exception::throw_invalid("NULL input", __FILE__, __LINE__);
15818   auto saved_ctx = ctx();
15819   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15820   auto res = isl_union_map_range_factor_range(copy());
15821   if (!res)
15822     exception::throw_last_error(saved_ctx);
15823   return manage(res);
15824 }
15825 
range_map()15826 isl::union_map union_map::range_map() const
15827 {
15828   if (!ptr)
15829     exception::throw_invalid("NULL input", __FILE__, __LINE__);
15830   auto saved_ctx = ctx();
15831   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15832   auto res = isl_union_map_range_map(copy());
15833   if (!res)
15834     exception::throw_last_error(saved_ctx);
15835   return manage(res);
15836 }
15837 
range_product(isl::union_map umap2)15838 isl::union_map union_map::range_product(isl::union_map umap2) const
15839 {
15840   if (!ptr || umap2.is_null())
15841     exception::throw_invalid("NULL input", __FILE__, __LINE__);
15842   auto saved_ctx = ctx();
15843   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15844   auto res = isl_union_map_range_product(copy(), umap2.release());
15845   if (!res)
15846     exception::throw_last_error(saved_ctx);
15847   return manage(res);
15848 }
15849 
range_reverse()15850 isl::union_map union_map::range_reverse() const
15851 {
15852   if (!ptr)
15853     exception::throw_invalid("NULL input", __FILE__, __LINE__);
15854   auto saved_ctx = ctx();
15855   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15856   auto res = isl_union_map_range_reverse(copy());
15857   if (!res)
15858     exception::throw_last_error(saved_ctx);
15859   return manage(res);
15860 }
15861 
reverse()15862 isl::union_map union_map::reverse() const
15863 {
15864   if (!ptr)
15865     exception::throw_invalid("NULL input", __FILE__, __LINE__);
15866   auto saved_ctx = ctx();
15867   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15868   auto res = isl_union_map_reverse(copy());
15869   if (!res)
15870     exception::throw_last_error(saved_ctx);
15871   return manage(res);
15872 }
15873 
subtract(isl::union_map umap2)15874 isl::union_map union_map::subtract(isl::union_map umap2) const
15875 {
15876   if (!ptr || umap2.is_null())
15877     exception::throw_invalid("NULL input", __FILE__, __LINE__);
15878   auto saved_ctx = ctx();
15879   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15880   auto res = isl_union_map_subtract(copy(), umap2.release());
15881   if (!res)
15882     exception::throw_last_error(saved_ctx);
15883   return manage(res);
15884 }
15885 
subtract_domain(isl::union_set dom)15886 isl::union_map union_map::subtract_domain(isl::union_set dom) const
15887 {
15888   if (!ptr || dom.is_null())
15889     exception::throw_invalid("NULL input", __FILE__, __LINE__);
15890   auto saved_ctx = ctx();
15891   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15892   auto res = isl_union_map_subtract_domain(copy(), dom.release());
15893   if (!res)
15894     exception::throw_last_error(saved_ctx);
15895   return manage(res);
15896 }
15897 
subtract_range(isl::union_set dom)15898 isl::union_map union_map::subtract_range(isl::union_set dom) const
15899 {
15900   if (!ptr || dom.is_null())
15901     exception::throw_invalid("NULL input", __FILE__, __LINE__);
15902   auto saved_ctx = ctx();
15903   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15904   auto res = isl_union_map_subtract_range(copy(), dom.release());
15905   if (!res)
15906     exception::throw_last_error(saved_ctx);
15907   return manage(res);
15908 }
15909 
uncurry()15910 isl::union_map union_map::uncurry() const
15911 {
15912   if (!ptr)
15913     exception::throw_invalid("NULL input", __FILE__, __LINE__);
15914   auto saved_ctx = ctx();
15915   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15916   auto res = isl_union_map_uncurry(copy());
15917   if (!res)
15918     exception::throw_last_error(saved_ctx);
15919   return manage(res);
15920 }
15921 
unite(isl::union_map umap2)15922 isl::union_map union_map::unite(isl::union_map umap2) const
15923 {
15924   if (!ptr || umap2.is_null())
15925     exception::throw_invalid("NULL input", __FILE__, __LINE__);
15926   auto saved_ctx = ctx();
15927   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15928   auto res = isl_union_map_union(copy(), umap2.release());
15929   if (!res)
15930     exception::throw_last_error(saved_ctx);
15931   return manage(res);
15932 }
15933 
universe()15934 isl::union_map union_map::universe() const
15935 {
15936   if (!ptr)
15937     exception::throw_invalid("NULL input", __FILE__, __LINE__);
15938   auto saved_ctx = ctx();
15939   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15940   auto res = isl_union_map_universe(copy());
15941   if (!res)
15942     exception::throw_last_error(saved_ctx);
15943   return manage(res);
15944 }
15945 
wrap()15946 isl::union_set union_map::wrap() const
15947 {
15948   if (!ptr)
15949     exception::throw_invalid("NULL input", __FILE__, __LINE__);
15950   auto saved_ctx = ctx();
15951   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15952   auto res = isl_union_map_wrap(copy());
15953   if (!res)
15954     exception::throw_last_error(saved_ctx);
15955   return manage(res);
15956 }
15957 
zip()15958 isl::union_map union_map::zip() const
15959 {
15960   if (!ptr)
15961     exception::throw_invalid("NULL input", __FILE__, __LINE__);
15962   auto saved_ctx = ctx();
15963   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15964   auto res = isl_union_map_zip(copy());
15965   if (!res)
15966     exception::throw_last_error(saved_ctx);
15967   return manage(res);
15968 }
15969 
15970 inline std::ostream &operator<<(std::ostream &os, const union_map &obj)
15971 {
15972   if (!obj.get())
15973     exception::throw_invalid("NULL input", __FILE__, __LINE__);
15974   auto saved_ctx = isl_union_map_get_ctx(obj.get());
15975   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15976   char *str = isl_union_map_to_str(obj.get());
15977   if (!str)
15978     exception::throw_last_error(saved_ctx);
15979   os << str;
15980   free(str);
15981   return os;
15982 }
15983 
15984 // implementations for isl::union_pw_aff
manage(__isl_take isl_union_pw_aff * ptr)15985 union_pw_aff manage(__isl_take isl_union_pw_aff *ptr) {
15986   if (!ptr)
15987     exception::throw_invalid("NULL input", __FILE__, __LINE__);
15988   return union_pw_aff(ptr);
15989 }
manage_copy(__isl_keep isl_union_pw_aff * ptr)15990 union_pw_aff manage_copy(__isl_keep isl_union_pw_aff *ptr) {
15991   if (!ptr)
15992     exception::throw_invalid("NULL input", __FILE__, __LINE__);
15993   auto saved_ctx = isl_union_pw_aff_get_ctx(ptr);
15994   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
15995   ptr = isl_union_pw_aff_copy(ptr);
15996   if (!ptr)
15997     exception::throw_last_error(saved_ctx);
15998   return union_pw_aff(ptr);
15999 }
16000 
union_pw_aff()16001 union_pw_aff::union_pw_aff()
16002     : ptr(nullptr) {}
16003 
union_pw_aff(const union_pw_aff & obj)16004 union_pw_aff::union_pw_aff(const union_pw_aff &obj)
16005     : ptr(nullptr)
16006 {
16007   if (!obj.ptr)
16008     exception::throw_invalid("NULL input", __FILE__, __LINE__);
16009   auto saved_ctx = isl_union_pw_aff_get_ctx(obj.ptr);
16010   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16011   ptr = obj.copy();
16012   if (!ptr)
16013     exception::throw_last_error(saved_ctx);
16014 }
16015 
union_pw_aff(__isl_take isl_union_pw_aff * ptr)16016 union_pw_aff::union_pw_aff(__isl_take isl_union_pw_aff *ptr)
16017     : ptr(ptr) {}
16018 
union_pw_aff(isl::pw_aff pa)16019 union_pw_aff::union_pw_aff(isl::pw_aff pa)
16020 {
16021   if (pa.is_null())
16022     exception::throw_invalid("NULL input", __FILE__, __LINE__);
16023   auto saved_ctx = pa.ctx();
16024   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16025   auto res = isl_union_pw_aff_from_pw_aff(pa.release());
16026   if (!res)
16027     exception::throw_last_error(saved_ctx);
16028   ptr = res;
16029 }
16030 
union_pw_aff(isl::ctx ctx,const std::string & str)16031 union_pw_aff::union_pw_aff(isl::ctx ctx, const std::string &str)
16032 {
16033   auto saved_ctx = ctx;
16034   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16035   auto res = isl_union_pw_aff_read_from_str(ctx.release(), str.c_str());
16036   if (!res)
16037     exception::throw_last_error(saved_ctx);
16038   ptr = res;
16039 }
16040 
16041 union_pw_aff &union_pw_aff::operator=(union_pw_aff obj) {
16042   std::swap(this->ptr, obj.ptr);
16043   return *this;
16044 }
16045 
~union_pw_aff()16046 union_pw_aff::~union_pw_aff() {
16047   if (ptr)
16048     isl_union_pw_aff_free(ptr);
16049 }
16050 
copy()16051 __isl_give isl_union_pw_aff *union_pw_aff::copy() const & {
16052   return isl_union_pw_aff_copy(ptr);
16053 }
16054 
get()16055 __isl_keep isl_union_pw_aff *union_pw_aff::get() const {
16056   return ptr;
16057 }
16058 
release()16059 __isl_give isl_union_pw_aff *union_pw_aff::release() {
16060   isl_union_pw_aff *tmp = ptr;
16061   ptr = nullptr;
16062   return tmp;
16063 }
16064 
is_null()16065 bool union_pw_aff::is_null() const {
16066   return ptr == nullptr;
16067 }
16068 
ctx()16069 isl::ctx union_pw_aff::ctx() const {
16070   return isl::ctx(isl_union_pw_aff_get_ctx(ptr));
16071 }
16072 
add(isl::union_pw_aff upa2)16073 isl::union_pw_aff union_pw_aff::add(isl::union_pw_aff upa2) const
16074 {
16075   if (!ptr || upa2.is_null())
16076     exception::throw_invalid("NULL input", __FILE__, __LINE__);
16077   auto saved_ctx = ctx();
16078   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16079   auto res = isl_union_pw_aff_add(copy(), upa2.release());
16080   if (!res)
16081     exception::throw_last_error(saved_ctx);
16082   return manage(res);
16083 }
16084 
bind(isl::id id)16085 isl::union_set union_pw_aff::bind(isl::id id) const
16086 {
16087   if (!ptr || id.is_null())
16088     exception::throw_invalid("NULL input", __FILE__, __LINE__);
16089   auto saved_ctx = ctx();
16090   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16091   auto res = isl_union_pw_aff_bind_id(copy(), id.release());
16092   if (!res)
16093     exception::throw_last_error(saved_ctx);
16094   return manage(res);
16095 }
16096 
bind(const std::string & id)16097 isl::union_set union_pw_aff::bind(const std::string &id) const
16098 {
16099   if (!ptr)
16100     exception::throw_invalid("NULL input", __FILE__, __LINE__);
16101   return this->bind(isl::id(ctx(), id));
16102 }
16103 
coalesce()16104 isl::union_pw_aff union_pw_aff::coalesce() const
16105 {
16106   if (!ptr)
16107     exception::throw_invalid("NULL input", __FILE__, __LINE__);
16108   auto saved_ctx = ctx();
16109   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16110   auto res = isl_union_pw_aff_coalesce(copy());
16111   if (!res)
16112     exception::throw_last_error(saved_ctx);
16113   return manage(res);
16114 }
16115 
domain()16116 isl::union_set union_pw_aff::domain() const
16117 {
16118   if (!ptr)
16119     exception::throw_invalid("NULL input", __FILE__, __LINE__);
16120   auto saved_ctx = ctx();
16121   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16122   auto res = isl_union_pw_aff_domain(copy());
16123   if (!res)
16124     exception::throw_last_error(saved_ctx);
16125   return manage(res);
16126 }
16127 
space()16128 isl::space union_pw_aff::space() const
16129 {
16130   if (!ptr)
16131     exception::throw_invalid("NULL input", __FILE__, __LINE__);
16132   auto saved_ctx = ctx();
16133   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16134   auto res = isl_union_pw_aff_get_space(get());
16135   if (!res)
16136     exception::throw_last_error(saved_ctx);
16137   return manage(res);
16138 }
16139 
get_space()16140 isl::space union_pw_aff::get_space() const
16141 {
16142   return space();
16143 }
16144 
gist(isl::union_set context)16145 isl::union_pw_aff union_pw_aff::gist(isl::union_set context) const
16146 {
16147   if (!ptr || context.is_null())
16148     exception::throw_invalid("NULL input", __FILE__, __LINE__);
16149   auto saved_ctx = ctx();
16150   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16151   auto res = isl_union_pw_aff_gist(copy(), context.release());
16152   if (!res)
16153     exception::throw_last_error(saved_ctx);
16154   return manage(res);
16155 }
16156 
intersect_domain(isl::union_set uset)16157 isl::union_pw_aff union_pw_aff::intersect_domain(isl::union_set uset) const
16158 {
16159   if (!ptr || uset.is_null())
16160     exception::throw_invalid("NULL input", __FILE__, __LINE__);
16161   auto saved_ctx = ctx();
16162   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16163   auto res = isl_union_pw_aff_intersect_domain(copy(), uset.release());
16164   if (!res)
16165     exception::throw_last_error(saved_ctx);
16166   return manage(res);
16167 }
16168 
intersect_domain_wrapped_domain(isl::union_set uset)16169 isl::union_pw_aff union_pw_aff::intersect_domain_wrapped_domain(isl::union_set uset) const
16170 {
16171   if (!ptr || uset.is_null())
16172     exception::throw_invalid("NULL input", __FILE__, __LINE__);
16173   auto saved_ctx = ctx();
16174   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16175   auto res = isl_union_pw_aff_intersect_domain_wrapped_domain(copy(), uset.release());
16176   if (!res)
16177     exception::throw_last_error(saved_ctx);
16178   return manage(res);
16179 }
16180 
intersect_domain_wrapped_range(isl::union_set uset)16181 isl::union_pw_aff union_pw_aff::intersect_domain_wrapped_range(isl::union_set uset) const
16182 {
16183   if (!ptr || uset.is_null())
16184     exception::throw_invalid("NULL input", __FILE__, __LINE__);
16185   auto saved_ctx = ctx();
16186   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16187   auto res = isl_union_pw_aff_intersect_domain_wrapped_range(copy(), uset.release());
16188   if (!res)
16189     exception::throw_last_error(saved_ctx);
16190   return manage(res);
16191 }
16192 
intersect_params(isl::set set)16193 isl::union_pw_aff union_pw_aff::intersect_params(isl::set set) const
16194 {
16195   if (!ptr || set.is_null())
16196     exception::throw_invalid("NULL input", __FILE__, __LINE__);
16197   auto saved_ctx = ctx();
16198   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16199   auto res = isl_union_pw_aff_intersect_params(copy(), set.release());
16200   if (!res)
16201     exception::throw_last_error(saved_ctx);
16202   return manage(res);
16203 }
16204 
pullback(isl::union_pw_multi_aff upma)16205 isl::union_pw_aff union_pw_aff::pullback(isl::union_pw_multi_aff upma) const
16206 {
16207   if (!ptr || upma.is_null())
16208     exception::throw_invalid("NULL input", __FILE__, __LINE__);
16209   auto saved_ctx = ctx();
16210   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16211   auto res = isl_union_pw_aff_pullback_union_pw_multi_aff(copy(), upma.release());
16212   if (!res)
16213     exception::throw_last_error(saved_ctx);
16214   return manage(res);
16215 }
16216 
sub(isl::union_pw_aff upa2)16217 isl::union_pw_aff union_pw_aff::sub(isl::union_pw_aff upa2) const
16218 {
16219   if (!ptr || upa2.is_null())
16220     exception::throw_invalid("NULL input", __FILE__, __LINE__);
16221   auto saved_ctx = ctx();
16222   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16223   auto res = isl_union_pw_aff_sub(copy(), upa2.release());
16224   if (!res)
16225     exception::throw_last_error(saved_ctx);
16226   return manage(res);
16227 }
16228 
subtract_domain(isl::union_set uset)16229 isl::union_pw_aff union_pw_aff::subtract_domain(isl::union_set uset) const
16230 {
16231   if (!ptr || uset.is_null())
16232     exception::throw_invalid("NULL input", __FILE__, __LINE__);
16233   auto saved_ctx = ctx();
16234   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16235   auto res = isl_union_pw_aff_subtract_domain(copy(), uset.release());
16236   if (!res)
16237     exception::throw_last_error(saved_ctx);
16238   return manage(res);
16239 }
16240 
union_add(isl::union_pw_aff upa2)16241 isl::union_pw_aff union_pw_aff::union_add(isl::union_pw_aff upa2) const
16242 {
16243   if (!ptr || upa2.is_null())
16244     exception::throw_invalid("NULL input", __FILE__, __LINE__);
16245   auto saved_ctx = ctx();
16246   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16247   auto res = isl_union_pw_aff_union_add(copy(), upa2.release());
16248   if (!res)
16249     exception::throw_last_error(saved_ctx);
16250   return manage(res);
16251 }
16252 
16253 inline std::ostream &operator<<(std::ostream &os, const union_pw_aff &obj)
16254 {
16255   if (!obj.get())
16256     exception::throw_invalid("NULL input", __FILE__, __LINE__);
16257   auto saved_ctx = isl_union_pw_aff_get_ctx(obj.get());
16258   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16259   char *str = isl_union_pw_aff_to_str(obj.get());
16260   if (!str)
16261     exception::throw_last_error(saved_ctx);
16262   os << str;
16263   free(str);
16264   return os;
16265 }
16266 
16267 // implementations for isl::union_pw_aff_list
manage(__isl_take isl_union_pw_aff_list * ptr)16268 union_pw_aff_list manage(__isl_take isl_union_pw_aff_list *ptr) {
16269   if (!ptr)
16270     exception::throw_invalid("NULL input", __FILE__, __LINE__);
16271   return union_pw_aff_list(ptr);
16272 }
manage_copy(__isl_keep isl_union_pw_aff_list * ptr)16273 union_pw_aff_list manage_copy(__isl_keep isl_union_pw_aff_list *ptr) {
16274   if (!ptr)
16275     exception::throw_invalid("NULL input", __FILE__, __LINE__);
16276   auto saved_ctx = isl_union_pw_aff_list_get_ctx(ptr);
16277   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16278   ptr = isl_union_pw_aff_list_copy(ptr);
16279   if (!ptr)
16280     exception::throw_last_error(saved_ctx);
16281   return union_pw_aff_list(ptr);
16282 }
16283 
union_pw_aff_list()16284 union_pw_aff_list::union_pw_aff_list()
16285     : ptr(nullptr) {}
16286 
union_pw_aff_list(const union_pw_aff_list & obj)16287 union_pw_aff_list::union_pw_aff_list(const union_pw_aff_list &obj)
16288     : ptr(nullptr)
16289 {
16290   if (!obj.ptr)
16291     exception::throw_invalid("NULL input", __FILE__, __LINE__);
16292   auto saved_ctx = isl_union_pw_aff_list_get_ctx(obj.ptr);
16293   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16294   ptr = obj.copy();
16295   if (!ptr)
16296     exception::throw_last_error(saved_ctx);
16297 }
16298 
union_pw_aff_list(__isl_take isl_union_pw_aff_list * ptr)16299 union_pw_aff_list::union_pw_aff_list(__isl_take isl_union_pw_aff_list *ptr)
16300     : ptr(ptr) {}
16301 
union_pw_aff_list(isl::ctx ctx,int n)16302 union_pw_aff_list::union_pw_aff_list(isl::ctx ctx, int n)
16303 {
16304   auto saved_ctx = ctx;
16305   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16306   auto res = isl_union_pw_aff_list_alloc(ctx.release(), n);
16307   if (!res)
16308     exception::throw_last_error(saved_ctx);
16309   ptr = res;
16310 }
16311 
union_pw_aff_list(isl::union_pw_aff el)16312 union_pw_aff_list::union_pw_aff_list(isl::union_pw_aff el)
16313 {
16314   if (el.is_null())
16315     exception::throw_invalid("NULL input", __FILE__, __LINE__);
16316   auto saved_ctx = el.ctx();
16317   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16318   auto res = isl_union_pw_aff_list_from_union_pw_aff(el.release());
16319   if (!res)
16320     exception::throw_last_error(saved_ctx);
16321   ptr = res;
16322 }
16323 
16324 union_pw_aff_list &union_pw_aff_list::operator=(union_pw_aff_list obj) {
16325   std::swap(this->ptr, obj.ptr);
16326   return *this;
16327 }
16328 
~union_pw_aff_list()16329 union_pw_aff_list::~union_pw_aff_list() {
16330   if (ptr)
16331     isl_union_pw_aff_list_free(ptr);
16332 }
16333 
copy()16334 __isl_give isl_union_pw_aff_list *union_pw_aff_list::copy() const & {
16335   return isl_union_pw_aff_list_copy(ptr);
16336 }
16337 
get()16338 __isl_keep isl_union_pw_aff_list *union_pw_aff_list::get() const {
16339   return ptr;
16340 }
16341 
release()16342 __isl_give isl_union_pw_aff_list *union_pw_aff_list::release() {
16343   isl_union_pw_aff_list *tmp = ptr;
16344   ptr = nullptr;
16345   return tmp;
16346 }
16347 
is_null()16348 bool union_pw_aff_list::is_null() const {
16349   return ptr == nullptr;
16350 }
16351 
ctx()16352 isl::ctx union_pw_aff_list::ctx() const {
16353   return isl::ctx(isl_union_pw_aff_list_get_ctx(ptr));
16354 }
16355 
add(isl::union_pw_aff el)16356 isl::union_pw_aff_list union_pw_aff_list::add(isl::union_pw_aff el) const
16357 {
16358   if (!ptr || el.is_null())
16359     exception::throw_invalid("NULL input", __FILE__, __LINE__);
16360   auto saved_ctx = ctx();
16361   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16362   auto res = isl_union_pw_aff_list_add(copy(), el.release());
16363   if (!res)
16364     exception::throw_last_error(saved_ctx);
16365   return manage(res);
16366 }
16367 
clear()16368 isl::union_pw_aff_list union_pw_aff_list::clear() const
16369 {
16370   if (!ptr)
16371     exception::throw_invalid("NULL input", __FILE__, __LINE__);
16372   auto saved_ctx = ctx();
16373   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16374   auto res = isl_union_pw_aff_list_clear(copy());
16375   if (!res)
16376     exception::throw_last_error(saved_ctx);
16377   return manage(res);
16378 }
16379 
concat(isl::union_pw_aff_list list2)16380 isl::union_pw_aff_list union_pw_aff_list::concat(isl::union_pw_aff_list list2) const
16381 {
16382   if (!ptr || list2.is_null())
16383     exception::throw_invalid("NULL input", __FILE__, __LINE__);
16384   auto saved_ctx = ctx();
16385   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16386   auto res = isl_union_pw_aff_list_concat(copy(), list2.release());
16387   if (!res)
16388     exception::throw_last_error(saved_ctx);
16389   return manage(res);
16390 }
16391 
foreach(const std::function<void (isl::union_pw_aff)> & fn)16392 void union_pw_aff_list::foreach(const std::function<void(isl::union_pw_aff)> &fn) const
16393 {
16394   if (!ptr)
16395     exception::throw_invalid("NULL input", __FILE__, __LINE__);
16396   auto saved_ctx = ctx();
16397   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16398   struct fn_data {
16399     std::function<void(isl::union_pw_aff)> func;
16400     std::exception_ptr eptr;
16401   } fn_data = { fn };
16402   auto fn_lambda = [](isl_union_pw_aff *arg_0, void *arg_1) -> isl_stat {
16403     auto *data = static_cast<struct fn_data *>(arg_1);
16404     ISL_CPP_TRY {
16405       (data->func)(manage(arg_0));
16406       return isl_stat_ok;
16407     } ISL_CPP_CATCH_ALL {
16408       data->eptr = std::current_exception();
16409       return isl_stat_error;
16410     }
16411   };
16412   auto res = isl_union_pw_aff_list_foreach(get(), fn_lambda, &fn_data);
16413   if (fn_data.eptr)
16414     std::rethrow_exception(fn_data.eptr);
16415   if (res < 0)
16416     exception::throw_last_error(saved_ctx);
16417   return;
16418 }
16419 
at(int index)16420 isl::union_pw_aff union_pw_aff_list::at(int index) const
16421 {
16422   if (!ptr)
16423     exception::throw_invalid("NULL input", __FILE__, __LINE__);
16424   auto saved_ctx = ctx();
16425   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16426   auto res = isl_union_pw_aff_list_get_at(get(), index);
16427   if (!res)
16428     exception::throw_last_error(saved_ctx);
16429   return manage(res);
16430 }
16431 
get_at(int index)16432 isl::union_pw_aff union_pw_aff_list::get_at(int index) const
16433 {
16434   return at(index);
16435 }
16436 
size()16437 unsigned union_pw_aff_list::size() const
16438 {
16439   if (!ptr)
16440     exception::throw_invalid("NULL input", __FILE__, __LINE__);
16441   auto saved_ctx = ctx();
16442   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16443   auto res = isl_union_pw_aff_list_size(get());
16444   if (res < 0)
16445     exception::throw_last_error(saved_ctx);
16446   return res;
16447 }
16448 
16449 inline std::ostream &operator<<(std::ostream &os, const union_pw_aff_list &obj)
16450 {
16451   if (!obj.get())
16452     exception::throw_invalid("NULL input", __FILE__, __LINE__);
16453   auto saved_ctx = isl_union_pw_aff_list_get_ctx(obj.get());
16454   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16455   char *str = isl_union_pw_aff_list_to_str(obj.get());
16456   if (!str)
16457     exception::throw_last_error(saved_ctx);
16458   os << str;
16459   free(str);
16460   return os;
16461 }
16462 
16463 // implementations for isl::union_pw_multi_aff
manage(__isl_take isl_union_pw_multi_aff * ptr)16464 union_pw_multi_aff manage(__isl_take isl_union_pw_multi_aff *ptr) {
16465   if (!ptr)
16466     exception::throw_invalid("NULL input", __FILE__, __LINE__);
16467   return union_pw_multi_aff(ptr);
16468 }
manage_copy(__isl_keep isl_union_pw_multi_aff * ptr)16469 union_pw_multi_aff manage_copy(__isl_keep isl_union_pw_multi_aff *ptr) {
16470   if (!ptr)
16471     exception::throw_invalid("NULL input", __FILE__, __LINE__);
16472   auto saved_ctx = isl_union_pw_multi_aff_get_ctx(ptr);
16473   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16474   ptr = isl_union_pw_multi_aff_copy(ptr);
16475   if (!ptr)
16476     exception::throw_last_error(saved_ctx);
16477   return union_pw_multi_aff(ptr);
16478 }
16479 
union_pw_multi_aff()16480 union_pw_multi_aff::union_pw_multi_aff()
16481     : ptr(nullptr) {}
16482 
union_pw_multi_aff(const union_pw_multi_aff & obj)16483 union_pw_multi_aff::union_pw_multi_aff(const union_pw_multi_aff &obj)
16484     : ptr(nullptr)
16485 {
16486   if (!obj.ptr)
16487     exception::throw_invalid("NULL input", __FILE__, __LINE__);
16488   auto saved_ctx = isl_union_pw_multi_aff_get_ctx(obj.ptr);
16489   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16490   ptr = obj.copy();
16491   if (!ptr)
16492     exception::throw_last_error(saved_ctx);
16493 }
16494 
union_pw_multi_aff(__isl_take isl_union_pw_multi_aff * ptr)16495 union_pw_multi_aff::union_pw_multi_aff(__isl_take isl_union_pw_multi_aff *ptr)
16496     : ptr(ptr) {}
16497 
union_pw_multi_aff(isl::pw_multi_aff pma)16498 union_pw_multi_aff::union_pw_multi_aff(isl::pw_multi_aff pma)
16499 {
16500   if (pma.is_null())
16501     exception::throw_invalid("NULL input", __FILE__, __LINE__);
16502   auto saved_ctx = pma.ctx();
16503   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16504   auto res = isl_union_pw_multi_aff_from_pw_multi_aff(pma.release());
16505   if (!res)
16506     exception::throw_last_error(saved_ctx);
16507   ptr = res;
16508 }
16509 
union_pw_multi_aff(isl::union_pw_aff upa)16510 union_pw_multi_aff::union_pw_multi_aff(isl::union_pw_aff upa)
16511 {
16512   if (upa.is_null())
16513     exception::throw_invalid("NULL input", __FILE__, __LINE__);
16514   auto saved_ctx = upa.ctx();
16515   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16516   auto res = isl_union_pw_multi_aff_from_union_pw_aff(upa.release());
16517   if (!res)
16518     exception::throw_last_error(saved_ctx);
16519   ptr = res;
16520 }
16521 
union_pw_multi_aff(isl::ctx ctx,const std::string & str)16522 union_pw_multi_aff::union_pw_multi_aff(isl::ctx ctx, const std::string &str)
16523 {
16524   auto saved_ctx = ctx;
16525   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16526   auto res = isl_union_pw_multi_aff_read_from_str(ctx.release(), str.c_str());
16527   if (!res)
16528     exception::throw_last_error(saved_ctx);
16529   ptr = res;
16530 }
16531 
16532 union_pw_multi_aff &union_pw_multi_aff::operator=(union_pw_multi_aff obj) {
16533   std::swap(this->ptr, obj.ptr);
16534   return *this;
16535 }
16536 
~union_pw_multi_aff()16537 union_pw_multi_aff::~union_pw_multi_aff() {
16538   if (ptr)
16539     isl_union_pw_multi_aff_free(ptr);
16540 }
16541 
copy()16542 __isl_give isl_union_pw_multi_aff *union_pw_multi_aff::copy() const & {
16543   return isl_union_pw_multi_aff_copy(ptr);
16544 }
16545 
get()16546 __isl_keep isl_union_pw_multi_aff *union_pw_multi_aff::get() const {
16547   return ptr;
16548 }
16549 
release()16550 __isl_give isl_union_pw_multi_aff *union_pw_multi_aff::release() {
16551   isl_union_pw_multi_aff *tmp = ptr;
16552   ptr = nullptr;
16553   return tmp;
16554 }
16555 
is_null()16556 bool union_pw_multi_aff::is_null() const {
16557   return ptr == nullptr;
16558 }
16559 
ctx()16560 isl::ctx union_pw_multi_aff::ctx() const {
16561   return isl::ctx(isl_union_pw_multi_aff_get_ctx(ptr));
16562 }
16563 
add(isl::union_pw_multi_aff upma2)16564 isl::union_pw_multi_aff union_pw_multi_aff::add(isl::union_pw_multi_aff upma2) const
16565 {
16566   if (!ptr || upma2.is_null())
16567     exception::throw_invalid("NULL input", __FILE__, __LINE__);
16568   auto saved_ctx = ctx();
16569   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16570   auto res = isl_union_pw_multi_aff_add(copy(), upma2.release());
16571   if (!res)
16572     exception::throw_last_error(saved_ctx);
16573   return manage(res);
16574 }
16575 
as_pw_multi_aff()16576 isl::pw_multi_aff union_pw_multi_aff::as_pw_multi_aff() const
16577 {
16578   if (!ptr)
16579     exception::throw_invalid("NULL input", __FILE__, __LINE__);
16580   auto saved_ctx = ctx();
16581   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16582   auto res = isl_union_pw_multi_aff_as_pw_multi_aff(copy());
16583   if (!res)
16584     exception::throw_last_error(saved_ctx);
16585   return manage(res);
16586 }
16587 
coalesce()16588 isl::union_pw_multi_aff union_pw_multi_aff::coalesce() const
16589 {
16590   if (!ptr)
16591     exception::throw_invalid("NULL input", __FILE__, __LINE__);
16592   auto saved_ctx = ctx();
16593   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16594   auto res = isl_union_pw_multi_aff_coalesce(copy());
16595   if (!res)
16596     exception::throw_last_error(saved_ctx);
16597   return manage(res);
16598 }
16599 
domain()16600 isl::union_set union_pw_multi_aff::domain() const
16601 {
16602   if (!ptr)
16603     exception::throw_invalid("NULL input", __FILE__, __LINE__);
16604   auto saved_ctx = ctx();
16605   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16606   auto res = isl_union_pw_multi_aff_domain(copy());
16607   if (!res)
16608     exception::throw_last_error(saved_ctx);
16609   return manage(res);
16610 }
16611 
empty(isl::ctx ctx)16612 isl::union_pw_multi_aff union_pw_multi_aff::empty(isl::ctx ctx)
16613 {
16614   auto saved_ctx = ctx;
16615   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16616   auto res = isl_union_pw_multi_aff_empty_ctx(ctx.release());
16617   if (!res)
16618     exception::throw_last_error(saved_ctx);
16619   return manage(res);
16620 }
16621 
extract_pw_multi_aff(isl::space space)16622 isl::pw_multi_aff union_pw_multi_aff::extract_pw_multi_aff(isl::space space) const
16623 {
16624   if (!ptr || space.is_null())
16625     exception::throw_invalid("NULL input", __FILE__, __LINE__);
16626   auto saved_ctx = ctx();
16627   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16628   auto res = isl_union_pw_multi_aff_extract_pw_multi_aff(get(), space.release());
16629   if (!res)
16630     exception::throw_last_error(saved_ctx);
16631   return manage(res);
16632 }
16633 
flat_range_product(isl::union_pw_multi_aff upma2)16634 isl::union_pw_multi_aff union_pw_multi_aff::flat_range_product(isl::union_pw_multi_aff upma2) const
16635 {
16636   if (!ptr || upma2.is_null())
16637     exception::throw_invalid("NULL input", __FILE__, __LINE__);
16638   auto saved_ctx = ctx();
16639   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16640   auto res = isl_union_pw_multi_aff_flat_range_product(copy(), upma2.release());
16641   if (!res)
16642     exception::throw_last_error(saved_ctx);
16643   return manage(res);
16644 }
16645 
space()16646 isl::space union_pw_multi_aff::space() const
16647 {
16648   if (!ptr)
16649     exception::throw_invalid("NULL input", __FILE__, __LINE__);
16650   auto saved_ctx = ctx();
16651   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16652   auto res = isl_union_pw_multi_aff_get_space(get());
16653   if (!res)
16654     exception::throw_last_error(saved_ctx);
16655   return manage(res);
16656 }
16657 
get_space()16658 isl::space union_pw_multi_aff::get_space() const
16659 {
16660   return space();
16661 }
16662 
gist(isl::union_set context)16663 isl::union_pw_multi_aff union_pw_multi_aff::gist(isl::union_set context) const
16664 {
16665   if (!ptr || context.is_null())
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_pw_multi_aff_gist(copy(), context.release());
16670   if (!res)
16671     exception::throw_last_error(saved_ctx);
16672   return manage(res);
16673 }
16674 
intersect_domain(isl::union_set uset)16675 isl::union_pw_multi_aff union_pw_multi_aff::intersect_domain(isl::union_set uset) const
16676 {
16677   if (!ptr || uset.is_null())
16678     exception::throw_invalid("NULL input", __FILE__, __LINE__);
16679   auto saved_ctx = ctx();
16680   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16681   auto res = isl_union_pw_multi_aff_intersect_domain(copy(), uset.release());
16682   if (!res)
16683     exception::throw_last_error(saved_ctx);
16684   return manage(res);
16685 }
16686 
intersect_domain_wrapped_domain(isl::union_set uset)16687 isl::union_pw_multi_aff union_pw_multi_aff::intersect_domain_wrapped_domain(isl::union_set uset) const
16688 {
16689   if (!ptr || uset.is_null())
16690     exception::throw_invalid("NULL input", __FILE__, __LINE__);
16691   auto saved_ctx = ctx();
16692   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16693   auto res = isl_union_pw_multi_aff_intersect_domain_wrapped_domain(copy(), uset.release());
16694   if (!res)
16695     exception::throw_last_error(saved_ctx);
16696   return manage(res);
16697 }
16698 
intersect_domain_wrapped_range(isl::union_set uset)16699 isl::union_pw_multi_aff union_pw_multi_aff::intersect_domain_wrapped_range(isl::union_set uset) const
16700 {
16701   if (!ptr || uset.is_null())
16702     exception::throw_invalid("NULL input", __FILE__, __LINE__);
16703   auto saved_ctx = ctx();
16704   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16705   auto res = isl_union_pw_multi_aff_intersect_domain_wrapped_range(copy(), uset.release());
16706   if (!res)
16707     exception::throw_last_error(saved_ctx);
16708   return manage(res);
16709 }
16710 
intersect_params(isl::set set)16711 isl::union_pw_multi_aff union_pw_multi_aff::intersect_params(isl::set set) const
16712 {
16713   if (!ptr || set.is_null())
16714     exception::throw_invalid("NULL input", __FILE__, __LINE__);
16715   auto saved_ctx = ctx();
16716   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16717   auto res = isl_union_pw_multi_aff_intersect_params(copy(), set.release());
16718   if (!res)
16719     exception::throw_last_error(saved_ctx);
16720   return manage(res);
16721 }
16722 
isa_pw_multi_aff()16723 bool union_pw_multi_aff::isa_pw_multi_aff() const
16724 {
16725   if (!ptr)
16726     exception::throw_invalid("NULL input", __FILE__, __LINE__);
16727   auto saved_ctx = ctx();
16728   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16729   auto res = isl_union_pw_multi_aff_isa_pw_multi_aff(get());
16730   if (res < 0)
16731     exception::throw_last_error(saved_ctx);
16732   return res;
16733 }
16734 
pullback(isl::union_pw_multi_aff upma2)16735 isl::union_pw_multi_aff union_pw_multi_aff::pullback(isl::union_pw_multi_aff upma2) const
16736 {
16737   if (!ptr || upma2.is_null())
16738     exception::throw_invalid("NULL input", __FILE__, __LINE__);
16739   auto saved_ctx = ctx();
16740   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16741   auto res = isl_union_pw_multi_aff_pullback_union_pw_multi_aff(copy(), upma2.release());
16742   if (!res)
16743     exception::throw_last_error(saved_ctx);
16744   return manage(res);
16745 }
16746 
range_factor_domain()16747 isl::union_pw_multi_aff union_pw_multi_aff::range_factor_domain() const
16748 {
16749   if (!ptr)
16750     exception::throw_invalid("NULL input", __FILE__, __LINE__);
16751   auto saved_ctx = ctx();
16752   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16753   auto res = isl_union_pw_multi_aff_range_factor_domain(copy());
16754   if (!res)
16755     exception::throw_last_error(saved_ctx);
16756   return manage(res);
16757 }
16758 
range_factor_range()16759 isl::union_pw_multi_aff union_pw_multi_aff::range_factor_range() const
16760 {
16761   if (!ptr)
16762     exception::throw_invalid("NULL input", __FILE__, __LINE__);
16763   auto saved_ctx = ctx();
16764   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16765   auto res = isl_union_pw_multi_aff_range_factor_range(copy());
16766   if (!res)
16767     exception::throw_last_error(saved_ctx);
16768   return manage(res);
16769 }
16770 
sub(isl::union_pw_multi_aff upma2)16771 isl::union_pw_multi_aff union_pw_multi_aff::sub(isl::union_pw_multi_aff upma2) const
16772 {
16773   if (!ptr || upma2.is_null())
16774     exception::throw_invalid("NULL input", __FILE__, __LINE__);
16775   auto saved_ctx = ctx();
16776   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16777   auto res = isl_union_pw_multi_aff_sub(copy(), upma2.release());
16778   if (!res)
16779     exception::throw_last_error(saved_ctx);
16780   return manage(res);
16781 }
16782 
subtract_domain(isl::union_set uset)16783 isl::union_pw_multi_aff union_pw_multi_aff::subtract_domain(isl::union_set uset) const
16784 {
16785   if (!ptr || uset.is_null())
16786     exception::throw_invalid("NULL input", __FILE__, __LINE__);
16787   auto saved_ctx = ctx();
16788   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16789   auto res = isl_union_pw_multi_aff_subtract_domain(copy(), uset.release());
16790   if (!res)
16791     exception::throw_last_error(saved_ctx);
16792   return manage(res);
16793 }
16794 
union_add(isl::union_pw_multi_aff upma2)16795 isl::union_pw_multi_aff union_pw_multi_aff::union_add(isl::union_pw_multi_aff upma2) const
16796 {
16797   if (!ptr || upma2.is_null())
16798     exception::throw_invalid("NULL input", __FILE__, __LINE__);
16799   auto saved_ctx = ctx();
16800   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16801   auto res = isl_union_pw_multi_aff_union_add(copy(), upma2.release());
16802   if (!res)
16803     exception::throw_last_error(saved_ctx);
16804   return manage(res);
16805 }
16806 
16807 inline std::ostream &operator<<(std::ostream &os, const union_pw_multi_aff &obj)
16808 {
16809   if (!obj.get())
16810     exception::throw_invalid("NULL input", __FILE__, __LINE__);
16811   auto saved_ctx = isl_union_pw_multi_aff_get_ctx(obj.get());
16812   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16813   char *str = isl_union_pw_multi_aff_to_str(obj.get());
16814   if (!str)
16815     exception::throw_last_error(saved_ctx);
16816   os << str;
16817   free(str);
16818   return os;
16819 }
16820 
16821 // implementations for isl::union_set
manage(__isl_take isl_union_set * ptr)16822 union_set manage(__isl_take isl_union_set *ptr) {
16823   if (!ptr)
16824     exception::throw_invalid("NULL input", __FILE__, __LINE__);
16825   return union_set(ptr);
16826 }
manage_copy(__isl_keep isl_union_set * ptr)16827 union_set manage_copy(__isl_keep isl_union_set *ptr) {
16828   if (!ptr)
16829     exception::throw_invalid("NULL input", __FILE__, __LINE__);
16830   auto saved_ctx = isl_union_set_get_ctx(ptr);
16831   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16832   ptr = isl_union_set_copy(ptr);
16833   if (!ptr)
16834     exception::throw_last_error(saved_ctx);
16835   return union_set(ptr);
16836 }
16837 
union_set()16838 union_set::union_set()
16839     : ptr(nullptr) {}
16840 
union_set(const union_set & obj)16841 union_set::union_set(const union_set &obj)
16842     : ptr(nullptr)
16843 {
16844   if (!obj.ptr)
16845     exception::throw_invalid("NULL input", __FILE__, __LINE__);
16846   auto saved_ctx = isl_union_set_get_ctx(obj.ptr);
16847   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16848   ptr = obj.copy();
16849   if (!ptr)
16850     exception::throw_last_error(saved_ctx);
16851 }
16852 
union_set(__isl_take isl_union_set * ptr)16853 union_set::union_set(__isl_take isl_union_set *ptr)
16854     : ptr(ptr) {}
16855 
union_set(isl::basic_set bset)16856 union_set::union_set(isl::basic_set bset)
16857 {
16858   if (bset.is_null())
16859     exception::throw_invalid("NULL input", __FILE__, __LINE__);
16860   auto saved_ctx = bset.ctx();
16861   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16862   auto res = isl_union_set_from_basic_set(bset.release());
16863   if (!res)
16864     exception::throw_last_error(saved_ctx);
16865   ptr = res;
16866 }
16867 
union_set(isl::point pnt)16868 union_set::union_set(isl::point pnt)
16869 {
16870   if (pnt.is_null())
16871     exception::throw_invalid("NULL input", __FILE__, __LINE__);
16872   auto saved_ctx = pnt.ctx();
16873   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16874   auto res = isl_union_set_from_point(pnt.release());
16875   if (!res)
16876     exception::throw_last_error(saved_ctx);
16877   ptr = res;
16878 }
16879 
union_set(isl::set set)16880 union_set::union_set(isl::set set)
16881 {
16882   if (set.is_null())
16883     exception::throw_invalid("NULL input", __FILE__, __LINE__);
16884   auto saved_ctx = set.ctx();
16885   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16886   auto res = isl_union_set_from_set(set.release());
16887   if (!res)
16888     exception::throw_last_error(saved_ctx);
16889   ptr = res;
16890 }
16891 
union_set(isl::ctx ctx,const std::string & str)16892 union_set::union_set(isl::ctx ctx, const std::string &str)
16893 {
16894   auto saved_ctx = ctx;
16895   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16896   auto res = isl_union_set_read_from_str(ctx.release(), str.c_str());
16897   if (!res)
16898     exception::throw_last_error(saved_ctx);
16899   ptr = res;
16900 }
16901 
16902 union_set &union_set::operator=(union_set obj) {
16903   std::swap(this->ptr, obj.ptr);
16904   return *this;
16905 }
16906 
~union_set()16907 union_set::~union_set() {
16908   if (ptr)
16909     isl_union_set_free(ptr);
16910 }
16911 
copy()16912 __isl_give isl_union_set *union_set::copy() const & {
16913   return isl_union_set_copy(ptr);
16914 }
16915 
get()16916 __isl_keep isl_union_set *union_set::get() const {
16917   return ptr;
16918 }
16919 
release()16920 __isl_give isl_union_set *union_set::release() {
16921   isl_union_set *tmp = ptr;
16922   ptr = nullptr;
16923   return tmp;
16924 }
16925 
is_null()16926 bool union_set::is_null() const {
16927   return ptr == nullptr;
16928 }
16929 
ctx()16930 isl::ctx union_set::ctx() const {
16931   return isl::ctx(isl_union_set_get_ctx(ptr));
16932 }
16933 
affine_hull()16934 isl::union_set union_set::affine_hull() const
16935 {
16936   if (!ptr)
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_set_affine_hull(copy());
16941   if (!res)
16942     exception::throw_last_error(saved_ctx);
16943   return manage(res);
16944 }
16945 
apply(isl::union_map umap)16946 isl::union_set union_set::apply(isl::union_map umap) const
16947 {
16948   if (!ptr || umap.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_set_apply(copy(), umap.release());
16953   if (!res)
16954     exception::throw_last_error(saved_ctx);
16955   return manage(res);
16956 }
16957 
coalesce()16958 isl::union_set union_set::coalesce() const
16959 {
16960   if (!ptr)
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_set_coalesce(copy());
16965   if (!res)
16966     exception::throw_last_error(saved_ctx);
16967   return manage(res);
16968 }
16969 
compute_divs()16970 isl::union_set union_set::compute_divs() const
16971 {
16972   if (!ptr)
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_set_compute_divs(copy());
16977   if (!res)
16978     exception::throw_last_error(saved_ctx);
16979   return manage(res);
16980 }
16981 
detect_equalities()16982 isl::union_set union_set::detect_equalities() const
16983 {
16984   if (!ptr)
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_set_detect_equalities(copy());
16989   if (!res)
16990     exception::throw_last_error(saved_ctx);
16991   return manage(res);
16992 }
16993 
empty(isl::ctx ctx)16994 isl::union_set union_set::empty(isl::ctx ctx)
16995 {
16996   auto saved_ctx = ctx;
16997   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
16998   auto res = isl_union_set_empty_ctx(ctx.release());
16999   if (!res)
17000     exception::throw_last_error(saved_ctx);
17001   return manage(res);
17002 }
17003 
every_set(const std::function<bool (isl::set)> & test)17004 bool union_set::every_set(const std::function<bool(isl::set)> &test) const
17005 {
17006   if (!ptr)
17007     exception::throw_invalid("NULL input", __FILE__, __LINE__);
17008   auto saved_ctx = ctx();
17009   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17010   struct test_data {
17011     std::function<bool(isl::set)> func;
17012     std::exception_ptr eptr;
17013   } test_data = { test };
17014   auto test_lambda = [](isl_set *arg_0, void *arg_1) -> isl_bool {
17015     auto *data = static_cast<struct test_data *>(arg_1);
17016     ISL_CPP_TRY {
17017       auto ret = (data->func)(manage_copy(arg_0));
17018       return ret ? isl_bool_true : isl_bool_false;
17019     } ISL_CPP_CATCH_ALL {
17020       data->eptr = std::current_exception();
17021       return isl_bool_error;
17022     }
17023   };
17024   auto res = isl_union_set_every_set(get(), test_lambda, &test_data);
17025   if (test_data.eptr)
17026     std::rethrow_exception(test_data.eptr);
17027   if (res < 0)
17028     exception::throw_last_error(saved_ctx);
17029   return res;
17030 }
17031 
extract_set(isl::space space)17032 isl::set union_set::extract_set(isl::space space) const
17033 {
17034   if (!ptr || space.is_null())
17035     exception::throw_invalid("NULL input", __FILE__, __LINE__);
17036   auto saved_ctx = ctx();
17037   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17038   auto res = isl_union_set_extract_set(get(), space.release());
17039   if (!res)
17040     exception::throw_last_error(saved_ctx);
17041   return manage(res);
17042 }
17043 
foreach_point(const std::function<void (isl::point)> & fn)17044 void union_set::foreach_point(const std::function<void(isl::point)> &fn) const
17045 {
17046   if (!ptr)
17047     exception::throw_invalid("NULL input", __FILE__, __LINE__);
17048   auto saved_ctx = ctx();
17049   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17050   struct fn_data {
17051     std::function<void(isl::point)> func;
17052     std::exception_ptr eptr;
17053   } fn_data = { fn };
17054   auto fn_lambda = [](isl_point *arg_0, void *arg_1) -> isl_stat {
17055     auto *data = static_cast<struct fn_data *>(arg_1);
17056     ISL_CPP_TRY {
17057       (data->func)(manage(arg_0));
17058       return isl_stat_ok;
17059     } ISL_CPP_CATCH_ALL {
17060       data->eptr = std::current_exception();
17061       return isl_stat_error;
17062     }
17063   };
17064   auto res = isl_union_set_foreach_point(get(), fn_lambda, &fn_data);
17065   if (fn_data.eptr)
17066     std::rethrow_exception(fn_data.eptr);
17067   if (res < 0)
17068     exception::throw_last_error(saved_ctx);
17069   return;
17070 }
17071 
foreach_set(const std::function<void (isl::set)> & fn)17072 void union_set::foreach_set(const std::function<void(isl::set)> &fn) const
17073 {
17074   if (!ptr)
17075     exception::throw_invalid("NULL input", __FILE__, __LINE__);
17076   auto saved_ctx = ctx();
17077   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17078   struct fn_data {
17079     std::function<void(isl::set)> func;
17080     std::exception_ptr eptr;
17081   } fn_data = { fn };
17082   auto fn_lambda = [](isl_set *arg_0, void *arg_1) -> isl_stat {
17083     auto *data = static_cast<struct fn_data *>(arg_1);
17084     ISL_CPP_TRY {
17085       (data->func)(manage(arg_0));
17086       return isl_stat_ok;
17087     } ISL_CPP_CATCH_ALL {
17088       data->eptr = std::current_exception();
17089       return isl_stat_error;
17090     }
17091   };
17092   auto res = isl_union_set_foreach_set(get(), fn_lambda, &fn_data);
17093   if (fn_data.eptr)
17094     std::rethrow_exception(fn_data.eptr);
17095   if (res < 0)
17096     exception::throw_last_error(saved_ctx);
17097   return;
17098 }
17099 
space()17100 isl::space union_set::space() const
17101 {
17102   if (!ptr)
17103     exception::throw_invalid("NULL input", __FILE__, __LINE__);
17104   auto saved_ctx = ctx();
17105   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17106   auto res = isl_union_set_get_space(get());
17107   if (!res)
17108     exception::throw_last_error(saved_ctx);
17109   return manage(res);
17110 }
17111 
get_space()17112 isl::space union_set::get_space() const
17113 {
17114   return space();
17115 }
17116 
gist(isl::union_set context)17117 isl::union_set union_set::gist(isl::union_set context) const
17118 {
17119   if (!ptr || context.is_null())
17120     exception::throw_invalid("NULL input", __FILE__, __LINE__);
17121   auto saved_ctx = ctx();
17122   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17123   auto res = isl_union_set_gist(copy(), context.release());
17124   if (!res)
17125     exception::throw_last_error(saved_ctx);
17126   return manage(res);
17127 }
17128 
gist_params(isl::set set)17129 isl::union_set union_set::gist_params(isl::set set) const
17130 {
17131   if (!ptr || set.is_null())
17132     exception::throw_invalid("NULL input", __FILE__, __LINE__);
17133   auto saved_ctx = ctx();
17134   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17135   auto res = isl_union_set_gist_params(copy(), set.release());
17136   if (!res)
17137     exception::throw_last_error(saved_ctx);
17138   return manage(res);
17139 }
17140 
identity()17141 isl::union_map union_set::identity() const
17142 {
17143   if (!ptr)
17144     exception::throw_invalid("NULL input", __FILE__, __LINE__);
17145   auto saved_ctx = ctx();
17146   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17147   auto res = isl_union_set_identity(copy());
17148   if (!res)
17149     exception::throw_last_error(saved_ctx);
17150   return manage(res);
17151 }
17152 
intersect(isl::union_set uset2)17153 isl::union_set union_set::intersect(isl::union_set uset2) const
17154 {
17155   if (!ptr || uset2.is_null())
17156     exception::throw_invalid("NULL input", __FILE__, __LINE__);
17157   auto saved_ctx = ctx();
17158   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17159   auto res = isl_union_set_intersect(copy(), uset2.release());
17160   if (!res)
17161     exception::throw_last_error(saved_ctx);
17162   return manage(res);
17163 }
17164 
intersect_params(isl::set set)17165 isl::union_set union_set::intersect_params(isl::set set) const
17166 {
17167   if (!ptr || set.is_null())
17168     exception::throw_invalid("NULL input", __FILE__, __LINE__);
17169   auto saved_ctx = ctx();
17170   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17171   auto res = isl_union_set_intersect_params(copy(), set.release());
17172   if (!res)
17173     exception::throw_last_error(saved_ctx);
17174   return manage(res);
17175 }
17176 
is_disjoint(const isl::union_set & uset2)17177 bool union_set::is_disjoint(const isl::union_set &uset2) const
17178 {
17179   if (!ptr || uset2.is_null())
17180     exception::throw_invalid("NULL input", __FILE__, __LINE__);
17181   auto saved_ctx = ctx();
17182   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17183   auto res = isl_union_set_is_disjoint(get(), uset2.get());
17184   if (res < 0)
17185     exception::throw_last_error(saved_ctx);
17186   return res;
17187 }
17188 
is_empty()17189 bool union_set::is_empty() const
17190 {
17191   if (!ptr)
17192     exception::throw_invalid("NULL input", __FILE__, __LINE__);
17193   auto saved_ctx = ctx();
17194   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17195   auto res = isl_union_set_is_empty(get());
17196   if (res < 0)
17197     exception::throw_last_error(saved_ctx);
17198   return res;
17199 }
17200 
is_equal(const isl::union_set & uset2)17201 bool union_set::is_equal(const isl::union_set &uset2) const
17202 {
17203   if (!ptr || uset2.is_null())
17204     exception::throw_invalid("NULL input", __FILE__, __LINE__);
17205   auto saved_ctx = ctx();
17206   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17207   auto res = isl_union_set_is_equal(get(), uset2.get());
17208   if (res < 0)
17209     exception::throw_last_error(saved_ctx);
17210   return res;
17211 }
17212 
is_strict_subset(const isl::union_set & uset2)17213 bool union_set::is_strict_subset(const isl::union_set &uset2) const
17214 {
17215   if (!ptr || uset2.is_null())
17216     exception::throw_invalid("NULL input", __FILE__, __LINE__);
17217   auto saved_ctx = ctx();
17218   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17219   auto res = isl_union_set_is_strict_subset(get(), uset2.get());
17220   if (res < 0)
17221     exception::throw_last_error(saved_ctx);
17222   return res;
17223 }
17224 
is_subset(const isl::union_set & uset2)17225 bool union_set::is_subset(const isl::union_set &uset2) const
17226 {
17227   if (!ptr || uset2.is_null())
17228     exception::throw_invalid("NULL input", __FILE__, __LINE__);
17229   auto saved_ctx = ctx();
17230   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17231   auto res = isl_union_set_is_subset(get(), uset2.get());
17232   if (res < 0)
17233     exception::throw_last_error(saved_ctx);
17234   return res;
17235 }
17236 
isa_set()17237 bool union_set::isa_set() const
17238 {
17239   if (!ptr)
17240     exception::throw_invalid("NULL input", __FILE__, __LINE__);
17241   auto saved_ctx = ctx();
17242   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17243   auto res = isl_union_set_isa_set(get());
17244   if (res < 0)
17245     exception::throw_last_error(saved_ctx);
17246   return res;
17247 }
17248 
lexmax()17249 isl::union_set union_set::lexmax() const
17250 {
17251   if (!ptr)
17252     exception::throw_invalid("NULL input", __FILE__, __LINE__);
17253   auto saved_ctx = ctx();
17254   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17255   auto res = isl_union_set_lexmax(copy());
17256   if (!res)
17257     exception::throw_last_error(saved_ctx);
17258   return manage(res);
17259 }
17260 
lexmin()17261 isl::union_set union_set::lexmin() const
17262 {
17263   if (!ptr)
17264     exception::throw_invalid("NULL input", __FILE__, __LINE__);
17265   auto saved_ctx = ctx();
17266   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17267   auto res = isl_union_set_lexmin(copy());
17268   if (!res)
17269     exception::throw_last_error(saved_ctx);
17270   return manage(res);
17271 }
17272 
polyhedral_hull()17273 isl::union_set union_set::polyhedral_hull() const
17274 {
17275   if (!ptr)
17276     exception::throw_invalid("NULL input", __FILE__, __LINE__);
17277   auto saved_ctx = ctx();
17278   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17279   auto res = isl_union_set_polyhedral_hull(copy());
17280   if (!res)
17281     exception::throw_last_error(saved_ctx);
17282   return manage(res);
17283 }
17284 
preimage(isl::multi_aff ma)17285 isl::union_set union_set::preimage(isl::multi_aff ma) const
17286 {
17287   if (!ptr || ma.is_null())
17288     exception::throw_invalid("NULL input", __FILE__, __LINE__);
17289   auto saved_ctx = ctx();
17290   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17291   auto res = isl_union_set_preimage_multi_aff(copy(), ma.release());
17292   if (!res)
17293     exception::throw_last_error(saved_ctx);
17294   return manage(res);
17295 }
17296 
preimage(isl::pw_multi_aff pma)17297 isl::union_set union_set::preimage(isl::pw_multi_aff pma) const
17298 {
17299   if (!ptr || pma.is_null())
17300     exception::throw_invalid("NULL input", __FILE__, __LINE__);
17301   auto saved_ctx = ctx();
17302   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17303   auto res = isl_union_set_preimage_pw_multi_aff(copy(), pma.release());
17304   if (!res)
17305     exception::throw_last_error(saved_ctx);
17306   return manage(res);
17307 }
17308 
preimage(isl::union_pw_multi_aff upma)17309 isl::union_set union_set::preimage(isl::union_pw_multi_aff upma) const
17310 {
17311   if (!ptr || upma.is_null())
17312     exception::throw_invalid("NULL input", __FILE__, __LINE__);
17313   auto saved_ctx = ctx();
17314   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17315   auto res = isl_union_set_preimage_union_pw_multi_aff(copy(), upma.release());
17316   if (!res)
17317     exception::throw_last_error(saved_ctx);
17318   return manage(res);
17319 }
17320 
sample_point()17321 isl::point union_set::sample_point() const
17322 {
17323   if (!ptr)
17324     exception::throw_invalid("NULL input", __FILE__, __LINE__);
17325   auto saved_ctx = ctx();
17326   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17327   auto res = isl_union_set_sample_point(copy());
17328   if (!res)
17329     exception::throw_last_error(saved_ctx);
17330   return manage(res);
17331 }
17332 
subtract(isl::union_set uset2)17333 isl::union_set union_set::subtract(isl::union_set uset2) const
17334 {
17335   if (!ptr || uset2.is_null())
17336     exception::throw_invalid("NULL input", __FILE__, __LINE__);
17337   auto saved_ctx = ctx();
17338   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17339   auto res = isl_union_set_subtract(copy(), uset2.release());
17340   if (!res)
17341     exception::throw_last_error(saved_ctx);
17342   return manage(res);
17343 }
17344 
unite(isl::union_set uset2)17345 isl::union_set union_set::unite(isl::union_set uset2) const
17346 {
17347   if (!ptr || uset2.is_null())
17348     exception::throw_invalid("NULL input", __FILE__, __LINE__);
17349   auto saved_ctx = ctx();
17350   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17351   auto res = isl_union_set_union(copy(), uset2.release());
17352   if (!res)
17353     exception::throw_last_error(saved_ctx);
17354   return manage(res);
17355 }
17356 
universe()17357 isl::union_set union_set::universe() const
17358 {
17359   if (!ptr)
17360     exception::throw_invalid("NULL input", __FILE__, __LINE__);
17361   auto saved_ctx = ctx();
17362   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17363   auto res = isl_union_set_universe(copy());
17364   if (!res)
17365     exception::throw_last_error(saved_ctx);
17366   return manage(res);
17367 }
17368 
unwrap()17369 isl::union_map union_set::unwrap() const
17370 {
17371   if (!ptr)
17372     exception::throw_invalid("NULL input", __FILE__, __LINE__);
17373   auto saved_ctx = ctx();
17374   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17375   auto res = isl_union_set_unwrap(copy());
17376   if (!res)
17377     exception::throw_last_error(saved_ctx);
17378   return manage(res);
17379 }
17380 
17381 inline std::ostream &operator<<(std::ostream &os, const union_set &obj)
17382 {
17383   if (!obj.get())
17384     exception::throw_invalid("NULL input", __FILE__, __LINE__);
17385   auto saved_ctx = isl_union_set_get_ctx(obj.get());
17386   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17387   char *str = isl_union_set_to_str(obj.get());
17388   if (!str)
17389     exception::throw_last_error(saved_ctx);
17390   os << str;
17391   free(str);
17392   return os;
17393 }
17394 
17395 // implementations for isl::union_set_list
manage(__isl_take isl_union_set_list * ptr)17396 union_set_list manage(__isl_take isl_union_set_list *ptr) {
17397   if (!ptr)
17398     exception::throw_invalid("NULL input", __FILE__, __LINE__);
17399   return union_set_list(ptr);
17400 }
manage_copy(__isl_keep isl_union_set_list * ptr)17401 union_set_list manage_copy(__isl_keep isl_union_set_list *ptr) {
17402   if (!ptr)
17403     exception::throw_invalid("NULL input", __FILE__, __LINE__);
17404   auto saved_ctx = isl_union_set_list_get_ctx(ptr);
17405   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17406   ptr = isl_union_set_list_copy(ptr);
17407   if (!ptr)
17408     exception::throw_last_error(saved_ctx);
17409   return union_set_list(ptr);
17410 }
17411 
union_set_list()17412 union_set_list::union_set_list()
17413     : ptr(nullptr) {}
17414 
union_set_list(const union_set_list & obj)17415 union_set_list::union_set_list(const union_set_list &obj)
17416     : ptr(nullptr)
17417 {
17418   if (!obj.ptr)
17419     exception::throw_invalid("NULL input", __FILE__, __LINE__);
17420   auto saved_ctx = isl_union_set_list_get_ctx(obj.ptr);
17421   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17422   ptr = obj.copy();
17423   if (!ptr)
17424     exception::throw_last_error(saved_ctx);
17425 }
17426 
union_set_list(__isl_take isl_union_set_list * ptr)17427 union_set_list::union_set_list(__isl_take isl_union_set_list *ptr)
17428     : ptr(ptr) {}
17429 
union_set_list(isl::ctx ctx,int n)17430 union_set_list::union_set_list(isl::ctx ctx, int n)
17431 {
17432   auto saved_ctx = ctx;
17433   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17434   auto res = isl_union_set_list_alloc(ctx.release(), n);
17435   if (!res)
17436     exception::throw_last_error(saved_ctx);
17437   ptr = res;
17438 }
17439 
union_set_list(isl::union_set el)17440 union_set_list::union_set_list(isl::union_set el)
17441 {
17442   if (el.is_null())
17443     exception::throw_invalid("NULL input", __FILE__, __LINE__);
17444   auto saved_ctx = el.ctx();
17445   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17446   auto res = isl_union_set_list_from_union_set(el.release());
17447   if (!res)
17448     exception::throw_last_error(saved_ctx);
17449   ptr = res;
17450 }
17451 
17452 union_set_list &union_set_list::operator=(union_set_list obj) {
17453   std::swap(this->ptr, obj.ptr);
17454   return *this;
17455 }
17456 
~union_set_list()17457 union_set_list::~union_set_list() {
17458   if (ptr)
17459     isl_union_set_list_free(ptr);
17460 }
17461 
copy()17462 __isl_give isl_union_set_list *union_set_list::copy() const & {
17463   return isl_union_set_list_copy(ptr);
17464 }
17465 
get()17466 __isl_keep isl_union_set_list *union_set_list::get() const {
17467   return ptr;
17468 }
17469 
release()17470 __isl_give isl_union_set_list *union_set_list::release() {
17471   isl_union_set_list *tmp = ptr;
17472   ptr = nullptr;
17473   return tmp;
17474 }
17475 
is_null()17476 bool union_set_list::is_null() const {
17477   return ptr == nullptr;
17478 }
17479 
ctx()17480 isl::ctx union_set_list::ctx() const {
17481   return isl::ctx(isl_union_set_list_get_ctx(ptr));
17482 }
17483 
add(isl::union_set el)17484 isl::union_set_list union_set_list::add(isl::union_set el) const
17485 {
17486   if (!ptr || el.is_null())
17487     exception::throw_invalid("NULL input", __FILE__, __LINE__);
17488   auto saved_ctx = ctx();
17489   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17490   auto res = isl_union_set_list_add(copy(), el.release());
17491   if (!res)
17492     exception::throw_last_error(saved_ctx);
17493   return manage(res);
17494 }
17495 
clear()17496 isl::union_set_list union_set_list::clear() const
17497 {
17498   if (!ptr)
17499     exception::throw_invalid("NULL input", __FILE__, __LINE__);
17500   auto saved_ctx = ctx();
17501   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17502   auto res = isl_union_set_list_clear(copy());
17503   if (!res)
17504     exception::throw_last_error(saved_ctx);
17505   return manage(res);
17506 }
17507 
concat(isl::union_set_list list2)17508 isl::union_set_list union_set_list::concat(isl::union_set_list list2) const
17509 {
17510   if (!ptr || list2.is_null())
17511     exception::throw_invalid("NULL input", __FILE__, __LINE__);
17512   auto saved_ctx = ctx();
17513   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17514   auto res = isl_union_set_list_concat(copy(), list2.release());
17515   if (!res)
17516     exception::throw_last_error(saved_ctx);
17517   return manage(res);
17518 }
17519 
foreach(const std::function<void (isl::union_set)> & fn)17520 void union_set_list::foreach(const std::function<void(isl::union_set)> &fn) const
17521 {
17522   if (!ptr)
17523     exception::throw_invalid("NULL input", __FILE__, __LINE__);
17524   auto saved_ctx = ctx();
17525   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17526   struct fn_data {
17527     std::function<void(isl::union_set)> func;
17528     std::exception_ptr eptr;
17529   } fn_data = { fn };
17530   auto fn_lambda = [](isl_union_set *arg_0, void *arg_1) -> isl_stat {
17531     auto *data = static_cast<struct fn_data *>(arg_1);
17532     ISL_CPP_TRY {
17533       (data->func)(manage(arg_0));
17534       return isl_stat_ok;
17535     } ISL_CPP_CATCH_ALL {
17536       data->eptr = std::current_exception();
17537       return isl_stat_error;
17538     }
17539   };
17540   auto res = isl_union_set_list_foreach(get(), fn_lambda, &fn_data);
17541   if (fn_data.eptr)
17542     std::rethrow_exception(fn_data.eptr);
17543   if (res < 0)
17544     exception::throw_last_error(saved_ctx);
17545   return;
17546 }
17547 
at(int index)17548 isl::union_set union_set_list::at(int index) 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_set_list_get_at(get(), index);
17555   if (!res)
17556     exception::throw_last_error(saved_ctx);
17557   return manage(res);
17558 }
17559 
get_at(int index)17560 isl::union_set union_set_list::get_at(int index) const
17561 {
17562   return at(index);
17563 }
17564 
size()17565 unsigned union_set_list::size() const
17566 {
17567   if (!ptr)
17568     exception::throw_invalid("NULL input", __FILE__, __LINE__);
17569   auto saved_ctx = ctx();
17570   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17571   auto res = isl_union_set_list_size(get());
17572   if (res < 0)
17573     exception::throw_last_error(saved_ctx);
17574   return res;
17575 }
17576 
17577 inline std::ostream &operator<<(std::ostream &os, const union_set_list &obj)
17578 {
17579   if (!obj.get())
17580     exception::throw_invalid("NULL input", __FILE__, __LINE__);
17581   auto saved_ctx = isl_union_set_list_get_ctx(obj.get());
17582   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17583   char *str = isl_union_set_list_to_str(obj.get());
17584   if (!str)
17585     exception::throw_last_error(saved_ctx);
17586   os << str;
17587   free(str);
17588   return os;
17589 }
17590 
17591 // implementations for isl::val
manage(__isl_take isl_val * ptr)17592 val manage(__isl_take isl_val *ptr) {
17593   if (!ptr)
17594     exception::throw_invalid("NULL input", __FILE__, __LINE__);
17595   return val(ptr);
17596 }
manage_copy(__isl_keep isl_val * ptr)17597 val manage_copy(__isl_keep isl_val *ptr) {
17598   if (!ptr)
17599     exception::throw_invalid("NULL input", __FILE__, __LINE__);
17600   auto saved_ctx = isl_val_get_ctx(ptr);
17601   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17602   ptr = isl_val_copy(ptr);
17603   if (!ptr)
17604     exception::throw_last_error(saved_ctx);
17605   return val(ptr);
17606 }
17607 
val()17608 val::val()
17609     : ptr(nullptr) {}
17610 
val(const val & obj)17611 val::val(const val &obj)
17612     : ptr(nullptr)
17613 {
17614   if (!obj.ptr)
17615     exception::throw_invalid("NULL input", __FILE__, __LINE__);
17616   auto saved_ctx = isl_val_get_ctx(obj.ptr);
17617   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17618   ptr = obj.copy();
17619   if (!ptr)
17620     exception::throw_last_error(saved_ctx);
17621 }
17622 
val(__isl_take isl_val * ptr)17623 val::val(__isl_take isl_val *ptr)
17624     : ptr(ptr) {}
17625 
val(isl::ctx ctx,long i)17626 val::val(isl::ctx ctx, long i)
17627 {
17628   auto saved_ctx = ctx;
17629   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17630   auto res = isl_val_int_from_si(ctx.release(), i);
17631   if (!res)
17632     exception::throw_last_error(saved_ctx);
17633   ptr = res;
17634 }
17635 
val(isl::ctx ctx,const std::string & str)17636 val::val(isl::ctx ctx, const std::string &str)
17637 {
17638   auto saved_ctx = ctx;
17639   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17640   auto res = isl_val_read_from_str(ctx.release(), str.c_str());
17641   if (!res)
17642     exception::throw_last_error(saved_ctx);
17643   ptr = res;
17644 }
17645 
17646 val &val::operator=(val obj) {
17647   std::swap(this->ptr, obj.ptr);
17648   return *this;
17649 }
17650 
~val()17651 val::~val() {
17652   if (ptr)
17653     isl_val_free(ptr);
17654 }
17655 
copy()17656 __isl_give isl_val *val::copy() const & {
17657   return isl_val_copy(ptr);
17658 }
17659 
get()17660 __isl_keep isl_val *val::get() const {
17661   return ptr;
17662 }
17663 
release()17664 __isl_give isl_val *val::release() {
17665   isl_val *tmp = ptr;
17666   ptr = nullptr;
17667   return tmp;
17668 }
17669 
is_null()17670 bool val::is_null() const {
17671   return ptr == nullptr;
17672 }
17673 
ctx()17674 isl::ctx val::ctx() const {
17675   return isl::ctx(isl_val_get_ctx(ptr));
17676 }
17677 
abs()17678 isl::val val::abs() const
17679 {
17680   if (!ptr)
17681     exception::throw_invalid("NULL input", __FILE__, __LINE__);
17682   auto saved_ctx = ctx();
17683   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17684   auto res = isl_val_abs(copy());
17685   if (!res)
17686     exception::throw_last_error(saved_ctx);
17687   return manage(res);
17688 }
17689 
abs_eq(const isl::val & v2)17690 bool val::abs_eq(const isl::val &v2) const
17691 {
17692   if (!ptr || v2.is_null())
17693     exception::throw_invalid("NULL input", __FILE__, __LINE__);
17694   auto saved_ctx = ctx();
17695   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17696   auto res = isl_val_abs_eq(get(), v2.get());
17697   if (res < 0)
17698     exception::throw_last_error(saved_ctx);
17699   return res;
17700 }
17701 
abs_eq(long v2)17702 bool val::abs_eq(long v2) const
17703 {
17704   if (!ptr)
17705     exception::throw_invalid("NULL input", __FILE__, __LINE__);
17706   return this->abs_eq(isl::val(ctx(), v2));
17707 }
17708 
add(isl::val v2)17709 isl::val val::add(isl::val v2) const
17710 {
17711   if (!ptr || v2.is_null())
17712     exception::throw_invalid("NULL input", __FILE__, __LINE__);
17713   auto saved_ctx = ctx();
17714   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17715   auto res = isl_val_add(copy(), v2.release());
17716   if (!res)
17717     exception::throw_last_error(saved_ctx);
17718   return manage(res);
17719 }
17720 
add(long v2)17721 isl::val val::add(long v2) const
17722 {
17723   if (!ptr)
17724     exception::throw_invalid("NULL input", __FILE__, __LINE__);
17725   return this->add(isl::val(ctx(), v2));
17726 }
17727 
ceil()17728 isl::val val::ceil() const
17729 {
17730   if (!ptr)
17731     exception::throw_invalid("NULL input", __FILE__, __LINE__);
17732   auto saved_ctx = ctx();
17733   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17734   auto res = isl_val_ceil(copy());
17735   if (!res)
17736     exception::throw_last_error(saved_ctx);
17737   return manage(res);
17738 }
17739 
cmp_si(long i)17740 int val::cmp_si(long i) const
17741 {
17742   if (!ptr)
17743     exception::throw_invalid("NULL input", __FILE__, __LINE__);
17744   auto saved_ctx = ctx();
17745   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17746   auto res = isl_val_cmp_si(get(), i);
17747   return res;
17748 }
17749 
div(isl::val v2)17750 isl::val val::div(isl::val v2) const
17751 {
17752   if (!ptr || v2.is_null())
17753     exception::throw_invalid("NULL input", __FILE__, __LINE__);
17754   auto saved_ctx = ctx();
17755   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17756   auto res = isl_val_div(copy(), v2.release());
17757   if (!res)
17758     exception::throw_last_error(saved_ctx);
17759   return manage(res);
17760 }
17761 
div(long v2)17762 isl::val val::div(long v2) const
17763 {
17764   if (!ptr)
17765     exception::throw_invalid("NULL input", __FILE__, __LINE__);
17766   return this->div(isl::val(ctx(), v2));
17767 }
17768 
eq(const isl::val & v2)17769 bool val::eq(const isl::val &v2) const
17770 {
17771   if (!ptr || v2.is_null())
17772     exception::throw_invalid("NULL input", __FILE__, __LINE__);
17773   auto saved_ctx = ctx();
17774   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17775   auto res = isl_val_eq(get(), v2.get());
17776   if (res < 0)
17777     exception::throw_last_error(saved_ctx);
17778   return res;
17779 }
17780 
eq(long v2)17781 bool val::eq(long v2) const
17782 {
17783   if (!ptr)
17784     exception::throw_invalid("NULL input", __FILE__, __LINE__);
17785   return this->eq(isl::val(ctx(), v2));
17786 }
17787 
floor()17788 isl::val val::floor() const
17789 {
17790   if (!ptr)
17791     exception::throw_invalid("NULL input", __FILE__, __LINE__);
17792   auto saved_ctx = ctx();
17793   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17794   auto res = isl_val_floor(copy());
17795   if (!res)
17796     exception::throw_last_error(saved_ctx);
17797   return manage(res);
17798 }
17799 
gcd(isl::val v2)17800 isl::val val::gcd(isl::val v2) const
17801 {
17802   if (!ptr || v2.is_null())
17803     exception::throw_invalid("NULL input", __FILE__, __LINE__);
17804   auto saved_ctx = ctx();
17805   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17806   auto res = isl_val_gcd(copy(), v2.release());
17807   if (!res)
17808     exception::throw_last_error(saved_ctx);
17809   return manage(res);
17810 }
17811 
gcd(long v2)17812 isl::val val::gcd(long v2) const
17813 {
17814   if (!ptr)
17815     exception::throw_invalid("NULL input", __FILE__, __LINE__);
17816   return this->gcd(isl::val(ctx(), v2));
17817 }
17818 
ge(const isl::val & v2)17819 bool val::ge(const isl::val &v2) const
17820 {
17821   if (!ptr || v2.is_null())
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_val_ge(get(), v2.get());
17826   if (res < 0)
17827     exception::throw_last_error(saved_ctx);
17828   return res;
17829 }
17830 
ge(long v2)17831 bool val::ge(long v2) const
17832 {
17833   if (!ptr)
17834     exception::throw_invalid("NULL input", __FILE__, __LINE__);
17835   return this->ge(isl::val(ctx(), v2));
17836 }
17837 
den_si()17838 long val::den_si() const
17839 {
17840   if (!ptr)
17841     exception::throw_invalid("NULL input", __FILE__, __LINE__);
17842   auto saved_ctx = ctx();
17843   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17844   auto res = isl_val_get_den_si(get());
17845   return res;
17846 }
17847 
get_den_si()17848 long val::get_den_si() const
17849 {
17850   return den_si();
17851 }
17852 
num_si()17853 long val::num_si() 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   auto res = isl_val_get_num_si(get());
17860   return res;
17861 }
17862 
get_num_si()17863 long val::get_num_si() const
17864 {
17865   return num_si();
17866 }
17867 
gt(const isl::val & v2)17868 bool val::gt(const isl::val &v2) const
17869 {
17870   if (!ptr || v2.is_null())
17871     exception::throw_invalid("NULL input", __FILE__, __LINE__);
17872   auto saved_ctx = ctx();
17873   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17874   auto res = isl_val_gt(get(), v2.get());
17875   if (res < 0)
17876     exception::throw_last_error(saved_ctx);
17877   return res;
17878 }
17879 
gt(long v2)17880 bool val::gt(long v2) const
17881 {
17882   if (!ptr)
17883     exception::throw_invalid("NULL input", __FILE__, __LINE__);
17884   return this->gt(isl::val(ctx(), v2));
17885 }
17886 
infty(isl::ctx ctx)17887 isl::val val::infty(isl::ctx ctx)
17888 {
17889   auto saved_ctx = ctx;
17890   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17891   auto res = isl_val_infty(ctx.release());
17892   if (!res)
17893     exception::throw_last_error(saved_ctx);
17894   return manage(res);
17895 }
17896 
inv()17897 isl::val val::inv() const
17898 {
17899   if (!ptr)
17900     exception::throw_invalid("NULL input", __FILE__, __LINE__);
17901   auto saved_ctx = ctx();
17902   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17903   auto res = isl_val_inv(copy());
17904   if (!res)
17905     exception::throw_last_error(saved_ctx);
17906   return manage(res);
17907 }
17908 
is_divisible_by(const isl::val & v2)17909 bool val::is_divisible_by(const isl::val &v2) const
17910 {
17911   if (!ptr || v2.is_null())
17912     exception::throw_invalid("NULL input", __FILE__, __LINE__);
17913   auto saved_ctx = ctx();
17914   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17915   auto res = isl_val_is_divisible_by(get(), v2.get());
17916   if (res < 0)
17917     exception::throw_last_error(saved_ctx);
17918   return res;
17919 }
17920 
is_divisible_by(long v2)17921 bool val::is_divisible_by(long v2) const
17922 {
17923   if (!ptr)
17924     exception::throw_invalid("NULL input", __FILE__, __LINE__);
17925   return this->is_divisible_by(isl::val(ctx(), v2));
17926 }
17927 
is_infty()17928 bool val::is_infty() const
17929 {
17930   if (!ptr)
17931     exception::throw_invalid("NULL input", __FILE__, __LINE__);
17932   auto saved_ctx = ctx();
17933   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17934   auto res = isl_val_is_infty(get());
17935   if (res < 0)
17936     exception::throw_last_error(saved_ctx);
17937   return res;
17938 }
17939 
is_int()17940 bool val::is_int() const
17941 {
17942   if (!ptr)
17943     exception::throw_invalid("NULL input", __FILE__, __LINE__);
17944   auto saved_ctx = ctx();
17945   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17946   auto res = isl_val_is_int(get());
17947   if (res < 0)
17948     exception::throw_last_error(saved_ctx);
17949   return res;
17950 }
17951 
is_nan()17952 bool val::is_nan() const
17953 {
17954   if (!ptr)
17955     exception::throw_invalid("NULL input", __FILE__, __LINE__);
17956   auto saved_ctx = ctx();
17957   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17958   auto res = isl_val_is_nan(get());
17959   if (res < 0)
17960     exception::throw_last_error(saved_ctx);
17961   return res;
17962 }
17963 
is_neg()17964 bool val::is_neg() const
17965 {
17966   if (!ptr)
17967     exception::throw_invalid("NULL input", __FILE__, __LINE__);
17968   auto saved_ctx = ctx();
17969   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17970   auto res = isl_val_is_neg(get());
17971   if (res < 0)
17972     exception::throw_last_error(saved_ctx);
17973   return res;
17974 }
17975 
is_neginfty()17976 bool val::is_neginfty() const
17977 {
17978   if (!ptr)
17979     exception::throw_invalid("NULL input", __FILE__, __LINE__);
17980   auto saved_ctx = ctx();
17981   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17982   auto res = isl_val_is_neginfty(get());
17983   if (res < 0)
17984     exception::throw_last_error(saved_ctx);
17985   return res;
17986 }
17987 
is_negone()17988 bool val::is_negone() const
17989 {
17990   if (!ptr)
17991     exception::throw_invalid("NULL input", __FILE__, __LINE__);
17992   auto saved_ctx = ctx();
17993   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
17994   auto res = isl_val_is_negone(get());
17995   if (res < 0)
17996     exception::throw_last_error(saved_ctx);
17997   return res;
17998 }
17999 
is_nonneg()18000 bool val::is_nonneg() const
18001 {
18002   if (!ptr)
18003     exception::throw_invalid("NULL input", __FILE__, __LINE__);
18004   auto saved_ctx = ctx();
18005   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
18006   auto res = isl_val_is_nonneg(get());
18007   if (res < 0)
18008     exception::throw_last_error(saved_ctx);
18009   return res;
18010 }
18011 
is_nonpos()18012 bool val::is_nonpos() const
18013 {
18014   if (!ptr)
18015     exception::throw_invalid("NULL input", __FILE__, __LINE__);
18016   auto saved_ctx = ctx();
18017   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
18018   auto res = isl_val_is_nonpos(get());
18019   if (res < 0)
18020     exception::throw_last_error(saved_ctx);
18021   return res;
18022 }
18023 
is_one()18024 bool val::is_one() const
18025 {
18026   if (!ptr)
18027     exception::throw_invalid("NULL input", __FILE__, __LINE__);
18028   auto saved_ctx = ctx();
18029   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
18030   auto res = isl_val_is_one(get());
18031   if (res < 0)
18032     exception::throw_last_error(saved_ctx);
18033   return res;
18034 }
18035 
is_pos()18036 bool val::is_pos() const
18037 {
18038   if (!ptr)
18039     exception::throw_invalid("NULL input", __FILE__, __LINE__);
18040   auto saved_ctx = ctx();
18041   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
18042   auto res = isl_val_is_pos(get());
18043   if (res < 0)
18044     exception::throw_last_error(saved_ctx);
18045   return res;
18046 }
18047 
is_rat()18048 bool val::is_rat() const
18049 {
18050   if (!ptr)
18051     exception::throw_invalid("NULL input", __FILE__, __LINE__);
18052   auto saved_ctx = ctx();
18053   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
18054   auto res = isl_val_is_rat(get());
18055   if (res < 0)
18056     exception::throw_last_error(saved_ctx);
18057   return res;
18058 }
18059 
is_zero()18060 bool val::is_zero() const
18061 {
18062   if (!ptr)
18063     exception::throw_invalid("NULL input", __FILE__, __LINE__);
18064   auto saved_ctx = ctx();
18065   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
18066   auto res = isl_val_is_zero(get());
18067   if (res < 0)
18068     exception::throw_last_error(saved_ctx);
18069   return res;
18070 }
18071 
le(const isl::val & v2)18072 bool val::le(const isl::val &v2) const
18073 {
18074   if (!ptr || v2.is_null())
18075     exception::throw_invalid("NULL input", __FILE__, __LINE__);
18076   auto saved_ctx = ctx();
18077   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
18078   auto res = isl_val_le(get(), v2.get());
18079   if (res < 0)
18080     exception::throw_last_error(saved_ctx);
18081   return res;
18082 }
18083 
le(long v2)18084 bool val::le(long v2) const
18085 {
18086   if (!ptr)
18087     exception::throw_invalid("NULL input", __FILE__, __LINE__);
18088   return this->le(isl::val(ctx(), v2));
18089 }
18090 
lt(const isl::val & v2)18091 bool val::lt(const isl::val &v2) const
18092 {
18093   if (!ptr || v2.is_null())
18094     exception::throw_invalid("NULL input", __FILE__, __LINE__);
18095   auto saved_ctx = ctx();
18096   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
18097   auto res = isl_val_lt(get(), v2.get());
18098   if (res < 0)
18099     exception::throw_last_error(saved_ctx);
18100   return res;
18101 }
18102 
lt(long v2)18103 bool val::lt(long v2) const
18104 {
18105   if (!ptr)
18106     exception::throw_invalid("NULL input", __FILE__, __LINE__);
18107   return this->lt(isl::val(ctx(), v2));
18108 }
18109 
max(isl::val v2)18110 isl::val val::max(isl::val v2) const
18111 {
18112   if (!ptr || v2.is_null())
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_val_max(copy(), v2.release());
18117   if (!res)
18118     exception::throw_last_error(saved_ctx);
18119   return manage(res);
18120 }
18121 
max(long v2)18122 isl::val val::max(long v2) const
18123 {
18124   if (!ptr)
18125     exception::throw_invalid("NULL input", __FILE__, __LINE__);
18126   return this->max(isl::val(ctx(), v2));
18127 }
18128 
min(isl::val v2)18129 isl::val val::min(isl::val v2) const
18130 {
18131   if (!ptr || v2.is_null())
18132     exception::throw_invalid("NULL input", __FILE__, __LINE__);
18133   auto saved_ctx = ctx();
18134   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
18135   auto res = isl_val_min(copy(), v2.release());
18136   if (!res)
18137     exception::throw_last_error(saved_ctx);
18138   return manage(res);
18139 }
18140 
min(long v2)18141 isl::val val::min(long v2) const
18142 {
18143   if (!ptr)
18144     exception::throw_invalid("NULL input", __FILE__, __LINE__);
18145   return this->min(isl::val(ctx(), v2));
18146 }
18147 
mod(isl::val v2)18148 isl::val val::mod(isl::val v2) const
18149 {
18150   if (!ptr || v2.is_null())
18151     exception::throw_invalid("NULL input", __FILE__, __LINE__);
18152   auto saved_ctx = ctx();
18153   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
18154   auto res = isl_val_mod(copy(), v2.release());
18155   if (!res)
18156     exception::throw_last_error(saved_ctx);
18157   return manage(res);
18158 }
18159 
mod(long v2)18160 isl::val val::mod(long v2) const
18161 {
18162   if (!ptr)
18163     exception::throw_invalid("NULL input", __FILE__, __LINE__);
18164   return this->mod(isl::val(ctx(), v2));
18165 }
18166 
mul(isl::val v2)18167 isl::val val::mul(isl::val v2) const
18168 {
18169   if (!ptr || v2.is_null())
18170     exception::throw_invalid("NULL input", __FILE__, __LINE__);
18171   auto saved_ctx = ctx();
18172   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
18173   auto res = isl_val_mul(copy(), v2.release());
18174   if (!res)
18175     exception::throw_last_error(saved_ctx);
18176   return manage(res);
18177 }
18178 
mul(long v2)18179 isl::val val::mul(long v2) const
18180 {
18181   if (!ptr)
18182     exception::throw_invalid("NULL input", __FILE__, __LINE__);
18183   return this->mul(isl::val(ctx(), v2));
18184 }
18185 
nan(isl::ctx ctx)18186 isl::val val::nan(isl::ctx ctx)
18187 {
18188   auto saved_ctx = ctx;
18189   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
18190   auto res = isl_val_nan(ctx.release());
18191   if (!res)
18192     exception::throw_last_error(saved_ctx);
18193   return manage(res);
18194 }
18195 
ne(const isl::val & v2)18196 bool val::ne(const isl::val &v2) const
18197 {
18198   if (!ptr || v2.is_null())
18199     exception::throw_invalid("NULL input", __FILE__, __LINE__);
18200   auto saved_ctx = ctx();
18201   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
18202   auto res = isl_val_ne(get(), v2.get());
18203   if (res < 0)
18204     exception::throw_last_error(saved_ctx);
18205   return res;
18206 }
18207 
ne(long v2)18208 bool val::ne(long v2) const
18209 {
18210   if (!ptr)
18211     exception::throw_invalid("NULL input", __FILE__, __LINE__);
18212   return this->ne(isl::val(ctx(), v2));
18213 }
18214 
neg()18215 isl::val val::neg() const
18216 {
18217   if (!ptr)
18218     exception::throw_invalid("NULL input", __FILE__, __LINE__);
18219   auto saved_ctx = ctx();
18220   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
18221   auto res = isl_val_neg(copy());
18222   if (!res)
18223     exception::throw_last_error(saved_ctx);
18224   return manage(res);
18225 }
18226 
neginfty(isl::ctx ctx)18227 isl::val val::neginfty(isl::ctx ctx)
18228 {
18229   auto saved_ctx = ctx;
18230   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
18231   auto res = isl_val_neginfty(ctx.release());
18232   if (!res)
18233     exception::throw_last_error(saved_ctx);
18234   return manage(res);
18235 }
18236 
negone(isl::ctx ctx)18237 isl::val val::negone(isl::ctx ctx)
18238 {
18239   auto saved_ctx = ctx;
18240   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
18241   auto res = isl_val_negone(ctx.release());
18242   if (!res)
18243     exception::throw_last_error(saved_ctx);
18244   return manage(res);
18245 }
18246 
one(isl::ctx ctx)18247 isl::val val::one(isl::ctx ctx)
18248 {
18249   auto saved_ctx = ctx;
18250   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
18251   auto res = isl_val_one(ctx.release());
18252   if (!res)
18253     exception::throw_last_error(saved_ctx);
18254   return manage(res);
18255 }
18256 
pow2()18257 isl::val val::pow2() const
18258 {
18259   if (!ptr)
18260     exception::throw_invalid("NULL input", __FILE__, __LINE__);
18261   auto saved_ctx = ctx();
18262   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
18263   auto res = isl_val_pow2(copy());
18264   if (!res)
18265     exception::throw_last_error(saved_ctx);
18266   return manage(res);
18267 }
18268 
sgn()18269 int val::sgn() const
18270 {
18271   if (!ptr)
18272     exception::throw_invalid("NULL input", __FILE__, __LINE__);
18273   auto saved_ctx = ctx();
18274   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
18275   auto res = isl_val_sgn(get());
18276   return res;
18277 }
18278 
sub(isl::val v2)18279 isl::val val::sub(isl::val v2) const
18280 {
18281   if (!ptr || v2.is_null())
18282     exception::throw_invalid("NULL input", __FILE__, __LINE__);
18283   auto saved_ctx = ctx();
18284   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
18285   auto res = isl_val_sub(copy(), v2.release());
18286   if (!res)
18287     exception::throw_last_error(saved_ctx);
18288   return manage(res);
18289 }
18290 
sub(long v2)18291 isl::val val::sub(long v2) const
18292 {
18293   if (!ptr)
18294     exception::throw_invalid("NULL input", __FILE__, __LINE__);
18295   return this->sub(isl::val(ctx(), v2));
18296 }
18297 
trunc()18298 isl::val val::trunc() const
18299 {
18300   if (!ptr)
18301     exception::throw_invalid("NULL input", __FILE__, __LINE__);
18302   auto saved_ctx = ctx();
18303   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
18304   auto res = isl_val_trunc(copy());
18305   if (!res)
18306     exception::throw_last_error(saved_ctx);
18307   return manage(res);
18308 }
18309 
zero(isl::ctx ctx)18310 isl::val val::zero(isl::ctx ctx)
18311 {
18312   auto saved_ctx = ctx;
18313   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
18314   auto res = isl_val_zero(ctx.release());
18315   if (!res)
18316     exception::throw_last_error(saved_ctx);
18317   return manage(res);
18318 }
18319 
18320 inline std::ostream &operator<<(std::ostream &os, const val &obj)
18321 {
18322   if (!obj.get())
18323     exception::throw_invalid("NULL input", __FILE__, __LINE__);
18324   auto saved_ctx = isl_val_get_ctx(obj.get());
18325   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
18326   char *str = isl_val_to_str(obj.get());
18327   if (!str)
18328     exception::throw_last_error(saved_ctx);
18329   os << str;
18330   free(str);
18331   return os;
18332 }
18333 
18334 // implementations for isl::val_list
manage(__isl_take isl_val_list * ptr)18335 val_list manage(__isl_take isl_val_list *ptr) {
18336   if (!ptr)
18337     exception::throw_invalid("NULL input", __FILE__, __LINE__);
18338   return val_list(ptr);
18339 }
manage_copy(__isl_keep isl_val_list * ptr)18340 val_list manage_copy(__isl_keep isl_val_list *ptr) {
18341   if (!ptr)
18342     exception::throw_invalid("NULL input", __FILE__, __LINE__);
18343   auto saved_ctx = isl_val_list_get_ctx(ptr);
18344   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
18345   ptr = isl_val_list_copy(ptr);
18346   if (!ptr)
18347     exception::throw_last_error(saved_ctx);
18348   return val_list(ptr);
18349 }
18350 
val_list()18351 val_list::val_list()
18352     : ptr(nullptr) {}
18353 
val_list(const val_list & obj)18354 val_list::val_list(const val_list &obj)
18355     : ptr(nullptr)
18356 {
18357   if (!obj.ptr)
18358     exception::throw_invalid("NULL input", __FILE__, __LINE__);
18359   auto saved_ctx = isl_val_list_get_ctx(obj.ptr);
18360   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
18361   ptr = obj.copy();
18362   if (!ptr)
18363     exception::throw_last_error(saved_ctx);
18364 }
18365 
val_list(__isl_take isl_val_list * ptr)18366 val_list::val_list(__isl_take isl_val_list *ptr)
18367     : ptr(ptr) {}
18368 
val_list(isl::ctx ctx,int n)18369 val_list::val_list(isl::ctx ctx, int n)
18370 {
18371   auto saved_ctx = ctx;
18372   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
18373   auto res = isl_val_list_alloc(ctx.release(), n);
18374   if (!res)
18375     exception::throw_last_error(saved_ctx);
18376   ptr = res;
18377 }
18378 
val_list(isl::val el)18379 val_list::val_list(isl::val el)
18380 {
18381   if (el.is_null())
18382     exception::throw_invalid("NULL input", __FILE__, __LINE__);
18383   auto saved_ctx = el.ctx();
18384   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
18385   auto res = isl_val_list_from_val(el.release());
18386   if (!res)
18387     exception::throw_last_error(saved_ctx);
18388   ptr = res;
18389 }
18390 
18391 val_list &val_list::operator=(val_list obj) {
18392   std::swap(this->ptr, obj.ptr);
18393   return *this;
18394 }
18395 
~val_list()18396 val_list::~val_list() {
18397   if (ptr)
18398     isl_val_list_free(ptr);
18399 }
18400 
copy()18401 __isl_give isl_val_list *val_list::copy() const & {
18402   return isl_val_list_copy(ptr);
18403 }
18404 
get()18405 __isl_keep isl_val_list *val_list::get() const {
18406   return ptr;
18407 }
18408 
release()18409 __isl_give isl_val_list *val_list::release() {
18410   isl_val_list *tmp = ptr;
18411   ptr = nullptr;
18412   return tmp;
18413 }
18414 
is_null()18415 bool val_list::is_null() const {
18416   return ptr == nullptr;
18417 }
18418 
ctx()18419 isl::ctx val_list::ctx() const {
18420   return isl::ctx(isl_val_list_get_ctx(ptr));
18421 }
18422 
add(isl::val el)18423 isl::val_list val_list::add(isl::val el) const
18424 {
18425   if (!ptr || el.is_null())
18426     exception::throw_invalid("NULL input", __FILE__, __LINE__);
18427   auto saved_ctx = ctx();
18428   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
18429   auto res = isl_val_list_add(copy(), el.release());
18430   if (!res)
18431     exception::throw_last_error(saved_ctx);
18432   return manage(res);
18433 }
18434 
add(long el)18435 isl::val_list val_list::add(long el) const
18436 {
18437   if (!ptr)
18438     exception::throw_invalid("NULL input", __FILE__, __LINE__);
18439   return this->add(isl::val(ctx(), el));
18440 }
18441 
clear()18442 isl::val_list val_list::clear() const
18443 {
18444   if (!ptr)
18445     exception::throw_invalid("NULL input", __FILE__, __LINE__);
18446   auto saved_ctx = ctx();
18447   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
18448   auto res = isl_val_list_clear(copy());
18449   if (!res)
18450     exception::throw_last_error(saved_ctx);
18451   return manage(res);
18452 }
18453 
concat(isl::val_list list2)18454 isl::val_list val_list::concat(isl::val_list list2) const
18455 {
18456   if (!ptr || list2.is_null())
18457     exception::throw_invalid("NULL input", __FILE__, __LINE__);
18458   auto saved_ctx = ctx();
18459   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
18460   auto res = isl_val_list_concat(copy(), list2.release());
18461   if (!res)
18462     exception::throw_last_error(saved_ctx);
18463   return manage(res);
18464 }
18465 
foreach(const std::function<void (isl::val)> & fn)18466 void val_list::foreach(const std::function<void(isl::val)> &fn) const
18467 {
18468   if (!ptr)
18469     exception::throw_invalid("NULL input", __FILE__, __LINE__);
18470   auto saved_ctx = ctx();
18471   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
18472   struct fn_data {
18473     std::function<void(isl::val)> func;
18474     std::exception_ptr eptr;
18475   } fn_data = { fn };
18476   auto fn_lambda = [](isl_val *arg_0, void *arg_1) -> isl_stat {
18477     auto *data = static_cast<struct fn_data *>(arg_1);
18478     ISL_CPP_TRY {
18479       (data->func)(manage(arg_0));
18480       return isl_stat_ok;
18481     } ISL_CPP_CATCH_ALL {
18482       data->eptr = std::current_exception();
18483       return isl_stat_error;
18484     }
18485   };
18486   auto res = isl_val_list_foreach(get(), fn_lambda, &fn_data);
18487   if (fn_data.eptr)
18488     std::rethrow_exception(fn_data.eptr);
18489   if (res < 0)
18490     exception::throw_last_error(saved_ctx);
18491   return;
18492 }
18493 
at(int index)18494 isl::val val_list::at(int index) const
18495 {
18496   if (!ptr)
18497     exception::throw_invalid("NULL input", __FILE__, __LINE__);
18498   auto saved_ctx = ctx();
18499   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
18500   auto res = isl_val_list_get_at(get(), index);
18501   if (!res)
18502     exception::throw_last_error(saved_ctx);
18503   return manage(res);
18504 }
18505 
get_at(int index)18506 isl::val val_list::get_at(int index) const
18507 {
18508   return at(index);
18509 }
18510 
size()18511 unsigned val_list::size() const
18512 {
18513   if (!ptr)
18514     exception::throw_invalid("NULL input", __FILE__, __LINE__);
18515   auto saved_ctx = ctx();
18516   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
18517   auto res = isl_val_list_size(get());
18518   if (res < 0)
18519     exception::throw_last_error(saved_ctx);
18520   return res;
18521 }
18522 
18523 inline std::ostream &operator<<(std::ostream &os, const val_list &obj)
18524 {
18525   if (!obj.get())
18526     exception::throw_invalid("NULL input", __FILE__, __LINE__);
18527   auto saved_ctx = isl_val_list_get_ctx(obj.get());
18528   options_scoped_set_on_error saved_on_error(saved_ctx, exception::on_error);
18529   char *str = isl_val_list_to_str(obj.get());
18530   if (!str)
18531     exception::throw_last_error(saved_ctx);
18532   os << str;
18533   free(str);
18534   return os;
18535 }
18536 } // namespace isl
18537 
18538 #endif /* ISL_CPP */
18539