Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Convenient to optimize the SURF.
[simgrid.git] / include / xbt / swag.h
index 1cfe70d..21d40fd 100644 (file)
@@ -1,18 +1,22 @@
-/* Authors: Arnaud Legrand                                                  */
+/*     $Id$     */
+
+/* Copyright (c) 2004 Arnaud Legrand. All rights reserved.                */
 
 /* This program is free software; you can redistribute it and/or modify it
  under the terms of the license (GNU LGPL) which comes with this package. */
* under the terms of the license (GNU LGPL) which comes with this package. */
 
 /* Warning, this module is done to be efficient and performs tons of
    cast and dirty things. So avoid using it unless you really know
    what you are doing. */
 
-/* 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 set to NULL */
+#ifndef _XBT_SWAG_H
+#define _XBT_SWAG_H
 
 #include "xbt/sysdep.h"
 
+/* 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 set to NULL */
 typedef struct xbt_swag_hookup {
   void *next;
   void *prev;
@@ -26,8 +30,11 @@ typedef struct xbt_swag {
 } s_xbt_swag_t, *xbt_swag_t;
 
 xbt_swag_t xbt_swag_new(size_t offset);
+void xbt_swag_free(xbt_swag_t swag);
 void xbt_swag_init(xbt_swag_t swag, size_t offset);
 void xbt_swag_insert(void *obj, xbt_swag_t swag);
+void xbt_swag_insert_at_head(void *obj, xbt_swag_t swag);
+void xbt_swag_insert_at_tail(void *obj, xbt_swag_t swag);
 void *xbt_swag_remove(void *obj, xbt_swag_t swag);
 void *xbt_swag_extract(xbt_swag_t swag);
 int xbt_swag_size(xbt_swag_t swag);
@@ -56,3 +63,5 @@ static __inline__ void *xbt_swag_getFirst(xbt_swag_t swag)
        (obj)=obj_next,                                            \
        ((obj)?(obj_next=xbt_swag_getNext((obj),(swag)->offset)):  \
                  (obj_next=NULL))     )
+
+#endif    /* _XBT_SWAG_H */