add isl_basic_set_n_constraint
authorSven Verdoolaege <skimo@kotnet.org>
Tue, 28 Feb 2012 11:12:19 +0000 (12:12 +0100)
committerSven Verdoolaege <skimo@kotnet.org>
Sun, 6 May 2012 12:33:05 +0000 (14:33 +0200)
Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
doc/user.pod
include/isl/constraint.h
isl_constraint.c

index 5da92ed..4358d82 100644 (file)
@@ -1422,6 +1422,8 @@ To iterate over the constraints of a basic set or map, use
 
        #include <isl/constraint.h>
 
+       int isl_basic_set_n_constraint(
+               __isl_keep isl_basic_set *bset);
        int isl_basic_set_foreach_constraint(
                __isl_keep isl_basic_set *bset,
                int (*fn)(__isl_take isl_constraint *c, void *user),
index bfd8989..34d53ec 100644 (file)
@@ -32,6 +32,7 @@ struct isl_constraint *isl_constraint_cow(struct isl_constraint *c);
 struct isl_constraint *isl_constraint_copy(struct isl_constraint *c);
 void *isl_constraint_free(__isl_take isl_constraint *c);
 
+int isl_basic_set_n_constraint(__isl_keep isl_basic_set *bset);
 int isl_basic_map_foreach_constraint(__isl_keep isl_basic_map *bmap,
        int (*fn)(__isl_take isl_constraint *c, void *user), void *user);
 int isl_basic_set_foreach_constraint(__isl_keep isl_basic_set *bset,
index 923cf59..68971b3 100644 (file)
@@ -181,6 +181,18 @@ void *isl_constraint_free(struct isl_constraint *c)
        return NULL;
 }
 
+/* Return the number of constraints in "bset", i.e., the
+ * number of times isl_basic_set_foreach_constraint will
+ * call the callback.
+ */
+int isl_basic_set_n_constraint(__isl_keep isl_basic_set *bset)
+{
+       if (!bset)
+               return -1;
+
+       return bset->n_eq + bset->n_ineq;
+}
+
 int isl_basic_map_foreach_constraint(__isl_keep isl_basic_map *bmap,
        int (*fn)(__isl_take isl_constraint *c, void *user), void *user)
 {