2 * Copyright 2011 Sven Verdoolaege
3 * Copyright 2012-2013 Ecole Normale Superieure
5 * Use of this software is governed by the MIT license
7 * Written by Sven Verdoolaege,
8 * Ecole Normale Superieure, 45 rue d'Ulm, 75230 Paris, France
11 #include <isl/space.h>
13 #include <isl_multi_macro.h>
15 const char *FN(MULTI(BASE
),get_tuple_name
)(__isl_keep
MULTI(BASE
) *multi
,
16 enum isl_dim_type type
)
18 return multi
? isl_space_get_tuple_name(multi
->space
, type
) : NULL
;
21 /* Does the specified tuple have an id?
23 isl_bool
FN(MULTI(BASE
),has_tuple_id
)(__isl_keep
MULTI(BASE
) *multi
,
24 enum isl_dim_type type
)
27 return isl_bool_error
;
28 return isl_space_has_tuple_id(multi
->space
, type
);
31 /* Does the (range) tuple of "multi" have an identifier?
33 * Technically, the implementation should use isl_dim_set if "multi"
34 * lives in a set space and isl_dim_out if it lives in a map space.
35 * Internally, however, it can be assumed that isl_dim_set is equal
38 isl_bool
FN(MULTI(BASE
),has_range_tuple_id
)(__isl_keep
MULTI(BASE
) *multi
)
40 return FN(MULTI(BASE
),has_tuple_id
)(multi
, isl_dim_out
);
43 /* Return the id of the specified tuple.
45 __isl_give isl_id
*FN(MULTI(BASE
),get_tuple_id
)(__isl_keep
MULTI(BASE
) *multi
,
46 enum isl_dim_type type
)
48 return multi
? isl_space_get_tuple_id(multi
->space
, type
) : NULL
;
51 /* Return the identifier of the (range) tuple of "multi", assuming it has one.
53 * Technically, the implementation should use isl_dim_set if "multi"
54 * lives in a set space and isl_dim_out if it lives in a map space.
55 * Internally, however, it can be assumed that isl_dim_set is equal
58 __isl_give isl_id
*FN(MULTI(BASE
),get_range_tuple_id
)(
59 __isl_keep
MULTI(BASE
) *multi
)
61 return FN(MULTI(BASE
),get_tuple_id
)(multi
, isl_dim_out
);
64 __isl_give
MULTI(BASE
) *FN(MULTI(BASE
),set_tuple_name
)(
65 __isl_keep
MULTI(BASE
) *multi
, enum isl_dim_type type
,
70 multi
= FN(MULTI(BASE
),cow
)(multi
);
74 space
= FN(MULTI(BASE
),get_space
)(multi
);
75 space
= isl_space_set_tuple_name(space
, type
, s
);
77 return FN(MULTI(BASE
),reset_space
)(multi
, space
);
80 __isl_give
MULTI(BASE
) *FN(MULTI(BASE
),set_tuple_id
)(
81 __isl_take
MULTI(BASE
) *multi
, enum isl_dim_type type
,
82 __isl_take isl_id
*id
)
86 multi
= FN(MULTI(BASE
),cow
)(multi
);
90 space
= FN(MULTI(BASE
),get_space
)(multi
);
91 space
= isl_space_set_tuple_id(space
, type
, id
);
93 return FN(MULTI(BASE
),reset_space
)(multi
, space
);
99 /* Replace the identifier of the (range) tuple of "multi" by "id".
101 * Technically, the implementation should use isl_dim_set if "multi"
102 * lives in a set space and isl_dim_out if it lives in a map space.
103 * Internally, however, it can be assumed that isl_dim_set is equal
106 __isl_give
MULTI(BASE
) *FN(MULTI(BASE
),set_range_tuple_id
)(
107 __isl_take
MULTI(BASE
) *multi
, __isl_take isl_id
*id
)
109 return FN(MULTI(BASE
),set_tuple_id
)(multi
, isl_dim_out
, id
);
112 /* Drop the id on the specified tuple.
114 __isl_give
MULTI(BASE
) *FN(MULTI(BASE
),reset_tuple_id
)(
115 __isl_take
MULTI(BASE
) *multi
, enum isl_dim_type type
)
121 if (!FN(MULTI(BASE
),has_tuple_id
)(multi
, type
))
124 multi
= FN(MULTI(BASE
),cow
)(multi
);
128 space
= FN(MULTI(BASE
),get_space
)(multi
);
129 space
= isl_space_reset_tuple_id(space
, type
);
131 return FN(MULTI(BASE
),reset_space
)(multi
, space
);
134 /* Drop the identifier of the (range) tuple of "multi".
136 * Technically, the implementation should use isl_dim_set if "multi"
137 * lives in a set space and isl_dim_out if it lives in a map space.
138 * Internally, however, it can be assumed that isl_dim_set is equal
141 __isl_give
MULTI(BASE
) *FN(MULTI(BASE
),reset_range_tuple_id
)(
142 __isl_take
MULTI(BASE
) *multi
)
144 return FN(MULTI(BASE
),reset_tuple_id
)(multi
, isl_dim_out
);