isl_rs/bindings/
bmap.rs

1// Automatically generated by isl_bindings_generator.
2// LICENSE: MIT
3
4use crate::bindings::{Aff, BasicSet, Context, DimType, Id, LocalSpace, Map, Mat, Space, Val};
5use libc::uintptr_t;
6use std::ffi::{CStr, CString};
7use std::os::raw::c_char;
8
9/// Wraps `isl_basic_map`.
10pub struct BasicMap {
11    pub ptr: uintptr_t,
12    pub should_free_on_drop: bool,
13}
14
15extern "C" {
16
17    fn isl_basic_map_total_dim(bmap: uintptr_t) -> i32;
18
19    fn isl_basic_map_dim(bmap: uintptr_t, type_: DimType) -> i32;
20
21    fn isl_basic_map_get_ctx(bmap: uintptr_t) -> uintptr_t;
22
23    fn isl_basic_map_get_space(bmap: uintptr_t) -> uintptr_t;
24
25    fn isl_basic_map_get_div(bmap: uintptr_t, pos: i32) -> uintptr_t;
26
27    fn isl_basic_map_get_local_space(bmap: uintptr_t) -> uintptr_t;
28
29    fn isl_basic_map_set_tuple_name(bmap: uintptr_t, type_: DimType, s: *const c_char)
30                                    -> uintptr_t;
31
32    fn isl_basic_map_get_tuple_name(bmap: uintptr_t, type_: DimType) -> *const c_char;
33
34    fn isl_basic_map_get_dim_name(bmap: uintptr_t, type_: DimType, pos: u32) -> *const c_char;
35
36    fn isl_basic_map_set_dim_name(bmap: uintptr_t, type_: DimType, pos: u32, s: *const c_char)
37                                  -> uintptr_t;
38
39    fn isl_basic_map_set_tuple_id(bmap: uintptr_t, type_: DimType, id: uintptr_t) -> uintptr_t;
40
41    fn isl_basic_map_has_dim_id(bmap: uintptr_t, type_: DimType, pos: u32) -> i32;
42
43    fn isl_basic_map_find_dim_by_name(bmap: uintptr_t, type_: DimType, name: *const c_char) -> i32;
44
45    fn isl_basic_map_is_rational(bmap: uintptr_t) -> i32;
46
47    fn isl_basic_map_identity(space: uintptr_t) -> uintptr_t;
48
49    fn isl_basic_map_free(bmap: uintptr_t) -> uintptr_t;
50
51    fn isl_basic_map_copy(bmap: uintptr_t) -> uintptr_t;
52
53    fn isl_basic_map_equal(space: uintptr_t, n_equal: u32) -> uintptr_t;
54
55    fn isl_basic_map_less_at(space: uintptr_t, pos: u32) -> uintptr_t;
56
57    fn isl_basic_map_more_at(space: uintptr_t, pos: u32) -> uintptr_t;
58
59    fn isl_basic_map_empty(space: uintptr_t) -> uintptr_t;
60
61    fn isl_basic_map_universe(space: uintptr_t) -> uintptr_t;
62
63    fn isl_basic_map_nat_universe(space: uintptr_t) -> uintptr_t;
64
65    fn isl_basic_map_remove_redundancies(bmap: uintptr_t) -> uintptr_t;
66
67    fn isl_basic_map_intersect_domain(bmap: uintptr_t, bset: uintptr_t) -> uintptr_t;
68
69    fn isl_basic_map_intersect_range(bmap: uintptr_t, bset: uintptr_t) -> uintptr_t;
70
71    fn isl_basic_map_intersect(bmap1: uintptr_t, bmap2: uintptr_t) -> uintptr_t;
72
73    fn isl_basic_map_union(bmap1: uintptr_t, bmap2: uintptr_t) -> uintptr_t;
74
75    fn isl_basic_map_apply_domain(bmap1: uintptr_t, bmap2: uintptr_t) -> uintptr_t;
76
77    fn isl_basic_map_apply_range(bmap1: uintptr_t, bmap2: uintptr_t) -> uintptr_t;
78
79    fn isl_basic_map_affine_hull(bmap: uintptr_t) -> uintptr_t;
80
81    fn isl_basic_map_reverse(bmap: uintptr_t) -> uintptr_t;
82
83    fn isl_basic_map_domain(bmap: uintptr_t) -> uintptr_t;
84
85    fn isl_basic_map_range(bmap: uintptr_t) -> uintptr_t;
86
87    fn isl_basic_map_domain_map(bmap: uintptr_t) -> uintptr_t;
88
89    fn isl_basic_map_range_map(bmap: uintptr_t) -> uintptr_t;
90
91    fn isl_basic_map_remove_dims(bmap: uintptr_t, type_: DimType, first: u32, n: u32) -> uintptr_t;
92
93    fn isl_basic_map_eliminate(bmap: uintptr_t, type_: DimType, first: u32, n: u32) -> uintptr_t;
94
95    fn isl_basic_map_sample(bmap: uintptr_t) -> uintptr_t;
96
97    fn isl_basic_map_detect_equalities(bmap: uintptr_t) -> uintptr_t;
98
99    fn isl_basic_map_read_from_str(ctx: uintptr_t, str_: *const c_char) -> uintptr_t;
100
101    fn isl_basic_map_dump(bmap: uintptr_t);
102
103    fn isl_basic_map_to_str(bmap: uintptr_t) -> *const c_char;
104
105    fn isl_basic_map_fix_si(bmap: uintptr_t, type_: DimType, pos: u32, value: i32) -> uintptr_t;
106
107    fn isl_basic_map_fix_val(bmap: uintptr_t, type_: DimType, pos: u32, v: uintptr_t) -> uintptr_t;
108
109    fn isl_basic_map_lower_bound_si(bmap: uintptr_t, type_: DimType, pos: u32, value: i32)
110                                    -> uintptr_t;
111
112    fn isl_basic_map_upper_bound_si(bmap: uintptr_t, type_: DimType, pos: u32, value: i32)
113                                    -> uintptr_t;
114
115    fn isl_basic_map_sum(bmap1: uintptr_t, bmap2: uintptr_t) -> uintptr_t;
116
117    fn isl_basic_map_neg(bmap: uintptr_t) -> uintptr_t;
118
119    fn isl_basic_map_is_equal(bmap1: uintptr_t, bmap2: uintptr_t) -> i32;
120
121    fn isl_basic_map_is_disjoint(bmap1: uintptr_t, bmap2: uintptr_t) -> i32;
122
123    fn isl_basic_map_lexmin(bmap: uintptr_t) -> uintptr_t;
124
125    fn isl_basic_map_lexmax(bmap: uintptr_t) -> uintptr_t;
126
127    fn isl_basic_map_plain_get_val_if_fixed(bmap: uintptr_t, type_: DimType, pos: u32)
128                                            -> uintptr_t;
129
130    fn isl_basic_map_image_is_bounded(bmap: uintptr_t) -> i32;
131
132    fn isl_basic_map_plain_is_universe(bmap: uintptr_t) -> i32;
133
134    fn isl_basic_map_is_universe(bmap: uintptr_t) -> i32;
135
136    fn isl_basic_map_plain_is_empty(bmap: uintptr_t) -> i32;
137
138    fn isl_basic_map_is_empty(bmap: uintptr_t) -> i32;
139
140    fn isl_basic_map_is_subset(bmap1: uintptr_t, bmap2: uintptr_t) -> i32;
141
142    fn isl_basic_map_is_strict_subset(bmap1: uintptr_t, bmap2: uintptr_t) -> i32;
143
144    fn isl_basic_map_product(bmap1: uintptr_t, bmap2: uintptr_t) -> uintptr_t;
145
146    fn isl_basic_map_domain_product(bmap1: uintptr_t, bmap2: uintptr_t) -> uintptr_t;
147
148    fn isl_basic_map_range_product(bmap1: uintptr_t, bmap2: uintptr_t) -> uintptr_t;
149
150    fn isl_basic_map_flat_product(bmap1: uintptr_t, bmap2: uintptr_t) -> uintptr_t;
151
152    fn isl_basic_map_flat_range_product(bmap1: uintptr_t, bmap2: uintptr_t) -> uintptr_t;
153
154    fn isl_basic_map_deltas(bmap: uintptr_t) -> uintptr_t;
155
156    fn isl_basic_map_deltas_map(bmap: uintptr_t) -> uintptr_t;
157
158    fn isl_basic_map_add_dims(bmap: uintptr_t, type_: DimType, n: u32) -> uintptr_t;
159
160    fn isl_basic_map_insert_dims(bmap: uintptr_t, type_: DimType, pos: u32, n: u32) -> uintptr_t;
161
162    fn isl_basic_map_move_dims(bmap: uintptr_t, dst_type: DimType, dst_pos: u32,
163                               src_type: DimType, src_pos: u32, n: u32)
164                               -> uintptr_t;
165
166    fn isl_basic_map_project_out(bmap: uintptr_t, type_: DimType, first: u32, n: u32) -> uintptr_t;
167
168    fn isl_basic_map_remove_divs(bmap: uintptr_t) -> uintptr_t;
169
170    fn isl_basic_map_remove_divs_involving_dims(bmap: uintptr_t, type_: DimType, first: u32,
171                                                n: u32)
172                                                -> uintptr_t;
173
174    fn isl_basic_map_equate(bmap: uintptr_t, type1: DimType, pos1: i32, type2: DimType, pos2: i32)
175                            -> uintptr_t;
176
177    fn isl_basic_map_order_ge(bmap: uintptr_t, type1: DimType, pos1: i32, type2: DimType,
178                              pos2: i32)
179                              -> uintptr_t;
180
181    fn isl_basic_map_order_gt(bmap: uintptr_t, type1: DimType, pos1: i32, type2: DimType,
182                              pos2: i32)
183                              -> uintptr_t;
184
185    fn isl_basic_map_wrap(bmap: uintptr_t) -> uintptr_t;
186
187    fn isl_basic_map_flatten(bmap: uintptr_t) -> uintptr_t;
188
189    fn isl_basic_map_flatten_domain(bmap: uintptr_t) -> uintptr_t;
190
191    fn isl_basic_map_flatten_range(bmap: uintptr_t) -> uintptr_t;
192
193    fn isl_basic_map_from_domain(bset: uintptr_t) -> uintptr_t;
194
195    fn isl_basic_map_from_range(bset: uintptr_t) -> uintptr_t;
196
197    fn isl_basic_map_from_domain_and_range(domain: uintptr_t, range: uintptr_t) -> uintptr_t;
198
199    fn isl_basic_map_is_single_valued(bmap: uintptr_t) -> i32;
200
201    fn isl_basic_map_can_zip(bmap: uintptr_t) -> i32;
202
203    fn isl_basic_map_zip(bmap: uintptr_t) -> uintptr_t;
204
205    fn isl_basic_map_can_curry(bmap: uintptr_t) -> i32;
206
207    fn isl_basic_map_curry(bmap: uintptr_t) -> uintptr_t;
208
209    fn isl_basic_map_can_uncurry(bmap: uintptr_t) -> i32;
210
211    fn isl_basic_map_uncurry(bmap: uintptr_t) -> uintptr_t;
212
213    fn isl_basic_map_compute_divs(bmap: uintptr_t) -> uintptr_t;
214
215    fn isl_basic_map_drop_constraints_involving_dims(bmap: uintptr_t, type_: DimType, first: u32,
216                                                     n: u32)
217                                                     -> uintptr_t;
218
219    fn isl_basic_map_drop_constraints_not_involving_dims(bmap: uintptr_t, type_: DimType,
220                                                         first: u32, n: u32)
221                                                         -> uintptr_t;
222
223    fn isl_basic_map_involves_dims(bmap: uintptr_t, type_: DimType, first: u32, n: u32) -> i32;
224
225    fn isl_basic_map_gist_domain(bmap: uintptr_t, context: uintptr_t) -> uintptr_t;
226
227    fn isl_basic_map_gist(bmap: uintptr_t, context: uintptr_t) -> uintptr_t;
228
229    fn isl_basic_map_align_params(bmap: uintptr_t, model: uintptr_t) -> uintptr_t;
230
231    fn isl_basic_map_drop_unused_params(bmap: uintptr_t) -> uintptr_t;
232
233    fn isl_basic_map_equalities_matrix(bmap: uintptr_t, c1: DimType, c2: DimType, c3: DimType,
234                                       c4: DimType, c5: DimType)
235                                       -> uintptr_t;
236
237    fn isl_basic_map_inequalities_matrix(bmap: uintptr_t, c1: DimType, c2: DimType, c3: DimType,
238                                         c4: DimType, c5: DimType)
239                                         -> uintptr_t;
240
241    fn isl_basic_map_from_constraint_matrices(space: uintptr_t, eq: uintptr_t, ineq: uintptr_t,
242                                              c1: DimType, c2: DimType, c3: DimType, c4: DimType,
243                                              c5: DimType)
244                                              -> uintptr_t;
245
246    fn isl_basic_map_from_aff(aff: uintptr_t) -> uintptr_t;
247
248}
249
250impl BasicMap {
251    /// Wraps `isl_basic_map_total_dim`.
252    pub fn total_dim(&self) -> i32 {
253        let bmap = self;
254        let bmap = bmap.ptr;
255        let isl_rs_result = unsafe { isl_basic_map_total_dim(bmap) };
256        isl_rs_result
257    }
258
259    /// Wraps `isl_basic_map_dim`.
260    pub fn dim(&self, type_: DimType) -> i32 {
261        let bmap = self;
262        let bmap = bmap.ptr;
263        let isl_rs_result = unsafe { isl_basic_map_dim(bmap, type_) };
264        isl_rs_result
265    }
266
267    /// Wraps `isl_basic_map_get_ctx`.
268    pub fn get_ctx(&self) -> Context {
269        let bmap = self;
270        let bmap = bmap.ptr;
271        let isl_rs_result = unsafe { isl_basic_map_get_ctx(bmap) };
272        let isl_rs_result = Context { ptr: isl_rs_result,
273                                      should_free_on_drop: true };
274        let mut isl_rs_result = isl_rs_result;
275        isl_rs_result.do_not_free_on_drop();
276        isl_rs_result
277    }
278
279    /// Wraps `isl_basic_map_get_space`.
280    pub fn get_space(&self) -> Space {
281        let bmap = self;
282        let bmap = bmap.ptr;
283        let isl_rs_result = unsafe { isl_basic_map_get_space(bmap) };
284        let isl_rs_result = Space { ptr: isl_rs_result,
285                                    should_free_on_drop: true };
286        isl_rs_result
287    }
288
289    /// Wraps `isl_basic_map_get_div`.
290    pub fn get_div(&self, pos: i32) -> Aff {
291        let bmap = self;
292        let bmap = bmap.ptr;
293        let isl_rs_result = unsafe { isl_basic_map_get_div(bmap, pos) };
294        let isl_rs_result = Aff { ptr: isl_rs_result,
295                                  should_free_on_drop: true };
296        isl_rs_result
297    }
298
299    /// Wraps `isl_basic_map_get_local_space`.
300    pub fn get_local_space(&self) -> LocalSpace {
301        let bmap = self;
302        let bmap = bmap.ptr;
303        let isl_rs_result = unsafe { isl_basic_map_get_local_space(bmap) };
304        let isl_rs_result = LocalSpace { ptr: isl_rs_result,
305                                         should_free_on_drop: true };
306        isl_rs_result
307    }
308
309    /// Wraps `isl_basic_map_set_tuple_name`.
310    pub fn set_tuple_name(self, type_: DimType, s: &str) -> BasicMap {
311        let bmap = self;
312        let mut bmap = bmap;
313        bmap.do_not_free_on_drop();
314        let bmap = bmap.ptr;
315        let s = CString::new(s).unwrap();
316        let s = s.as_ptr();
317        let isl_rs_result = unsafe { isl_basic_map_set_tuple_name(bmap, type_, s) };
318        let isl_rs_result = BasicMap { ptr: isl_rs_result,
319                                       should_free_on_drop: true };
320        isl_rs_result
321    }
322
323    /// Wraps `isl_basic_map_get_tuple_name`.
324    pub fn get_tuple_name(&self, type_: DimType) -> &str {
325        let bmap = self;
326        let bmap = bmap.ptr;
327        let isl_rs_result = unsafe { isl_basic_map_get_tuple_name(bmap, type_) };
328        let isl_rs_result = unsafe { CStr::from_ptr(isl_rs_result) };
329        let isl_rs_result = isl_rs_result.to_str().unwrap();
330        isl_rs_result
331    }
332
333    /// Wraps `isl_basic_map_get_dim_name`.
334    pub fn get_dim_name(&self, type_: DimType, pos: u32) -> &str {
335        let bmap = self;
336        let bmap = bmap.ptr;
337        let isl_rs_result = unsafe { isl_basic_map_get_dim_name(bmap, type_, pos) };
338        let isl_rs_result = unsafe { CStr::from_ptr(isl_rs_result) };
339        let isl_rs_result = isl_rs_result.to_str().unwrap();
340        isl_rs_result
341    }
342
343    /// Wraps `isl_basic_map_set_dim_name`.
344    pub fn set_dim_name(self, type_: DimType, pos: u32, s: &str) -> BasicMap {
345        let bmap = self;
346        let mut bmap = bmap;
347        bmap.do_not_free_on_drop();
348        let bmap = bmap.ptr;
349        let s = CString::new(s).unwrap();
350        let s = s.as_ptr();
351        let isl_rs_result = unsafe { isl_basic_map_set_dim_name(bmap, type_, pos, s) };
352        let isl_rs_result = BasicMap { ptr: isl_rs_result,
353                                       should_free_on_drop: true };
354        isl_rs_result
355    }
356
357    /// Wraps `isl_basic_map_set_tuple_id`.
358    pub fn set_tuple_id(self, type_: DimType, id: Id) -> BasicMap {
359        let bmap = self;
360        let mut bmap = bmap;
361        bmap.do_not_free_on_drop();
362        let bmap = bmap.ptr;
363        let mut id = id;
364        id.do_not_free_on_drop();
365        let id = id.ptr;
366        let isl_rs_result = unsafe { isl_basic_map_set_tuple_id(bmap, type_, id) };
367        let isl_rs_result = BasicMap { ptr: isl_rs_result,
368                                       should_free_on_drop: true };
369        isl_rs_result
370    }
371
372    /// Wraps `isl_basic_map_has_dim_id`.
373    pub fn has_dim_id(&self, type_: DimType, pos: u32) -> bool {
374        let bmap = self;
375        let bmap = bmap.ptr;
376        let isl_rs_result = unsafe { isl_basic_map_has_dim_id(bmap, type_, pos) };
377        let isl_rs_result = match isl_rs_result {
378            0 => false,
379            1 => true,
380            _ => panic!("Got isl_bool = -1"),
381        };
382        isl_rs_result
383    }
384
385    /// Wraps `isl_basic_map_find_dim_by_name`.
386    pub fn find_dim_by_name(&self, type_: DimType, name: &str) -> i32 {
387        let bmap = self;
388        let bmap = bmap.ptr;
389        let name = CString::new(name).unwrap();
390        let name = name.as_ptr();
391        let isl_rs_result = unsafe { isl_basic_map_find_dim_by_name(bmap, type_, name) };
392        isl_rs_result
393    }
394
395    /// Wraps `isl_basic_map_is_rational`.
396    pub fn is_rational(&self) -> bool {
397        let bmap = self;
398        let bmap = bmap.ptr;
399        let isl_rs_result = unsafe { isl_basic_map_is_rational(bmap) };
400        let isl_rs_result = match isl_rs_result {
401            0 => false,
402            1 => true,
403            _ => panic!("Got isl_bool = -1"),
404        };
405        isl_rs_result
406    }
407
408    /// Wraps `isl_basic_map_identity`.
409    pub fn identity(space: Space) -> BasicMap {
410        let mut space = space;
411        space.do_not_free_on_drop();
412        let space = space.ptr;
413        let isl_rs_result = unsafe { isl_basic_map_identity(space) };
414        let isl_rs_result = BasicMap { ptr: isl_rs_result,
415                                       should_free_on_drop: true };
416        isl_rs_result
417    }
418
419    /// Wraps `isl_basic_map_free`.
420    pub fn free(self) -> BasicMap {
421        let bmap = self;
422        let mut bmap = bmap;
423        bmap.do_not_free_on_drop();
424        let bmap = bmap.ptr;
425        let isl_rs_result = unsafe { isl_basic_map_free(bmap) };
426        let isl_rs_result = BasicMap { ptr: isl_rs_result,
427                                       should_free_on_drop: true };
428        isl_rs_result
429    }
430
431    /// Wraps `isl_basic_map_copy`.
432    pub fn copy(&self) -> BasicMap {
433        let bmap = self;
434        let bmap = bmap.ptr;
435        let isl_rs_result = unsafe { isl_basic_map_copy(bmap) };
436        let isl_rs_result = BasicMap { ptr: isl_rs_result,
437                                       should_free_on_drop: true };
438        isl_rs_result
439    }
440
441    /// Wraps `isl_basic_map_equal`.
442    pub fn equal(space: Space, n_equal: u32) -> BasicMap {
443        let mut space = space;
444        space.do_not_free_on_drop();
445        let space = space.ptr;
446        let isl_rs_result = unsafe { isl_basic_map_equal(space, n_equal) };
447        let isl_rs_result = BasicMap { ptr: isl_rs_result,
448                                       should_free_on_drop: true };
449        isl_rs_result
450    }
451
452    /// Wraps `isl_basic_map_less_at`.
453    pub fn less_at(space: Space, pos: u32) -> BasicMap {
454        let mut space = space;
455        space.do_not_free_on_drop();
456        let space = space.ptr;
457        let isl_rs_result = unsafe { isl_basic_map_less_at(space, pos) };
458        let isl_rs_result = BasicMap { ptr: isl_rs_result,
459                                       should_free_on_drop: true };
460        isl_rs_result
461    }
462
463    /// Wraps `isl_basic_map_more_at`.
464    pub fn more_at(space: Space, pos: u32) -> BasicMap {
465        let mut space = space;
466        space.do_not_free_on_drop();
467        let space = space.ptr;
468        let isl_rs_result = unsafe { isl_basic_map_more_at(space, pos) };
469        let isl_rs_result = BasicMap { ptr: isl_rs_result,
470                                       should_free_on_drop: true };
471        isl_rs_result
472    }
473
474    /// Wraps `isl_basic_map_empty`.
475    pub fn empty(space: Space) -> BasicMap {
476        let mut space = space;
477        space.do_not_free_on_drop();
478        let space = space.ptr;
479        let isl_rs_result = unsafe { isl_basic_map_empty(space) };
480        let isl_rs_result = BasicMap { ptr: isl_rs_result,
481                                       should_free_on_drop: true };
482        isl_rs_result
483    }
484
485    /// Wraps `isl_basic_map_universe`.
486    pub fn universe(space: Space) -> BasicMap {
487        let mut space = space;
488        space.do_not_free_on_drop();
489        let space = space.ptr;
490        let isl_rs_result = unsafe { isl_basic_map_universe(space) };
491        let isl_rs_result = BasicMap { ptr: isl_rs_result,
492                                       should_free_on_drop: true };
493        isl_rs_result
494    }
495
496    /// Wraps `isl_basic_map_nat_universe`.
497    pub fn nat_universe(space: Space) -> BasicMap {
498        let mut space = space;
499        space.do_not_free_on_drop();
500        let space = space.ptr;
501        let isl_rs_result = unsafe { isl_basic_map_nat_universe(space) };
502        let isl_rs_result = BasicMap { ptr: isl_rs_result,
503                                       should_free_on_drop: true };
504        isl_rs_result
505    }
506
507    /// Wraps `isl_basic_map_remove_redundancies`.
508    pub fn remove_redundancies(self) -> BasicMap {
509        let bmap = self;
510        let mut bmap = bmap;
511        bmap.do_not_free_on_drop();
512        let bmap = bmap.ptr;
513        let isl_rs_result = unsafe { isl_basic_map_remove_redundancies(bmap) };
514        let isl_rs_result = BasicMap { ptr: isl_rs_result,
515                                       should_free_on_drop: true };
516        isl_rs_result
517    }
518
519    /// Wraps `isl_basic_map_intersect_domain`.
520    pub fn intersect_domain(self, bset: BasicSet) -> BasicMap {
521        let bmap = self;
522        let mut bmap = bmap;
523        bmap.do_not_free_on_drop();
524        let bmap = bmap.ptr;
525        let mut bset = bset;
526        bset.do_not_free_on_drop();
527        let bset = bset.ptr;
528        let isl_rs_result = unsafe { isl_basic_map_intersect_domain(bmap, bset) };
529        let isl_rs_result = BasicMap { ptr: isl_rs_result,
530                                       should_free_on_drop: true };
531        isl_rs_result
532    }
533
534    /// Wraps `isl_basic_map_intersect_range`.
535    pub fn intersect_range(self, bset: BasicSet) -> BasicMap {
536        let bmap = self;
537        let mut bmap = bmap;
538        bmap.do_not_free_on_drop();
539        let bmap = bmap.ptr;
540        let mut bset = bset;
541        bset.do_not_free_on_drop();
542        let bset = bset.ptr;
543        let isl_rs_result = unsafe { isl_basic_map_intersect_range(bmap, bset) };
544        let isl_rs_result = BasicMap { ptr: isl_rs_result,
545                                       should_free_on_drop: true };
546        isl_rs_result
547    }
548
549    /// Wraps `isl_basic_map_intersect`.
550    pub fn intersect(self, bmap2: BasicMap) -> BasicMap {
551        let bmap1 = self;
552        let mut bmap1 = bmap1;
553        bmap1.do_not_free_on_drop();
554        let bmap1 = bmap1.ptr;
555        let mut bmap2 = bmap2;
556        bmap2.do_not_free_on_drop();
557        let bmap2 = bmap2.ptr;
558        let isl_rs_result = unsafe { isl_basic_map_intersect(bmap1, bmap2) };
559        let isl_rs_result = BasicMap { ptr: isl_rs_result,
560                                       should_free_on_drop: true };
561        isl_rs_result
562    }
563
564    /// Wraps `isl_basic_map_union`.
565    pub fn union(self, bmap2: BasicMap) -> Map {
566        let bmap1 = self;
567        let mut bmap1 = bmap1;
568        bmap1.do_not_free_on_drop();
569        let bmap1 = bmap1.ptr;
570        let mut bmap2 = bmap2;
571        bmap2.do_not_free_on_drop();
572        let bmap2 = bmap2.ptr;
573        let isl_rs_result = unsafe { isl_basic_map_union(bmap1, bmap2) };
574        let isl_rs_result = Map { ptr: isl_rs_result,
575                                  should_free_on_drop: true };
576        isl_rs_result
577    }
578
579    /// Wraps `isl_basic_map_apply_domain`.
580    pub fn apply_domain(self, bmap2: BasicMap) -> BasicMap {
581        let bmap1 = self;
582        let mut bmap1 = bmap1;
583        bmap1.do_not_free_on_drop();
584        let bmap1 = bmap1.ptr;
585        let mut bmap2 = bmap2;
586        bmap2.do_not_free_on_drop();
587        let bmap2 = bmap2.ptr;
588        let isl_rs_result = unsafe { isl_basic_map_apply_domain(bmap1, bmap2) };
589        let isl_rs_result = BasicMap { ptr: isl_rs_result,
590                                       should_free_on_drop: true };
591        isl_rs_result
592    }
593
594    /// Wraps `isl_basic_map_apply_range`.
595    pub fn apply_range(self, bmap2: BasicMap) -> BasicMap {
596        let bmap1 = self;
597        let mut bmap1 = bmap1;
598        bmap1.do_not_free_on_drop();
599        let bmap1 = bmap1.ptr;
600        let mut bmap2 = bmap2;
601        bmap2.do_not_free_on_drop();
602        let bmap2 = bmap2.ptr;
603        let isl_rs_result = unsafe { isl_basic_map_apply_range(bmap1, bmap2) };
604        let isl_rs_result = BasicMap { ptr: isl_rs_result,
605                                       should_free_on_drop: true };
606        isl_rs_result
607    }
608
609    /// Wraps `isl_basic_map_affine_hull`.
610    pub fn affine_hull(self) -> BasicMap {
611        let bmap = self;
612        let mut bmap = bmap;
613        bmap.do_not_free_on_drop();
614        let bmap = bmap.ptr;
615        let isl_rs_result = unsafe { isl_basic_map_affine_hull(bmap) };
616        let isl_rs_result = BasicMap { ptr: isl_rs_result,
617                                       should_free_on_drop: true };
618        isl_rs_result
619    }
620
621    /// Wraps `isl_basic_map_reverse`.
622    pub fn reverse(self) -> BasicMap {
623        let bmap = self;
624        let mut bmap = bmap;
625        bmap.do_not_free_on_drop();
626        let bmap = bmap.ptr;
627        let isl_rs_result = unsafe { isl_basic_map_reverse(bmap) };
628        let isl_rs_result = BasicMap { ptr: isl_rs_result,
629                                       should_free_on_drop: true };
630        isl_rs_result
631    }
632
633    /// Wraps `isl_basic_map_domain`.
634    pub fn domain(self) -> BasicSet {
635        let bmap = self;
636        let mut bmap = bmap;
637        bmap.do_not_free_on_drop();
638        let bmap = bmap.ptr;
639        let isl_rs_result = unsafe { isl_basic_map_domain(bmap) };
640        let isl_rs_result = BasicSet { ptr: isl_rs_result,
641                                       should_free_on_drop: true };
642        isl_rs_result
643    }
644
645    /// Wraps `isl_basic_map_range`.
646    pub fn range(self) -> BasicSet {
647        let bmap = self;
648        let mut bmap = bmap;
649        bmap.do_not_free_on_drop();
650        let bmap = bmap.ptr;
651        let isl_rs_result = unsafe { isl_basic_map_range(bmap) };
652        let isl_rs_result = BasicSet { ptr: isl_rs_result,
653                                       should_free_on_drop: true };
654        isl_rs_result
655    }
656
657    /// Wraps `isl_basic_map_domain_map`.
658    pub fn domain_map(self) -> BasicMap {
659        let bmap = self;
660        let mut bmap = bmap;
661        bmap.do_not_free_on_drop();
662        let bmap = bmap.ptr;
663        let isl_rs_result = unsafe { isl_basic_map_domain_map(bmap) };
664        let isl_rs_result = BasicMap { ptr: isl_rs_result,
665                                       should_free_on_drop: true };
666        isl_rs_result
667    }
668
669    /// Wraps `isl_basic_map_range_map`.
670    pub fn range_map(self) -> BasicMap {
671        let bmap = self;
672        let mut bmap = bmap;
673        bmap.do_not_free_on_drop();
674        let bmap = bmap.ptr;
675        let isl_rs_result = unsafe { isl_basic_map_range_map(bmap) };
676        let isl_rs_result = BasicMap { ptr: isl_rs_result,
677                                       should_free_on_drop: true };
678        isl_rs_result
679    }
680
681    /// Wraps `isl_basic_map_remove_dims`.
682    pub fn remove_dims(self, type_: DimType, first: u32, n: u32) -> BasicMap {
683        let bmap = self;
684        let mut bmap = bmap;
685        bmap.do_not_free_on_drop();
686        let bmap = bmap.ptr;
687        let isl_rs_result = unsafe { isl_basic_map_remove_dims(bmap, type_, first, n) };
688        let isl_rs_result = BasicMap { ptr: isl_rs_result,
689                                       should_free_on_drop: true };
690        isl_rs_result
691    }
692
693    /// Wraps `isl_basic_map_eliminate`.
694    pub fn eliminate(self, type_: DimType, first: u32, n: u32) -> BasicMap {
695        let bmap = self;
696        let mut bmap = bmap;
697        bmap.do_not_free_on_drop();
698        let bmap = bmap.ptr;
699        let isl_rs_result = unsafe { isl_basic_map_eliminate(bmap, type_, first, n) };
700        let isl_rs_result = BasicMap { ptr: isl_rs_result,
701                                       should_free_on_drop: true };
702        isl_rs_result
703    }
704
705    /// Wraps `isl_basic_map_sample`.
706    pub fn sample(self) -> BasicMap {
707        let bmap = self;
708        let mut bmap = bmap;
709        bmap.do_not_free_on_drop();
710        let bmap = bmap.ptr;
711        let isl_rs_result = unsafe { isl_basic_map_sample(bmap) };
712        let isl_rs_result = BasicMap { ptr: isl_rs_result,
713                                       should_free_on_drop: true };
714        isl_rs_result
715    }
716
717    /// Wraps `isl_basic_map_detect_equalities`.
718    pub fn detect_equalities(self) -> BasicMap {
719        let bmap = self;
720        let mut bmap = bmap;
721        bmap.do_not_free_on_drop();
722        let bmap = bmap.ptr;
723        let isl_rs_result = unsafe { isl_basic_map_detect_equalities(bmap) };
724        let isl_rs_result = BasicMap { ptr: isl_rs_result,
725                                       should_free_on_drop: true };
726        isl_rs_result
727    }
728
729    /// Wraps `isl_basic_map_read_from_str`.
730    pub fn read_from_str(ctx: &Context, str_: &str) -> BasicMap {
731        let ctx = ctx.ptr;
732        let str_ = CString::new(str_).unwrap();
733        let str_ = str_.as_ptr();
734        let isl_rs_result = unsafe { isl_basic_map_read_from_str(ctx, str_) };
735        let isl_rs_result = BasicMap { ptr: isl_rs_result,
736                                       should_free_on_drop: true };
737        isl_rs_result
738    }
739
740    /// Wraps `isl_basic_map_dump`.
741    pub fn dump(&self) {
742        let bmap = self;
743        let bmap = bmap.ptr;
744        let isl_rs_result = unsafe { isl_basic_map_dump(bmap) };
745        isl_rs_result
746    }
747
748    /// Wraps `isl_basic_map_to_str`.
749    pub fn to_str(&self) -> &str {
750        let bmap = self;
751        let bmap = bmap.ptr;
752        let isl_rs_result = unsafe { isl_basic_map_to_str(bmap) };
753        let isl_rs_result = unsafe { CStr::from_ptr(isl_rs_result) };
754        let isl_rs_result = isl_rs_result.to_str().unwrap();
755        isl_rs_result
756    }
757
758    /// Wraps `isl_basic_map_fix_si`.
759    pub fn fix_si(self, type_: DimType, pos: u32, value: i32) -> BasicMap {
760        let bmap = self;
761        let mut bmap = bmap;
762        bmap.do_not_free_on_drop();
763        let bmap = bmap.ptr;
764        let isl_rs_result = unsafe { isl_basic_map_fix_si(bmap, type_, pos, value) };
765        let isl_rs_result = BasicMap { ptr: isl_rs_result,
766                                       should_free_on_drop: true };
767        isl_rs_result
768    }
769
770    /// Wraps `isl_basic_map_fix_val`.
771    pub fn fix_val(self, type_: DimType, pos: u32, v: Val) -> BasicMap {
772        let bmap = self;
773        let mut bmap = bmap;
774        bmap.do_not_free_on_drop();
775        let bmap = bmap.ptr;
776        let mut v = v;
777        v.do_not_free_on_drop();
778        let v = v.ptr;
779        let isl_rs_result = unsafe { isl_basic_map_fix_val(bmap, type_, pos, v) };
780        let isl_rs_result = BasicMap { ptr: isl_rs_result,
781                                       should_free_on_drop: true };
782        isl_rs_result
783    }
784
785    /// Wraps `isl_basic_map_lower_bound_si`.
786    pub fn lower_bound_si(self, type_: DimType, pos: u32, value: i32) -> BasicMap {
787        let bmap = self;
788        let mut bmap = bmap;
789        bmap.do_not_free_on_drop();
790        let bmap = bmap.ptr;
791        let isl_rs_result = unsafe { isl_basic_map_lower_bound_si(bmap, type_, pos, value) };
792        let isl_rs_result = BasicMap { ptr: isl_rs_result,
793                                       should_free_on_drop: true };
794        isl_rs_result
795    }
796
797    /// Wraps `isl_basic_map_upper_bound_si`.
798    pub fn upper_bound_si(self, type_: DimType, pos: u32, value: i32) -> BasicMap {
799        let bmap = self;
800        let mut bmap = bmap;
801        bmap.do_not_free_on_drop();
802        let bmap = bmap.ptr;
803        let isl_rs_result = unsafe { isl_basic_map_upper_bound_si(bmap, type_, pos, value) };
804        let isl_rs_result = BasicMap { ptr: isl_rs_result,
805                                       should_free_on_drop: true };
806        isl_rs_result
807    }
808
809    /// Wraps `isl_basic_map_sum`.
810    pub fn sum(self, bmap2: BasicMap) -> BasicMap {
811        let bmap1 = self;
812        let mut bmap1 = bmap1;
813        bmap1.do_not_free_on_drop();
814        let bmap1 = bmap1.ptr;
815        let mut bmap2 = bmap2;
816        bmap2.do_not_free_on_drop();
817        let bmap2 = bmap2.ptr;
818        let isl_rs_result = unsafe { isl_basic_map_sum(bmap1, bmap2) };
819        let isl_rs_result = BasicMap { ptr: isl_rs_result,
820                                       should_free_on_drop: true };
821        isl_rs_result
822    }
823
824    /// Wraps `isl_basic_map_neg`.
825    pub fn neg(self) -> BasicMap {
826        let bmap = self;
827        let mut bmap = bmap;
828        bmap.do_not_free_on_drop();
829        let bmap = bmap.ptr;
830        let isl_rs_result = unsafe { isl_basic_map_neg(bmap) };
831        let isl_rs_result = BasicMap { ptr: isl_rs_result,
832                                       should_free_on_drop: true };
833        isl_rs_result
834    }
835
836    /// Wraps `isl_basic_map_is_equal`.
837    pub fn is_equal(&self, bmap2: &BasicMap) -> bool {
838        let bmap1 = self;
839        let bmap1 = bmap1.ptr;
840        let bmap2 = bmap2.ptr;
841        let isl_rs_result = unsafe { isl_basic_map_is_equal(bmap1, bmap2) };
842        let isl_rs_result = match isl_rs_result {
843            0 => false,
844            1 => true,
845            _ => panic!("Got isl_bool = -1"),
846        };
847        isl_rs_result
848    }
849
850    /// Wraps `isl_basic_map_is_disjoint`.
851    pub fn is_disjoint(&self, bmap2: &BasicMap) -> bool {
852        let bmap1 = self;
853        let bmap1 = bmap1.ptr;
854        let bmap2 = bmap2.ptr;
855        let isl_rs_result = unsafe { isl_basic_map_is_disjoint(bmap1, bmap2) };
856        let isl_rs_result = match isl_rs_result {
857            0 => false,
858            1 => true,
859            _ => panic!("Got isl_bool = -1"),
860        };
861        isl_rs_result
862    }
863
864    /// Wraps `isl_basic_map_lexmin`.
865    pub fn lexmin(self) -> Map {
866        let bmap = self;
867        let mut bmap = bmap;
868        bmap.do_not_free_on_drop();
869        let bmap = bmap.ptr;
870        let isl_rs_result = unsafe { isl_basic_map_lexmin(bmap) };
871        let isl_rs_result = Map { ptr: isl_rs_result,
872                                  should_free_on_drop: true };
873        isl_rs_result
874    }
875
876    /// Wraps `isl_basic_map_lexmax`.
877    pub fn lexmax(self) -> Map {
878        let bmap = self;
879        let mut bmap = bmap;
880        bmap.do_not_free_on_drop();
881        let bmap = bmap.ptr;
882        let isl_rs_result = unsafe { isl_basic_map_lexmax(bmap) };
883        let isl_rs_result = Map { ptr: isl_rs_result,
884                                  should_free_on_drop: true };
885        isl_rs_result
886    }
887
888    /// Wraps `isl_basic_map_plain_get_val_if_fixed`.
889    pub fn plain_get_val_if_fixed(&self, type_: DimType, pos: u32) -> Val {
890        let bmap = self;
891        let bmap = bmap.ptr;
892        let isl_rs_result = unsafe { isl_basic_map_plain_get_val_if_fixed(bmap, type_, pos) };
893        let isl_rs_result = Val { ptr: isl_rs_result,
894                                  should_free_on_drop: true };
895        isl_rs_result
896    }
897
898    /// Wraps `isl_basic_map_image_is_bounded`.
899    pub fn image_is_bounded(&self) -> bool {
900        let bmap = self;
901        let bmap = bmap.ptr;
902        let isl_rs_result = unsafe { isl_basic_map_image_is_bounded(bmap) };
903        let isl_rs_result = match isl_rs_result {
904            0 => false,
905            1 => true,
906            _ => panic!("Got isl_bool = -1"),
907        };
908        isl_rs_result
909    }
910
911    /// Wraps `isl_basic_map_plain_is_universe`.
912    pub fn plain_is_universe(&self) -> bool {
913        let bmap = self;
914        let bmap = bmap.ptr;
915        let isl_rs_result = unsafe { isl_basic_map_plain_is_universe(bmap) };
916        let isl_rs_result = match isl_rs_result {
917            0 => false,
918            1 => true,
919            _ => panic!("Got isl_bool = -1"),
920        };
921        isl_rs_result
922    }
923
924    /// Wraps `isl_basic_map_is_universe`.
925    pub fn is_universe(&self) -> bool {
926        let bmap = self;
927        let bmap = bmap.ptr;
928        let isl_rs_result = unsafe { isl_basic_map_is_universe(bmap) };
929        let isl_rs_result = match isl_rs_result {
930            0 => false,
931            1 => true,
932            _ => panic!("Got isl_bool = -1"),
933        };
934        isl_rs_result
935    }
936
937    /// Wraps `isl_basic_map_plain_is_empty`.
938    pub fn plain_is_empty(&self) -> bool {
939        let bmap = self;
940        let bmap = bmap.ptr;
941        let isl_rs_result = unsafe { isl_basic_map_plain_is_empty(bmap) };
942        let isl_rs_result = match isl_rs_result {
943            0 => false,
944            1 => true,
945            _ => panic!("Got isl_bool = -1"),
946        };
947        isl_rs_result
948    }
949
950    /// Wraps `isl_basic_map_is_empty`.
951    pub fn is_empty(&self) -> bool {
952        let bmap = self;
953        let bmap = bmap.ptr;
954        let isl_rs_result = unsafe { isl_basic_map_is_empty(bmap) };
955        let isl_rs_result = match isl_rs_result {
956            0 => false,
957            1 => true,
958            _ => panic!("Got isl_bool = -1"),
959        };
960        isl_rs_result
961    }
962
963    /// Wraps `isl_basic_map_is_subset`.
964    pub fn is_subset(&self, bmap2: &BasicMap) -> bool {
965        let bmap1 = self;
966        let bmap1 = bmap1.ptr;
967        let bmap2 = bmap2.ptr;
968        let isl_rs_result = unsafe { isl_basic_map_is_subset(bmap1, bmap2) };
969        let isl_rs_result = match isl_rs_result {
970            0 => false,
971            1 => true,
972            _ => panic!("Got isl_bool = -1"),
973        };
974        isl_rs_result
975    }
976
977    /// Wraps `isl_basic_map_is_strict_subset`.
978    pub fn is_strict_subset(&self, bmap2: &BasicMap) -> bool {
979        let bmap1 = self;
980        let bmap1 = bmap1.ptr;
981        let bmap2 = bmap2.ptr;
982        let isl_rs_result = unsafe { isl_basic_map_is_strict_subset(bmap1, bmap2) };
983        let isl_rs_result = match isl_rs_result {
984            0 => false,
985            1 => true,
986            _ => panic!("Got isl_bool = -1"),
987        };
988        isl_rs_result
989    }
990
991    /// Wraps `isl_basic_map_product`.
992    pub fn product(self, bmap2: BasicMap) -> BasicMap {
993        let bmap1 = self;
994        let mut bmap1 = bmap1;
995        bmap1.do_not_free_on_drop();
996        let bmap1 = bmap1.ptr;
997        let mut bmap2 = bmap2;
998        bmap2.do_not_free_on_drop();
999        let bmap2 = bmap2.ptr;
1000        let isl_rs_result = unsafe { isl_basic_map_product(bmap1, bmap2) };
1001        let isl_rs_result = BasicMap { ptr: isl_rs_result,
1002                                       should_free_on_drop: true };
1003        isl_rs_result
1004    }
1005
1006    /// Wraps `isl_basic_map_domain_product`.
1007    pub fn domain_product(self, bmap2: BasicMap) -> BasicMap {
1008        let bmap1 = self;
1009        let mut bmap1 = bmap1;
1010        bmap1.do_not_free_on_drop();
1011        let bmap1 = bmap1.ptr;
1012        let mut bmap2 = bmap2;
1013        bmap2.do_not_free_on_drop();
1014        let bmap2 = bmap2.ptr;
1015        let isl_rs_result = unsafe { isl_basic_map_domain_product(bmap1, bmap2) };
1016        let isl_rs_result = BasicMap { ptr: isl_rs_result,
1017                                       should_free_on_drop: true };
1018        isl_rs_result
1019    }
1020
1021    /// Wraps `isl_basic_map_range_product`.
1022    pub fn range_product(self, bmap2: BasicMap) -> BasicMap {
1023        let bmap1 = self;
1024        let mut bmap1 = bmap1;
1025        bmap1.do_not_free_on_drop();
1026        let bmap1 = bmap1.ptr;
1027        let mut bmap2 = bmap2;
1028        bmap2.do_not_free_on_drop();
1029        let bmap2 = bmap2.ptr;
1030        let isl_rs_result = unsafe { isl_basic_map_range_product(bmap1, bmap2) };
1031        let isl_rs_result = BasicMap { ptr: isl_rs_result,
1032                                       should_free_on_drop: true };
1033        isl_rs_result
1034    }
1035
1036    /// Wraps `isl_basic_map_flat_product`.
1037    pub fn flat_product(self, bmap2: BasicMap) -> BasicMap {
1038        let bmap1 = self;
1039        let mut bmap1 = bmap1;
1040        bmap1.do_not_free_on_drop();
1041        let bmap1 = bmap1.ptr;
1042        let mut bmap2 = bmap2;
1043        bmap2.do_not_free_on_drop();
1044        let bmap2 = bmap2.ptr;
1045        let isl_rs_result = unsafe { isl_basic_map_flat_product(bmap1, bmap2) };
1046        let isl_rs_result = BasicMap { ptr: isl_rs_result,
1047                                       should_free_on_drop: true };
1048        isl_rs_result
1049    }
1050
1051    /// Wraps `isl_basic_map_flat_range_product`.
1052    pub fn flat_range_product(self, bmap2: BasicMap) -> BasicMap {
1053        let bmap1 = self;
1054        let mut bmap1 = bmap1;
1055        bmap1.do_not_free_on_drop();
1056        let bmap1 = bmap1.ptr;
1057        let mut bmap2 = bmap2;
1058        bmap2.do_not_free_on_drop();
1059        let bmap2 = bmap2.ptr;
1060        let isl_rs_result = unsafe { isl_basic_map_flat_range_product(bmap1, bmap2) };
1061        let isl_rs_result = BasicMap { ptr: isl_rs_result,
1062                                       should_free_on_drop: true };
1063        isl_rs_result
1064    }
1065
1066    /// Wraps `isl_basic_map_deltas`.
1067    pub fn deltas(self) -> BasicSet {
1068        let bmap = self;
1069        let mut bmap = bmap;
1070        bmap.do_not_free_on_drop();
1071        let bmap = bmap.ptr;
1072        let isl_rs_result = unsafe { isl_basic_map_deltas(bmap) };
1073        let isl_rs_result = BasicSet { ptr: isl_rs_result,
1074                                       should_free_on_drop: true };
1075        isl_rs_result
1076    }
1077
1078    /// Wraps `isl_basic_map_deltas_map`.
1079    pub fn deltas_map(self) -> BasicMap {
1080        let bmap = self;
1081        let mut bmap = bmap;
1082        bmap.do_not_free_on_drop();
1083        let bmap = bmap.ptr;
1084        let isl_rs_result = unsafe { isl_basic_map_deltas_map(bmap) };
1085        let isl_rs_result = BasicMap { ptr: isl_rs_result,
1086                                       should_free_on_drop: true };
1087        isl_rs_result
1088    }
1089
1090    /// Wraps `isl_basic_map_add_dims`.
1091    pub fn add_dims(self, type_: DimType, n: u32) -> BasicMap {
1092        let bmap = self;
1093        let mut bmap = bmap;
1094        bmap.do_not_free_on_drop();
1095        let bmap = bmap.ptr;
1096        let isl_rs_result = unsafe { isl_basic_map_add_dims(bmap, type_, n) };
1097        let isl_rs_result = BasicMap { ptr: isl_rs_result,
1098                                       should_free_on_drop: true };
1099        isl_rs_result
1100    }
1101
1102    /// Wraps `isl_basic_map_insert_dims`.
1103    pub fn insert_dims(self, type_: DimType, pos: u32, n: u32) -> BasicMap {
1104        let bmap = self;
1105        let mut bmap = bmap;
1106        bmap.do_not_free_on_drop();
1107        let bmap = bmap.ptr;
1108        let isl_rs_result = unsafe { isl_basic_map_insert_dims(bmap, type_, pos, n) };
1109        let isl_rs_result = BasicMap { ptr: isl_rs_result,
1110                                       should_free_on_drop: true };
1111        isl_rs_result
1112    }
1113
1114    /// Wraps `isl_basic_map_move_dims`.
1115    pub fn move_dims(self, dst_type: DimType, dst_pos: u32, src_type: DimType, src_pos: u32,
1116                     n: u32)
1117                     -> BasicMap {
1118        let bmap = self;
1119        let mut bmap = bmap;
1120        bmap.do_not_free_on_drop();
1121        let bmap = bmap.ptr;
1122        let isl_rs_result =
1123            unsafe { isl_basic_map_move_dims(bmap, dst_type, dst_pos, src_type, src_pos, n) };
1124        let isl_rs_result = BasicMap { ptr: isl_rs_result,
1125                                       should_free_on_drop: true };
1126        isl_rs_result
1127    }
1128
1129    /// Wraps `isl_basic_map_project_out`.
1130    pub fn project_out(self, type_: DimType, first: u32, n: u32) -> BasicMap {
1131        let bmap = self;
1132        let mut bmap = bmap;
1133        bmap.do_not_free_on_drop();
1134        let bmap = bmap.ptr;
1135        let isl_rs_result = unsafe { isl_basic_map_project_out(bmap, type_, first, n) };
1136        let isl_rs_result = BasicMap { ptr: isl_rs_result,
1137                                       should_free_on_drop: true };
1138        isl_rs_result
1139    }
1140
1141    /// Wraps `isl_basic_map_remove_divs`.
1142    pub fn remove_divs(self) -> BasicMap {
1143        let bmap = self;
1144        let mut bmap = bmap;
1145        bmap.do_not_free_on_drop();
1146        let bmap = bmap.ptr;
1147        let isl_rs_result = unsafe { isl_basic_map_remove_divs(bmap) };
1148        let isl_rs_result = BasicMap { ptr: isl_rs_result,
1149                                       should_free_on_drop: true };
1150        isl_rs_result
1151    }
1152
1153    /// Wraps `isl_basic_map_remove_divs_involving_dims`.
1154    pub fn remove_divs_involving_dims(self, type_: DimType, first: u32, n: u32) -> BasicMap {
1155        let bmap = self;
1156        let mut bmap = bmap;
1157        bmap.do_not_free_on_drop();
1158        let bmap = bmap.ptr;
1159        let isl_rs_result =
1160            unsafe { isl_basic_map_remove_divs_involving_dims(bmap, type_, first, n) };
1161        let isl_rs_result = BasicMap { ptr: isl_rs_result,
1162                                       should_free_on_drop: true };
1163        isl_rs_result
1164    }
1165
1166    /// Wraps `isl_basic_map_equate`.
1167    pub fn equate(self, type1: DimType, pos1: i32, type2: DimType, pos2: i32) -> BasicMap {
1168        let bmap = self;
1169        let mut bmap = bmap;
1170        bmap.do_not_free_on_drop();
1171        let bmap = bmap.ptr;
1172        let isl_rs_result = unsafe { isl_basic_map_equate(bmap, type1, pos1, type2, pos2) };
1173        let isl_rs_result = BasicMap { ptr: isl_rs_result,
1174                                       should_free_on_drop: true };
1175        isl_rs_result
1176    }
1177
1178    /// Wraps `isl_basic_map_order_ge`.
1179    pub fn order_ge(self, type1: DimType, pos1: i32, type2: DimType, pos2: i32) -> BasicMap {
1180        let bmap = self;
1181        let mut bmap = bmap;
1182        bmap.do_not_free_on_drop();
1183        let bmap = bmap.ptr;
1184        let isl_rs_result = unsafe { isl_basic_map_order_ge(bmap, type1, pos1, type2, pos2) };
1185        let isl_rs_result = BasicMap { ptr: isl_rs_result,
1186                                       should_free_on_drop: true };
1187        isl_rs_result
1188    }
1189
1190    /// Wraps `isl_basic_map_order_gt`.
1191    pub fn order_gt(self, type1: DimType, pos1: i32, type2: DimType, pos2: i32) -> BasicMap {
1192        let bmap = self;
1193        let mut bmap = bmap;
1194        bmap.do_not_free_on_drop();
1195        let bmap = bmap.ptr;
1196        let isl_rs_result = unsafe { isl_basic_map_order_gt(bmap, type1, pos1, type2, pos2) };
1197        let isl_rs_result = BasicMap { ptr: isl_rs_result,
1198                                       should_free_on_drop: true };
1199        isl_rs_result
1200    }
1201
1202    /// Wraps `isl_basic_map_wrap`.
1203    pub fn wrap(self) -> BasicSet {
1204        let bmap = self;
1205        let mut bmap = bmap;
1206        bmap.do_not_free_on_drop();
1207        let bmap = bmap.ptr;
1208        let isl_rs_result = unsafe { isl_basic_map_wrap(bmap) };
1209        let isl_rs_result = BasicSet { ptr: isl_rs_result,
1210                                       should_free_on_drop: true };
1211        isl_rs_result
1212    }
1213
1214    /// Wraps `isl_basic_map_flatten`.
1215    pub fn flatten(self) -> BasicMap {
1216        let bmap = self;
1217        let mut bmap = bmap;
1218        bmap.do_not_free_on_drop();
1219        let bmap = bmap.ptr;
1220        let isl_rs_result = unsafe { isl_basic_map_flatten(bmap) };
1221        let isl_rs_result = BasicMap { ptr: isl_rs_result,
1222                                       should_free_on_drop: true };
1223        isl_rs_result
1224    }
1225
1226    /// Wraps `isl_basic_map_flatten_domain`.
1227    pub fn flatten_domain(self) -> BasicMap {
1228        let bmap = self;
1229        let mut bmap = bmap;
1230        bmap.do_not_free_on_drop();
1231        let bmap = bmap.ptr;
1232        let isl_rs_result = unsafe { isl_basic_map_flatten_domain(bmap) };
1233        let isl_rs_result = BasicMap { ptr: isl_rs_result,
1234                                       should_free_on_drop: true };
1235        isl_rs_result
1236    }
1237
1238    /// Wraps `isl_basic_map_flatten_range`.
1239    pub fn flatten_range(self) -> BasicMap {
1240        let bmap = self;
1241        let mut bmap = bmap;
1242        bmap.do_not_free_on_drop();
1243        let bmap = bmap.ptr;
1244        let isl_rs_result = unsafe { isl_basic_map_flatten_range(bmap) };
1245        let isl_rs_result = BasicMap { ptr: isl_rs_result,
1246                                       should_free_on_drop: true };
1247        isl_rs_result
1248    }
1249
1250    /// Wraps `isl_basic_map_from_domain`.
1251    pub fn from_domain(bset: BasicSet) -> BasicMap {
1252        let mut bset = bset;
1253        bset.do_not_free_on_drop();
1254        let bset = bset.ptr;
1255        let isl_rs_result = unsafe { isl_basic_map_from_domain(bset) };
1256        let isl_rs_result = BasicMap { ptr: isl_rs_result,
1257                                       should_free_on_drop: true };
1258        isl_rs_result
1259    }
1260
1261    /// Wraps `isl_basic_map_from_range`.
1262    pub fn from_range(bset: BasicSet) -> BasicMap {
1263        let mut bset = bset;
1264        bset.do_not_free_on_drop();
1265        let bset = bset.ptr;
1266        let isl_rs_result = unsafe { isl_basic_map_from_range(bset) };
1267        let isl_rs_result = BasicMap { ptr: isl_rs_result,
1268                                       should_free_on_drop: true };
1269        isl_rs_result
1270    }
1271
1272    /// Wraps `isl_basic_map_from_domain_and_range`.
1273    pub fn from_domain_and_range(domain: BasicSet, range: BasicSet) -> BasicMap {
1274        let mut domain = domain;
1275        domain.do_not_free_on_drop();
1276        let domain = domain.ptr;
1277        let mut range = range;
1278        range.do_not_free_on_drop();
1279        let range = range.ptr;
1280        let isl_rs_result = unsafe { isl_basic_map_from_domain_and_range(domain, range) };
1281        let isl_rs_result = BasicMap { ptr: isl_rs_result,
1282                                       should_free_on_drop: true };
1283        isl_rs_result
1284    }
1285
1286    /// Wraps `isl_basic_map_is_single_valued`.
1287    pub fn is_single_valued(&self) -> bool {
1288        let bmap = self;
1289        let bmap = bmap.ptr;
1290        let isl_rs_result = unsafe { isl_basic_map_is_single_valued(bmap) };
1291        let isl_rs_result = match isl_rs_result {
1292            0 => false,
1293            1 => true,
1294            _ => panic!("Got isl_bool = -1"),
1295        };
1296        isl_rs_result
1297    }
1298
1299    /// Wraps `isl_basic_map_can_zip`.
1300    pub fn can_zip(&self) -> bool {
1301        let bmap = self;
1302        let bmap = bmap.ptr;
1303        let isl_rs_result = unsafe { isl_basic_map_can_zip(bmap) };
1304        let isl_rs_result = match isl_rs_result {
1305            0 => false,
1306            1 => true,
1307            _ => panic!("Got isl_bool = -1"),
1308        };
1309        isl_rs_result
1310    }
1311
1312    /// Wraps `isl_basic_map_zip`.
1313    pub fn zip(self) -> BasicMap {
1314        let bmap = self;
1315        let mut bmap = bmap;
1316        bmap.do_not_free_on_drop();
1317        let bmap = bmap.ptr;
1318        let isl_rs_result = unsafe { isl_basic_map_zip(bmap) };
1319        let isl_rs_result = BasicMap { ptr: isl_rs_result,
1320                                       should_free_on_drop: true };
1321        isl_rs_result
1322    }
1323
1324    /// Wraps `isl_basic_map_can_curry`.
1325    pub fn can_curry(&self) -> bool {
1326        let bmap = self;
1327        let bmap = bmap.ptr;
1328        let isl_rs_result = unsafe { isl_basic_map_can_curry(bmap) };
1329        let isl_rs_result = match isl_rs_result {
1330            0 => false,
1331            1 => true,
1332            _ => panic!("Got isl_bool = -1"),
1333        };
1334        isl_rs_result
1335    }
1336
1337    /// Wraps `isl_basic_map_curry`.
1338    pub fn curry(self) -> BasicMap {
1339        let bmap = self;
1340        let mut bmap = bmap;
1341        bmap.do_not_free_on_drop();
1342        let bmap = bmap.ptr;
1343        let isl_rs_result = unsafe { isl_basic_map_curry(bmap) };
1344        let isl_rs_result = BasicMap { ptr: isl_rs_result,
1345                                       should_free_on_drop: true };
1346        isl_rs_result
1347    }
1348
1349    /// Wraps `isl_basic_map_can_uncurry`.
1350    pub fn can_uncurry(&self) -> bool {
1351        let bmap = self;
1352        let bmap = bmap.ptr;
1353        let isl_rs_result = unsafe { isl_basic_map_can_uncurry(bmap) };
1354        let isl_rs_result = match isl_rs_result {
1355            0 => false,
1356            1 => true,
1357            _ => panic!("Got isl_bool = -1"),
1358        };
1359        isl_rs_result
1360    }
1361
1362    /// Wraps `isl_basic_map_uncurry`.
1363    pub fn uncurry(self) -> BasicMap {
1364        let bmap = self;
1365        let mut bmap = bmap;
1366        bmap.do_not_free_on_drop();
1367        let bmap = bmap.ptr;
1368        let isl_rs_result = unsafe { isl_basic_map_uncurry(bmap) };
1369        let isl_rs_result = BasicMap { ptr: isl_rs_result,
1370                                       should_free_on_drop: true };
1371        isl_rs_result
1372    }
1373
1374    /// Wraps `isl_basic_map_compute_divs`.
1375    pub fn compute_divs(self) -> Map {
1376        let bmap = self;
1377        let mut bmap = bmap;
1378        bmap.do_not_free_on_drop();
1379        let bmap = bmap.ptr;
1380        let isl_rs_result = unsafe { isl_basic_map_compute_divs(bmap) };
1381        let isl_rs_result = Map { ptr: isl_rs_result,
1382                                  should_free_on_drop: true };
1383        isl_rs_result
1384    }
1385
1386    /// Wraps `isl_basic_map_drop_constraints_involving_dims`.
1387    pub fn drop_constraints_involving_dims(self, type_: DimType, first: u32, n: u32) -> BasicMap {
1388        let bmap = self;
1389        let mut bmap = bmap;
1390        bmap.do_not_free_on_drop();
1391        let bmap = bmap.ptr;
1392        let isl_rs_result =
1393            unsafe { isl_basic_map_drop_constraints_involving_dims(bmap, type_, first, n) };
1394        let isl_rs_result = BasicMap { ptr: isl_rs_result,
1395                                       should_free_on_drop: true };
1396        isl_rs_result
1397    }
1398
1399    /// Wraps `isl_basic_map_drop_constraints_not_involving_dims`.
1400    pub fn drop_constraints_not_involving_dims(self, type_: DimType, first: u32, n: u32)
1401                                               -> BasicMap {
1402        let bmap = self;
1403        let mut bmap = bmap;
1404        bmap.do_not_free_on_drop();
1405        let bmap = bmap.ptr;
1406        let isl_rs_result =
1407            unsafe { isl_basic_map_drop_constraints_not_involving_dims(bmap, type_, first, n) };
1408        let isl_rs_result = BasicMap { ptr: isl_rs_result,
1409                                       should_free_on_drop: true };
1410        isl_rs_result
1411    }
1412
1413    /// Wraps `isl_basic_map_involves_dims`.
1414    pub fn involves_dims(&self, type_: DimType, first: u32, n: u32) -> bool {
1415        let bmap = self;
1416        let bmap = bmap.ptr;
1417        let isl_rs_result = unsafe { isl_basic_map_involves_dims(bmap, type_, first, n) };
1418        let isl_rs_result = match isl_rs_result {
1419            0 => false,
1420            1 => true,
1421            _ => panic!("Got isl_bool = -1"),
1422        };
1423        isl_rs_result
1424    }
1425
1426    /// Wraps `isl_basic_map_gist_domain`.
1427    pub fn gist_domain(self, context: BasicSet) -> BasicMap {
1428        let bmap = self;
1429        let mut bmap = bmap;
1430        bmap.do_not_free_on_drop();
1431        let bmap = bmap.ptr;
1432        let mut context = context;
1433        context.do_not_free_on_drop();
1434        let context = context.ptr;
1435        let isl_rs_result = unsafe { isl_basic_map_gist_domain(bmap, context) };
1436        let isl_rs_result = BasicMap { ptr: isl_rs_result,
1437                                       should_free_on_drop: true };
1438        isl_rs_result
1439    }
1440
1441    /// Wraps `isl_basic_map_gist`.
1442    pub fn gist(self, context: BasicMap) -> BasicMap {
1443        let bmap = self;
1444        let mut bmap = bmap;
1445        bmap.do_not_free_on_drop();
1446        let bmap = bmap.ptr;
1447        let mut context = context;
1448        context.do_not_free_on_drop();
1449        let context = context.ptr;
1450        let isl_rs_result = unsafe { isl_basic_map_gist(bmap, context) };
1451        let isl_rs_result = BasicMap { ptr: isl_rs_result,
1452                                       should_free_on_drop: true };
1453        isl_rs_result
1454    }
1455
1456    /// Wraps `isl_basic_map_align_params`.
1457    pub fn align_params(self, model: Space) -> BasicMap {
1458        let bmap = self;
1459        let mut bmap = bmap;
1460        bmap.do_not_free_on_drop();
1461        let bmap = bmap.ptr;
1462        let mut model = model;
1463        model.do_not_free_on_drop();
1464        let model = model.ptr;
1465        let isl_rs_result = unsafe { isl_basic_map_align_params(bmap, model) };
1466        let isl_rs_result = BasicMap { ptr: isl_rs_result,
1467                                       should_free_on_drop: true };
1468        isl_rs_result
1469    }
1470
1471    /// Wraps `isl_basic_map_drop_unused_params`.
1472    pub fn drop_unused_params(self) -> BasicMap {
1473        let bmap = self;
1474        let mut bmap = bmap;
1475        bmap.do_not_free_on_drop();
1476        let bmap = bmap.ptr;
1477        let isl_rs_result = unsafe { isl_basic_map_drop_unused_params(bmap) };
1478        let isl_rs_result = BasicMap { ptr: isl_rs_result,
1479                                       should_free_on_drop: true };
1480        isl_rs_result
1481    }
1482
1483    /// Wraps `isl_basic_map_equalities_matrix`.
1484    pub fn equalities_matrix(&self, c1: DimType, c2: DimType, c3: DimType, c4: DimType,
1485                             c5: DimType)
1486                             -> Mat {
1487        let bmap = self;
1488        let bmap = bmap.ptr;
1489        let isl_rs_result = unsafe { isl_basic_map_equalities_matrix(bmap, c1, c2, c3, c4, c5) };
1490        let isl_rs_result = Mat { ptr: isl_rs_result,
1491                                  should_free_on_drop: true };
1492        isl_rs_result
1493    }
1494
1495    /// Wraps `isl_basic_map_inequalities_matrix`.
1496    pub fn inequalities_matrix(&self, c1: DimType, c2: DimType, c3: DimType, c4: DimType,
1497                               c5: DimType)
1498                               -> Mat {
1499        let bmap = self;
1500        let bmap = bmap.ptr;
1501        let isl_rs_result = unsafe { isl_basic_map_inequalities_matrix(bmap, c1, c2, c3, c4, c5) };
1502        let isl_rs_result = Mat { ptr: isl_rs_result,
1503                                  should_free_on_drop: true };
1504        isl_rs_result
1505    }
1506
1507    /// Wraps `isl_basic_map_from_constraint_matrices`.
1508    pub fn from_constraint_matrices(space: Space, eq: Mat, ineq: Mat, c1: DimType, c2: DimType,
1509                                    c3: DimType, c4: DimType, c5: DimType)
1510                                    -> BasicMap {
1511        let mut space = space;
1512        space.do_not_free_on_drop();
1513        let space = space.ptr;
1514        let mut eq = eq;
1515        eq.do_not_free_on_drop();
1516        let eq = eq.ptr;
1517        let mut ineq = ineq;
1518        ineq.do_not_free_on_drop();
1519        let ineq = ineq.ptr;
1520        let isl_rs_result =
1521            unsafe { isl_basic_map_from_constraint_matrices(space, eq, ineq, c1, c2, c3, c4, c5) };
1522        let isl_rs_result = BasicMap { ptr: isl_rs_result,
1523                                       should_free_on_drop: true };
1524        isl_rs_result
1525    }
1526
1527    /// Wraps `isl_basic_map_from_aff`.
1528    pub fn from_aff(aff: Aff) -> BasicMap {
1529        let mut aff = aff;
1530        aff.do_not_free_on_drop();
1531        let aff = aff.ptr;
1532        let isl_rs_result = unsafe { isl_basic_map_from_aff(aff) };
1533        let isl_rs_result = BasicMap { ptr: isl_rs_result,
1534                                       should_free_on_drop: true };
1535        isl_rs_result
1536    }
1537
1538    /// Does not call isl_xxx_free() on being dropped. (For internal use only.)
1539    pub fn do_not_free_on_drop(&mut self) {
1540        self.should_free_on_drop = false;
1541    }
1542}
1543
1544impl Drop for BasicMap {
1545    fn drop(&mut self) {
1546        if self.should_free_on_drop {
1547            unsafe {
1548                isl_basic_map_free(self.ptr);
1549            }
1550        }
1551    }
1552}