isl_rs/bindings/
map.rs

1// Automatically generated by isl_bindings_generator.
2// LICENSE: MIT
3
4use super::{
5    Aff, BasicMap, BasicMapList, Constraint, Context, DimType, Error, FixedBox, Id, IdList,
6    LibISLError, MapList, MultiAff, MultiId, MultiPwAff, PwAff, PwMultiAff, Set, Space, StrideInfo,
7    UnionMap, Val,
8};
9use libc::uintptr_t;
10use std::ffi::{CStr, CString};
11use std::os::raw::c_char;
12
13/// Wraps `isl_map`.
14pub struct Map {
15    pub ptr: uintptr_t,
16    pub should_free_on_drop: bool,
17}
18
19extern "C" {
20
21    fn isl_map_add_constraint(map: uintptr_t, constraint: uintptr_t) -> uintptr_t;
22
23    fn isl_map_add_dims(map: uintptr_t, type_: i32, n: u32) -> uintptr_t;
24
25    fn isl_map_affine_hull(map: uintptr_t) -> uintptr_t;
26
27    fn isl_map_align_divs(map: uintptr_t) -> uintptr_t;
28
29    fn isl_map_align_params(map: uintptr_t, model: uintptr_t) -> uintptr_t;
30
31    fn isl_map_apply_domain(map1: uintptr_t, map2: uintptr_t) -> uintptr_t;
32
33    fn isl_map_apply_range(map1: uintptr_t, map2: uintptr_t) -> uintptr_t;
34
35    fn isl_map_as_pw_multi_aff(map: uintptr_t) -> uintptr_t;
36
37    fn isl_map_bind_domain(map: uintptr_t, tuple: uintptr_t) -> uintptr_t;
38
39    fn isl_map_bind_range(map: uintptr_t, tuple: uintptr_t) -> uintptr_t;
40
41    fn isl_map_can_curry(map: uintptr_t) -> i32;
42
43    fn isl_map_can_range_curry(map: uintptr_t) -> i32;
44
45    fn isl_map_can_uncurry(map: uintptr_t) -> i32;
46
47    fn isl_map_can_zip(map: uintptr_t) -> i32;
48
49    fn isl_map_coalesce(map: uintptr_t) -> uintptr_t;
50
51    fn isl_map_complement(map: uintptr_t) -> uintptr_t;
52
53    fn isl_map_compute_divs(map: uintptr_t) -> uintptr_t;
54
55    fn isl_map_convex_hull(map: uintptr_t) -> uintptr_t;
56
57    fn isl_map_copy(map: uintptr_t) -> uintptr_t;
58
59    fn isl_map_curry(map: uintptr_t) -> uintptr_t;
60
61    fn isl_map_deltas(map: uintptr_t) -> uintptr_t;
62
63    fn isl_map_deltas_map(map: uintptr_t) -> uintptr_t;
64
65    fn isl_map_detect_equalities(map: uintptr_t) -> uintptr_t;
66
67    fn isl_map_dim(map: uintptr_t, type_: i32) -> i32;
68
69    fn isl_map_dim_max(map: uintptr_t, pos: i32) -> uintptr_t;
70
71    fn isl_map_dim_min(map: uintptr_t, pos: i32) -> uintptr_t;
72
73    fn isl_map_domain(bmap: uintptr_t) -> uintptr_t;
74
75    fn isl_map_domain_factor_domain(map: uintptr_t) -> uintptr_t;
76
77    fn isl_map_domain_factor_range(map: uintptr_t) -> uintptr_t;
78
79    fn isl_map_domain_is_wrapping(map: uintptr_t) -> i32;
80
81    fn isl_map_domain_map(map: uintptr_t) -> uintptr_t;
82
83    fn isl_map_domain_product(map1: uintptr_t, map2: uintptr_t) -> uintptr_t;
84
85    fn isl_map_domain_reverse(map: uintptr_t) -> uintptr_t;
86
87    fn isl_map_domain_tuple_dim(map: uintptr_t) -> i32;
88
89    fn isl_map_drop_constraints_involving_dims(map: uintptr_t, type_: i32, first: u32, n: u32)
90                                               -> uintptr_t;
91
92    fn isl_map_drop_constraints_not_involving_dims(map: uintptr_t, type_: i32, first: u32, n: u32)
93                                                   -> uintptr_t;
94
95    fn isl_map_drop_unused_params(map: uintptr_t) -> uintptr_t;
96
97    fn isl_map_dump(map: uintptr_t) -> ();
98
99    fn isl_map_eliminate(map: uintptr_t, type_: i32, first: u32, n: u32) -> uintptr_t;
100
101    fn isl_map_empty(space: uintptr_t) -> uintptr_t;
102
103    fn isl_map_eq_at_multi_pw_aff(map: uintptr_t, mpa: uintptr_t) -> uintptr_t;
104
105    fn isl_map_equate(map: uintptr_t, type1: i32, pos1: i32, type2: i32, pos2: i32) -> uintptr_t;
106
107    fn isl_map_factor_domain(map: uintptr_t) -> uintptr_t;
108
109    fn isl_map_factor_range(map: uintptr_t) -> uintptr_t;
110
111    fn isl_map_find_dim_by_id(map: uintptr_t, type_: i32, id: uintptr_t) -> i32;
112
113    fn isl_map_find_dim_by_name(map: uintptr_t, type_: i32, name: *const c_char) -> i32;
114
115    fn isl_map_fix_input_si(map: uintptr_t, input: u32, value: i32) -> uintptr_t;
116
117    fn isl_map_fix_si(map: uintptr_t, type_: i32, pos: u32, value: i32) -> uintptr_t;
118
119    fn isl_map_fix_val(map: uintptr_t, type_: i32, pos: u32, v: uintptr_t) -> uintptr_t;
120
121    fn isl_map_fixed_power_val(map: uintptr_t, exp: uintptr_t) -> uintptr_t;
122
123    fn isl_map_flat_domain_product(map1: uintptr_t, map2: uintptr_t) -> uintptr_t;
124
125    fn isl_map_flat_product(map1: uintptr_t, map2: uintptr_t) -> uintptr_t;
126
127    fn isl_map_flat_range_product(map1: uintptr_t, map2: uintptr_t) -> uintptr_t;
128
129    fn isl_map_flatten(map: uintptr_t) -> uintptr_t;
130
131    fn isl_map_flatten_domain(map: uintptr_t) -> uintptr_t;
132
133    fn isl_map_flatten_range(map: uintptr_t) -> uintptr_t;
134
135    fn isl_map_floordiv_val(map: uintptr_t, d: uintptr_t) -> uintptr_t;
136
137    fn isl_map_free(map: uintptr_t) -> uintptr_t;
138
139    fn isl_map_from_aff(aff: uintptr_t) -> uintptr_t;
140
141    fn isl_map_from_basic_map(bmap: uintptr_t) -> uintptr_t;
142
143    fn isl_map_from_domain(set: uintptr_t) -> uintptr_t;
144
145    fn isl_map_from_domain_and_range(domain: uintptr_t, range: uintptr_t) -> uintptr_t;
146
147    fn isl_map_from_multi_aff(maff: uintptr_t) -> uintptr_t;
148
149    fn isl_map_from_multi_pw_aff(mpa: uintptr_t) -> uintptr_t;
150
151    fn isl_map_from_pw_aff(pwaff: uintptr_t) -> uintptr_t;
152
153    fn isl_map_from_pw_multi_aff(pma: uintptr_t) -> uintptr_t;
154
155    fn isl_map_from_range(set: uintptr_t) -> uintptr_t;
156
157    fn isl_map_from_union_map(umap: uintptr_t) -> uintptr_t;
158
159    fn isl_map_get_basic_map_list(map: uintptr_t) -> uintptr_t;
160
161    fn isl_map_get_ctx(map: uintptr_t) -> uintptr_t;
162
163    fn isl_map_get_dim_id(map: uintptr_t, type_: i32, pos: u32) -> uintptr_t;
164
165    fn isl_map_get_dim_name(map: uintptr_t, type_: i32, pos: u32) -> *const c_char;
166
167    fn isl_map_get_domain_tuple_id(map: uintptr_t) -> uintptr_t;
168
169    fn isl_map_get_hash(map: uintptr_t) -> u32;
170
171    fn isl_map_get_range_lattice_tile(map: uintptr_t) -> uintptr_t;
172
173    fn isl_map_get_range_simple_fixed_box_hull(map: uintptr_t) -> uintptr_t;
174
175    fn isl_map_get_range_stride_info(map: uintptr_t, pos: i32) -> uintptr_t;
176
177    fn isl_map_get_range_tuple_id(map: uintptr_t) -> uintptr_t;
178
179    fn isl_map_get_space(map: uintptr_t) -> uintptr_t;
180
181    fn isl_map_get_tuple_id(map: uintptr_t, type_: i32) -> uintptr_t;
182
183    fn isl_map_get_tuple_name(map: uintptr_t, type_: i32) -> *const c_char;
184
185    fn isl_map_gist(map: uintptr_t, context: uintptr_t) -> uintptr_t;
186
187    fn isl_map_gist_basic_map(map: uintptr_t, context: uintptr_t) -> uintptr_t;
188
189    fn isl_map_gist_domain(map: uintptr_t, context: uintptr_t) -> uintptr_t;
190
191    fn isl_map_gist_params(map: uintptr_t, context: uintptr_t) -> uintptr_t;
192
193    fn isl_map_gist_range(map: uintptr_t, context: uintptr_t) -> uintptr_t;
194
195    fn isl_map_has_dim_id(map: uintptr_t, type_: i32, pos: u32) -> i32;
196
197    fn isl_map_has_dim_name(map: uintptr_t, type_: i32, pos: u32) -> i32;
198
199    fn isl_map_has_domain_tuple_id(map: uintptr_t) -> i32;
200
201    fn isl_map_has_equal_space(map1: uintptr_t, map2: uintptr_t) -> i32;
202
203    fn isl_map_has_range_tuple_id(map: uintptr_t) -> i32;
204
205    fn isl_map_has_tuple_id(map: uintptr_t, type_: i32) -> i32;
206
207    fn isl_map_has_tuple_name(map: uintptr_t, type_: i32) -> i32;
208
209    fn isl_map_identity(space: uintptr_t) -> uintptr_t;
210
211    fn isl_map_insert_dims(map: uintptr_t, type_: i32, pos: u32, n: u32) -> uintptr_t;
212
213    fn isl_map_intersect(map1: uintptr_t, map2: uintptr_t) -> uintptr_t;
214
215    fn isl_map_intersect_domain(map: uintptr_t, set: uintptr_t) -> uintptr_t;
216
217    fn isl_map_intersect_domain_factor_domain(map: uintptr_t, factor: uintptr_t) -> uintptr_t;
218
219    fn isl_map_intersect_domain_factor_range(map: uintptr_t, factor: uintptr_t) -> uintptr_t;
220
221    fn isl_map_intersect_domain_wrapped_domain(map: uintptr_t, domain: uintptr_t) -> uintptr_t;
222
223    fn isl_map_intersect_params(map: uintptr_t, params: uintptr_t) -> uintptr_t;
224
225    fn isl_map_intersect_range(map: uintptr_t, set: uintptr_t) -> uintptr_t;
226
227    fn isl_map_intersect_range_factor_domain(map: uintptr_t, factor: uintptr_t) -> uintptr_t;
228
229    fn isl_map_intersect_range_factor_range(map: uintptr_t, factor: uintptr_t) -> uintptr_t;
230
231    fn isl_map_intersect_range_wrapped_domain(map: uintptr_t, domain: uintptr_t) -> uintptr_t;
232
233    fn isl_map_involves_dims(map: uintptr_t, type_: i32, first: u32, n: u32) -> i32;
234
235    fn isl_map_is_bijective(map: uintptr_t) -> i32;
236
237    fn isl_map_is_disjoint(map1: uintptr_t, map2: uintptr_t) -> i32;
238
239    fn isl_map_is_empty(map: uintptr_t) -> i32;
240
241    fn isl_map_is_equal(map1: uintptr_t, map2: uintptr_t) -> i32;
242
243    fn isl_map_is_identity(map: uintptr_t) -> i32;
244
245    fn isl_map_is_injective(map: uintptr_t) -> i32;
246
247    fn isl_map_is_product(map: uintptr_t) -> i32;
248
249    fn isl_map_is_single_valued(map: uintptr_t) -> i32;
250
251    fn isl_map_is_strict_subset(map1: uintptr_t, map2: uintptr_t) -> i32;
252
253    fn isl_map_is_subset(map1: uintptr_t, map2: uintptr_t) -> i32;
254
255    fn isl_map_is_translation(map: uintptr_t) -> i32;
256
257    fn isl_map_lex_ge(set_space: uintptr_t) -> uintptr_t;
258
259    fn isl_map_lex_ge_at_multi_pw_aff(map: uintptr_t, mpa: uintptr_t) -> uintptr_t;
260
261    fn isl_map_lex_ge_first(space: uintptr_t, n: u32) -> uintptr_t;
262
263    fn isl_map_lex_ge_map(map1: uintptr_t, map2: uintptr_t) -> uintptr_t;
264
265    fn isl_map_lex_gt(set_space: uintptr_t) -> uintptr_t;
266
267    fn isl_map_lex_gt_at_multi_pw_aff(map: uintptr_t, mpa: uintptr_t) -> uintptr_t;
268
269    fn isl_map_lex_gt_first(space: uintptr_t, n: u32) -> uintptr_t;
270
271    fn isl_map_lex_gt_map(map1: uintptr_t, map2: uintptr_t) -> uintptr_t;
272
273    fn isl_map_lex_le(set_space: uintptr_t) -> uintptr_t;
274
275    fn isl_map_lex_le_at_multi_pw_aff(map: uintptr_t, mpa: uintptr_t) -> uintptr_t;
276
277    fn isl_map_lex_le_first(space: uintptr_t, n: u32) -> uintptr_t;
278
279    fn isl_map_lex_le_map(map1: uintptr_t, map2: uintptr_t) -> uintptr_t;
280
281    fn isl_map_lex_lt(set_space: uintptr_t) -> uintptr_t;
282
283    fn isl_map_lex_lt_at_multi_pw_aff(map: uintptr_t, mpa: uintptr_t) -> uintptr_t;
284
285    fn isl_map_lex_lt_first(space: uintptr_t, n: u32) -> uintptr_t;
286
287    fn isl_map_lex_lt_map(map1: uintptr_t, map2: uintptr_t) -> uintptr_t;
288
289    fn isl_map_lexmax(map: uintptr_t) -> uintptr_t;
290
291    fn isl_map_lexmax_pw_multi_aff(map: uintptr_t) -> uintptr_t;
292
293    fn isl_map_lexmin(map: uintptr_t) -> uintptr_t;
294
295    fn isl_map_lexmin_pw_multi_aff(map: uintptr_t) -> uintptr_t;
296
297    fn isl_map_lower_bound_multi_pw_aff(map: uintptr_t, lower: uintptr_t) -> uintptr_t;
298
299    fn isl_map_lower_bound_si(map: uintptr_t, type_: i32, pos: u32, value: i32) -> uintptr_t;
300
301    fn isl_map_lower_bound_val(map: uintptr_t, type_: i32, pos: u32, value: uintptr_t)
302                               -> uintptr_t;
303
304    fn isl_map_make_disjoint(map: uintptr_t) -> uintptr_t;
305
306    fn isl_map_max_multi_pw_aff(map: uintptr_t) -> uintptr_t;
307
308    fn isl_map_min_multi_pw_aff(map: uintptr_t) -> uintptr_t;
309
310    fn isl_map_move_dims(map: uintptr_t, dst_type: i32, dst_pos: u32, src_type: i32, src_pos: u32,
311                         n: u32)
312                         -> uintptr_t;
313
314    fn isl_map_n_basic_map(map: uintptr_t) -> i32;
315
316    fn isl_map_nat_universe(space: uintptr_t) -> uintptr_t;
317
318    fn isl_map_neg(map: uintptr_t) -> uintptr_t;
319
320    fn isl_map_oppose(map: uintptr_t, type1: i32, pos1: i32, type2: i32, pos2: i32) -> uintptr_t;
321
322    fn isl_map_order_ge(map: uintptr_t, type1: i32, pos1: i32, type2: i32, pos2: i32) -> uintptr_t;
323
324    fn isl_map_order_gt(map: uintptr_t, type1: i32, pos1: i32, type2: i32, pos2: i32) -> uintptr_t;
325
326    fn isl_map_order_le(map: uintptr_t, type1: i32, pos1: i32, type2: i32, pos2: i32) -> uintptr_t;
327
328    fn isl_map_order_lt(map: uintptr_t, type1: i32, pos1: i32, type2: i32, pos2: i32) -> uintptr_t;
329
330    fn isl_map_params(map: uintptr_t) -> uintptr_t;
331
332    fn isl_map_plain_get_val_if_fixed(map: uintptr_t, type_: i32, pos: u32) -> uintptr_t;
333
334    fn isl_map_plain_is_empty(map: uintptr_t) -> i32;
335
336    fn isl_map_plain_is_equal(map1: uintptr_t, map2: uintptr_t) -> i32;
337
338    fn isl_map_plain_is_injective(map: uintptr_t) -> i32;
339
340    fn isl_map_plain_is_single_valued(map: uintptr_t) -> i32;
341
342    fn isl_map_plain_is_universe(map: uintptr_t) -> i32;
343
344    fn isl_map_plain_unshifted_simple_hull(map: uintptr_t) -> uintptr_t;
345
346    fn isl_map_polyhedral_hull(map: uintptr_t) -> uintptr_t;
347
348    fn isl_map_preimage_domain_multi_aff(map: uintptr_t, ma: uintptr_t) -> uintptr_t;
349
350    fn isl_map_preimage_domain_multi_pw_aff(map: uintptr_t, mpa: uintptr_t) -> uintptr_t;
351
352    fn isl_map_preimage_domain_pw_multi_aff(map: uintptr_t, pma: uintptr_t) -> uintptr_t;
353
354    fn isl_map_preimage_range_multi_aff(map: uintptr_t, ma: uintptr_t) -> uintptr_t;
355
356    fn isl_map_preimage_range_pw_multi_aff(map: uintptr_t, pma: uintptr_t) -> uintptr_t;
357
358    fn isl_map_product(map1: uintptr_t, map2: uintptr_t) -> uintptr_t;
359
360    fn isl_map_project_out(map: uintptr_t, type_: i32, first: u32, n: u32) -> uintptr_t;
361
362    fn isl_map_project_out_all_params(map: uintptr_t) -> uintptr_t;
363
364    fn isl_map_project_out_param_id(map: uintptr_t, id: uintptr_t) -> uintptr_t;
365
366    fn isl_map_project_out_param_id_list(map: uintptr_t, list: uintptr_t) -> uintptr_t;
367
368    fn isl_map_range(map: uintptr_t) -> uintptr_t;
369
370    fn isl_map_range_curry(map: uintptr_t) -> uintptr_t;
371
372    fn isl_map_range_factor_domain(map: uintptr_t) -> uintptr_t;
373
374    fn isl_map_range_factor_range(map: uintptr_t) -> uintptr_t;
375
376    fn isl_map_range_is_wrapping(map: uintptr_t) -> i32;
377
378    fn isl_map_range_map(map: uintptr_t) -> uintptr_t;
379
380    fn isl_map_range_product(map1: uintptr_t, map2: uintptr_t) -> uintptr_t;
381
382    fn isl_map_range_reverse(map: uintptr_t) -> uintptr_t;
383
384    fn isl_map_range_tuple_dim(map: uintptr_t) -> i32;
385
386    fn isl_map_read_from_str(ctx: uintptr_t, str_: *const c_char) -> uintptr_t;
387
388    fn isl_map_remove_dims(map: uintptr_t, type_: i32, first: u32, n: u32) -> uintptr_t;
389
390    fn isl_map_remove_divs(map: uintptr_t) -> uintptr_t;
391
392    fn isl_map_remove_divs_involving_dims(map: uintptr_t, type_: i32, first: u32, n: u32)
393                                          -> uintptr_t;
394
395    fn isl_map_remove_inputs(map: uintptr_t, first: u32, n: u32) -> uintptr_t;
396
397    fn isl_map_remove_redundancies(map: uintptr_t) -> uintptr_t;
398
399    fn isl_map_remove_unknown_divs(map: uintptr_t) -> uintptr_t;
400
401    fn isl_map_reset_tuple_id(map: uintptr_t, type_: i32) -> uintptr_t;
402
403    fn isl_map_reset_user(map: uintptr_t) -> uintptr_t;
404
405    fn isl_map_reverse(map: uintptr_t) -> uintptr_t;
406
407    fn isl_map_sample(map: uintptr_t) -> uintptr_t;
408
409    fn isl_map_set_dim_id(map: uintptr_t, type_: i32, pos: u32, id: uintptr_t) -> uintptr_t;
410
411    fn isl_map_set_dim_name(map: uintptr_t, type_: i32, pos: u32, s: *const c_char) -> uintptr_t;
412
413    fn isl_map_set_domain_tuple_id(map: uintptr_t, id: uintptr_t) -> uintptr_t;
414
415    fn isl_map_set_range_tuple_id(map: uintptr_t, id: uintptr_t) -> uintptr_t;
416
417    fn isl_map_set_tuple_id(map: uintptr_t, type_: i32, id: uintptr_t) -> uintptr_t;
418
419    fn isl_map_set_tuple_name(map: uintptr_t, type_: i32, s: *const c_char) -> uintptr_t;
420
421    fn isl_map_simple_hull(map: uintptr_t) -> uintptr_t;
422
423    fn isl_map_subtract(map1: uintptr_t, map2: uintptr_t) -> uintptr_t;
424
425    fn isl_map_subtract_domain(map: uintptr_t, dom: uintptr_t) -> uintptr_t;
426
427    fn isl_map_subtract_range(map: uintptr_t, dom: uintptr_t) -> uintptr_t;
428
429    fn isl_map_sum(map1: uintptr_t, map2: uintptr_t) -> uintptr_t;
430
431    fn isl_map_to_list(el: uintptr_t) -> uintptr_t;
432
433    fn isl_map_to_str(map: uintptr_t) -> *const c_char;
434
435    fn isl_map_to_union_map(map: uintptr_t) -> uintptr_t;
436
437    fn isl_map_uncurry(map: uintptr_t) -> uintptr_t;
438
439    fn isl_map_union(map1: uintptr_t, map2: uintptr_t) -> uintptr_t;
440
441    fn isl_map_union_disjoint(map1: uintptr_t, map2: uintptr_t) -> uintptr_t;
442
443    fn isl_map_universe(space: uintptr_t) -> uintptr_t;
444
445    fn isl_map_unshifted_simple_hull(map: uintptr_t) -> uintptr_t;
446
447    fn isl_map_unshifted_simple_hull_from_map_list(map: uintptr_t, list: uintptr_t) -> uintptr_t;
448
449    fn isl_map_upper_bound_multi_pw_aff(map: uintptr_t, upper: uintptr_t) -> uintptr_t;
450
451    fn isl_map_upper_bound_si(map: uintptr_t, type_: i32, pos: u32, value: i32) -> uintptr_t;
452
453    fn isl_map_upper_bound_val(map: uintptr_t, type_: i32, pos: u32, value: uintptr_t)
454                               -> uintptr_t;
455
456    fn isl_map_wrap(map: uintptr_t) -> uintptr_t;
457
458    fn isl_map_zip(map: uintptr_t) -> uintptr_t;
459
460}
461
462impl Map {
463    /// Wraps `isl_map_add_constraint`.
464    pub fn add_constraint(self, constraint: Constraint) -> Result<Map, LibISLError> {
465        let map = self;
466        let isl_rs_ctx = map.get_ctx();
467        let mut map = map;
468        map.do_not_free_on_drop();
469        let map = map.ptr;
470        let mut constraint = constraint;
471        constraint.do_not_free_on_drop();
472        let constraint = constraint.ptr;
473        let isl_rs_result = unsafe { isl_map_add_constraint(map, constraint) };
474        let isl_rs_result = Map { ptr: isl_rs_result,
475                                  should_free_on_drop: true };
476        let err = isl_rs_ctx.last_error();
477        if err != Error::None_ {
478            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
479        }
480        Ok(isl_rs_result)
481    }
482
483    /// Wraps `isl_map_add_dims`.
484    pub fn add_dims(self, type_: DimType, n: u32) -> Result<Map, LibISLError> {
485        let map = self;
486        let isl_rs_ctx = map.get_ctx();
487        let mut map = map;
488        map.do_not_free_on_drop();
489        let map = map.ptr;
490        let type_ = type_.to_i32();
491        let isl_rs_result = unsafe { isl_map_add_dims(map, type_, n) };
492        let isl_rs_result = Map { ptr: isl_rs_result,
493                                  should_free_on_drop: true };
494        let err = isl_rs_ctx.last_error();
495        if err != Error::None_ {
496            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
497        }
498        Ok(isl_rs_result)
499    }
500
501    /// Wraps `isl_map_affine_hull`.
502    pub fn affine_hull(self) -> Result<BasicMap, LibISLError> {
503        let map = self;
504        let isl_rs_ctx = map.get_ctx();
505        let mut map = map;
506        map.do_not_free_on_drop();
507        let map = map.ptr;
508        let isl_rs_result = unsafe { isl_map_affine_hull(map) };
509        let isl_rs_result = BasicMap { ptr: isl_rs_result,
510                                       should_free_on_drop: true };
511        let err = isl_rs_ctx.last_error();
512        if err != Error::None_ {
513            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
514        }
515        Ok(isl_rs_result)
516    }
517
518    /// Wraps `isl_map_align_divs`.
519    pub fn align_divs(self) -> Result<Map, LibISLError> {
520        let map = self;
521        let isl_rs_ctx = map.get_ctx();
522        let mut map = map;
523        map.do_not_free_on_drop();
524        let map = map.ptr;
525        let isl_rs_result = unsafe { isl_map_align_divs(map) };
526        let isl_rs_result = Map { ptr: isl_rs_result,
527                                  should_free_on_drop: true };
528        let err = isl_rs_ctx.last_error();
529        if err != Error::None_ {
530            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
531        }
532        Ok(isl_rs_result)
533    }
534
535    /// Wraps `isl_map_align_params`.
536    pub fn align_params(self, model: Space) -> Result<Map, LibISLError> {
537        let map = self;
538        let isl_rs_ctx = map.get_ctx();
539        let mut map = map;
540        map.do_not_free_on_drop();
541        let map = map.ptr;
542        let mut model = model;
543        model.do_not_free_on_drop();
544        let model = model.ptr;
545        let isl_rs_result = unsafe { isl_map_align_params(map, model) };
546        let isl_rs_result = Map { ptr: isl_rs_result,
547                                  should_free_on_drop: true };
548        let err = isl_rs_ctx.last_error();
549        if err != Error::None_ {
550            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
551        }
552        Ok(isl_rs_result)
553    }
554
555    /// Wraps `isl_map_apply_domain`.
556    pub fn apply_domain(self, map2: Map) -> Result<Map, LibISLError> {
557        let map1 = self;
558        let isl_rs_ctx = map1.get_ctx();
559        let mut map1 = map1;
560        map1.do_not_free_on_drop();
561        let map1 = map1.ptr;
562        let mut map2 = map2;
563        map2.do_not_free_on_drop();
564        let map2 = map2.ptr;
565        let isl_rs_result = unsafe { isl_map_apply_domain(map1, map2) };
566        let isl_rs_result = Map { ptr: isl_rs_result,
567                                  should_free_on_drop: true };
568        let err = isl_rs_ctx.last_error();
569        if err != Error::None_ {
570            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
571        }
572        Ok(isl_rs_result)
573    }
574
575    /// Wraps `isl_map_apply_range`.
576    pub fn apply_range(self, map2: Map) -> Result<Map, LibISLError> {
577        let map1 = self;
578        let isl_rs_ctx = map1.get_ctx();
579        let mut map1 = map1;
580        map1.do_not_free_on_drop();
581        let map1 = map1.ptr;
582        let mut map2 = map2;
583        map2.do_not_free_on_drop();
584        let map2 = map2.ptr;
585        let isl_rs_result = unsafe { isl_map_apply_range(map1, map2) };
586        let isl_rs_result = Map { ptr: isl_rs_result,
587                                  should_free_on_drop: true };
588        let err = isl_rs_ctx.last_error();
589        if err != Error::None_ {
590            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
591        }
592        Ok(isl_rs_result)
593    }
594
595    /// Wraps `isl_map_as_pw_multi_aff`.
596    pub fn as_pw_multi_aff(self) -> Result<PwMultiAff, LibISLError> {
597        let map = self;
598        let isl_rs_ctx = map.get_ctx();
599        let mut map = map;
600        map.do_not_free_on_drop();
601        let map = map.ptr;
602        let isl_rs_result = unsafe { isl_map_as_pw_multi_aff(map) };
603        let isl_rs_result = PwMultiAff { ptr: isl_rs_result,
604                                         should_free_on_drop: true };
605        let err = isl_rs_ctx.last_error();
606        if err != Error::None_ {
607            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
608        }
609        Ok(isl_rs_result)
610    }
611
612    /// Wraps `isl_map_bind_domain`.
613    pub fn bind_domain(self, tuple: MultiId) -> Result<Set, LibISLError> {
614        let map = self;
615        let isl_rs_ctx = map.get_ctx();
616        let mut map = map;
617        map.do_not_free_on_drop();
618        let map = map.ptr;
619        let mut tuple = tuple;
620        tuple.do_not_free_on_drop();
621        let tuple = tuple.ptr;
622        let isl_rs_result = unsafe { isl_map_bind_domain(map, tuple) };
623        let isl_rs_result = Set { ptr: isl_rs_result,
624                                  should_free_on_drop: true };
625        let err = isl_rs_ctx.last_error();
626        if err != Error::None_ {
627            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
628        }
629        Ok(isl_rs_result)
630    }
631
632    /// Wraps `isl_map_bind_range`.
633    pub fn bind_range(self, tuple: MultiId) -> Result<Set, LibISLError> {
634        let map = self;
635        let isl_rs_ctx = map.get_ctx();
636        let mut map = map;
637        map.do_not_free_on_drop();
638        let map = map.ptr;
639        let mut tuple = tuple;
640        tuple.do_not_free_on_drop();
641        let tuple = tuple.ptr;
642        let isl_rs_result = unsafe { isl_map_bind_range(map, tuple) };
643        let isl_rs_result = Set { ptr: isl_rs_result,
644                                  should_free_on_drop: true };
645        let err = isl_rs_ctx.last_error();
646        if err != Error::None_ {
647            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
648        }
649        Ok(isl_rs_result)
650    }
651
652    /// Wraps `isl_map_can_curry`.
653    pub fn can_curry(&self) -> Result<bool, LibISLError> {
654        let map = self;
655        let isl_rs_ctx = map.get_ctx();
656        let map = map.ptr;
657        let isl_rs_result = unsafe { isl_map_can_curry(map) };
658        let isl_rs_result = match isl_rs_result {
659            0 => false,
660            1 => true,
661            _ => panic!("Got isl_bool = -1"),
662        };
663        let err = isl_rs_ctx.last_error();
664        if err != Error::None_ {
665            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
666        }
667        Ok(isl_rs_result)
668    }
669
670    /// Wraps `isl_map_can_range_curry`.
671    pub fn can_range_curry(&self) -> Result<bool, LibISLError> {
672        let map = self;
673        let isl_rs_ctx = map.get_ctx();
674        let map = map.ptr;
675        let isl_rs_result = unsafe { isl_map_can_range_curry(map) };
676        let isl_rs_result = match isl_rs_result {
677            0 => false,
678            1 => true,
679            _ => panic!("Got isl_bool = -1"),
680        };
681        let err = isl_rs_ctx.last_error();
682        if err != Error::None_ {
683            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
684        }
685        Ok(isl_rs_result)
686    }
687
688    /// Wraps `isl_map_can_uncurry`.
689    pub fn can_uncurry(&self) -> Result<bool, LibISLError> {
690        let map = self;
691        let isl_rs_ctx = map.get_ctx();
692        let map = map.ptr;
693        let isl_rs_result = unsafe { isl_map_can_uncurry(map) };
694        let isl_rs_result = match isl_rs_result {
695            0 => false,
696            1 => true,
697            _ => panic!("Got isl_bool = -1"),
698        };
699        let err = isl_rs_ctx.last_error();
700        if err != Error::None_ {
701            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
702        }
703        Ok(isl_rs_result)
704    }
705
706    /// Wraps `isl_map_can_zip`.
707    pub fn can_zip(&self) -> Result<bool, LibISLError> {
708        let map = self;
709        let isl_rs_ctx = map.get_ctx();
710        let map = map.ptr;
711        let isl_rs_result = unsafe { isl_map_can_zip(map) };
712        let isl_rs_result = match isl_rs_result {
713            0 => false,
714            1 => true,
715            _ => panic!("Got isl_bool = -1"),
716        };
717        let err = isl_rs_ctx.last_error();
718        if err != Error::None_ {
719            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
720        }
721        Ok(isl_rs_result)
722    }
723
724    /// Wraps `isl_map_coalesce`.
725    pub fn coalesce(self) -> Result<Map, LibISLError> {
726        let map = self;
727        let isl_rs_ctx = map.get_ctx();
728        let mut map = map;
729        map.do_not_free_on_drop();
730        let map = map.ptr;
731        let isl_rs_result = unsafe { isl_map_coalesce(map) };
732        let isl_rs_result = Map { ptr: isl_rs_result,
733                                  should_free_on_drop: true };
734        let err = isl_rs_ctx.last_error();
735        if err != Error::None_ {
736            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
737        }
738        Ok(isl_rs_result)
739    }
740
741    /// Wraps `isl_map_complement`.
742    pub fn complement(self) -> Result<Map, LibISLError> {
743        let map = self;
744        let isl_rs_ctx = map.get_ctx();
745        let mut map = map;
746        map.do_not_free_on_drop();
747        let map = map.ptr;
748        let isl_rs_result = unsafe { isl_map_complement(map) };
749        let isl_rs_result = Map { ptr: isl_rs_result,
750                                  should_free_on_drop: true };
751        let err = isl_rs_ctx.last_error();
752        if err != Error::None_ {
753            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
754        }
755        Ok(isl_rs_result)
756    }
757
758    /// Wraps `isl_map_compute_divs`.
759    pub fn compute_divs(self) -> Result<Map, LibISLError> {
760        let map = self;
761        let isl_rs_ctx = map.get_ctx();
762        let mut map = map;
763        map.do_not_free_on_drop();
764        let map = map.ptr;
765        let isl_rs_result = unsafe { isl_map_compute_divs(map) };
766        let isl_rs_result = Map { ptr: isl_rs_result,
767                                  should_free_on_drop: true };
768        let err = isl_rs_ctx.last_error();
769        if err != Error::None_ {
770            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
771        }
772        Ok(isl_rs_result)
773    }
774
775    /// Wraps `isl_map_convex_hull`.
776    pub fn convex_hull(self) -> Result<BasicMap, LibISLError> {
777        let map = self;
778        let isl_rs_ctx = map.get_ctx();
779        let mut map = map;
780        map.do_not_free_on_drop();
781        let map = map.ptr;
782        let isl_rs_result = unsafe { isl_map_convex_hull(map) };
783        let isl_rs_result = BasicMap { ptr: isl_rs_result,
784                                       should_free_on_drop: true };
785        let err = isl_rs_ctx.last_error();
786        if err != Error::None_ {
787            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
788        }
789        Ok(isl_rs_result)
790    }
791
792    /// Wraps `isl_map_copy`.
793    pub fn copy(&self) -> Result<Map, LibISLError> {
794        let map = self;
795        let isl_rs_ctx = map.get_ctx();
796        let map = map.ptr;
797        let isl_rs_result = unsafe { isl_map_copy(map) };
798        let isl_rs_result = Map { ptr: isl_rs_result,
799                                  should_free_on_drop: true };
800        let err = isl_rs_ctx.last_error();
801        if err != Error::None_ {
802            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
803        }
804        Ok(isl_rs_result)
805    }
806
807    /// Wraps `isl_map_curry`.
808    pub fn curry(self) -> Result<Map, LibISLError> {
809        let map = self;
810        let isl_rs_ctx = map.get_ctx();
811        let mut map = map;
812        map.do_not_free_on_drop();
813        let map = map.ptr;
814        let isl_rs_result = unsafe { isl_map_curry(map) };
815        let isl_rs_result = Map { ptr: isl_rs_result,
816                                  should_free_on_drop: true };
817        let err = isl_rs_ctx.last_error();
818        if err != Error::None_ {
819            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
820        }
821        Ok(isl_rs_result)
822    }
823
824    /// Wraps `isl_map_deltas`.
825    pub fn deltas(self) -> Result<Set, LibISLError> {
826        let map = self;
827        let isl_rs_ctx = map.get_ctx();
828        let mut map = map;
829        map.do_not_free_on_drop();
830        let map = map.ptr;
831        let isl_rs_result = unsafe { isl_map_deltas(map) };
832        let isl_rs_result = Set { ptr: isl_rs_result,
833                                  should_free_on_drop: true };
834        let err = isl_rs_ctx.last_error();
835        if err != Error::None_ {
836            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
837        }
838        Ok(isl_rs_result)
839    }
840
841    /// Wraps `isl_map_deltas_map`.
842    pub fn deltas_map(self) -> Result<Map, LibISLError> {
843        let map = self;
844        let isl_rs_ctx = map.get_ctx();
845        let mut map = map;
846        map.do_not_free_on_drop();
847        let map = map.ptr;
848        let isl_rs_result = unsafe { isl_map_deltas_map(map) };
849        let isl_rs_result = Map { ptr: isl_rs_result,
850                                  should_free_on_drop: true };
851        let err = isl_rs_ctx.last_error();
852        if err != Error::None_ {
853            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
854        }
855        Ok(isl_rs_result)
856    }
857
858    /// Wraps `isl_map_detect_equalities`.
859    pub fn detect_equalities(self) -> Result<Map, LibISLError> {
860        let map = self;
861        let isl_rs_ctx = map.get_ctx();
862        let mut map = map;
863        map.do_not_free_on_drop();
864        let map = map.ptr;
865        let isl_rs_result = unsafe { isl_map_detect_equalities(map) };
866        let isl_rs_result = Map { ptr: isl_rs_result,
867                                  should_free_on_drop: true };
868        let err = isl_rs_ctx.last_error();
869        if err != Error::None_ {
870            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
871        }
872        Ok(isl_rs_result)
873    }
874
875    /// Wraps `isl_map_dim`.
876    pub fn dim(&self, type_: DimType) -> Result<i32, LibISLError> {
877        let map = self;
878        let isl_rs_ctx = map.get_ctx();
879        let map = map.ptr;
880        let type_ = type_.to_i32();
881        let isl_rs_result = unsafe { isl_map_dim(map, type_) };
882        let err = isl_rs_ctx.last_error();
883        if err != Error::None_ {
884            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
885        }
886        Ok(isl_rs_result)
887    }
888
889    /// Wraps `isl_map_dim_max`.
890    pub fn dim_max(self, pos: i32) -> Result<PwAff, LibISLError> {
891        let map = self;
892        let isl_rs_ctx = map.get_ctx();
893        let mut map = map;
894        map.do_not_free_on_drop();
895        let map = map.ptr;
896        let isl_rs_result = unsafe { isl_map_dim_max(map, pos) };
897        let isl_rs_result = PwAff { ptr: isl_rs_result,
898                                    should_free_on_drop: true };
899        let err = isl_rs_ctx.last_error();
900        if err != Error::None_ {
901            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
902        }
903        Ok(isl_rs_result)
904    }
905
906    /// Wraps `isl_map_dim_min`.
907    pub fn dim_min(self, pos: i32) -> Result<PwAff, LibISLError> {
908        let map = self;
909        let isl_rs_ctx = map.get_ctx();
910        let mut map = map;
911        map.do_not_free_on_drop();
912        let map = map.ptr;
913        let isl_rs_result = unsafe { isl_map_dim_min(map, pos) };
914        let isl_rs_result = PwAff { ptr: isl_rs_result,
915                                    should_free_on_drop: true };
916        let err = isl_rs_ctx.last_error();
917        if err != Error::None_ {
918            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
919        }
920        Ok(isl_rs_result)
921    }
922
923    /// Wraps `isl_map_domain`.
924    pub fn domain(self) -> Result<Set, LibISLError> {
925        let bmap = self;
926        let isl_rs_ctx = bmap.get_ctx();
927        let mut bmap = bmap;
928        bmap.do_not_free_on_drop();
929        let bmap = bmap.ptr;
930        let isl_rs_result = unsafe { isl_map_domain(bmap) };
931        let isl_rs_result = Set { ptr: isl_rs_result,
932                                  should_free_on_drop: true };
933        let err = isl_rs_ctx.last_error();
934        if err != Error::None_ {
935            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
936        }
937        Ok(isl_rs_result)
938    }
939
940    /// Wraps `isl_map_domain_factor_domain`.
941    pub fn domain_factor_domain(self) -> Result<Map, LibISLError> {
942        let map = self;
943        let isl_rs_ctx = map.get_ctx();
944        let mut map = map;
945        map.do_not_free_on_drop();
946        let map = map.ptr;
947        let isl_rs_result = unsafe { isl_map_domain_factor_domain(map) };
948        let isl_rs_result = Map { ptr: isl_rs_result,
949                                  should_free_on_drop: true };
950        let err = isl_rs_ctx.last_error();
951        if err != Error::None_ {
952            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
953        }
954        Ok(isl_rs_result)
955    }
956
957    /// Wraps `isl_map_domain_factor_range`.
958    pub fn domain_factor_range(self) -> Result<Map, LibISLError> {
959        let map = self;
960        let isl_rs_ctx = map.get_ctx();
961        let mut map = map;
962        map.do_not_free_on_drop();
963        let map = map.ptr;
964        let isl_rs_result = unsafe { isl_map_domain_factor_range(map) };
965        let isl_rs_result = Map { ptr: isl_rs_result,
966                                  should_free_on_drop: true };
967        let err = isl_rs_ctx.last_error();
968        if err != Error::None_ {
969            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
970        }
971        Ok(isl_rs_result)
972    }
973
974    /// Wraps `isl_map_domain_is_wrapping`.
975    pub fn domain_is_wrapping(&self) -> Result<bool, LibISLError> {
976        let map = self;
977        let isl_rs_ctx = map.get_ctx();
978        let map = map.ptr;
979        let isl_rs_result = unsafe { isl_map_domain_is_wrapping(map) };
980        let isl_rs_result = match isl_rs_result {
981            0 => false,
982            1 => true,
983            _ => panic!("Got isl_bool = -1"),
984        };
985        let err = isl_rs_ctx.last_error();
986        if err != Error::None_ {
987            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
988        }
989        Ok(isl_rs_result)
990    }
991
992    /// Wraps `isl_map_domain_map`.
993    pub fn domain_map(self) -> Result<Map, LibISLError> {
994        let map = self;
995        let isl_rs_ctx = map.get_ctx();
996        let mut map = map;
997        map.do_not_free_on_drop();
998        let map = map.ptr;
999        let isl_rs_result = unsafe { isl_map_domain_map(map) };
1000        let isl_rs_result = Map { ptr: isl_rs_result,
1001                                  should_free_on_drop: true };
1002        let err = isl_rs_ctx.last_error();
1003        if err != Error::None_ {
1004            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
1005        }
1006        Ok(isl_rs_result)
1007    }
1008
1009    /// Wraps `isl_map_domain_product`.
1010    pub fn domain_product(self, map2: Map) -> Result<Map, LibISLError> {
1011        let map1 = self;
1012        let isl_rs_ctx = map1.get_ctx();
1013        let mut map1 = map1;
1014        map1.do_not_free_on_drop();
1015        let map1 = map1.ptr;
1016        let mut map2 = map2;
1017        map2.do_not_free_on_drop();
1018        let map2 = map2.ptr;
1019        let isl_rs_result = unsafe { isl_map_domain_product(map1, map2) };
1020        let isl_rs_result = Map { ptr: isl_rs_result,
1021                                  should_free_on_drop: true };
1022        let err = isl_rs_ctx.last_error();
1023        if err != Error::None_ {
1024            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
1025        }
1026        Ok(isl_rs_result)
1027    }
1028
1029    /// Wraps `isl_map_domain_reverse`.
1030    pub fn domain_reverse(self) -> Result<Map, LibISLError> {
1031        let map = self;
1032        let isl_rs_ctx = map.get_ctx();
1033        let mut map = map;
1034        map.do_not_free_on_drop();
1035        let map = map.ptr;
1036        let isl_rs_result = unsafe { isl_map_domain_reverse(map) };
1037        let isl_rs_result = Map { ptr: isl_rs_result,
1038                                  should_free_on_drop: true };
1039        let err = isl_rs_ctx.last_error();
1040        if err != Error::None_ {
1041            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
1042        }
1043        Ok(isl_rs_result)
1044    }
1045
1046    /// Wraps `isl_map_domain_tuple_dim`.
1047    pub fn domain_tuple_dim(&self) -> Result<i32, LibISLError> {
1048        let map = self;
1049        let isl_rs_ctx = map.get_ctx();
1050        let map = map.ptr;
1051        let isl_rs_result = unsafe { isl_map_domain_tuple_dim(map) };
1052        let err = isl_rs_ctx.last_error();
1053        if err != Error::None_ {
1054            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
1055        }
1056        Ok(isl_rs_result)
1057    }
1058
1059    /// Wraps `isl_map_drop_constraints_involving_dims`.
1060    pub fn drop_constraints_involving_dims(self, type_: DimType, first: u32, n: u32)
1061                                           -> Result<Map, LibISLError> {
1062        let map = self;
1063        let isl_rs_ctx = map.get_ctx();
1064        let mut map = map;
1065        map.do_not_free_on_drop();
1066        let map = map.ptr;
1067        let type_ = type_.to_i32();
1068        let isl_rs_result =
1069            unsafe { isl_map_drop_constraints_involving_dims(map, type_, first, n) };
1070        let isl_rs_result = Map { ptr: isl_rs_result,
1071                                  should_free_on_drop: true };
1072        let err = isl_rs_ctx.last_error();
1073        if err != Error::None_ {
1074            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
1075        }
1076        Ok(isl_rs_result)
1077    }
1078
1079    /// Wraps `isl_map_drop_constraints_not_involving_dims`.
1080    pub fn drop_constraints_not_involving_dims(self, type_: DimType, first: u32, n: u32)
1081                                               -> Result<Map, LibISLError> {
1082        let map = self;
1083        let isl_rs_ctx = map.get_ctx();
1084        let mut map = map;
1085        map.do_not_free_on_drop();
1086        let map = map.ptr;
1087        let type_ = type_.to_i32();
1088        let isl_rs_result =
1089            unsafe { isl_map_drop_constraints_not_involving_dims(map, type_, first, n) };
1090        let isl_rs_result = Map { ptr: isl_rs_result,
1091                                  should_free_on_drop: true };
1092        let err = isl_rs_ctx.last_error();
1093        if err != Error::None_ {
1094            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
1095        }
1096        Ok(isl_rs_result)
1097    }
1098
1099    /// Wraps `isl_map_drop_unused_params`.
1100    pub fn drop_unused_params(self) -> Result<Map, LibISLError> {
1101        let map = self;
1102        let isl_rs_ctx = map.get_ctx();
1103        let mut map = map;
1104        map.do_not_free_on_drop();
1105        let map = map.ptr;
1106        let isl_rs_result = unsafe { isl_map_drop_unused_params(map) };
1107        let isl_rs_result = Map { ptr: isl_rs_result,
1108                                  should_free_on_drop: true };
1109        let err = isl_rs_ctx.last_error();
1110        if err != Error::None_ {
1111            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
1112        }
1113        Ok(isl_rs_result)
1114    }
1115
1116    /// Wraps `isl_map_dump`.
1117    pub fn dump(&self) -> Result<(), LibISLError> {
1118        let map = self;
1119        let isl_rs_ctx = map.get_ctx();
1120        let map = map.ptr;
1121        let isl_rs_result = unsafe { isl_map_dump(map) };
1122        let err = isl_rs_ctx.last_error();
1123        if err != Error::None_ {
1124            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
1125        }
1126        Ok(isl_rs_result)
1127    }
1128
1129    /// Wraps `isl_map_eliminate`.
1130    pub fn eliminate(self, type_: DimType, first: u32, n: u32) -> Result<Map, LibISLError> {
1131        let map = self;
1132        let isl_rs_ctx = map.get_ctx();
1133        let mut map = map;
1134        map.do_not_free_on_drop();
1135        let map = map.ptr;
1136        let type_ = type_.to_i32();
1137        let isl_rs_result = unsafe { isl_map_eliminate(map, type_, first, n) };
1138        let isl_rs_result = Map { ptr: isl_rs_result,
1139                                  should_free_on_drop: true };
1140        let err = isl_rs_ctx.last_error();
1141        if err != Error::None_ {
1142            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
1143        }
1144        Ok(isl_rs_result)
1145    }
1146
1147    /// Wraps `isl_map_empty`.
1148    pub fn empty(space: Space) -> Result<Map, LibISLError> {
1149        let isl_rs_ctx = space.get_ctx();
1150        let mut space = space;
1151        space.do_not_free_on_drop();
1152        let space = space.ptr;
1153        let isl_rs_result = unsafe { isl_map_empty(space) };
1154        let isl_rs_result = Map { ptr: isl_rs_result,
1155                                  should_free_on_drop: true };
1156        let err = isl_rs_ctx.last_error();
1157        if err != Error::None_ {
1158            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
1159        }
1160        Ok(isl_rs_result)
1161    }
1162
1163    /// Wraps `isl_map_eq_at_multi_pw_aff`.
1164    pub fn eq_at_multi_pw_aff(self, mpa: MultiPwAff) -> Result<Map, LibISLError> {
1165        let map = self;
1166        let isl_rs_ctx = map.get_ctx();
1167        let mut map = map;
1168        map.do_not_free_on_drop();
1169        let map = map.ptr;
1170        let mut mpa = mpa;
1171        mpa.do_not_free_on_drop();
1172        let mpa = mpa.ptr;
1173        let isl_rs_result = unsafe { isl_map_eq_at_multi_pw_aff(map, mpa) };
1174        let isl_rs_result = Map { ptr: isl_rs_result,
1175                                  should_free_on_drop: true };
1176        let err = isl_rs_ctx.last_error();
1177        if err != Error::None_ {
1178            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
1179        }
1180        Ok(isl_rs_result)
1181    }
1182
1183    /// Wraps `isl_map_equate`.
1184    pub fn equate(self, type1: DimType, pos1: i32, type2: DimType, pos2: i32)
1185                  -> Result<Map, LibISLError> {
1186        let map = self;
1187        let isl_rs_ctx = map.get_ctx();
1188        let mut map = map;
1189        map.do_not_free_on_drop();
1190        let map = map.ptr;
1191        let type1 = type1.to_i32();
1192        let type2 = type2.to_i32();
1193        let isl_rs_result = unsafe { isl_map_equate(map, type1, pos1, type2, pos2) };
1194        let isl_rs_result = Map { ptr: isl_rs_result,
1195                                  should_free_on_drop: true };
1196        let err = isl_rs_ctx.last_error();
1197        if err != Error::None_ {
1198            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
1199        }
1200        Ok(isl_rs_result)
1201    }
1202
1203    /// Wraps `isl_map_factor_domain`.
1204    pub fn factor_domain(self) -> Result<Map, LibISLError> {
1205        let map = self;
1206        let isl_rs_ctx = map.get_ctx();
1207        let mut map = map;
1208        map.do_not_free_on_drop();
1209        let map = map.ptr;
1210        let isl_rs_result = unsafe { isl_map_factor_domain(map) };
1211        let isl_rs_result = Map { ptr: isl_rs_result,
1212                                  should_free_on_drop: true };
1213        let err = isl_rs_ctx.last_error();
1214        if err != Error::None_ {
1215            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
1216        }
1217        Ok(isl_rs_result)
1218    }
1219
1220    /// Wraps `isl_map_factor_range`.
1221    pub fn factor_range(self) -> Result<Map, LibISLError> {
1222        let map = self;
1223        let isl_rs_ctx = map.get_ctx();
1224        let mut map = map;
1225        map.do_not_free_on_drop();
1226        let map = map.ptr;
1227        let isl_rs_result = unsafe { isl_map_factor_range(map) };
1228        let isl_rs_result = Map { ptr: isl_rs_result,
1229                                  should_free_on_drop: true };
1230        let err = isl_rs_ctx.last_error();
1231        if err != Error::None_ {
1232            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
1233        }
1234        Ok(isl_rs_result)
1235    }
1236
1237    /// Wraps `isl_map_find_dim_by_id`.
1238    pub fn find_dim_by_id(&self, type_: DimType, id: &Id) -> Result<i32, LibISLError> {
1239        let map = self;
1240        let isl_rs_ctx = map.get_ctx();
1241        let map = map.ptr;
1242        let type_ = type_.to_i32();
1243        let id = id.ptr;
1244        let isl_rs_result = unsafe { isl_map_find_dim_by_id(map, type_, id) };
1245        let err = isl_rs_ctx.last_error();
1246        if err != Error::None_ {
1247            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
1248        }
1249        Ok(isl_rs_result)
1250    }
1251
1252    /// Wraps `isl_map_find_dim_by_name`.
1253    pub fn find_dim_by_name(&self, type_: DimType, name: &str) -> Result<i32, LibISLError> {
1254        let map = self;
1255        let isl_rs_ctx = map.get_ctx();
1256        let map = map.ptr;
1257        let type_ = type_.to_i32();
1258        let name = CString::new(name).unwrap();
1259        let name = name.as_ptr();
1260        let isl_rs_result = unsafe { isl_map_find_dim_by_name(map, type_, name) };
1261        let err = isl_rs_ctx.last_error();
1262        if err != Error::None_ {
1263            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
1264        }
1265        Ok(isl_rs_result)
1266    }
1267
1268    /// Wraps `isl_map_fix_input_si`.
1269    pub fn fix_input_si(self, input: u32, value: i32) -> Result<Map, LibISLError> {
1270        let map = self;
1271        let isl_rs_ctx = map.get_ctx();
1272        let mut map = map;
1273        map.do_not_free_on_drop();
1274        let map = map.ptr;
1275        let isl_rs_result = unsafe { isl_map_fix_input_si(map, input, value) };
1276        let isl_rs_result = Map { ptr: isl_rs_result,
1277                                  should_free_on_drop: true };
1278        let err = isl_rs_ctx.last_error();
1279        if err != Error::None_ {
1280            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
1281        }
1282        Ok(isl_rs_result)
1283    }
1284
1285    /// Wraps `isl_map_fix_si`.
1286    pub fn fix_si(self, type_: DimType, pos: u32, value: i32) -> Result<Map, LibISLError> {
1287        let map = self;
1288        let isl_rs_ctx = map.get_ctx();
1289        let mut map = map;
1290        map.do_not_free_on_drop();
1291        let map = map.ptr;
1292        let type_ = type_.to_i32();
1293        let isl_rs_result = unsafe { isl_map_fix_si(map, type_, pos, value) };
1294        let isl_rs_result = Map { ptr: isl_rs_result,
1295                                  should_free_on_drop: true };
1296        let err = isl_rs_ctx.last_error();
1297        if err != Error::None_ {
1298            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
1299        }
1300        Ok(isl_rs_result)
1301    }
1302
1303    /// Wraps `isl_map_fix_val`.
1304    pub fn fix_val(self, type_: DimType, pos: u32, v: Val) -> Result<Map, LibISLError> {
1305        let map = self;
1306        let isl_rs_ctx = map.get_ctx();
1307        let mut map = map;
1308        map.do_not_free_on_drop();
1309        let map = map.ptr;
1310        let type_ = type_.to_i32();
1311        let mut v = v;
1312        v.do_not_free_on_drop();
1313        let v = v.ptr;
1314        let isl_rs_result = unsafe { isl_map_fix_val(map, type_, pos, v) };
1315        let isl_rs_result = Map { ptr: isl_rs_result,
1316                                  should_free_on_drop: true };
1317        let err = isl_rs_ctx.last_error();
1318        if err != Error::None_ {
1319            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
1320        }
1321        Ok(isl_rs_result)
1322    }
1323
1324    /// Wraps `isl_map_fixed_power_val`.
1325    pub fn fixed_power_val(self, exp: Val) -> Result<Map, LibISLError> {
1326        let map = self;
1327        let isl_rs_ctx = map.get_ctx();
1328        let mut map = map;
1329        map.do_not_free_on_drop();
1330        let map = map.ptr;
1331        let mut exp = exp;
1332        exp.do_not_free_on_drop();
1333        let exp = exp.ptr;
1334        let isl_rs_result = unsafe { isl_map_fixed_power_val(map, exp) };
1335        let isl_rs_result = Map { ptr: isl_rs_result,
1336                                  should_free_on_drop: true };
1337        let err = isl_rs_ctx.last_error();
1338        if err != Error::None_ {
1339            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
1340        }
1341        Ok(isl_rs_result)
1342    }
1343
1344    /// Wraps `isl_map_flat_domain_product`.
1345    pub fn flat_domain_product(self, map2: Map) -> Result<Map, LibISLError> {
1346        let map1 = self;
1347        let isl_rs_ctx = map1.get_ctx();
1348        let mut map1 = map1;
1349        map1.do_not_free_on_drop();
1350        let map1 = map1.ptr;
1351        let mut map2 = map2;
1352        map2.do_not_free_on_drop();
1353        let map2 = map2.ptr;
1354        let isl_rs_result = unsafe { isl_map_flat_domain_product(map1, map2) };
1355        let isl_rs_result = Map { ptr: isl_rs_result,
1356                                  should_free_on_drop: true };
1357        let err = isl_rs_ctx.last_error();
1358        if err != Error::None_ {
1359            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
1360        }
1361        Ok(isl_rs_result)
1362    }
1363
1364    /// Wraps `isl_map_flat_product`.
1365    pub fn flat_product(self, map2: Map) -> Result<Map, LibISLError> {
1366        let map1 = self;
1367        let isl_rs_ctx = map1.get_ctx();
1368        let mut map1 = map1;
1369        map1.do_not_free_on_drop();
1370        let map1 = map1.ptr;
1371        let mut map2 = map2;
1372        map2.do_not_free_on_drop();
1373        let map2 = map2.ptr;
1374        let isl_rs_result = unsafe { isl_map_flat_product(map1, map2) };
1375        let isl_rs_result = Map { ptr: isl_rs_result,
1376                                  should_free_on_drop: true };
1377        let err = isl_rs_ctx.last_error();
1378        if err != Error::None_ {
1379            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
1380        }
1381        Ok(isl_rs_result)
1382    }
1383
1384    /// Wraps `isl_map_flat_range_product`.
1385    pub fn flat_range_product(self, map2: Map) -> Result<Map, LibISLError> {
1386        let map1 = self;
1387        let isl_rs_ctx = map1.get_ctx();
1388        let mut map1 = map1;
1389        map1.do_not_free_on_drop();
1390        let map1 = map1.ptr;
1391        let mut map2 = map2;
1392        map2.do_not_free_on_drop();
1393        let map2 = map2.ptr;
1394        let isl_rs_result = unsafe { isl_map_flat_range_product(map1, map2) };
1395        let isl_rs_result = Map { ptr: isl_rs_result,
1396                                  should_free_on_drop: true };
1397        let err = isl_rs_ctx.last_error();
1398        if err != Error::None_ {
1399            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
1400        }
1401        Ok(isl_rs_result)
1402    }
1403
1404    /// Wraps `isl_map_flatten`.
1405    pub fn flatten(self) -> Result<Map, LibISLError> {
1406        let map = self;
1407        let isl_rs_ctx = map.get_ctx();
1408        let mut map = map;
1409        map.do_not_free_on_drop();
1410        let map = map.ptr;
1411        let isl_rs_result = unsafe { isl_map_flatten(map) };
1412        let isl_rs_result = Map { ptr: isl_rs_result,
1413                                  should_free_on_drop: true };
1414        let err = isl_rs_ctx.last_error();
1415        if err != Error::None_ {
1416            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
1417        }
1418        Ok(isl_rs_result)
1419    }
1420
1421    /// Wraps `isl_map_flatten_domain`.
1422    pub fn flatten_domain(self) -> Result<Map, LibISLError> {
1423        let map = self;
1424        let isl_rs_ctx = map.get_ctx();
1425        let mut map = map;
1426        map.do_not_free_on_drop();
1427        let map = map.ptr;
1428        let isl_rs_result = unsafe { isl_map_flatten_domain(map) };
1429        let isl_rs_result = Map { ptr: isl_rs_result,
1430                                  should_free_on_drop: true };
1431        let err = isl_rs_ctx.last_error();
1432        if err != Error::None_ {
1433            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
1434        }
1435        Ok(isl_rs_result)
1436    }
1437
1438    /// Wraps `isl_map_flatten_range`.
1439    pub fn flatten_range(self) -> Result<Map, LibISLError> {
1440        let map = self;
1441        let isl_rs_ctx = map.get_ctx();
1442        let mut map = map;
1443        map.do_not_free_on_drop();
1444        let map = map.ptr;
1445        let isl_rs_result = unsafe { isl_map_flatten_range(map) };
1446        let isl_rs_result = Map { ptr: isl_rs_result,
1447                                  should_free_on_drop: true };
1448        let err = isl_rs_ctx.last_error();
1449        if err != Error::None_ {
1450            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
1451        }
1452        Ok(isl_rs_result)
1453    }
1454
1455    /// Wraps `isl_map_floordiv_val`.
1456    pub fn floordiv_val(self, d: Val) -> Result<Map, LibISLError> {
1457        let map = self;
1458        let isl_rs_ctx = map.get_ctx();
1459        let mut map = map;
1460        map.do_not_free_on_drop();
1461        let map = map.ptr;
1462        let mut d = d;
1463        d.do_not_free_on_drop();
1464        let d = d.ptr;
1465        let isl_rs_result = unsafe { isl_map_floordiv_val(map, d) };
1466        let isl_rs_result = Map { ptr: isl_rs_result,
1467                                  should_free_on_drop: true };
1468        let err = isl_rs_ctx.last_error();
1469        if err != Error::None_ {
1470            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
1471        }
1472        Ok(isl_rs_result)
1473    }
1474
1475    /// Wraps `isl_map_free`.
1476    pub fn free(self) -> Result<Map, LibISLError> {
1477        let map = self;
1478        let isl_rs_ctx = map.get_ctx();
1479        let mut map = map;
1480        map.do_not_free_on_drop();
1481        let map = map.ptr;
1482        let isl_rs_result = unsafe { isl_map_free(map) };
1483        let isl_rs_result = Map { ptr: isl_rs_result,
1484                                  should_free_on_drop: true };
1485        let err = isl_rs_ctx.last_error();
1486        if err != Error::None_ {
1487            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
1488        }
1489        Ok(isl_rs_result)
1490    }
1491
1492    /// Wraps `isl_map_from_aff`.
1493    pub fn from_aff(aff: Aff) -> Result<Map, LibISLError> {
1494        let isl_rs_ctx = aff.get_ctx();
1495        let mut aff = aff;
1496        aff.do_not_free_on_drop();
1497        let aff = aff.ptr;
1498        let isl_rs_result = unsafe { isl_map_from_aff(aff) };
1499        let isl_rs_result = Map { ptr: isl_rs_result,
1500                                  should_free_on_drop: true };
1501        let err = isl_rs_ctx.last_error();
1502        if err != Error::None_ {
1503            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
1504        }
1505        Ok(isl_rs_result)
1506    }
1507
1508    /// Wraps `isl_map_from_basic_map`.
1509    pub fn from_basic_map(bmap: BasicMap) -> Result<Map, LibISLError> {
1510        let isl_rs_ctx = bmap.get_ctx();
1511        let mut bmap = bmap;
1512        bmap.do_not_free_on_drop();
1513        let bmap = bmap.ptr;
1514        let isl_rs_result = unsafe { isl_map_from_basic_map(bmap) };
1515        let isl_rs_result = Map { ptr: isl_rs_result,
1516                                  should_free_on_drop: true };
1517        let err = isl_rs_ctx.last_error();
1518        if err != Error::None_ {
1519            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
1520        }
1521        Ok(isl_rs_result)
1522    }
1523
1524    /// Wraps `isl_map_from_domain`.
1525    pub fn from_domain(set: Set) -> Result<Map, LibISLError> {
1526        let isl_rs_ctx = set.get_ctx();
1527        let mut set = set;
1528        set.do_not_free_on_drop();
1529        let set = set.ptr;
1530        let isl_rs_result = unsafe { isl_map_from_domain(set) };
1531        let isl_rs_result = Map { ptr: isl_rs_result,
1532                                  should_free_on_drop: true };
1533        let err = isl_rs_ctx.last_error();
1534        if err != Error::None_ {
1535            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
1536        }
1537        Ok(isl_rs_result)
1538    }
1539
1540    /// Wraps `isl_map_from_domain_and_range`.
1541    pub fn from_domain_and_range(domain: Set, range: Set) -> Result<Map, LibISLError> {
1542        let isl_rs_ctx = domain.get_ctx();
1543        let mut domain = domain;
1544        domain.do_not_free_on_drop();
1545        let domain = domain.ptr;
1546        let mut range = range;
1547        range.do_not_free_on_drop();
1548        let range = range.ptr;
1549        let isl_rs_result = unsafe { isl_map_from_domain_and_range(domain, range) };
1550        let isl_rs_result = Map { ptr: isl_rs_result,
1551                                  should_free_on_drop: true };
1552        let err = isl_rs_ctx.last_error();
1553        if err != Error::None_ {
1554            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
1555        }
1556        Ok(isl_rs_result)
1557    }
1558
1559    /// Wraps `isl_map_from_multi_aff`.
1560    pub fn from_multi_aff(maff: MultiAff) -> Result<Map, LibISLError> {
1561        let isl_rs_ctx = maff.get_ctx();
1562        let mut maff = maff;
1563        maff.do_not_free_on_drop();
1564        let maff = maff.ptr;
1565        let isl_rs_result = unsafe { isl_map_from_multi_aff(maff) };
1566        let isl_rs_result = Map { ptr: isl_rs_result,
1567                                  should_free_on_drop: true };
1568        let err = isl_rs_ctx.last_error();
1569        if err != Error::None_ {
1570            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
1571        }
1572        Ok(isl_rs_result)
1573    }
1574
1575    /// Wraps `isl_map_from_multi_pw_aff`.
1576    pub fn from_multi_pw_aff(mpa: MultiPwAff) -> Result<Map, LibISLError> {
1577        let isl_rs_ctx = mpa.get_ctx();
1578        let mut mpa = mpa;
1579        mpa.do_not_free_on_drop();
1580        let mpa = mpa.ptr;
1581        let isl_rs_result = unsafe { isl_map_from_multi_pw_aff(mpa) };
1582        let isl_rs_result = Map { ptr: isl_rs_result,
1583                                  should_free_on_drop: true };
1584        let err = isl_rs_ctx.last_error();
1585        if err != Error::None_ {
1586            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
1587        }
1588        Ok(isl_rs_result)
1589    }
1590
1591    /// Wraps `isl_map_from_pw_aff`.
1592    pub fn from_pw_aff(pwaff: PwAff) -> Result<Map, LibISLError> {
1593        let isl_rs_ctx = pwaff.get_ctx();
1594        let mut pwaff = pwaff;
1595        pwaff.do_not_free_on_drop();
1596        let pwaff = pwaff.ptr;
1597        let isl_rs_result = unsafe { isl_map_from_pw_aff(pwaff) };
1598        let isl_rs_result = Map { ptr: isl_rs_result,
1599                                  should_free_on_drop: true };
1600        let err = isl_rs_ctx.last_error();
1601        if err != Error::None_ {
1602            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
1603        }
1604        Ok(isl_rs_result)
1605    }
1606
1607    /// Wraps `isl_map_from_pw_multi_aff`.
1608    pub fn from_pw_multi_aff(pma: PwMultiAff) -> Result<Map, LibISLError> {
1609        let isl_rs_ctx = pma.get_ctx();
1610        let mut pma = pma;
1611        pma.do_not_free_on_drop();
1612        let pma = pma.ptr;
1613        let isl_rs_result = unsafe { isl_map_from_pw_multi_aff(pma) };
1614        let isl_rs_result = Map { ptr: isl_rs_result,
1615                                  should_free_on_drop: true };
1616        let err = isl_rs_ctx.last_error();
1617        if err != Error::None_ {
1618            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
1619        }
1620        Ok(isl_rs_result)
1621    }
1622
1623    /// Wraps `isl_map_from_range`.
1624    pub fn from_range(set: Set) -> Result<Map, LibISLError> {
1625        let isl_rs_ctx = set.get_ctx();
1626        let mut set = set;
1627        set.do_not_free_on_drop();
1628        let set = set.ptr;
1629        let isl_rs_result = unsafe { isl_map_from_range(set) };
1630        let isl_rs_result = Map { ptr: isl_rs_result,
1631                                  should_free_on_drop: true };
1632        let err = isl_rs_ctx.last_error();
1633        if err != Error::None_ {
1634            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
1635        }
1636        Ok(isl_rs_result)
1637    }
1638
1639    /// Wraps `isl_map_from_union_map`.
1640    pub fn from_union_map(umap: UnionMap) -> Result<Map, LibISLError> {
1641        let isl_rs_ctx = umap.get_ctx();
1642        let mut umap = umap;
1643        umap.do_not_free_on_drop();
1644        let umap = umap.ptr;
1645        let isl_rs_result = unsafe { isl_map_from_union_map(umap) };
1646        let isl_rs_result = Map { ptr: isl_rs_result,
1647                                  should_free_on_drop: true };
1648        let err = isl_rs_ctx.last_error();
1649        if err != Error::None_ {
1650            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
1651        }
1652        Ok(isl_rs_result)
1653    }
1654
1655    /// Wraps `isl_map_get_basic_map_list`.
1656    pub fn get_basic_map_list(&self) -> Result<BasicMapList, LibISLError> {
1657        let map = self;
1658        let isl_rs_ctx = map.get_ctx();
1659        let map = map.ptr;
1660        let isl_rs_result = unsafe { isl_map_get_basic_map_list(map) };
1661        let isl_rs_result = BasicMapList { ptr: isl_rs_result,
1662                                           should_free_on_drop: true };
1663        let err = isl_rs_ctx.last_error();
1664        if err != Error::None_ {
1665            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
1666        }
1667        Ok(isl_rs_result)
1668    }
1669
1670    /// Wraps `isl_map_get_ctx`.
1671    pub fn get_ctx(&self) -> Context {
1672        let map = self;
1673        let map = map.ptr;
1674        let isl_rs_result = unsafe { isl_map_get_ctx(map) };
1675        let isl_rs_result = Context { ptr: isl_rs_result,
1676                                      should_free_on_drop: false };
1677        isl_rs_result
1678    }
1679
1680    /// Wraps `isl_map_get_dim_id`.
1681    pub fn get_dim_id(&self, type_: DimType, pos: u32) -> Result<Id, LibISLError> {
1682        let map = self;
1683        let isl_rs_ctx = map.get_ctx();
1684        let map = map.ptr;
1685        let type_ = type_.to_i32();
1686        let isl_rs_result = unsafe { isl_map_get_dim_id(map, type_, pos) };
1687        let isl_rs_result = Id { ptr: isl_rs_result,
1688                                 should_free_on_drop: true };
1689        let err = isl_rs_ctx.last_error();
1690        if err != Error::None_ {
1691            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
1692        }
1693        Ok(isl_rs_result)
1694    }
1695
1696    /// Wraps `isl_map_get_dim_name`.
1697    pub fn get_dim_name(&self, type_: DimType, pos: u32) -> Result<&str, LibISLError> {
1698        let map = self;
1699        let isl_rs_ctx = map.get_ctx();
1700        let map = map.ptr;
1701        let type_ = type_.to_i32();
1702        let isl_rs_result = unsafe { isl_map_get_dim_name(map, type_, pos) };
1703        let isl_rs_result = unsafe { CStr::from_ptr(isl_rs_result) };
1704        let isl_rs_result = isl_rs_result.to_str().unwrap();
1705        let err = isl_rs_ctx.last_error();
1706        if err != Error::None_ {
1707            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
1708        }
1709        Ok(isl_rs_result)
1710    }
1711
1712    /// Wraps `isl_map_get_domain_tuple_id`.
1713    pub fn get_domain_tuple_id(&self) -> Result<Id, LibISLError> {
1714        let map = self;
1715        let isl_rs_ctx = map.get_ctx();
1716        let map = map.ptr;
1717        let isl_rs_result = unsafe { isl_map_get_domain_tuple_id(map) };
1718        let isl_rs_result = Id { ptr: isl_rs_result,
1719                                 should_free_on_drop: true };
1720        let err = isl_rs_ctx.last_error();
1721        if err != Error::None_ {
1722            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
1723        }
1724        Ok(isl_rs_result)
1725    }
1726
1727    /// Wraps `isl_map_get_hash`.
1728    pub fn get_hash(&self) -> Result<u32, LibISLError> {
1729        let map = self;
1730        let isl_rs_ctx = map.get_ctx();
1731        let map = map.ptr;
1732        let isl_rs_result = unsafe { isl_map_get_hash(map) };
1733        let err = isl_rs_ctx.last_error();
1734        if err != Error::None_ {
1735            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
1736        }
1737        Ok(isl_rs_result)
1738    }
1739
1740    /// Wraps `isl_map_get_range_lattice_tile`.
1741    pub fn get_range_lattice_tile(&self) -> Result<FixedBox, LibISLError> {
1742        let map = self;
1743        let isl_rs_ctx = map.get_ctx();
1744        let map = map.ptr;
1745        let isl_rs_result = unsafe { isl_map_get_range_lattice_tile(map) };
1746        let isl_rs_result = FixedBox { ptr: isl_rs_result,
1747                                       should_free_on_drop: true };
1748        let err = isl_rs_ctx.last_error();
1749        if err != Error::None_ {
1750            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
1751        }
1752        Ok(isl_rs_result)
1753    }
1754
1755    /// Wraps `isl_map_get_range_simple_fixed_box_hull`.
1756    pub fn get_range_simple_fixed_box_hull(&self) -> Result<FixedBox, LibISLError> {
1757        let map = self;
1758        let isl_rs_ctx = map.get_ctx();
1759        let map = map.ptr;
1760        let isl_rs_result = unsafe { isl_map_get_range_simple_fixed_box_hull(map) };
1761        let isl_rs_result = FixedBox { ptr: isl_rs_result,
1762                                       should_free_on_drop: true };
1763        let err = isl_rs_ctx.last_error();
1764        if err != Error::None_ {
1765            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
1766        }
1767        Ok(isl_rs_result)
1768    }
1769
1770    /// Wraps `isl_map_get_range_stride_info`.
1771    pub fn get_range_stride_info(&self, pos: i32) -> Result<StrideInfo, LibISLError> {
1772        let map = self;
1773        let isl_rs_ctx = map.get_ctx();
1774        let map = map.ptr;
1775        let isl_rs_result = unsafe { isl_map_get_range_stride_info(map, pos) };
1776        let isl_rs_result = StrideInfo { ptr: isl_rs_result,
1777                                         should_free_on_drop: true };
1778        let err = isl_rs_ctx.last_error();
1779        if err != Error::None_ {
1780            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
1781        }
1782        Ok(isl_rs_result)
1783    }
1784
1785    /// Wraps `isl_map_get_range_tuple_id`.
1786    pub fn get_range_tuple_id(&self) -> Result<Id, LibISLError> {
1787        let map = self;
1788        let isl_rs_ctx = map.get_ctx();
1789        let map = map.ptr;
1790        let isl_rs_result = unsafe { isl_map_get_range_tuple_id(map) };
1791        let isl_rs_result = Id { ptr: isl_rs_result,
1792                                 should_free_on_drop: true };
1793        let err = isl_rs_ctx.last_error();
1794        if err != Error::None_ {
1795            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
1796        }
1797        Ok(isl_rs_result)
1798    }
1799
1800    /// Wraps `isl_map_get_space`.
1801    pub fn get_space(&self) -> Result<Space, LibISLError> {
1802        let map = self;
1803        let isl_rs_ctx = map.get_ctx();
1804        let map = map.ptr;
1805        let isl_rs_result = unsafe { isl_map_get_space(map) };
1806        let isl_rs_result = Space { ptr: isl_rs_result,
1807                                    should_free_on_drop: true };
1808        let err = isl_rs_ctx.last_error();
1809        if err != Error::None_ {
1810            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
1811        }
1812        Ok(isl_rs_result)
1813    }
1814
1815    /// Wraps `isl_map_get_tuple_id`.
1816    pub fn get_tuple_id(&self, type_: DimType) -> Result<Id, LibISLError> {
1817        let map = self;
1818        let isl_rs_ctx = map.get_ctx();
1819        let map = map.ptr;
1820        let type_ = type_.to_i32();
1821        let isl_rs_result = unsafe { isl_map_get_tuple_id(map, type_) };
1822        let isl_rs_result = Id { ptr: isl_rs_result,
1823                                 should_free_on_drop: true };
1824        let err = isl_rs_ctx.last_error();
1825        if err != Error::None_ {
1826            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
1827        }
1828        Ok(isl_rs_result)
1829    }
1830
1831    /// Wraps `isl_map_get_tuple_name`.
1832    pub fn get_tuple_name(&self, type_: DimType) -> Result<&str, LibISLError> {
1833        let map = self;
1834        let isl_rs_ctx = map.get_ctx();
1835        let map = map.ptr;
1836        let type_ = type_.to_i32();
1837        let isl_rs_result = unsafe { isl_map_get_tuple_name(map, type_) };
1838        let isl_rs_result = unsafe { CStr::from_ptr(isl_rs_result) };
1839        let isl_rs_result = isl_rs_result.to_str().unwrap();
1840        let err = isl_rs_ctx.last_error();
1841        if err != Error::None_ {
1842            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
1843        }
1844        Ok(isl_rs_result)
1845    }
1846
1847    /// Wraps `isl_map_gist`.
1848    pub fn gist(self, context: Map) -> Result<Map, LibISLError> {
1849        let map = self;
1850        let isl_rs_ctx = map.get_ctx();
1851        let mut map = map;
1852        map.do_not_free_on_drop();
1853        let map = map.ptr;
1854        let mut context = context;
1855        context.do_not_free_on_drop();
1856        let context = context.ptr;
1857        let isl_rs_result = unsafe { isl_map_gist(map, context) };
1858        let isl_rs_result = Map { ptr: isl_rs_result,
1859                                  should_free_on_drop: true };
1860        let err = isl_rs_ctx.last_error();
1861        if err != Error::None_ {
1862            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
1863        }
1864        Ok(isl_rs_result)
1865    }
1866
1867    /// Wraps `isl_map_gist_basic_map`.
1868    pub fn gist_basic_map(self, context: BasicMap) -> Result<Map, LibISLError> {
1869        let map = self;
1870        let isl_rs_ctx = map.get_ctx();
1871        let mut map = map;
1872        map.do_not_free_on_drop();
1873        let map = map.ptr;
1874        let mut context = context;
1875        context.do_not_free_on_drop();
1876        let context = context.ptr;
1877        let isl_rs_result = unsafe { isl_map_gist_basic_map(map, context) };
1878        let isl_rs_result = Map { ptr: isl_rs_result,
1879                                  should_free_on_drop: true };
1880        let err = isl_rs_ctx.last_error();
1881        if err != Error::None_ {
1882            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
1883        }
1884        Ok(isl_rs_result)
1885    }
1886
1887    /// Wraps `isl_map_gist_domain`.
1888    pub fn gist_domain(self, context: Set) -> Result<Map, LibISLError> {
1889        let map = self;
1890        let isl_rs_ctx = map.get_ctx();
1891        let mut map = map;
1892        map.do_not_free_on_drop();
1893        let map = map.ptr;
1894        let mut context = context;
1895        context.do_not_free_on_drop();
1896        let context = context.ptr;
1897        let isl_rs_result = unsafe { isl_map_gist_domain(map, context) };
1898        let isl_rs_result = Map { ptr: isl_rs_result,
1899                                  should_free_on_drop: true };
1900        let err = isl_rs_ctx.last_error();
1901        if err != Error::None_ {
1902            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
1903        }
1904        Ok(isl_rs_result)
1905    }
1906
1907    /// Wraps `isl_map_gist_params`.
1908    pub fn gist_params(self, context: Set) -> Result<Map, LibISLError> {
1909        let map = self;
1910        let isl_rs_ctx = map.get_ctx();
1911        let mut map = map;
1912        map.do_not_free_on_drop();
1913        let map = map.ptr;
1914        let mut context = context;
1915        context.do_not_free_on_drop();
1916        let context = context.ptr;
1917        let isl_rs_result = unsafe { isl_map_gist_params(map, context) };
1918        let isl_rs_result = Map { ptr: isl_rs_result,
1919                                  should_free_on_drop: true };
1920        let err = isl_rs_ctx.last_error();
1921        if err != Error::None_ {
1922            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
1923        }
1924        Ok(isl_rs_result)
1925    }
1926
1927    /// Wraps `isl_map_gist_range`.
1928    pub fn gist_range(self, context: Set) -> Result<Map, LibISLError> {
1929        let map = self;
1930        let isl_rs_ctx = map.get_ctx();
1931        let mut map = map;
1932        map.do_not_free_on_drop();
1933        let map = map.ptr;
1934        let mut context = context;
1935        context.do_not_free_on_drop();
1936        let context = context.ptr;
1937        let isl_rs_result = unsafe { isl_map_gist_range(map, context) };
1938        let isl_rs_result = Map { ptr: isl_rs_result,
1939                                  should_free_on_drop: true };
1940        let err = isl_rs_ctx.last_error();
1941        if err != Error::None_ {
1942            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
1943        }
1944        Ok(isl_rs_result)
1945    }
1946
1947    /// Wraps `isl_map_has_dim_id`.
1948    pub fn has_dim_id(&self, type_: DimType, pos: u32) -> Result<bool, LibISLError> {
1949        let map = self;
1950        let isl_rs_ctx = map.get_ctx();
1951        let map = map.ptr;
1952        let type_ = type_.to_i32();
1953        let isl_rs_result = unsafe { isl_map_has_dim_id(map, type_, pos) };
1954        let isl_rs_result = match isl_rs_result {
1955            0 => false,
1956            1 => true,
1957            _ => panic!("Got isl_bool = -1"),
1958        };
1959        let err = isl_rs_ctx.last_error();
1960        if err != Error::None_ {
1961            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
1962        }
1963        Ok(isl_rs_result)
1964    }
1965
1966    /// Wraps `isl_map_has_dim_name`.
1967    pub fn has_dim_name(&self, type_: DimType, pos: u32) -> Result<bool, LibISLError> {
1968        let map = self;
1969        let isl_rs_ctx = map.get_ctx();
1970        let map = map.ptr;
1971        let type_ = type_.to_i32();
1972        let isl_rs_result = unsafe { isl_map_has_dim_name(map, type_, pos) };
1973        let isl_rs_result = match isl_rs_result {
1974            0 => false,
1975            1 => true,
1976            _ => panic!("Got isl_bool = -1"),
1977        };
1978        let err = isl_rs_ctx.last_error();
1979        if err != Error::None_ {
1980            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
1981        }
1982        Ok(isl_rs_result)
1983    }
1984
1985    /// Wraps `isl_map_has_domain_tuple_id`.
1986    pub fn has_domain_tuple_id(&self) -> Result<bool, LibISLError> {
1987        let map = self;
1988        let isl_rs_ctx = map.get_ctx();
1989        let map = map.ptr;
1990        let isl_rs_result = unsafe { isl_map_has_domain_tuple_id(map) };
1991        let isl_rs_result = match isl_rs_result {
1992            0 => false,
1993            1 => true,
1994            _ => panic!("Got isl_bool = -1"),
1995        };
1996        let err = isl_rs_ctx.last_error();
1997        if err != Error::None_ {
1998            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
1999        }
2000        Ok(isl_rs_result)
2001    }
2002
2003    /// Wraps `isl_map_has_equal_space`.
2004    pub fn has_equal_space(&self, map2: &Map) -> Result<bool, LibISLError> {
2005        let map1 = self;
2006        let isl_rs_ctx = map1.get_ctx();
2007        let map1 = map1.ptr;
2008        let map2 = map2.ptr;
2009        let isl_rs_result = unsafe { isl_map_has_equal_space(map1, map2) };
2010        let isl_rs_result = match isl_rs_result {
2011            0 => false,
2012            1 => true,
2013            _ => panic!("Got isl_bool = -1"),
2014        };
2015        let err = isl_rs_ctx.last_error();
2016        if err != Error::None_ {
2017            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
2018        }
2019        Ok(isl_rs_result)
2020    }
2021
2022    /// Wraps `isl_map_has_range_tuple_id`.
2023    pub fn has_range_tuple_id(&self) -> Result<bool, LibISLError> {
2024        let map = self;
2025        let isl_rs_ctx = map.get_ctx();
2026        let map = map.ptr;
2027        let isl_rs_result = unsafe { isl_map_has_range_tuple_id(map) };
2028        let isl_rs_result = match isl_rs_result {
2029            0 => false,
2030            1 => true,
2031            _ => panic!("Got isl_bool = -1"),
2032        };
2033        let err = isl_rs_ctx.last_error();
2034        if err != Error::None_ {
2035            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
2036        }
2037        Ok(isl_rs_result)
2038    }
2039
2040    /// Wraps `isl_map_has_tuple_id`.
2041    pub fn has_tuple_id(&self, type_: DimType) -> Result<bool, LibISLError> {
2042        let map = self;
2043        let isl_rs_ctx = map.get_ctx();
2044        let map = map.ptr;
2045        let type_ = type_.to_i32();
2046        let isl_rs_result = unsafe { isl_map_has_tuple_id(map, type_) };
2047        let isl_rs_result = match isl_rs_result {
2048            0 => false,
2049            1 => true,
2050            _ => panic!("Got isl_bool = -1"),
2051        };
2052        let err = isl_rs_ctx.last_error();
2053        if err != Error::None_ {
2054            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
2055        }
2056        Ok(isl_rs_result)
2057    }
2058
2059    /// Wraps `isl_map_has_tuple_name`.
2060    pub fn has_tuple_name(&self, type_: DimType) -> Result<bool, LibISLError> {
2061        let map = self;
2062        let isl_rs_ctx = map.get_ctx();
2063        let map = map.ptr;
2064        let type_ = type_.to_i32();
2065        let isl_rs_result = unsafe { isl_map_has_tuple_name(map, type_) };
2066        let isl_rs_result = match isl_rs_result {
2067            0 => false,
2068            1 => true,
2069            _ => panic!("Got isl_bool = -1"),
2070        };
2071        let err = isl_rs_ctx.last_error();
2072        if err != Error::None_ {
2073            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
2074        }
2075        Ok(isl_rs_result)
2076    }
2077
2078    /// Wraps `isl_map_identity`.
2079    pub fn identity(space: Space) -> Result<Map, LibISLError> {
2080        let isl_rs_ctx = space.get_ctx();
2081        let mut space = space;
2082        space.do_not_free_on_drop();
2083        let space = space.ptr;
2084        let isl_rs_result = unsafe { isl_map_identity(space) };
2085        let isl_rs_result = Map { ptr: isl_rs_result,
2086                                  should_free_on_drop: true };
2087        let err = isl_rs_ctx.last_error();
2088        if err != Error::None_ {
2089            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
2090        }
2091        Ok(isl_rs_result)
2092    }
2093
2094    /// Wraps `isl_map_insert_dims`.
2095    pub fn insert_dims(self, type_: DimType, pos: u32, n: u32) -> Result<Map, LibISLError> {
2096        let map = self;
2097        let isl_rs_ctx = map.get_ctx();
2098        let mut map = map;
2099        map.do_not_free_on_drop();
2100        let map = map.ptr;
2101        let type_ = type_.to_i32();
2102        let isl_rs_result = unsafe { isl_map_insert_dims(map, type_, pos, n) };
2103        let isl_rs_result = Map { ptr: isl_rs_result,
2104                                  should_free_on_drop: true };
2105        let err = isl_rs_ctx.last_error();
2106        if err != Error::None_ {
2107            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
2108        }
2109        Ok(isl_rs_result)
2110    }
2111
2112    /// Wraps `isl_map_intersect`.
2113    pub fn intersect(self, map2: Map) -> Result<Map, LibISLError> {
2114        let map1 = self;
2115        let isl_rs_ctx = map1.get_ctx();
2116        let mut map1 = map1;
2117        map1.do_not_free_on_drop();
2118        let map1 = map1.ptr;
2119        let mut map2 = map2;
2120        map2.do_not_free_on_drop();
2121        let map2 = map2.ptr;
2122        let isl_rs_result = unsafe { isl_map_intersect(map1, map2) };
2123        let isl_rs_result = Map { ptr: isl_rs_result,
2124                                  should_free_on_drop: true };
2125        let err = isl_rs_ctx.last_error();
2126        if err != Error::None_ {
2127            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
2128        }
2129        Ok(isl_rs_result)
2130    }
2131
2132    /// Wraps `isl_map_intersect_domain`.
2133    pub fn intersect_domain(self, set: Set) -> Result<Map, LibISLError> {
2134        let map = self;
2135        let isl_rs_ctx = map.get_ctx();
2136        let mut map = map;
2137        map.do_not_free_on_drop();
2138        let map = map.ptr;
2139        let mut set = set;
2140        set.do_not_free_on_drop();
2141        let set = set.ptr;
2142        let isl_rs_result = unsafe { isl_map_intersect_domain(map, set) };
2143        let isl_rs_result = Map { ptr: isl_rs_result,
2144                                  should_free_on_drop: true };
2145        let err = isl_rs_ctx.last_error();
2146        if err != Error::None_ {
2147            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
2148        }
2149        Ok(isl_rs_result)
2150    }
2151
2152    /// Wraps `isl_map_intersect_domain_factor_domain`.
2153    pub fn intersect_domain_factor_domain(self, factor: Map) -> Result<Map, LibISLError> {
2154        let map = self;
2155        let isl_rs_ctx = map.get_ctx();
2156        let mut map = map;
2157        map.do_not_free_on_drop();
2158        let map = map.ptr;
2159        let mut factor = factor;
2160        factor.do_not_free_on_drop();
2161        let factor = factor.ptr;
2162        let isl_rs_result = unsafe { isl_map_intersect_domain_factor_domain(map, factor) };
2163        let isl_rs_result = Map { ptr: isl_rs_result,
2164                                  should_free_on_drop: true };
2165        let err = isl_rs_ctx.last_error();
2166        if err != Error::None_ {
2167            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
2168        }
2169        Ok(isl_rs_result)
2170    }
2171
2172    /// Wraps `isl_map_intersect_domain_factor_range`.
2173    pub fn intersect_domain_factor_range(self, factor: Map) -> Result<Map, LibISLError> {
2174        let map = self;
2175        let isl_rs_ctx = map.get_ctx();
2176        let mut map = map;
2177        map.do_not_free_on_drop();
2178        let map = map.ptr;
2179        let mut factor = factor;
2180        factor.do_not_free_on_drop();
2181        let factor = factor.ptr;
2182        let isl_rs_result = unsafe { isl_map_intersect_domain_factor_range(map, factor) };
2183        let isl_rs_result = Map { ptr: isl_rs_result,
2184                                  should_free_on_drop: true };
2185        let err = isl_rs_ctx.last_error();
2186        if err != Error::None_ {
2187            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
2188        }
2189        Ok(isl_rs_result)
2190    }
2191
2192    /// Wraps `isl_map_intersect_domain_wrapped_domain`.
2193    pub fn intersect_domain_wrapped_domain(self, domain: Set) -> Result<Map, LibISLError> {
2194        let map = self;
2195        let isl_rs_ctx = map.get_ctx();
2196        let mut map = map;
2197        map.do_not_free_on_drop();
2198        let map = map.ptr;
2199        let mut domain = domain;
2200        domain.do_not_free_on_drop();
2201        let domain = domain.ptr;
2202        let isl_rs_result = unsafe { isl_map_intersect_domain_wrapped_domain(map, domain) };
2203        let isl_rs_result = Map { ptr: isl_rs_result,
2204                                  should_free_on_drop: true };
2205        let err = isl_rs_ctx.last_error();
2206        if err != Error::None_ {
2207            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
2208        }
2209        Ok(isl_rs_result)
2210    }
2211
2212    /// Wraps `isl_map_intersect_params`.
2213    pub fn intersect_params(self, params: Set) -> Result<Map, LibISLError> {
2214        let map = self;
2215        let isl_rs_ctx = map.get_ctx();
2216        let mut map = map;
2217        map.do_not_free_on_drop();
2218        let map = map.ptr;
2219        let mut params = params;
2220        params.do_not_free_on_drop();
2221        let params = params.ptr;
2222        let isl_rs_result = unsafe { isl_map_intersect_params(map, params) };
2223        let isl_rs_result = Map { ptr: isl_rs_result,
2224                                  should_free_on_drop: true };
2225        let err = isl_rs_ctx.last_error();
2226        if err != Error::None_ {
2227            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
2228        }
2229        Ok(isl_rs_result)
2230    }
2231
2232    /// Wraps `isl_map_intersect_range`.
2233    pub fn intersect_range(self, set: Set) -> Result<Map, LibISLError> {
2234        let map = self;
2235        let isl_rs_ctx = map.get_ctx();
2236        let mut map = map;
2237        map.do_not_free_on_drop();
2238        let map = map.ptr;
2239        let mut set = set;
2240        set.do_not_free_on_drop();
2241        let set = set.ptr;
2242        let isl_rs_result = unsafe { isl_map_intersect_range(map, set) };
2243        let isl_rs_result = Map { ptr: isl_rs_result,
2244                                  should_free_on_drop: true };
2245        let err = isl_rs_ctx.last_error();
2246        if err != Error::None_ {
2247            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
2248        }
2249        Ok(isl_rs_result)
2250    }
2251
2252    /// Wraps `isl_map_intersect_range_factor_domain`.
2253    pub fn intersect_range_factor_domain(self, factor: Map) -> Result<Map, LibISLError> {
2254        let map = self;
2255        let isl_rs_ctx = map.get_ctx();
2256        let mut map = map;
2257        map.do_not_free_on_drop();
2258        let map = map.ptr;
2259        let mut factor = factor;
2260        factor.do_not_free_on_drop();
2261        let factor = factor.ptr;
2262        let isl_rs_result = unsafe { isl_map_intersect_range_factor_domain(map, factor) };
2263        let isl_rs_result = Map { ptr: isl_rs_result,
2264                                  should_free_on_drop: true };
2265        let err = isl_rs_ctx.last_error();
2266        if err != Error::None_ {
2267            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
2268        }
2269        Ok(isl_rs_result)
2270    }
2271
2272    /// Wraps `isl_map_intersect_range_factor_range`.
2273    pub fn intersect_range_factor_range(self, factor: Map) -> Result<Map, LibISLError> {
2274        let map = self;
2275        let isl_rs_ctx = map.get_ctx();
2276        let mut map = map;
2277        map.do_not_free_on_drop();
2278        let map = map.ptr;
2279        let mut factor = factor;
2280        factor.do_not_free_on_drop();
2281        let factor = factor.ptr;
2282        let isl_rs_result = unsafe { isl_map_intersect_range_factor_range(map, factor) };
2283        let isl_rs_result = Map { ptr: isl_rs_result,
2284                                  should_free_on_drop: true };
2285        let err = isl_rs_ctx.last_error();
2286        if err != Error::None_ {
2287            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
2288        }
2289        Ok(isl_rs_result)
2290    }
2291
2292    /// Wraps `isl_map_intersect_range_wrapped_domain`.
2293    pub fn intersect_range_wrapped_domain(self, domain: Set) -> Result<Map, LibISLError> {
2294        let map = self;
2295        let isl_rs_ctx = map.get_ctx();
2296        let mut map = map;
2297        map.do_not_free_on_drop();
2298        let map = map.ptr;
2299        let mut domain = domain;
2300        domain.do_not_free_on_drop();
2301        let domain = domain.ptr;
2302        let isl_rs_result = unsafe { isl_map_intersect_range_wrapped_domain(map, domain) };
2303        let isl_rs_result = Map { ptr: isl_rs_result,
2304                                  should_free_on_drop: true };
2305        let err = isl_rs_ctx.last_error();
2306        if err != Error::None_ {
2307            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
2308        }
2309        Ok(isl_rs_result)
2310    }
2311
2312    /// Wraps `isl_map_involves_dims`.
2313    pub fn involves_dims(&self, type_: DimType, first: u32, n: u32) -> Result<bool, LibISLError> {
2314        let map = self;
2315        let isl_rs_ctx = map.get_ctx();
2316        let map = map.ptr;
2317        let type_ = type_.to_i32();
2318        let isl_rs_result = unsafe { isl_map_involves_dims(map, type_, first, n) };
2319        let isl_rs_result = match isl_rs_result {
2320            0 => false,
2321            1 => true,
2322            _ => panic!("Got isl_bool = -1"),
2323        };
2324        let err = isl_rs_ctx.last_error();
2325        if err != Error::None_ {
2326            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
2327        }
2328        Ok(isl_rs_result)
2329    }
2330
2331    /// Wraps `isl_map_is_bijective`.
2332    pub fn is_bijective(&self) -> Result<bool, LibISLError> {
2333        let map = self;
2334        let isl_rs_ctx = map.get_ctx();
2335        let map = map.ptr;
2336        let isl_rs_result = unsafe { isl_map_is_bijective(map) };
2337        let isl_rs_result = match isl_rs_result {
2338            0 => false,
2339            1 => true,
2340            _ => panic!("Got isl_bool = -1"),
2341        };
2342        let err = isl_rs_ctx.last_error();
2343        if err != Error::None_ {
2344            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
2345        }
2346        Ok(isl_rs_result)
2347    }
2348
2349    /// Wraps `isl_map_is_disjoint`.
2350    pub fn is_disjoint(&self, map2: &Map) -> Result<bool, LibISLError> {
2351        let map1 = self;
2352        let isl_rs_ctx = map1.get_ctx();
2353        let map1 = map1.ptr;
2354        let map2 = map2.ptr;
2355        let isl_rs_result = unsafe { isl_map_is_disjoint(map1, map2) };
2356        let isl_rs_result = match isl_rs_result {
2357            0 => false,
2358            1 => true,
2359            _ => panic!("Got isl_bool = -1"),
2360        };
2361        let err = isl_rs_ctx.last_error();
2362        if err != Error::None_ {
2363            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
2364        }
2365        Ok(isl_rs_result)
2366    }
2367
2368    /// Wraps `isl_map_is_empty`.
2369    pub fn is_empty(&self) -> Result<bool, LibISLError> {
2370        let map = self;
2371        let isl_rs_ctx = map.get_ctx();
2372        let map = map.ptr;
2373        let isl_rs_result = unsafe { isl_map_is_empty(map) };
2374        let isl_rs_result = match isl_rs_result {
2375            0 => false,
2376            1 => true,
2377            _ => panic!("Got isl_bool = -1"),
2378        };
2379        let err = isl_rs_ctx.last_error();
2380        if err != Error::None_ {
2381            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
2382        }
2383        Ok(isl_rs_result)
2384    }
2385
2386    /// Wraps `isl_map_is_equal`.
2387    pub fn is_equal(&self, map2: &Map) -> Result<bool, LibISLError> {
2388        let map1 = self;
2389        let isl_rs_ctx = map1.get_ctx();
2390        let map1 = map1.ptr;
2391        let map2 = map2.ptr;
2392        let isl_rs_result = unsafe { isl_map_is_equal(map1, map2) };
2393        let isl_rs_result = match isl_rs_result {
2394            0 => false,
2395            1 => true,
2396            _ => panic!("Got isl_bool = -1"),
2397        };
2398        let err = isl_rs_ctx.last_error();
2399        if err != Error::None_ {
2400            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
2401        }
2402        Ok(isl_rs_result)
2403    }
2404
2405    /// Wraps `isl_map_is_identity`.
2406    pub fn is_identity(&self) -> Result<bool, LibISLError> {
2407        let map = self;
2408        let isl_rs_ctx = map.get_ctx();
2409        let map = map.ptr;
2410        let isl_rs_result = unsafe { isl_map_is_identity(map) };
2411        let isl_rs_result = match isl_rs_result {
2412            0 => false,
2413            1 => true,
2414            _ => panic!("Got isl_bool = -1"),
2415        };
2416        let err = isl_rs_ctx.last_error();
2417        if err != Error::None_ {
2418            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
2419        }
2420        Ok(isl_rs_result)
2421    }
2422
2423    /// Wraps `isl_map_is_injective`.
2424    pub fn is_injective(&self) -> Result<bool, LibISLError> {
2425        let map = self;
2426        let isl_rs_ctx = map.get_ctx();
2427        let map = map.ptr;
2428        let isl_rs_result = unsafe { isl_map_is_injective(map) };
2429        let isl_rs_result = match isl_rs_result {
2430            0 => false,
2431            1 => true,
2432            _ => panic!("Got isl_bool = -1"),
2433        };
2434        let err = isl_rs_ctx.last_error();
2435        if err != Error::None_ {
2436            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
2437        }
2438        Ok(isl_rs_result)
2439    }
2440
2441    /// Wraps `isl_map_is_product`.
2442    pub fn is_product(&self) -> Result<bool, LibISLError> {
2443        let map = self;
2444        let isl_rs_ctx = map.get_ctx();
2445        let map = map.ptr;
2446        let isl_rs_result = unsafe { isl_map_is_product(map) };
2447        let isl_rs_result = match isl_rs_result {
2448            0 => false,
2449            1 => true,
2450            _ => panic!("Got isl_bool = -1"),
2451        };
2452        let err = isl_rs_ctx.last_error();
2453        if err != Error::None_ {
2454            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
2455        }
2456        Ok(isl_rs_result)
2457    }
2458
2459    /// Wraps `isl_map_is_single_valued`.
2460    pub fn is_single_valued(&self) -> Result<bool, LibISLError> {
2461        let map = self;
2462        let isl_rs_ctx = map.get_ctx();
2463        let map = map.ptr;
2464        let isl_rs_result = unsafe { isl_map_is_single_valued(map) };
2465        let isl_rs_result = match isl_rs_result {
2466            0 => false,
2467            1 => true,
2468            _ => panic!("Got isl_bool = -1"),
2469        };
2470        let err = isl_rs_ctx.last_error();
2471        if err != Error::None_ {
2472            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
2473        }
2474        Ok(isl_rs_result)
2475    }
2476
2477    /// Wraps `isl_map_is_strict_subset`.
2478    pub fn is_strict_subset(&self, map2: &Map) -> Result<bool, LibISLError> {
2479        let map1 = self;
2480        let isl_rs_ctx = map1.get_ctx();
2481        let map1 = map1.ptr;
2482        let map2 = map2.ptr;
2483        let isl_rs_result = unsafe { isl_map_is_strict_subset(map1, map2) };
2484        let isl_rs_result = match isl_rs_result {
2485            0 => false,
2486            1 => true,
2487            _ => panic!("Got isl_bool = -1"),
2488        };
2489        let err = isl_rs_ctx.last_error();
2490        if err != Error::None_ {
2491            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
2492        }
2493        Ok(isl_rs_result)
2494    }
2495
2496    /// Wraps `isl_map_is_subset`.
2497    pub fn is_subset(&self, map2: &Map) -> Result<bool, LibISLError> {
2498        let map1 = self;
2499        let isl_rs_ctx = map1.get_ctx();
2500        let map1 = map1.ptr;
2501        let map2 = map2.ptr;
2502        let isl_rs_result = unsafe { isl_map_is_subset(map1, map2) };
2503        let isl_rs_result = match isl_rs_result {
2504            0 => false,
2505            1 => true,
2506            _ => panic!("Got isl_bool = -1"),
2507        };
2508        let err = isl_rs_ctx.last_error();
2509        if err != Error::None_ {
2510            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
2511        }
2512        Ok(isl_rs_result)
2513    }
2514
2515    /// Wraps `isl_map_is_translation`.
2516    pub fn is_translation(&self) -> Result<i32, LibISLError> {
2517        let map = self;
2518        let isl_rs_ctx = map.get_ctx();
2519        let map = map.ptr;
2520        let isl_rs_result = unsafe { isl_map_is_translation(map) };
2521        let err = isl_rs_ctx.last_error();
2522        if err != Error::None_ {
2523            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
2524        }
2525        Ok(isl_rs_result)
2526    }
2527
2528    /// Wraps `isl_map_lex_ge`.
2529    pub fn lex_ge(set_space: Space) -> Result<Map, LibISLError> {
2530        let isl_rs_ctx = set_space.get_ctx();
2531        let mut set_space = set_space;
2532        set_space.do_not_free_on_drop();
2533        let set_space = set_space.ptr;
2534        let isl_rs_result = unsafe { isl_map_lex_ge(set_space) };
2535        let isl_rs_result = Map { ptr: isl_rs_result,
2536                                  should_free_on_drop: true };
2537        let err = isl_rs_ctx.last_error();
2538        if err != Error::None_ {
2539            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
2540        }
2541        Ok(isl_rs_result)
2542    }
2543
2544    /// Wraps `isl_map_lex_ge_at_multi_pw_aff`.
2545    pub fn lex_ge_at_multi_pw_aff(self, mpa: MultiPwAff) -> Result<Map, LibISLError> {
2546        let map = self;
2547        let isl_rs_ctx = map.get_ctx();
2548        let mut map = map;
2549        map.do_not_free_on_drop();
2550        let map = map.ptr;
2551        let mut mpa = mpa;
2552        mpa.do_not_free_on_drop();
2553        let mpa = mpa.ptr;
2554        let isl_rs_result = unsafe { isl_map_lex_ge_at_multi_pw_aff(map, mpa) };
2555        let isl_rs_result = Map { ptr: isl_rs_result,
2556                                  should_free_on_drop: true };
2557        let err = isl_rs_ctx.last_error();
2558        if err != Error::None_ {
2559            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
2560        }
2561        Ok(isl_rs_result)
2562    }
2563
2564    /// Wraps `isl_map_lex_ge_first`.
2565    pub fn lex_ge_first(space: Space, n: u32) -> Result<Map, LibISLError> {
2566        let isl_rs_ctx = space.get_ctx();
2567        let mut space = space;
2568        space.do_not_free_on_drop();
2569        let space = space.ptr;
2570        let isl_rs_result = unsafe { isl_map_lex_ge_first(space, n) };
2571        let isl_rs_result = Map { ptr: isl_rs_result,
2572                                  should_free_on_drop: true };
2573        let err = isl_rs_ctx.last_error();
2574        if err != Error::None_ {
2575            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
2576        }
2577        Ok(isl_rs_result)
2578    }
2579
2580    /// Wraps `isl_map_lex_ge_map`.
2581    pub fn lex_ge_map(self, map2: Map) -> Result<Map, LibISLError> {
2582        let map1 = self;
2583        let isl_rs_ctx = map1.get_ctx();
2584        let mut map1 = map1;
2585        map1.do_not_free_on_drop();
2586        let map1 = map1.ptr;
2587        let mut map2 = map2;
2588        map2.do_not_free_on_drop();
2589        let map2 = map2.ptr;
2590        let isl_rs_result = unsafe { isl_map_lex_ge_map(map1, map2) };
2591        let isl_rs_result = Map { ptr: isl_rs_result,
2592                                  should_free_on_drop: true };
2593        let err = isl_rs_ctx.last_error();
2594        if err != Error::None_ {
2595            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
2596        }
2597        Ok(isl_rs_result)
2598    }
2599
2600    /// Wraps `isl_map_lex_gt`.
2601    pub fn lex_gt(set_space: Space) -> Result<Map, LibISLError> {
2602        let isl_rs_ctx = set_space.get_ctx();
2603        let mut set_space = set_space;
2604        set_space.do_not_free_on_drop();
2605        let set_space = set_space.ptr;
2606        let isl_rs_result = unsafe { isl_map_lex_gt(set_space) };
2607        let isl_rs_result = Map { ptr: isl_rs_result,
2608                                  should_free_on_drop: true };
2609        let err = isl_rs_ctx.last_error();
2610        if err != Error::None_ {
2611            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
2612        }
2613        Ok(isl_rs_result)
2614    }
2615
2616    /// Wraps `isl_map_lex_gt_at_multi_pw_aff`.
2617    pub fn lex_gt_at_multi_pw_aff(self, mpa: MultiPwAff) -> Result<Map, LibISLError> {
2618        let map = self;
2619        let isl_rs_ctx = map.get_ctx();
2620        let mut map = map;
2621        map.do_not_free_on_drop();
2622        let map = map.ptr;
2623        let mut mpa = mpa;
2624        mpa.do_not_free_on_drop();
2625        let mpa = mpa.ptr;
2626        let isl_rs_result = unsafe { isl_map_lex_gt_at_multi_pw_aff(map, mpa) };
2627        let isl_rs_result = Map { ptr: isl_rs_result,
2628                                  should_free_on_drop: true };
2629        let err = isl_rs_ctx.last_error();
2630        if err != Error::None_ {
2631            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
2632        }
2633        Ok(isl_rs_result)
2634    }
2635
2636    /// Wraps `isl_map_lex_gt_first`.
2637    pub fn lex_gt_first(space: Space, n: u32) -> Result<Map, LibISLError> {
2638        let isl_rs_ctx = space.get_ctx();
2639        let mut space = space;
2640        space.do_not_free_on_drop();
2641        let space = space.ptr;
2642        let isl_rs_result = unsafe { isl_map_lex_gt_first(space, n) };
2643        let isl_rs_result = Map { ptr: isl_rs_result,
2644                                  should_free_on_drop: true };
2645        let err = isl_rs_ctx.last_error();
2646        if err != Error::None_ {
2647            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
2648        }
2649        Ok(isl_rs_result)
2650    }
2651
2652    /// Wraps `isl_map_lex_gt_map`.
2653    pub fn lex_gt_map(self, map2: Map) -> Result<Map, LibISLError> {
2654        let map1 = self;
2655        let isl_rs_ctx = map1.get_ctx();
2656        let mut map1 = map1;
2657        map1.do_not_free_on_drop();
2658        let map1 = map1.ptr;
2659        let mut map2 = map2;
2660        map2.do_not_free_on_drop();
2661        let map2 = map2.ptr;
2662        let isl_rs_result = unsafe { isl_map_lex_gt_map(map1, map2) };
2663        let isl_rs_result = Map { ptr: isl_rs_result,
2664                                  should_free_on_drop: true };
2665        let err = isl_rs_ctx.last_error();
2666        if err != Error::None_ {
2667            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
2668        }
2669        Ok(isl_rs_result)
2670    }
2671
2672    /// Wraps `isl_map_lex_le`.
2673    pub fn lex_le(set_space: Space) -> Result<Map, LibISLError> {
2674        let isl_rs_ctx = set_space.get_ctx();
2675        let mut set_space = set_space;
2676        set_space.do_not_free_on_drop();
2677        let set_space = set_space.ptr;
2678        let isl_rs_result = unsafe { isl_map_lex_le(set_space) };
2679        let isl_rs_result = Map { ptr: isl_rs_result,
2680                                  should_free_on_drop: true };
2681        let err = isl_rs_ctx.last_error();
2682        if err != Error::None_ {
2683            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
2684        }
2685        Ok(isl_rs_result)
2686    }
2687
2688    /// Wraps `isl_map_lex_le_at_multi_pw_aff`.
2689    pub fn lex_le_at_multi_pw_aff(self, mpa: MultiPwAff) -> Result<Map, LibISLError> {
2690        let map = self;
2691        let isl_rs_ctx = map.get_ctx();
2692        let mut map = map;
2693        map.do_not_free_on_drop();
2694        let map = map.ptr;
2695        let mut mpa = mpa;
2696        mpa.do_not_free_on_drop();
2697        let mpa = mpa.ptr;
2698        let isl_rs_result = unsafe { isl_map_lex_le_at_multi_pw_aff(map, mpa) };
2699        let isl_rs_result = Map { ptr: isl_rs_result,
2700                                  should_free_on_drop: true };
2701        let err = isl_rs_ctx.last_error();
2702        if err != Error::None_ {
2703            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
2704        }
2705        Ok(isl_rs_result)
2706    }
2707
2708    /// Wraps `isl_map_lex_le_first`.
2709    pub fn lex_le_first(space: Space, n: u32) -> Result<Map, LibISLError> {
2710        let isl_rs_ctx = space.get_ctx();
2711        let mut space = space;
2712        space.do_not_free_on_drop();
2713        let space = space.ptr;
2714        let isl_rs_result = unsafe { isl_map_lex_le_first(space, n) };
2715        let isl_rs_result = Map { ptr: isl_rs_result,
2716                                  should_free_on_drop: true };
2717        let err = isl_rs_ctx.last_error();
2718        if err != Error::None_ {
2719            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
2720        }
2721        Ok(isl_rs_result)
2722    }
2723
2724    /// Wraps `isl_map_lex_le_map`.
2725    pub fn lex_le_map(self, map2: Map) -> Result<Map, LibISLError> {
2726        let map1 = self;
2727        let isl_rs_ctx = map1.get_ctx();
2728        let mut map1 = map1;
2729        map1.do_not_free_on_drop();
2730        let map1 = map1.ptr;
2731        let mut map2 = map2;
2732        map2.do_not_free_on_drop();
2733        let map2 = map2.ptr;
2734        let isl_rs_result = unsafe { isl_map_lex_le_map(map1, map2) };
2735        let isl_rs_result = Map { ptr: isl_rs_result,
2736                                  should_free_on_drop: true };
2737        let err = isl_rs_ctx.last_error();
2738        if err != Error::None_ {
2739            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
2740        }
2741        Ok(isl_rs_result)
2742    }
2743
2744    /// Wraps `isl_map_lex_lt`.
2745    pub fn lex_lt(set_space: Space) -> Result<Map, LibISLError> {
2746        let isl_rs_ctx = set_space.get_ctx();
2747        let mut set_space = set_space;
2748        set_space.do_not_free_on_drop();
2749        let set_space = set_space.ptr;
2750        let isl_rs_result = unsafe { isl_map_lex_lt(set_space) };
2751        let isl_rs_result = Map { ptr: isl_rs_result,
2752                                  should_free_on_drop: true };
2753        let err = isl_rs_ctx.last_error();
2754        if err != Error::None_ {
2755            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
2756        }
2757        Ok(isl_rs_result)
2758    }
2759
2760    /// Wraps `isl_map_lex_lt_at_multi_pw_aff`.
2761    pub fn lex_lt_at_multi_pw_aff(self, mpa: MultiPwAff) -> Result<Map, LibISLError> {
2762        let map = self;
2763        let isl_rs_ctx = map.get_ctx();
2764        let mut map = map;
2765        map.do_not_free_on_drop();
2766        let map = map.ptr;
2767        let mut mpa = mpa;
2768        mpa.do_not_free_on_drop();
2769        let mpa = mpa.ptr;
2770        let isl_rs_result = unsafe { isl_map_lex_lt_at_multi_pw_aff(map, mpa) };
2771        let isl_rs_result = Map { ptr: isl_rs_result,
2772                                  should_free_on_drop: true };
2773        let err = isl_rs_ctx.last_error();
2774        if err != Error::None_ {
2775            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
2776        }
2777        Ok(isl_rs_result)
2778    }
2779
2780    /// Wraps `isl_map_lex_lt_first`.
2781    pub fn lex_lt_first(space: Space, n: u32) -> Result<Map, LibISLError> {
2782        let isl_rs_ctx = space.get_ctx();
2783        let mut space = space;
2784        space.do_not_free_on_drop();
2785        let space = space.ptr;
2786        let isl_rs_result = unsafe { isl_map_lex_lt_first(space, n) };
2787        let isl_rs_result = Map { ptr: isl_rs_result,
2788                                  should_free_on_drop: true };
2789        let err = isl_rs_ctx.last_error();
2790        if err != Error::None_ {
2791            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
2792        }
2793        Ok(isl_rs_result)
2794    }
2795
2796    /// Wraps `isl_map_lex_lt_map`.
2797    pub fn lex_lt_map(self, map2: Map) -> Result<Map, LibISLError> {
2798        let map1 = self;
2799        let isl_rs_ctx = map1.get_ctx();
2800        let mut map1 = map1;
2801        map1.do_not_free_on_drop();
2802        let map1 = map1.ptr;
2803        let mut map2 = map2;
2804        map2.do_not_free_on_drop();
2805        let map2 = map2.ptr;
2806        let isl_rs_result = unsafe { isl_map_lex_lt_map(map1, map2) };
2807        let isl_rs_result = Map { ptr: isl_rs_result,
2808                                  should_free_on_drop: true };
2809        let err = isl_rs_ctx.last_error();
2810        if err != Error::None_ {
2811            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
2812        }
2813        Ok(isl_rs_result)
2814    }
2815
2816    /// Wraps `isl_map_lexmax`.
2817    pub fn lexmax(self) -> Result<Map, LibISLError> {
2818        let map = self;
2819        let isl_rs_ctx = map.get_ctx();
2820        let mut map = map;
2821        map.do_not_free_on_drop();
2822        let map = map.ptr;
2823        let isl_rs_result = unsafe { isl_map_lexmax(map) };
2824        let isl_rs_result = Map { ptr: isl_rs_result,
2825                                  should_free_on_drop: true };
2826        let err = isl_rs_ctx.last_error();
2827        if err != Error::None_ {
2828            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
2829        }
2830        Ok(isl_rs_result)
2831    }
2832
2833    /// Wraps `isl_map_lexmax_pw_multi_aff`.
2834    pub fn lexmax_pw_multi_aff(self) -> Result<PwMultiAff, LibISLError> {
2835        let map = self;
2836        let isl_rs_ctx = map.get_ctx();
2837        let mut map = map;
2838        map.do_not_free_on_drop();
2839        let map = map.ptr;
2840        let isl_rs_result = unsafe { isl_map_lexmax_pw_multi_aff(map) };
2841        let isl_rs_result = PwMultiAff { ptr: isl_rs_result,
2842                                         should_free_on_drop: true };
2843        let err = isl_rs_ctx.last_error();
2844        if err != Error::None_ {
2845            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
2846        }
2847        Ok(isl_rs_result)
2848    }
2849
2850    /// Wraps `isl_map_lexmin`.
2851    pub fn lexmin(self) -> Result<Map, LibISLError> {
2852        let map = self;
2853        let isl_rs_ctx = map.get_ctx();
2854        let mut map = map;
2855        map.do_not_free_on_drop();
2856        let map = map.ptr;
2857        let isl_rs_result = unsafe { isl_map_lexmin(map) };
2858        let isl_rs_result = Map { ptr: isl_rs_result,
2859                                  should_free_on_drop: true };
2860        let err = isl_rs_ctx.last_error();
2861        if err != Error::None_ {
2862            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
2863        }
2864        Ok(isl_rs_result)
2865    }
2866
2867    /// Wraps `isl_map_lexmin_pw_multi_aff`.
2868    pub fn lexmin_pw_multi_aff(self) -> Result<PwMultiAff, LibISLError> {
2869        let map = self;
2870        let isl_rs_ctx = map.get_ctx();
2871        let mut map = map;
2872        map.do_not_free_on_drop();
2873        let map = map.ptr;
2874        let isl_rs_result = unsafe { isl_map_lexmin_pw_multi_aff(map) };
2875        let isl_rs_result = PwMultiAff { ptr: isl_rs_result,
2876                                         should_free_on_drop: true };
2877        let err = isl_rs_ctx.last_error();
2878        if err != Error::None_ {
2879            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
2880        }
2881        Ok(isl_rs_result)
2882    }
2883
2884    /// Wraps `isl_map_lower_bound_multi_pw_aff`.
2885    pub fn lower_bound_multi_pw_aff(self, lower: MultiPwAff) -> Result<Map, LibISLError> {
2886        let map = self;
2887        let isl_rs_ctx = map.get_ctx();
2888        let mut map = map;
2889        map.do_not_free_on_drop();
2890        let map = map.ptr;
2891        let mut lower = lower;
2892        lower.do_not_free_on_drop();
2893        let lower = lower.ptr;
2894        let isl_rs_result = unsafe { isl_map_lower_bound_multi_pw_aff(map, lower) };
2895        let isl_rs_result = Map { ptr: isl_rs_result,
2896                                  should_free_on_drop: true };
2897        let err = isl_rs_ctx.last_error();
2898        if err != Error::None_ {
2899            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
2900        }
2901        Ok(isl_rs_result)
2902    }
2903
2904    /// Wraps `isl_map_lower_bound_si`.
2905    pub fn lower_bound_si(self, type_: DimType, pos: u32, value: i32) -> Result<Map, LibISLError> {
2906        let map = self;
2907        let isl_rs_ctx = map.get_ctx();
2908        let mut map = map;
2909        map.do_not_free_on_drop();
2910        let map = map.ptr;
2911        let type_ = type_.to_i32();
2912        let isl_rs_result = unsafe { isl_map_lower_bound_si(map, type_, pos, value) };
2913        let isl_rs_result = Map { ptr: isl_rs_result,
2914                                  should_free_on_drop: true };
2915        let err = isl_rs_ctx.last_error();
2916        if err != Error::None_ {
2917            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
2918        }
2919        Ok(isl_rs_result)
2920    }
2921
2922    /// Wraps `isl_map_lower_bound_val`.
2923    pub fn lower_bound_val(self, type_: DimType, pos: u32, value: Val) -> Result<Map, LibISLError> {
2924        let map = self;
2925        let isl_rs_ctx = map.get_ctx();
2926        let mut map = map;
2927        map.do_not_free_on_drop();
2928        let map = map.ptr;
2929        let type_ = type_.to_i32();
2930        let mut value = value;
2931        value.do_not_free_on_drop();
2932        let value = value.ptr;
2933        let isl_rs_result = unsafe { isl_map_lower_bound_val(map, type_, pos, value) };
2934        let isl_rs_result = Map { ptr: isl_rs_result,
2935                                  should_free_on_drop: true };
2936        let err = isl_rs_ctx.last_error();
2937        if err != Error::None_ {
2938            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
2939        }
2940        Ok(isl_rs_result)
2941    }
2942
2943    /// Wraps `isl_map_make_disjoint`.
2944    pub fn make_disjoint(self) -> Result<Map, LibISLError> {
2945        let map = self;
2946        let isl_rs_ctx = map.get_ctx();
2947        let mut map = map;
2948        map.do_not_free_on_drop();
2949        let map = map.ptr;
2950        let isl_rs_result = unsafe { isl_map_make_disjoint(map) };
2951        let isl_rs_result = Map { ptr: isl_rs_result,
2952                                  should_free_on_drop: true };
2953        let err = isl_rs_ctx.last_error();
2954        if err != Error::None_ {
2955            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
2956        }
2957        Ok(isl_rs_result)
2958    }
2959
2960    /// Wraps `isl_map_max_multi_pw_aff`.
2961    pub fn max_multi_pw_aff(self) -> Result<MultiPwAff, LibISLError> {
2962        let map = self;
2963        let isl_rs_ctx = map.get_ctx();
2964        let mut map = map;
2965        map.do_not_free_on_drop();
2966        let map = map.ptr;
2967        let isl_rs_result = unsafe { isl_map_max_multi_pw_aff(map) };
2968        let isl_rs_result = MultiPwAff { ptr: isl_rs_result,
2969                                         should_free_on_drop: true };
2970        let err = isl_rs_ctx.last_error();
2971        if err != Error::None_ {
2972            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
2973        }
2974        Ok(isl_rs_result)
2975    }
2976
2977    /// Wraps `isl_map_min_multi_pw_aff`.
2978    pub fn min_multi_pw_aff(self) -> Result<MultiPwAff, LibISLError> {
2979        let map = self;
2980        let isl_rs_ctx = map.get_ctx();
2981        let mut map = map;
2982        map.do_not_free_on_drop();
2983        let map = map.ptr;
2984        let isl_rs_result = unsafe { isl_map_min_multi_pw_aff(map) };
2985        let isl_rs_result = MultiPwAff { ptr: isl_rs_result,
2986                                         should_free_on_drop: true };
2987        let err = isl_rs_ctx.last_error();
2988        if err != Error::None_ {
2989            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
2990        }
2991        Ok(isl_rs_result)
2992    }
2993
2994    /// Wraps `isl_map_move_dims`.
2995    pub fn move_dims(self, dst_type: DimType, dst_pos: u32, src_type: DimType, src_pos: u32,
2996                     n: u32)
2997                     -> Result<Map, LibISLError> {
2998        let map = self;
2999        let isl_rs_ctx = map.get_ctx();
3000        let mut map = map;
3001        map.do_not_free_on_drop();
3002        let map = map.ptr;
3003        let dst_type = dst_type.to_i32();
3004        let src_type = src_type.to_i32();
3005        let isl_rs_result =
3006            unsafe { isl_map_move_dims(map, dst_type, dst_pos, src_type, src_pos, n) };
3007        let isl_rs_result = Map { ptr: isl_rs_result,
3008                                  should_free_on_drop: true };
3009        let err = isl_rs_ctx.last_error();
3010        if err != Error::None_ {
3011            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
3012        }
3013        Ok(isl_rs_result)
3014    }
3015
3016    /// Wraps `isl_map_n_basic_map`.
3017    pub fn n_basic_map(&self) -> Result<i32, LibISLError> {
3018        let map = self;
3019        let isl_rs_ctx = map.get_ctx();
3020        let map = map.ptr;
3021        let isl_rs_result = unsafe { isl_map_n_basic_map(map) };
3022        let err = isl_rs_ctx.last_error();
3023        if err != Error::None_ {
3024            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
3025        }
3026        Ok(isl_rs_result)
3027    }
3028
3029    /// Wraps `isl_map_nat_universe`.
3030    pub fn nat_universe(space: Space) -> Result<Map, LibISLError> {
3031        let isl_rs_ctx = space.get_ctx();
3032        let mut space = space;
3033        space.do_not_free_on_drop();
3034        let space = space.ptr;
3035        let isl_rs_result = unsafe { isl_map_nat_universe(space) };
3036        let isl_rs_result = Map { ptr: isl_rs_result,
3037                                  should_free_on_drop: true };
3038        let err = isl_rs_ctx.last_error();
3039        if err != Error::None_ {
3040            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
3041        }
3042        Ok(isl_rs_result)
3043    }
3044
3045    /// Wraps `isl_map_neg`.
3046    pub fn neg(self) -> Result<Map, LibISLError> {
3047        let map = self;
3048        let isl_rs_ctx = map.get_ctx();
3049        let mut map = map;
3050        map.do_not_free_on_drop();
3051        let map = map.ptr;
3052        let isl_rs_result = unsafe { isl_map_neg(map) };
3053        let isl_rs_result = Map { ptr: isl_rs_result,
3054                                  should_free_on_drop: true };
3055        let err = isl_rs_ctx.last_error();
3056        if err != Error::None_ {
3057            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
3058        }
3059        Ok(isl_rs_result)
3060    }
3061
3062    /// Wraps `isl_map_oppose`.
3063    pub fn oppose(self, type1: DimType, pos1: i32, type2: DimType, pos2: i32)
3064                  -> Result<Map, LibISLError> {
3065        let map = self;
3066        let isl_rs_ctx = map.get_ctx();
3067        let mut map = map;
3068        map.do_not_free_on_drop();
3069        let map = map.ptr;
3070        let type1 = type1.to_i32();
3071        let type2 = type2.to_i32();
3072        let isl_rs_result = unsafe { isl_map_oppose(map, type1, pos1, type2, pos2) };
3073        let isl_rs_result = Map { ptr: isl_rs_result,
3074                                  should_free_on_drop: true };
3075        let err = isl_rs_ctx.last_error();
3076        if err != Error::None_ {
3077            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
3078        }
3079        Ok(isl_rs_result)
3080    }
3081
3082    /// Wraps `isl_map_order_ge`.
3083    pub fn order_ge(self, type1: DimType, pos1: i32, type2: DimType, pos2: i32)
3084                    -> Result<Map, LibISLError> {
3085        let map = self;
3086        let isl_rs_ctx = map.get_ctx();
3087        let mut map = map;
3088        map.do_not_free_on_drop();
3089        let map = map.ptr;
3090        let type1 = type1.to_i32();
3091        let type2 = type2.to_i32();
3092        let isl_rs_result = unsafe { isl_map_order_ge(map, type1, pos1, type2, pos2) };
3093        let isl_rs_result = Map { ptr: isl_rs_result,
3094                                  should_free_on_drop: true };
3095        let err = isl_rs_ctx.last_error();
3096        if err != Error::None_ {
3097            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
3098        }
3099        Ok(isl_rs_result)
3100    }
3101
3102    /// Wraps `isl_map_order_gt`.
3103    pub fn order_gt(self, type1: DimType, pos1: i32, type2: DimType, pos2: i32)
3104                    -> Result<Map, LibISLError> {
3105        let map = self;
3106        let isl_rs_ctx = map.get_ctx();
3107        let mut map = map;
3108        map.do_not_free_on_drop();
3109        let map = map.ptr;
3110        let type1 = type1.to_i32();
3111        let type2 = type2.to_i32();
3112        let isl_rs_result = unsafe { isl_map_order_gt(map, type1, pos1, type2, pos2) };
3113        let isl_rs_result = Map { ptr: isl_rs_result,
3114                                  should_free_on_drop: true };
3115        let err = isl_rs_ctx.last_error();
3116        if err != Error::None_ {
3117            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
3118        }
3119        Ok(isl_rs_result)
3120    }
3121
3122    /// Wraps `isl_map_order_le`.
3123    pub fn order_le(self, type1: DimType, pos1: i32, type2: DimType, pos2: i32)
3124                    -> Result<Map, LibISLError> {
3125        let map = self;
3126        let isl_rs_ctx = map.get_ctx();
3127        let mut map = map;
3128        map.do_not_free_on_drop();
3129        let map = map.ptr;
3130        let type1 = type1.to_i32();
3131        let type2 = type2.to_i32();
3132        let isl_rs_result = unsafe { isl_map_order_le(map, type1, pos1, type2, pos2) };
3133        let isl_rs_result = Map { ptr: isl_rs_result,
3134                                  should_free_on_drop: true };
3135        let err = isl_rs_ctx.last_error();
3136        if err != Error::None_ {
3137            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
3138        }
3139        Ok(isl_rs_result)
3140    }
3141
3142    /// Wraps `isl_map_order_lt`.
3143    pub fn order_lt(self, type1: DimType, pos1: i32, type2: DimType, pos2: i32)
3144                    -> Result<Map, LibISLError> {
3145        let map = self;
3146        let isl_rs_ctx = map.get_ctx();
3147        let mut map = map;
3148        map.do_not_free_on_drop();
3149        let map = map.ptr;
3150        let type1 = type1.to_i32();
3151        let type2 = type2.to_i32();
3152        let isl_rs_result = unsafe { isl_map_order_lt(map, type1, pos1, type2, pos2) };
3153        let isl_rs_result = Map { ptr: isl_rs_result,
3154                                  should_free_on_drop: true };
3155        let err = isl_rs_ctx.last_error();
3156        if err != Error::None_ {
3157            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
3158        }
3159        Ok(isl_rs_result)
3160    }
3161
3162    /// Wraps `isl_map_params`.
3163    pub fn params(self) -> Result<Set, LibISLError> {
3164        let map = self;
3165        let isl_rs_ctx = map.get_ctx();
3166        let mut map = map;
3167        map.do_not_free_on_drop();
3168        let map = map.ptr;
3169        let isl_rs_result = unsafe { isl_map_params(map) };
3170        let isl_rs_result = Set { ptr: isl_rs_result,
3171                                  should_free_on_drop: true };
3172        let err = isl_rs_ctx.last_error();
3173        if err != Error::None_ {
3174            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
3175        }
3176        Ok(isl_rs_result)
3177    }
3178
3179    /// Wraps `isl_map_plain_get_val_if_fixed`.
3180    pub fn plain_get_val_if_fixed(&self, type_: DimType, pos: u32) -> Result<Val, LibISLError> {
3181        let map = self;
3182        let isl_rs_ctx = map.get_ctx();
3183        let map = map.ptr;
3184        let type_ = type_.to_i32();
3185        let isl_rs_result = unsafe { isl_map_plain_get_val_if_fixed(map, type_, pos) };
3186        let isl_rs_result = Val { ptr: isl_rs_result,
3187                                  should_free_on_drop: true };
3188        let err = isl_rs_ctx.last_error();
3189        if err != Error::None_ {
3190            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
3191        }
3192        Ok(isl_rs_result)
3193    }
3194
3195    /// Wraps `isl_map_plain_is_empty`.
3196    pub fn plain_is_empty(&self) -> Result<bool, LibISLError> {
3197        let map = self;
3198        let isl_rs_ctx = map.get_ctx();
3199        let map = map.ptr;
3200        let isl_rs_result = unsafe { isl_map_plain_is_empty(map) };
3201        let isl_rs_result = match isl_rs_result {
3202            0 => false,
3203            1 => true,
3204            _ => panic!("Got isl_bool = -1"),
3205        };
3206        let err = isl_rs_ctx.last_error();
3207        if err != Error::None_ {
3208            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
3209        }
3210        Ok(isl_rs_result)
3211    }
3212
3213    /// Wraps `isl_map_plain_is_equal`.
3214    pub fn plain_is_equal(&self, map2: &Map) -> Result<bool, LibISLError> {
3215        let map1 = self;
3216        let isl_rs_ctx = map1.get_ctx();
3217        let map1 = map1.ptr;
3218        let map2 = map2.ptr;
3219        let isl_rs_result = unsafe { isl_map_plain_is_equal(map1, map2) };
3220        let isl_rs_result = match isl_rs_result {
3221            0 => false,
3222            1 => true,
3223            _ => panic!("Got isl_bool = -1"),
3224        };
3225        let err = isl_rs_ctx.last_error();
3226        if err != Error::None_ {
3227            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
3228        }
3229        Ok(isl_rs_result)
3230    }
3231
3232    /// Wraps `isl_map_plain_is_injective`.
3233    pub fn plain_is_injective(&self) -> Result<bool, LibISLError> {
3234        let map = self;
3235        let isl_rs_ctx = map.get_ctx();
3236        let map = map.ptr;
3237        let isl_rs_result = unsafe { isl_map_plain_is_injective(map) };
3238        let isl_rs_result = match isl_rs_result {
3239            0 => false,
3240            1 => true,
3241            _ => panic!("Got isl_bool = -1"),
3242        };
3243        let err = isl_rs_ctx.last_error();
3244        if err != Error::None_ {
3245            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
3246        }
3247        Ok(isl_rs_result)
3248    }
3249
3250    /// Wraps `isl_map_plain_is_single_valued`.
3251    pub fn plain_is_single_valued(&self) -> Result<bool, LibISLError> {
3252        let map = self;
3253        let isl_rs_ctx = map.get_ctx();
3254        let map = map.ptr;
3255        let isl_rs_result = unsafe { isl_map_plain_is_single_valued(map) };
3256        let isl_rs_result = match isl_rs_result {
3257            0 => false,
3258            1 => true,
3259            _ => panic!("Got isl_bool = -1"),
3260        };
3261        let err = isl_rs_ctx.last_error();
3262        if err != Error::None_ {
3263            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
3264        }
3265        Ok(isl_rs_result)
3266    }
3267
3268    /// Wraps `isl_map_plain_is_universe`.
3269    pub fn plain_is_universe(&self) -> Result<bool, LibISLError> {
3270        let map = self;
3271        let isl_rs_ctx = map.get_ctx();
3272        let map = map.ptr;
3273        let isl_rs_result = unsafe { isl_map_plain_is_universe(map) };
3274        let isl_rs_result = match isl_rs_result {
3275            0 => false,
3276            1 => true,
3277            _ => panic!("Got isl_bool = -1"),
3278        };
3279        let err = isl_rs_ctx.last_error();
3280        if err != Error::None_ {
3281            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
3282        }
3283        Ok(isl_rs_result)
3284    }
3285
3286    /// Wraps `isl_map_plain_unshifted_simple_hull`.
3287    pub fn plain_unshifted_simple_hull(self) -> Result<BasicMap, LibISLError> {
3288        let map = self;
3289        let isl_rs_ctx = map.get_ctx();
3290        let mut map = map;
3291        map.do_not_free_on_drop();
3292        let map = map.ptr;
3293        let isl_rs_result = unsafe { isl_map_plain_unshifted_simple_hull(map) };
3294        let isl_rs_result = BasicMap { ptr: isl_rs_result,
3295                                       should_free_on_drop: true };
3296        let err = isl_rs_ctx.last_error();
3297        if err != Error::None_ {
3298            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
3299        }
3300        Ok(isl_rs_result)
3301    }
3302
3303    /// Wraps `isl_map_polyhedral_hull`.
3304    pub fn polyhedral_hull(self) -> Result<BasicMap, LibISLError> {
3305        let map = self;
3306        let isl_rs_ctx = map.get_ctx();
3307        let mut map = map;
3308        map.do_not_free_on_drop();
3309        let map = map.ptr;
3310        let isl_rs_result = unsafe { isl_map_polyhedral_hull(map) };
3311        let isl_rs_result = BasicMap { ptr: isl_rs_result,
3312                                       should_free_on_drop: true };
3313        let err = isl_rs_ctx.last_error();
3314        if err != Error::None_ {
3315            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
3316        }
3317        Ok(isl_rs_result)
3318    }
3319
3320    /// Wraps `isl_map_preimage_domain_multi_aff`.
3321    pub fn preimage_domain_multi_aff(self, ma: MultiAff) -> Result<Map, LibISLError> {
3322        let map = self;
3323        let isl_rs_ctx = map.get_ctx();
3324        let mut map = map;
3325        map.do_not_free_on_drop();
3326        let map = map.ptr;
3327        let mut ma = ma;
3328        ma.do_not_free_on_drop();
3329        let ma = ma.ptr;
3330        let isl_rs_result = unsafe { isl_map_preimage_domain_multi_aff(map, ma) };
3331        let isl_rs_result = Map { ptr: isl_rs_result,
3332                                  should_free_on_drop: true };
3333        let err = isl_rs_ctx.last_error();
3334        if err != Error::None_ {
3335            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
3336        }
3337        Ok(isl_rs_result)
3338    }
3339
3340    /// Wraps `isl_map_preimage_domain_multi_pw_aff`.
3341    pub fn preimage_domain_multi_pw_aff(self, mpa: MultiPwAff) -> Result<Map, LibISLError> {
3342        let map = self;
3343        let isl_rs_ctx = map.get_ctx();
3344        let mut map = map;
3345        map.do_not_free_on_drop();
3346        let map = map.ptr;
3347        let mut mpa = mpa;
3348        mpa.do_not_free_on_drop();
3349        let mpa = mpa.ptr;
3350        let isl_rs_result = unsafe { isl_map_preimage_domain_multi_pw_aff(map, mpa) };
3351        let isl_rs_result = Map { ptr: isl_rs_result,
3352                                  should_free_on_drop: true };
3353        let err = isl_rs_ctx.last_error();
3354        if err != Error::None_ {
3355            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
3356        }
3357        Ok(isl_rs_result)
3358    }
3359
3360    /// Wraps `isl_map_preimage_domain_pw_multi_aff`.
3361    pub fn preimage_domain_pw_multi_aff(self, pma: PwMultiAff) -> Result<Map, LibISLError> {
3362        let map = self;
3363        let isl_rs_ctx = map.get_ctx();
3364        let mut map = map;
3365        map.do_not_free_on_drop();
3366        let map = map.ptr;
3367        let mut pma = pma;
3368        pma.do_not_free_on_drop();
3369        let pma = pma.ptr;
3370        let isl_rs_result = unsafe { isl_map_preimage_domain_pw_multi_aff(map, pma) };
3371        let isl_rs_result = Map { ptr: isl_rs_result,
3372                                  should_free_on_drop: true };
3373        let err = isl_rs_ctx.last_error();
3374        if err != Error::None_ {
3375            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
3376        }
3377        Ok(isl_rs_result)
3378    }
3379
3380    /// Wraps `isl_map_preimage_range_multi_aff`.
3381    pub fn preimage_range_multi_aff(self, ma: MultiAff) -> Result<Map, LibISLError> {
3382        let map = self;
3383        let isl_rs_ctx = map.get_ctx();
3384        let mut map = map;
3385        map.do_not_free_on_drop();
3386        let map = map.ptr;
3387        let mut ma = ma;
3388        ma.do_not_free_on_drop();
3389        let ma = ma.ptr;
3390        let isl_rs_result = unsafe { isl_map_preimage_range_multi_aff(map, ma) };
3391        let isl_rs_result = Map { ptr: isl_rs_result,
3392                                  should_free_on_drop: true };
3393        let err = isl_rs_ctx.last_error();
3394        if err != Error::None_ {
3395            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
3396        }
3397        Ok(isl_rs_result)
3398    }
3399
3400    /// Wraps `isl_map_preimage_range_pw_multi_aff`.
3401    pub fn preimage_range_pw_multi_aff(self, pma: PwMultiAff) -> Result<Map, LibISLError> {
3402        let map = self;
3403        let isl_rs_ctx = map.get_ctx();
3404        let mut map = map;
3405        map.do_not_free_on_drop();
3406        let map = map.ptr;
3407        let mut pma = pma;
3408        pma.do_not_free_on_drop();
3409        let pma = pma.ptr;
3410        let isl_rs_result = unsafe { isl_map_preimage_range_pw_multi_aff(map, pma) };
3411        let isl_rs_result = Map { ptr: isl_rs_result,
3412                                  should_free_on_drop: true };
3413        let err = isl_rs_ctx.last_error();
3414        if err != Error::None_ {
3415            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
3416        }
3417        Ok(isl_rs_result)
3418    }
3419
3420    /// Wraps `isl_map_product`.
3421    pub fn product(self, map2: Map) -> Result<Map, LibISLError> {
3422        let map1 = self;
3423        let isl_rs_ctx = map1.get_ctx();
3424        let mut map1 = map1;
3425        map1.do_not_free_on_drop();
3426        let map1 = map1.ptr;
3427        let mut map2 = map2;
3428        map2.do_not_free_on_drop();
3429        let map2 = map2.ptr;
3430        let isl_rs_result = unsafe { isl_map_product(map1, map2) };
3431        let isl_rs_result = Map { ptr: isl_rs_result,
3432                                  should_free_on_drop: true };
3433        let err = isl_rs_ctx.last_error();
3434        if err != Error::None_ {
3435            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
3436        }
3437        Ok(isl_rs_result)
3438    }
3439
3440    /// Wraps `isl_map_project_out`.
3441    pub fn project_out(self, type_: DimType, first: u32, n: u32) -> Result<Map, LibISLError> {
3442        let map = self;
3443        let isl_rs_ctx = map.get_ctx();
3444        let mut map = map;
3445        map.do_not_free_on_drop();
3446        let map = map.ptr;
3447        let type_ = type_.to_i32();
3448        let isl_rs_result = unsafe { isl_map_project_out(map, type_, first, n) };
3449        let isl_rs_result = Map { ptr: isl_rs_result,
3450                                  should_free_on_drop: true };
3451        let err = isl_rs_ctx.last_error();
3452        if err != Error::None_ {
3453            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
3454        }
3455        Ok(isl_rs_result)
3456    }
3457
3458    /// Wraps `isl_map_project_out_all_params`.
3459    pub fn project_out_all_params(self) -> Result<Map, LibISLError> {
3460        let map = self;
3461        let isl_rs_ctx = map.get_ctx();
3462        let mut map = map;
3463        map.do_not_free_on_drop();
3464        let map = map.ptr;
3465        let isl_rs_result = unsafe { isl_map_project_out_all_params(map) };
3466        let isl_rs_result = Map { ptr: isl_rs_result,
3467                                  should_free_on_drop: true };
3468        let err = isl_rs_ctx.last_error();
3469        if err != Error::None_ {
3470            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
3471        }
3472        Ok(isl_rs_result)
3473    }
3474
3475    /// Wraps `isl_map_project_out_param_id`.
3476    pub fn project_out_param_id(self, id: Id) -> Result<Map, LibISLError> {
3477        let map = self;
3478        let isl_rs_ctx = map.get_ctx();
3479        let mut map = map;
3480        map.do_not_free_on_drop();
3481        let map = map.ptr;
3482        let mut id = id;
3483        id.do_not_free_on_drop();
3484        let id = id.ptr;
3485        let isl_rs_result = unsafe { isl_map_project_out_param_id(map, id) };
3486        let isl_rs_result = Map { ptr: isl_rs_result,
3487                                  should_free_on_drop: true };
3488        let err = isl_rs_ctx.last_error();
3489        if err != Error::None_ {
3490            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
3491        }
3492        Ok(isl_rs_result)
3493    }
3494
3495    /// Wraps `isl_map_project_out_param_id_list`.
3496    pub fn project_out_param_id_list(self, list: IdList) -> Result<Map, LibISLError> {
3497        let map = self;
3498        let isl_rs_ctx = map.get_ctx();
3499        let mut map = map;
3500        map.do_not_free_on_drop();
3501        let map = map.ptr;
3502        let mut list = list;
3503        list.do_not_free_on_drop();
3504        let list = list.ptr;
3505        let isl_rs_result = unsafe { isl_map_project_out_param_id_list(map, list) };
3506        let isl_rs_result = Map { ptr: isl_rs_result,
3507                                  should_free_on_drop: true };
3508        let err = isl_rs_ctx.last_error();
3509        if err != Error::None_ {
3510            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
3511        }
3512        Ok(isl_rs_result)
3513    }
3514
3515    /// Wraps `isl_map_range`.
3516    pub fn range(self) -> Result<Set, LibISLError> {
3517        let map = self;
3518        let isl_rs_ctx = map.get_ctx();
3519        let mut map = map;
3520        map.do_not_free_on_drop();
3521        let map = map.ptr;
3522        let isl_rs_result = unsafe { isl_map_range(map) };
3523        let isl_rs_result = Set { ptr: isl_rs_result,
3524                                  should_free_on_drop: true };
3525        let err = isl_rs_ctx.last_error();
3526        if err != Error::None_ {
3527            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
3528        }
3529        Ok(isl_rs_result)
3530    }
3531
3532    /// Wraps `isl_map_range_curry`.
3533    pub fn range_curry(self) -> Result<Map, LibISLError> {
3534        let map = self;
3535        let isl_rs_ctx = map.get_ctx();
3536        let mut map = map;
3537        map.do_not_free_on_drop();
3538        let map = map.ptr;
3539        let isl_rs_result = unsafe { isl_map_range_curry(map) };
3540        let isl_rs_result = Map { ptr: isl_rs_result,
3541                                  should_free_on_drop: true };
3542        let err = isl_rs_ctx.last_error();
3543        if err != Error::None_ {
3544            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
3545        }
3546        Ok(isl_rs_result)
3547    }
3548
3549    /// Wraps `isl_map_range_factor_domain`.
3550    pub fn range_factor_domain(self) -> Result<Map, LibISLError> {
3551        let map = self;
3552        let isl_rs_ctx = map.get_ctx();
3553        let mut map = map;
3554        map.do_not_free_on_drop();
3555        let map = map.ptr;
3556        let isl_rs_result = unsafe { isl_map_range_factor_domain(map) };
3557        let isl_rs_result = Map { ptr: isl_rs_result,
3558                                  should_free_on_drop: true };
3559        let err = isl_rs_ctx.last_error();
3560        if err != Error::None_ {
3561            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
3562        }
3563        Ok(isl_rs_result)
3564    }
3565
3566    /// Wraps `isl_map_range_factor_range`.
3567    pub fn range_factor_range(self) -> Result<Map, LibISLError> {
3568        let map = self;
3569        let isl_rs_ctx = map.get_ctx();
3570        let mut map = map;
3571        map.do_not_free_on_drop();
3572        let map = map.ptr;
3573        let isl_rs_result = unsafe { isl_map_range_factor_range(map) };
3574        let isl_rs_result = Map { ptr: isl_rs_result,
3575                                  should_free_on_drop: true };
3576        let err = isl_rs_ctx.last_error();
3577        if err != Error::None_ {
3578            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
3579        }
3580        Ok(isl_rs_result)
3581    }
3582
3583    /// Wraps `isl_map_range_is_wrapping`.
3584    pub fn range_is_wrapping(&self) -> Result<bool, LibISLError> {
3585        let map = self;
3586        let isl_rs_ctx = map.get_ctx();
3587        let map = map.ptr;
3588        let isl_rs_result = unsafe { isl_map_range_is_wrapping(map) };
3589        let isl_rs_result = match isl_rs_result {
3590            0 => false,
3591            1 => true,
3592            _ => panic!("Got isl_bool = -1"),
3593        };
3594        let err = isl_rs_ctx.last_error();
3595        if err != Error::None_ {
3596            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
3597        }
3598        Ok(isl_rs_result)
3599    }
3600
3601    /// Wraps `isl_map_range_map`.
3602    pub fn range_map(self) -> Result<Map, LibISLError> {
3603        let map = self;
3604        let isl_rs_ctx = map.get_ctx();
3605        let mut map = map;
3606        map.do_not_free_on_drop();
3607        let map = map.ptr;
3608        let isl_rs_result = unsafe { isl_map_range_map(map) };
3609        let isl_rs_result = Map { ptr: isl_rs_result,
3610                                  should_free_on_drop: true };
3611        let err = isl_rs_ctx.last_error();
3612        if err != Error::None_ {
3613            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
3614        }
3615        Ok(isl_rs_result)
3616    }
3617
3618    /// Wraps `isl_map_range_product`.
3619    pub fn range_product(self, map2: Map) -> Result<Map, LibISLError> {
3620        let map1 = self;
3621        let isl_rs_ctx = map1.get_ctx();
3622        let mut map1 = map1;
3623        map1.do_not_free_on_drop();
3624        let map1 = map1.ptr;
3625        let mut map2 = map2;
3626        map2.do_not_free_on_drop();
3627        let map2 = map2.ptr;
3628        let isl_rs_result = unsafe { isl_map_range_product(map1, map2) };
3629        let isl_rs_result = Map { ptr: isl_rs_result,
3630                                  should_free_on_drop: true };
3631        let err = isl_rs_ctx.last_error();
3632        if err != Error::None_ {
3633            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
3634        }
3635        Ok(isl_rs_result)
3636    }
3637
3638    /// Wraps `isl_map_range_reverse`.
3639    pub fn range_reverse(self) -> Result<Map, LibISLError> {
3640        let map = self;
3641        let isl_rs_ctx = map.get_ctx();
3642        let mut map = map;
3643        map.do_not_free_on_drop();
3644        let map = map.ptr;
3645        let isl_rs_result = unsafe { isl_map_range_reverse(map) };
3646        let isl_rs_result = Map { ptr: isl_rs_result,
3647                                  should_free_on_drop: true };
3648        let err = isl_rs_ctx.last_error();
3649        if err != Error::None_ {
3650            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
3651        }
3652        Ok(isl_rs_result)
3653    }
3654
3655    /// Wraps `isl_map_range_tuple_dim`.
3656    pub fn range_tuple_dim(&self) -> Result<i32, LibISLError> {
3657        let map = self;
3658        let isl_rs_ctx = map.get_ctx();
3659        let map = map.ptr;
3660        let isl_rs_result = unsafe { isl_map_range_tuple_dim(map) };
3661        let err = isl_rs_ctx.last_error();
3662        if err != Error::None_ {
3663            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
3664        }
3665        Ok(isl_rs_result)
3666    }
3667
3668    /// Wraps `isl_map_read_from_str`.
3669    pub fn read_from_str(ctx: &Context, str_: &str) -> Result<Map, LibISLError> {
3670        let isl_rs_ctx = Context { ptr: ctx.ptr,
3671                                   should_free_on_drop: false };
3672        let ctx = ctx.ptr;
3673        let str_ = CString::new(str_).unwrap();
3674        let str_ = str_.as_ptr();
3675        let isl_rs_result = unsafe { isl_map_read_from_str(ctx, str_) };
3676        let isl_rs_result = Map { ptr: isl_rs_result,
3677                                  should_free_on_drop: true };
3678        let err = isl_rs_ctx.last_error();
3679        if err != Error::None_ {
3680            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
3681        }
3682        Ok(isl_rs_result)
3683    }
3684
3685    /// Wraps `isl_map_remove_dims`.
3686    pub fn remove_dims(self, type_: DimType, first: u32, n: u32) -> Result<Map, LibISLError> {
3687        let map = self;
3688        let isl_rs_ctx = map.get_ctx();
3689        let mut map = map;
3690        map.do_not_free_on_drop();
3691        let map = map.ptr;
3692        let type_ = type_.to_i32();
3693        let isl_rs_result = unsafe { isl_map_remove_dims(map, type_, first, n) };
3694        let isl_rs_result = Map { ptr: isl_rs_result,
3695                                  should_free_on_drop: true };
3696        let err = isl_rs_ctx.last_error();
3697        if err != Error::None_ {
3698            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
3699        }
3700        Ok(isl_rs_result)
3701    }
3702
3703    /// Wraps `isl_map_remove_divs`.
3704    pub fn remove_divs(self) -> Result<Map, LibISLError> {
3705        let map = self;
3706        let isl_rs_ctx = map.get_ctx();
3707        let mut map = map;
3708        map.do_not_free_on_drop();
3709        let map = map.ptr;
3710        let isl_rs_result = unsafe { isl_map_remove_divs(map) };
3711        let isl_rs_result = Map { ptr: isl_rs_result,
3712                                  should_free_on_drop: true };
3713        let err = isl_rs_ctx.last_error();
3714        if err != Error::None_ {
3715            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
3716        }
3717        Ok(isl_rs_result)
3718    }
3719
3720    /// Wraps `isl_map_remove_divs_involving_dims`.
3721    pub fn remove_divs_involving_dims(self, type_: DimType, first: u32, n: u32)
3722                                      -> Result<Map, LibISLError> {
3723        let map = self;
3724        let isl_rs_ctx = map.get_ctx();
3725        let mut map = map;
3726        map.do_not_free_on_drop();
3727        let map = map.ptr;
3728        let type_ = type_.to_i32();
3729        let isl_rs_result = unsafe { isl_map_remove_divs_involving_dims(map, type_, first, n) };
3730        let isl_rs_result = Map { ptr: isl_rs_result,
3731                                  should_free_on_drop: true };
3732        let err = isl_rs_ctx.last_error();
3733        if err != Error::None_ {
3734            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
3735        }
3736        Ok(isl_rs_result)
3737    }
3738
3739    /// Wraps `isl_map_remove_inputs`.
3740    pub fn remove_inputs(self, first: u32, n: u32) -> Result<Map, LibISLError> {
3741        let map = self;
3742        let isl_rs_ctx = map.get_ctx();
3743        let mut map = map;
3744        map.do_not_free_on_drop();
3745        let map = map.ptr;
3746        let isl_rs_result = unsafe { isl_map_remove_inputs(map, first, n) };
3747        let isl_rs_result = Map { ptr: isl_rs_result,
3748                                  should_free_on_drop: true };
3749        let err = isl_rs_ctx.last_error();
3750        if err != Error::None_ {
3751            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
3752        }
3753        Ok(isl_rs_result)
3754    }
3755
3756    /// Wraps `isl_map_remove_redundancies`.
3757    pub fn remove_redundancies(self) -> Result<Map, LibISLError> {
3758        let map = self;
3759        let isl_rs_ctx = map.get_ctx();
3760        let mut map = map;
3761        map.do_not_free_on_drop();
3762        let map = map.ptr;
3763        let isl_rs_result = unsafe { isl_map_remove_redundancies(map) };
3764        let isl_rs_result = Map { ptr: isl_rs_result,
3765                                  should_free_on_drop: true };
3766        let err = isl_rs_ctx.last_error();
3767        if err != Error::None_ {
3768            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
3769        }
3770        Ok(isl_rs_result)
3771    }
3772
3773    /// Wraps `isl_map_remove_unknown_divs`.
3774    pub fn remove_unknown_divs(self) -> Result<Map, LibISLError> {
3775        let map = self;
3776        let isl_rs_ctx = map.get_ctx();
3777        let mut map = map;
3778        map.do_not_free_on_drop();
3779        let map = map.ptr;
3780        let isl_rs_result = unsafe { isl_map_remove_unknown_divs(map) };
3781        let isl_rs_result = Map { ptr: isl_rs_result,
3782                                  should_free_on_drop: true };
3783        let err = isl_rs_ctx.last_error();
3784        if err != Error::None_ {
3785            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
3786        }
3787        Ok(isl_rs_result)
3788    }
3789
3790    /// Wraps `isl_map_reset_tuple_id`.
3791    pub fn reset_tuple_id(self, type_: DimType) -> Result<Map, LibISLError> {
3792        let map = self;
3793        let isl_rs_ctx = map.get_ctx();
3794        let mut map = map;
3795        map.do_not_free_on_drop();
3796        let map = map.ptr;
3797        let type_ = type_.to_i32();
3798        let isl_rs_result = unsafe { isl_map_reset_tuple_id(map, type_) };
3799        let isl_rs_result = Map { ptr: isl_rs_result,
3800                                  should_free_on_drop: true };
3801        let err = isl_rs_ctx.last_error();
3802        if err != Error::None_ {
3803            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
3804        }
3805        Ok(isl_rs_result)
3806    }
3807
3808    /// Wraps `isl_map_reset_user`.
3809    pub fn reset_user(self) -> Result<Map, LibISLError> {
3810        let map = self;
3811        let isl_rs_ctx = map.get_ctx();
3812        let mut map = map;
3813        map.do_not_free_on_drop();
3814        let map = map.ptr;
3815        let isl_rs_result = unsafe { isl_map_reset_user(map) };
3816        let isl_rs_result = Map { ptr: isl_rs_result,
3817                                  should_free_on_drop: true };
3818        let err = isl_rs_ctx.last_error();
3819        if err != Error::None_ {
3820            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
3821        }
3822        Ok(isl_rs_result)
3823    }
3824
3825    /// Wraps `isl_map_reverse`.
3826    pub fn reverse(self) -> Result<Map, LibISLError> {
3827        let map = self;
3828        let isl_rs_ctx = map.get_ctx();
3829        let mut map = map;
3830        map.do_not_free_on_drop();
3831        let map = map.ptr;
3832        let isl_rs_result = unsafe { isl_map_reverse(map) };
3833        let isl_rs_result = Map { ptr: isl_rs_result,
3834                                  should_free_on_drop: true };
3835        let err = isl_rs_ctx.last_error();
3836        if err != Error::None_ {
3837            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
3838        }
3839        Ok(isl_rs_result)
3840    }
3841
3842    /// Wraps `isl_map_sample`.
3843    pub fn sample(self) -> Result<BasicMap, LibISLError> {
3844        let map = self;
3845        let isl_rs_ctx = map.get_ctx();
3846        let mut map = map;
3847        map.do_not_free_on_drop();
3848        let map = map.ptr;
3849        let isl_rs_result = unsafe { isl_map_sample(map) };
3850        let isl_rs_result = BasicMap { ptr: isl_rs_result,
3851                                       should_free_on_drop: true };
3852        let err = isl_rs_ctx.last_error();
3853        if err != Error::None_ {
3854            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
3855        }
3856        Ok(isl_rs_result)
3857    }
3858
3859    /// Wraps `isl_map_set_dim_id`.
3860    pub fn set_dim_id(self, type_: DimType, pos: u32, id: Id) -> Result<Map, LibISLError> {
3861        let map = self;
3862        let isl_rs_ctx = map.get_ctx();
3863        let mut map = map;
3864        map.do_not_free_on_drop();
3865        let map = map.ptr;
3866        let type_ = type_.to_i32();
3867        let mut id = id;
3868        id.do_not_free_on_drop();
3869        let id = id.ptr;
3870        let isl_rs_result = unsafe { isl_map_set_dim_id(map, type_, pos, id) };
3871        let isl_rs_result = Map { ptr: isl_rs_result,
3872                                  should_free_on_drop: true };
3873        let err = isl_rs_ctx.last_error();
3874        if err != Error::None_ {
3875            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
3876        }
3877        Ok(isl_rs_result)
3878    }
3879
3880    /// Wraps `isl_map_set_dim_name`.
3881    pub fn set_dim_name(self, type_: DimType, pos: u32, s: &str) -> Result<Map, LibISLError> {
3882        let map = self;
3883        let isl_rs_ctx = map.get_ctx();
3884        let mut map = map;
3885        map.do_not_free_on_drop();
3886        let map = map.ptr;
3887        let type_ = type_.to_i32();
3888        let s = CString::new(s).unwrap();
3889        let s = s.as_ptr();
3890        let isl_rs_result = unsafe { isl_map_set_dim_name(map, type_, pos, s) };
3891        let isl_rs_result = Map { ptr: isl_rs_result,
3892                                  should_free_on_drop: true };
3893        let err = isl_rs_ctx.last_error();
3894        if err != Error::None_ {
3895            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
3896        }
3897        Ok(isl_rs_result)
3898    }
3899
3900    /// Wraps `isl_map_set_domain_tuple_id`.
3901    pub fn set_domain_tuple_id(self, id: Id) -> Result<Map, LibISLError> {
3902        let map = self;
3903        let isl_rs_ctx = map.get_ctx();
3904        let mut map = map;
3905        map.do_not_free_on_drop();
3906        let map = map.ptr;
3907        let mut id = id;
3908        id.do_not_free_on_drop();
3909        let id = id.ptr;
3910        let isl_rs_result = unsafe { isl_map_set_domain_tuple_id(map, id) };
3911        let isl_rs_result = Map { ptr: isl_rs_result,
3912                                  should_free_on_drop: true };
3913        let err = isl_rs_ctx.last_error();
3914        if err != Error::None_ {
3915            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
3916        }
3917        Ok(isl_rs_result)
3918    }
3919
3920    /// Wraps `isl_map_set_range_tuple_id`.
3921    pub fn set_range_tuple_id(self, id: Id) -> Result<Map, LibISLError> {
3922        let map = self;
3923        let isl_rs_ctx = map.get_ctx();
3924        let mut map = map;
3925        map.do_not_free_on_drop();
3926        let map = map.ptr;
3927        let mut id = id;
3928        id.do_not_free_on_drop();
3929        let id = id.ptr;
3930        let isl_rs_result = unsafe { isl_map_set_range_tuple_id(map, id) };
3931        let isl_rs_result = Map { ptr: isl_rs_result,
3932                                  should_free_on_drop: true };
3933        let err = isl_rs_ctx.last_error();
3934        if err != Error::None_ {
3935            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
3936        }
3937        Ok(isl_rs_result)
3938    }
3939
3940    /// Wraps `isl_map_set_tuple_id`.
3941    pub fn set_tuple_id(self, type_: DimType, id: Id) -> Result<Map, LibISLError> {
3942        let map = self;
3943        let isl_rs_ctx = map.get_ctx();
3944        let mut map = map;
3945        map.do_not_free_on_drop();
3946        let map = map.ptr;
3947        let type_ = type_.to_i32();
3948        let mut id = id;
3949        id.do_not_free_on_drop();
3950        let id = id.ptr;
3951        let isl_rs_result = unsafe { isl_map_set_tuple_id(map, type_, id) };
3952        let isl_rs_result = Map { ptr: isl_rs_result,
3953                                  should_free_on_drop: true };
3954        let err = isl_rs_ctx.last_error();
3955        if err != Error::None_ {
3956            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
3957        }
3958        Ok(isl_rs_result)
3959    }
3960
3961    /// Wraps `isl_map_set_tuple_name`.
3962    pub fn set_tuple_name(self, type_: DimType, s: &str) -> Result<Map, LibISLError> {
3963        let map = self;
3964        let isl_rs_ctx = map.get_ctx();
3965        let mut map = map;
3966        map.do_not_free_on_drop();
3967        let map = map.ptr;
3968        let type_ = type_.to_i32();
3969        let s = CString::new(s).unwrap();
3970        let s = s.as_ptr();
3971        let isl_rs_result = unsafe { isl_map_set_tuple_name(map, type_, s) };
3972        let isl_rs_result = Map { ptr: isl_rs_result,
3973                                  should_free_on_drop: true };
3974        let err = isl_rs_ctx.last_error();
3975        if err != Error::None_ {
3976            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
3977        }
3978        Ok(isl_rs_result)
3979    }
3980
3981    /// Wraps `isl_map_simple_hull`.
3982    pub fn simple_hull(self) -> Result<BasicMap, LibISLError> {
3983        let map = self;
3984        let isl_rs_ctx = map.get_ctx();
3985        let mut map = map;
3986        map.do_not_free_on_drop();
3987        let map = map.ptr;
3988        let isl_rs_result = unsafe { isl_map_simple_hull(map) };
3989        let isl_rs_result = BasicMap { ptr: isl_rs_result,
3990                                       should_free_on_drop: true };
3991        let err = isl_rs_ctx.last_error();
3992        if err != Error::None_ {
3993            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
3994        }
3995        Ok(isl_rs_result)
3996    }
3997
3998    /// Wraps `isl_map_subtract`.
3999    pub fn subtract(self, map2: Map) -> Result<Map, LibISLError> {
4000        let map1 = self;
4001        let isl_rs_ctx = map1.get_ctx();
4002        let mut map1 = map1;
4003        map1.do_not_free_on_drop();
4004        let map1 = map1.ptr;
4005        let mut map2 = map2;
4006        map2.do_not_free_on_drop();
4007        let map2 = map2.ptr;
4008        let isl_rs_result = unsafe { isl_map_subtract(map1, map2) };
4009        let isl_rs_result = Map { ptr: isl_rs_result,
4010                                  should_free_on_drop: true };
4011        let err = isl_rs_ctx.last_error();
4012        if err != Error::None_ {
4013            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
4014        }
4015        Ok(isl_rs_result)
4016    }
4017
4018    /// Wraps `isl_map_subtract_domain`.
4019    pub fn subtract_domain(self, dom: Set) -> Result<Map, LibISLError> {
4020        let map = self;
4021        let isl_rs_ctx = map.get_ctx();
4022        let mut map = map;
4023        map.do_not_free_on_drop();
4024        let map = map.ptr;
4025        let mut dom = dom;
4026        dom.do_not_free_on_drop();
4027        let dom = dom.ptr;
4028        let isl_rs_result = unsafe { isl_map_subtract_domain(map, dom) };
4029        let isl_rs_result = Map { ptr: isl_rs_result,
4030                                  should_free_on_drop: true };
4031        let err = isl_rs_ctx.last_error();
4032        if err != Error::None_ {
4033            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
4034        }
4035        Ok(isl_rs_result)
4036    }
4037
4038    /// Wraps `isl_map_subtract_range`.
4039    pub fn subtract_range(self, dom: Set) -> Result<Map, LibISLError> {
4040        let map = self;
4041        let isl_rs_ctx = map.get_ctx();
4042        let mut map = map;
4043        map.do_not_free_on_drop();
4044        let map = map.ptr;
4045        let mut dom = dom;
4046        dom.do_not_free_on_drop();
4047        let dom = dom.ptr;
4048        let isl_rs_result = unsafe { isl_map_subtract_range(map, dom) };
4049        let isl_rs_result = Map { ptr: isl_rs_result,
4050                                  should_free_on_drop: true };
4051        let err = isl_rs_ctx.last_error();
4052        if err != Error::None_ {
4053            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
4054        }
4055        Ok(isl_rs_result)
4056    }
4057
4058    /// Wraps `isl_map_sum`.
4059    pub fn sum(self, map2: Map) -> Result<Map, LibISLError> {
4060        let map1 = self;
4061        let isl_rs_ctx = map1.get_ctx();
4062        let mut map1 = map1;
4063        map1.do_not_free_on_drop();
4064        let map1 = map1.ptr;
4065        let mut map2 = map2;
4066        map2.do_not_free_on_drop();
4067        let map2 = map2.ptr;
4068        let isl_rs_result = unsafe { isl_map_sum(map1, map2) };
4069        let isl_rs_result = Map { ptr: isl_rs_result,
4070                                  should_free_on_drop: true };
4071        let err = isl_rs_ctx.last_error();
4072        if err != Error::None_ {
4073            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
4074        }
4075        Ok(isl_rs_result)
4076    }
4077
4078    /// Wraps `isl_map_to_list`.
4079    pub fn to_list(self) -> Result<MapList, LibISLError> {
4080        let el = self;
4081        let isl_rs_ctx = el.get_ctx();
4082        let mut el = el;
4083        el.do_not_free_on_drop();
4084        let el = el.ptr;
4085        let isl_rs_result = unsafe { isl_map_to_list(el) };
4086        let isl_rs_result = MapList { ptr: isl_rs_result,
4087                                      should_free_on_drop: true };
4088        let err = isl_rs_ctx.last_error();
4089        if err != Error::None_ {
4090            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
4091        }
4092        Ok(isl_rs_result)
4093    }
4094
4095    /// Wraps `isl_map_to_str`.
4096    pub fn to_str(&self) -> Result<&str, LibISLError> {
4097        let map = self;
4098        let isl_rs_ctx = map.get_ctx();
4099        let map = map.ptr;
4100        let isl_rs_result = unsafe { isl_map_to_str(map) };
4101        let isl_rs_result = unsafe { CStr::from_ptr(isl_rs_result) };
4102        let isl_rs_result = isl_rs_result.to_str().unwrap();
4103        let err = isl_rs_ctx.last_error();
4104        if err != Error::None_ {
4105            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
4106        }
4107        Ok(isl_rs_result)
4108    }
4109
4110    /// Wraps `isl_map_to_union_map`.
4111    pub fn to_union_map(self) -> Result<UnionMap, LibISLError> {
4112        let map = self;
4113        let isl_rs_ctx = map.get_ctx();
4114        let mut map = map;
4115        map.do_not_free_on_drop();
4116        let map = map.ptr;
4117        let isl_rs_result = unsafe { isl_map_to_union_map(map) };
4118        let isl_rs_result = UnionMap { ptr: isl_rs_result,
4119                                       should_free_on_drop: true };
4120        let err = isl_rs_ctx.last_error();
4121        if err != Error::None_ {
4122            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
4123        }
4124        Ok(isl_rs_result)
4125    }
4126
4127    /// Wraps `isl_map_uncurry`.
4128    pub fn uncurry(self) -> Result<Map, LibISLError> {
4129        let map = self;
4130        let isl_rs_ctx = map.get_ctx();
4131        let mut map = map;
4132        map.do_not_free_on_drop();
4133        let map = map.ptr;
4134        let isl_rs_result = unsafe { isl_map_uncurry(map) };
4135        let isl_rs_result = Map { ptr: isl_rs_result,
4136                                  should_free_on_drop: true };
4137        let err = isl_rs_ctx.last_error();
4138        if err != Error::None_ {
4139            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
4140        }
4141        Ok(isl_rs_result)
4142    }
4143
4144    /// Wraps `isl_map_union`.
4145    pub fn union(self, map2: Map) -> Result<Map, LibISLError> {
4146        let map1 = self;
4147        let isl_rs_ctx = map1.get_ctx();
4148        let mut map1 = map1;
4149        map1.do_not_free_on_drop();
4150        let map1 = map1.ptr;
4151        let mut map2 = map2;
4152        map2.do_not_free_on_drop();
4153        let map2 = map2.ptr;
4154        let isl_rs_result = unsafe { isl_map_union(map1, map2) };
4155        let isl_rs_result = Map { ptr: isl_rs_result,
4156                                  should_free_on_drop: true };
4157        let err = isl_rs_ctx.last_error();
4158        if err != Error::None_ {
4159            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
4160        }
4161        Ok(isl_rs_result)
4162    }
4163
4164    /// Wraps `isl_map_union_disjoint`.
4165    pub fn union_disjoint(self, map2: Map) -> Result<Map, LibISLError> {
4166        let map1 = self;
4167        let isl_rs_ctx = map1.get_ctx();
4168        let mut map1 = map1;
4169        map1.do_not_free_on_drop();
4170        let map1 = map1.ptr;
4171        let mut map2 = map2;
4172        map2.do_not_free_on_drop();
4173        let map2 = map2.ptr;
4174        let isl_rs_result = unsafe { isl_map_union_disjoint(map1, map2) };
4175        let isl_rs_result = Map { ptr: isl_rs_result,
4176                                  should_free_on_drop: true };
4177        let err = isl_rs_ctx.last_error();
4178        if err != Error::None_ {
4179            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
4180        }
4181        Ok(isl_rs_result)
4182    }
4183
4184    /// Wraps `isl_map_universe`.
4185    pub fn universe(space: Space) -> Result<Map, LibISLError> {
4186        let isl_rs_ctx = space.get_ctx();
4187        let mut space = space;
4188        space.do_not_free_on_drop();
4189        let space = space.ptr;
4190        let isl_rs_result = unsafe { isl_map_universe(space) };
4191        let isl_rs_result = Map { ptr: isl_rs_result,
4192                                  should_free_on_drop: true };
4193        let err = isl_rs_ctx.last_error();
4194        if err != Error::None_ {
4195            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
4196        }
4197        Ok(isl_rs_result)
4198    }
4199
4200    /// Wraps `isl_map_unshifted_simple_hull`.
4201    pub fn unshifted_simple_hull(self) -> Result<BasicMap, LibISLError> {
4202        let map = self;
4203        let isl_rs_ctx = map.get_ctx();
4204        let mut map = map;
4205        map.do_not_free_on_drop();
4206        let map = map.ptr;
4207        let isl_rs_result = unsafe { isl_map_unshifted_simple_hull(map) };
4208        let isl_rs_result = BasicMap { ptr: isl_rs_result,
4209                                       should_free_on_drop: true };
4210        let err = isl_rs_ctx.last_error();
4211        if err != Error::None_ {
4212            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
4213        }
4214        Ok(isl_rs_result)
4215    }
4216
4217    /// Wraps `isl_map_unshifted_simple_hull_from_map_list`.
4218    pub fn unshifted_simple_hull_from_map_list(self, list: MapList)
4219                                               -> Result<BasicMap, LibISLError> {
4220        let map = self;
4221        let isl_rs_ctx = map.get_ctx();
4222        let mut map = map;
4223        map.do_not_free_on_drop();
4224        let map = map.ptr;
4225        let mut list = list;
4226        list.do_not_free_on_drop();
4227        let list = list.ptr;
4228        let isl_rs_result = unsafe { isl_map_unshifted_simple_hull_from_map_list(map, list) };
4229        let isl_rs_result = BasicMap { ptr: isl_rs_result,
4230                                       should_free_on_drop: true };
4231        let err = isl_rs_ctx.last_error();
4232        if err != Error::None_ {
4233            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
4234        }
4235        Ok(isl_rs_result)
4236    }
4237
4238    /// Wraps `isl_map_upper_bound_multi_pw_aff`.
4239    pub fn upper_bound_multi_pw_aff(self, upper: MultiPwAff) -> Result<Map, LibISLError> {
4240        let map = self;
4241        let isl_rs_ctx = map.get_ctx();
4242        let mut map = map;
4243        map.do_not_free_on_drop();
4244        let map = map.ptr;
4245        let mut upper = upper;
4246        upper.do_not_free_on_drop();
4247        let upper = upper.ptr;
4248        let isl_rs_result = unsafe { isl_map_upper_bound_multi_pw_aff(map, upper) };
4249        let isl_rs_result = Map { ptr: isl_rs_result,
4250                                  should_free_on_drop: true };
4251        let err = isl_rs_ctx.last_error();
4252        if err != Error::None_ {
4253            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
4254        }
4255        Ok(isl_rs_result)
4256    }
4257
4258    /// Wraps `isl_map_upper_bound_si`.
4259    pub fn upper_bound_si(self, type_: DimType, pos: u32, value: i32) -> Result<Map, LibISLError> {
4260        let map = self;
4261        let isl_rs_ctx = map.get_ctx();
4262        let mut map = map;
4263        map.do_not_free_on_drop();
4264        let map = map.ptr;
4265        let type_ = type_.to_i32();
4266        let isl_rs_result = unsafe { isl_map_upper_bound_si(map, type_, pos, value) };
4267        let isl_rs_result = Map { ptr: isl_rs_result,
4268                                  should_free_on_drop: true };
4269        let err = isl_rs_ctx.last_error();
4270        if err != Error::None_ {
4271            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
4272        }
4273        Ok(isl_rs_result)
4274    }
4275
4276    /// Wraps `isl_map_upper_bound_val`.
4277    pub fn upper_bound_val(self, type_: DimType, pos: u32, value: Val) -> Result<Map, LibISLError> {
4278        let map = self;
4279        let isl_rs_ctx = map.get_ctx();
4280        let mut map = map;
4281        map.do_not_free_on_drop();
4282        let map = map.ptr;
4283        let type_ = type_.to_i32();
4284        let mut value = value;
4285        value.do_not_free_on_drop();
4286        let value = value.ptr;
4287        let isl_rs_result = unsafe { isl_map_upper_bound_val(map, type_, pos, value) };
4288        let isl_rs_result = Map { ptr: isl_rs_result,
4289                                  should_free_on_drop: true };
4290        let err = isl_rs_ctx.last_error();
4291        if err != Error::None_ {
4292            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
4293        }
4294        Ok(isl_rs_result)
4295    }
4296
4297    /// Wraps `isl_map_wrap`.
4298    pub fn wrap(self) -> Result<Set, LibISLError> {
4299        let map = self;
4300        let isl_rs_ctx = map.get_ctx();
4301        let mut map = map;
4302        map.do_not_free_on_drop();
4303        let map = map.ptr;
4304        let isl_rs_result = unsafe { isl_map_wrap(map) };
4305        let isl_rs_result = Set { ptr: isl_rs_result,
4306                                  should_free_on_drop: true };
4307        let err = isl_rs_ctx.last_error();
4308        if err != Error::None_ {
4309            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
4310        }
4311        Ok(isl_rs_result)
4312    }
4313
4314    /// Wraps `isl_map_zip`.
4315    pub fn zip(self) -> Result<Map, LibISLError> {
4316        let map = self;
4317        let isl_rs_ctx = map.get_ctx();
4318        let mut map = map;
4319        map.do_not_free_on_drop();
4320        let map = map.ptr;
4321        let isl_rs_result = unsafe { isl_map_zip(map) };
4322        let isl_rs_result = Map { ptr: isl_rs_result,
4323                                  should_free_on_drop: true };
4324        let err = isl_rs_ctx.last_error();
4325        if err != Error::None_ {
4326            return Err(LibISLError::new(err, isl_rs_ctx.last_error_msg()));
4327        }
4328        Ok(isl_rs_result)
4329    }
4330
4331    /// Does not call isl_map_free() on being dropped. (For internal use only.)
4332    pub fn do_not_free_on_drop(&mut self) {
4333        self.should_free_on_drop = false;
4334    }
4335}
4336
4337impl Drop for Map {
4338    fn drop(&mut self) {
4339        if self.should_free_on_drop {
4340            unsafe {
4341                isl_map_free(self.ptr);
4342            }
4343        }
4344    }
4345}