Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Rename BEGIN_DECL since we changed the usual definition to a macro with arguments...
[simgrid.git] / include / xbt / fifo.h
index 8971ab5b626618e39addfa0752ab7902be68716c..004db05ddfc8f719d78b880c5bf139edf25d0a75 100644 (file)
@@ -7,25 +7,49 @@
 
 #ifndef _XBT_FIFO_H
 #define _XBT_FIFO_H
+#include "xbt/misc.h" /* SG_BEGIN_DECL */
+
+SG_BEGIN_DECL()
+
+/** \addtogroup XBT_fifo
+ *  @{ */
+
+/** @name 1. Constructor/destructor
+ *  @{
+ */
 
 /** \brief  Bucket structure 
- *  \ingroup XBT_fifo
 */
 typedef struct xbt_fifo_item *xbt_fifo_item_t;
 
 /** \brief  FIFO structure
- *  \ingroup XBT_fifo
 */
 typedef struct xbt_fifo *xbt_fifo_t;
 
-/* API */
 xbt_fifo_t xbt_fifo_new(void);
 void xbt_fifo_free(xbt_fifo_t);
+/** @} */
 
+/** @name 2. Perl-like functions
+ *  @{
+ */
 xbt_fifo_item_t xbt_fifo_push(xbt_fifo_t, void *);
 void *xbt_fifo_pop(xbt_fifo_t);
 xbt_fifo_item_t xbt_fifo_unshift(xbt_fifo_t, void *);
 void *xbt_fifo_shift(xbt_fifo_t);
+int xbt_fifo_size(xbt_fifo_t);
+int xbt_fifo_is_in(xbt_fifo_t, void *);
+/** @} */
+
+/** @name 3. Manipulating items directly
+ *
+ *  @{
+ */
+
+xbt_fifo_item_t xbt_fifo_new_item(void);
+void xbt_fifo_set_item_content(xbt_fifo_item_t, void *);
+void *xbt_fifo_get_item_content(xbt_fifo_item_t);
+void xbt_fifo_free_item(xbt_fifo_item_t);
 
 void xbt_fifo_push_item(xbt_fifo_t, xbt_fifo_item_t);
 xbt_fifo_item_t xbt_fifo_pop_item(xbt_fifo_t);
@@ -35,25 +59,12 @@ xbt_fifo_item_t xbt_fifo_shift_item(xbt_fifo_t);
 void xbt_fifo_remove(xbt_fifo_t, void *);
 void xbt_fifo_remove_item(xbt_fifo_t, xbt_fifo_item_t);
 
-int xbt_fifo_is_in(xbt_fifo_t, void *);
-
-void **xbt_fifo_to_array(xbt_fifo_t);
-xbt_fifo_t xbt_fifo_copy(xbt_fifo_t);
-
-xbt_fifo_item_t xbt_fifo_newitem(void);
-void xbt_fifo_set_item_content(xbt_fifo_item_t, void *);
-void *xbt_fifo_get_item_content(xbt_fifo_item_t);
-void xbt_fifo_freeitem(xbt_fifo_item_t);
-
-int xbt_fifo_size(xbt_fifo_t);
-
-xbt_fifo_item_t xbt_fifo_getFirstItem(xbt_fifo_t l);
-xbt_fifo_item_t xbt_fifo_getNextItem(xbt_fifo_item_t i);
-xbt_fifo_item_t xbt_fifo_getPrevItem(xbt_fifo_item_t i);
+xbt_fifo_item_t xbt_fifo_get_first_item(xbt_fifo_t l);
+xbt_fifo_item_t xbt_fifo_get_next_item(xbt_fifo_item_t i);
+xbt_fifo_item_t xbt_fifo_get_prev_item(xbt_fifo_item_t i);
 
 /** 
  * \brief List iterator
- * \ingroup XBT_fifo
  * asserts and stuff
  * \param f a list (#xbt_fifo_t)
  * \param i a bucket (#xbt_fifo_item_t)
@@ -63,9 +74,33 @@ xbt_fifo_item_t xbt_fifo_getPrevItem(xbt_fifo_item_t i);
  * Iterates over the whole list. 
  */
 #define xbt_fifo_foreach(f,i,n,type)                  \
-   for(i=xbt_fifo_getFirstItem(f);                    \
+   for(i=xbt_fifo_get_first_item(f);                    \
      ((i)?(n=(type)(xbt_fifo_get_item_content(i))):(NULL));             \
-       i=xbt_fifo_getNextItem(i))
+       i=xbt_fifo_get_next_item(i))
+
+/** @} */
+
+/** @name 4. Miscanaleous
+ *
+ *  @{
+ */
+void **xbt_fifo_to_array(xbt_fifo_t);
+xbt_fifo_t xbt_fifo_copy(xbt_fifo_t);
+/** @} */
+
+/** @name 5. Deprecated functions: don't use!
+ *
+ *  @{
+ */
+xbt_fifo_item_t xbt_fifo_newitem(void);
+void xbt_fifo_freeitem(xbt_fifo_item_t);
+
+xbt_fifo_item_t xbt_fifo_getFirstItem(xbt_fifo_t l);
+xbt_fifo_item_t xbt_fifo_getNextItem(xbt_fifo_item_t i);
+xbt_fifo_item_t xbt_fifo_getPrevItem(xbt_fifo_item_t i);
+/** @} */
 
+SG_END_DECL()
 
+/** @} */
 #endif                         /* _XBT_FIFO_H */