-/* This type should be added to a type that is to be used in such a swag */
-/* Whenever a new object with this struct is created, all fields have to be swag to NULL */
-
-typedef struct xbt_swag_hookup {
- void *next;
- void *prev;
-} s_xbt_swag_hookup_t, *xbt_swag_hookup_t;
-
-typedef struct xbt_swag {
- void *head;
- void *tail;
- size_t offset;
- int count;
-} s_xbt_swag_t, *xbt_swag_t;
-
-xbt_swag_t xbt_swag_new(size_t offset);
-void xbt_swag_init(xbt_swag_t swag, size_t offset);
-void xbt_swag_insert(void *obj,xbt_swag_t swag);
-void *xbt_swag_extract(void *obj, xbt_swag_t swag);
-int xbt_swag_size(xbt_swag_t swag);
-int xbt_swag_belongs(void *obj,xbt_swag_t swag);
-
-static __inline__ void *xbt_swag_getFirst(xbt_swag_t swag)
+#ifndef _XBT_SWAG_H
+#define _XBT_SWAG_H
+
+#include "xbt/misc.h"
+#include "xbt/sysdep.h" /* size_t */
+
+SG_BEGIN_DECL()
+
+/**
+ * @addtogroup XBT_swag
+ * @brief a O(1) set based on linked lists
+ *
+ * Warning, this module is done to be efficient and performs tons of
+ * cast and dirty things. So make sure you know what you are doing while using it.
+ * It is basically a fifo but with restrictions so that
+ * it can be used as a set. Any operation (add, remove, belongs) is O(1) and
+ * no call to malloc/free is done.
+ *
+ */
+/** @defgroup XBT_swag_type Swag types
+ @ingroup XBT_swag
+
+ Specific set.
+
+
+ These typedefs are public so that the compiler can
+ do his job but believe me, you don't want to try to play with
+ those structs directly. Use them as an abstract datatype.
+*/
+/* @{ */
+ typedef struct xbt_swag_hookup {
+ void *next;
+ void *prev;
+ } s_xbt_swag_hookup_t;
+/**< This type should be added to a type that is to be used in a swag.
+ *
+ * Whenever a new object with this struct is created, all fields have
+ * to be set to NULL
+ *
+ * Here is an example like that :
+
+\code
+typedef struct foo {
+ s_xbt_swag_hookup_t set1_hookup;
+ s_xbt_swag_hookup_t set2_hookup;
+
+ double value;
+} s_foo_t, *foo_t;
+...