Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Preparing surf_parser to be hijacked
[simgrid.git] / include / gras / datadesc.h
index 49f9ac0..3ac22b8 100644 (file)
@@ -11,6 +11,7 @@
 #define GRAS_DATADESC_H
 
 #include "xbt/misc.h" /* BEGIN_DECL */
+#include "xbt/dynar.h" /* void_f_pvoid_t */
 
 BEGIN_DECL()
 
@@ -172,11 +173,11 @@ typedef struct s_gras_cbps *gras_cbps_t;
 
 /* callbacks prototypes */
 /** \brief Prototype of type callbacks returning nothing. */
-typedef void (*gras_datadesc_type_cb_void_t)(gras_cbps_t vars, void *data);
+typedef void (*gras_datadesc_type_cb_void_t)(gras_datadesc_type_t typedesc, gras_cbps_t vars, void *data);
 /** \brief Prototype of type callbacks returning an int. */
-typedef int (*gras_datadesc_type_cb_int_t)(gras_cbps_t vars, void *data);
+typedef int (*gras_datadesc_type_cb_int_t)(gras_datadesc_type_t typedesc, gras_cbps_t vars, void *data);
 /** \brief Prototype of type callbacks selecting a type. */
-typedef gras_datadesc_type_t (*gras_datadesc_selector_t)(gras_cbps_t vars, void *data);
+typedef gras_datadesc_type_t (*gras_datadesc_selector_t)(gras_datadesc_type_t typedesc, gras_cbps_t vars, void *data);
 
 
 /******************************************
@@ -216,6 +217,10 @@ gras_datadesc_type_t
 gras_datadesc_type_t 
   gras_datadesc_ref_pop_arr(gras_datadesc_type_t  element_type);
 
+gras_datadesc_type_t 
+  gras_datadesc_dynar(gras_datadesc_type_t elm_t,
+                     void_f_pvoid_t *free_func);
+
 /*********************************
  * Change stuff within datadescs *
  *********************************/
@@ -246,7 +251,7 @@ void gras_datadesc_cb_field_push (gras_datadesc_type_t   type,
  * Get stuff within datadescs *
  ******************************/
 /** \brief Returns the name of a datadescription */
-char * gras_datadesc_get_name(gras_datadesc_type_t ddt);
+const char * gras_datadesc_get_name(gras_datadesc_type_t ddt);
 /** \brief Returns the identifier of a datadescription */
 int gras_datadesc_get_id(gras_datadesc_type_t ddt);
 
@@ -280,11 +285,11 @@ gras_cbps_i_push(gras_cbps_t ps, int val);
 int 
 gras_cbps_i_pop(gras_cbps_t ps);
 
-int gras_datadesc_cb_pop(gras_cbps_t vars, void *data);
-void gras_datadesc_cb_push_int(gras_cbps_t vars, void *data);
-void gras_datadesc_cb_push_uint(gras_cbps_t vars, void *data);
-void gras_datadesc_cb_push_lint(gras_cbps_t vars, void *data);
-void gras_datadesc_cb_push_ulint(gras_cbps_t vars, void *data);
+int gras_datadesc_cb_pop(gras_datadesc_type_t typedesc, gras_cbps_t vars, void *data);
+void gras_datadesc_cb_push_int(gras_datadesc_type_t typedesc, gras_cbps_t vars, void *data);
+void gras_datadesc_cb_push_uint(gras_datadesc_type_t typedesc, gras_cbps_t vars, void *data);
+void gras_datadesc_cb_push_lint(gras_datadesc_type_t typedesc, gras_cbps_t vars, void *data);
+void gras_datadesc_cb_push_ulint(gras_datadesc_type_t typedesc, gras_cbps_t vars, void *data);
 
 
 /* @} */
@@ -297,31 +302,25 @@ void gras_datadesc_cb_push_ulint(gras_cbps_t vars, void *data);
 
 /* @{ */
 
-xbt_error_t
-  gras_cbps_v_pop (gras_cbps_t            ps, 
-                  const char            *name,
-        /* OUT */ gras_datadesc_type_t  *ddt,
-        /* OUT */ void                 **res);
-xbt_error_t
-gras_cbps_v_push(gras_cbps_t            ps,
-                const char            *name,
-                void                  *data,
-                gras_datadesc_type_t   ddt);
-void
-gras_cbps_v_set (gras_cbps_t            ps,
-                const char            *name,
-                void                  *data,
-                gras_datadesc_type_t   ddt);
-
-void *
-gras_cbps_v_get (gras_cbps_t            ps, 
-                const char            *name,
-       /* OUT */ gras_datadesc_type_t  *ddt);
-
-void
-gras_cbps_block_begin(gras_cbps_t ps);
-void
-gras_cbps_block_end(gras_cbps_t ps);
+void   gras_cbps_v_pop (gras_cbps_t            ps, 
+                       const char            *name,
+             /* OUT */ gras_datadesc_type_t  *ddt,
+             /* OUT */ void                 **res);
+void   gras_cbps_v_push(gras_cbps_t            ps,
+                       const char            *name,
+                       void                  *data,
+                       gras_datadesc_type_t   ddt);
+void   gras_cbps_v_set (gras_cbps_t            ps,
+                       const char            *name,
+                       void                  *data,
+                       gras_datadesc_type_t   ddt);
+
+void * gras_cbps_v_get (gras_cbps_t            ps, 
+                       const char            *name,
+             /* OUT */ gras_datadesc_type_t  *ddt);
+
+void gras_cbps_block_begin(gras_cbps_t ps);
+void gras_cbps_block_end(gras_cbps_t ps);
 
 /* @} */
 /* @} */
@@ -346,15 +345,15 @@ typedef enum
   DataTypes;
 #define SIMPLE_TYPE_COUNT 9
 
-/*!  \brief Describe a collection of data.
+/**  \brief Describe a collection of data.
  * 
-** A description of a collection of #type# data.  #repetitions# is used only
-** for arrays; it contains the number of elements.  #offset# is used only for
+** A description of a collection of \a type data.  \a repetitions is used only
+** for arrays; it contains the number of elements.  \a offset is used only for
 ** struct members in host format; it contains the offset of the member from the
 ** beginning of the struct, taking into account internal padding added by the
-** compiler for alignment purposes.  #members#, #length#, and #tailPadding# are
-** used only for STRUCT_TYPE data; the #length#-long array #members# describes
-** the members of the nested struct, and #tailPadding# indicates how many
+** compiler for alignment purposes.  \a members, \a length, and \a tailPadding are
+** used only for STRUCT_TYPE data; the \a length -long array \a members describes
+** the members of the nested struct, and \a tailPadding indicates how many
 ** padding bytes the compiler adds to the end of the structure.
 */
 
@@ -377,11 +376,10 @@ typedef struct DataDescriptorStruct {
   sizeof(structType) - offsetof(structType, lastMember) - \
   sizeof(memberType) * repetitions
 
-xbt_error_t
+gras_datadesc_type_t
 gras_datadesc_import_nws(const char           *name,
                         const DataDescriptor *desc,
-                        unsigned long         howmany,
-              /* OUT */ gras_datadesc_type_t *dst);
+                        unsigned long         howmany);
 
 
 END_DECL()