summaryrefslogtreecommitdiff
path: root/cesar/lib/set.h
diff options
context:
space:
mode:
Diffstat (limited to 'cesar/lib/set.h')
-rw-r--r--cesar/lib/set.h48
1 files changed, 48 insertions, 0 deletions
diff --git a/cesar/lib/set.h b/cesar/lib/set.h
new file mode 100644
index 0000000000..97f5353631
--- /dev/null
+++ b/cesar/lib/set.h
@@ -0,0 +1,48 @@
+#ifndef lib_set_h
+#define lib_set_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2007 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file lib/set.h
+ * \brief Set of ordered data service.
+ * \ingroup lib
+ *
+ * A set is a ordered binary tree structure.
+ *
+ * It defines the following set of operations efficiently:
+ * - insert an element,
+ * - find an element,
+ * - remove an element,
+ * - travel the set in order.
+ */
+
+/* Forward declaration. */
+typedef struct set_node_t set_node_t;
+
+/**
+ * Set node comparison function pointer.
+ * \param left left hand node
+ * \param right right hand node
+ * \return true iff left is lesser than right
+ */
+typedef bool
+(*set_node_less_t) (set_node_t *left, set_node_t *right);
+
+/** Set structure. */
+struct set_t
+{
+ /** Set root node. */
+ set_node_t *root;
+ /** Set "is lesser than" comparison function. */
+ set_node_less_t less;
+};
+typedef struct set_t set_t;
+
+#include "lib/aatree.h"
+
+#endif /* lib_set_h */