X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/215ed67257173f5e26c9489ec96c4ced08d1614a..7fd8e320a3dd37fce7d9f03970e14d7e4d95ff00:/include/xbt/dynar.h diff --git a/include/xbt/dynar.h b/include/xbt/dynar.h index 2cc56aa135..4eea121cb7 100644 --- a/include/xbt/dynar.h +++ b/include/xbt/dynar.h @@ -17,11 +17,6 @@ SG_BEGIN_DECL() /** @addtogroup XBT_dynar * @brief DynArr are dynamically sized vector which may contain any type of variables. * - *
Top [\ref index]::[\ref XBT_API] - *
Prev [\ref XBT_config] - *
Next [\ref XBT_dict] - *
Down [\ref XBT_dynar_cons]
- * * These are the SimGrid version of the dynamically size arrays, which all C programmer recode one day or another. * * For performance concerns, the content of DynArr must be homogeneous (in @@ -30,7 +25,7 @@ SG_BEGIN_DECL() * structure creation (of type void_f_ppvoid_t or void_f_pvoid_t). * * \section XBT_dynar_exscal Example with scalar - * \dontinclude dynar_int.c + * \dontinclude dynar.c * * \skip Vars_decl * \skip dyn @@ -43,17 +38,16 @@ SG_BEGIN_DECL() * \until xbt_dynar_free * * \section XBT_dynar_exptr Example with pointed data - * \dontinclude dynar_string.c * - * \skip doxygen_first_cruft - * \skip f - * \until xbt_init + * \skip doxygen_string_cruft + * \skip function + * \until s2 * \skip Populate_str * \skip dyn * \until } * \skip macro * \until dynar_free - * \skip xbt_exit + * \skip end_of_doxygen * \until } * */ @@ -61,10 +55,6 @@ SG_BEGIN_DECL() /** @defgroup XBT_dynar_cons Dynar constructor and destructor * @ingroup XBT_dynar * - *
Top [\ref index]::[\ref XBT_API]::[\ref XBT_dynar] - *
Prev - *
Next [\ref XBT_dynar_array]
- * * @{ */ /** \brief Dynar data type (opaque type) */ @@ -85,10 +75,6 @@ SG_BEGIN_DECL() /** @defgroup XBT_dynar_array Dynar as a regular array * @ingroup XBT_dynar * - *
Top [\ref index]::[\ref XBT_API]::[\ref XBT_dynar] - *
Prev [\ref XBT_dynar_cons] - *
Next [\ref XBT_dynar_perl]
- * * @{ */ @@ -104,10 +90,6 @@ SG_BEGIN_DECL() /** @defgroup XBT_dynar_perl Perl-like use of dynars * @ingroup XBT_dynar * - *
Top [\ref index]::[\ref XBT_API]::[\ref XBT_dynar] - *
Prev [\ref XBT_dynar_array] - *
Next [\ref XBT_dynar_ctn]
- * * @{ */ @@ -121,10 +103,6 @@ SG_BEGIN_DECL() /** @defgroup XBT_dynar_ctn Direct manipulation to the dynars content * @ingroup XBT_dynar * - *
Top [\ref index]::[\ref XBT_API]::[\ref XBT_dynar] - *
Prev [\ref XBT_dynar_perl] - *
Next [\ref XBT_dynar_speed]
- * * Those functions do not retrive the content, but only their address. * * @{ @@ -139,10 +117,6 @@ SG_BEGIN_DECL() /** @defgroup XBT_dynar_speed Speed optimized access to dynars of scalars * @ingroup XBT_dynar * - *
Top [\ref index]::[\ref XBT_API]::[\ref XBT_dynar] - *
Prev [\ref XBT_dynar_ctn] - *
Next [\ref XBT_dynar_cursor]
- * * While the other functions use a memcpy to retrive the content into the * user provided area, those ones use a regular affectation. It only works * for scalar values, but should be a little faster. @@ -153,7 +127,15 @@ SG_BEGIN_DECL() /** @brief Quick retrieval of scalar content * @hideinitializer */ # define xbt_dynar_get_as(dynar,idx,type) \ - *(type*)xbt_dynar_get_ptr(dynar,idx) + (*(type*)xbt_dynar_get_ptr((dynar),(idx))) + /** @brief Quick retrieval of scalar content + * @hideinitializer */ +# define xbt_dynar_getlast_as(dynar,type) \ + (*(type*)xbt_dynar_get_ptr((dynar),xbt_dynar_length(dynar)-1)) + /** @brief Quick retrieval of scalar content + * @hideinitializer */ +# define xbt_dynar_getfirst_as(dynar,type) \ + (*(type*)xbt_dynar_get_ptr((dynar),0)) /** @brief Quick insertion of scalar content * @hideinitializer */ # define xbt_dynar_insert_at_as(dynar,idx,type,value) \ @@ -165,16 +147,12 @@ SG_BEGIN_DECL() /** @brief Quick insertion of scalar content * @hideinitializer */ # define xbt_dynar_pop_as(dynar,type) \ - *(type*)xbt_dynar_pop_ptr(dynar) + (*(type*)xbt_dynar_pop_ptr(dynar)) /** @} */ /** @defgroup XBT_dynar_cursor Cursors on dynar * @ingroup XBT_dynar * - *
Top [\ref index]::[\ref XBT_API]::[\ref XBT_dynar] - *
Prev [\ref XBT_dynar_speed] - *
Next
- * * Cursors are used to iterate over the structure. Never add elements to the * DynArr during the traversal. To remove elements, use the * xbt_dynar_cursor_rm() function