X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/2539fff313cbd67c45b8490f7961e45e358d9ba2..3e19adce0ed360638d224b4316d5f8e5833b13f9:/src/xbt/set.c diff --git a/src/xbt/set.c b/src/xbt/set.c index 2d912e5441..1323a3fdba 100644 --- a/src/xbt/set.c +++ b/src/xbt/set.c @@ -2,11 +2,10 @@ /* set - data container consisting in dict+dynar */ -/* Authors: Martin Quinson */ -/* Copyright (C) 2004 the GRAS posse. */ +/* Copyright (c) 2004 Martin Quinson. 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. */ #include "xbt/misc.h" #include "xbt/sysdep.h" @@ -17,7 +16,8 @@ #include "xbt/set.h" -XBT_LOG_NEW_DEFAULT_SUBCATEGORY(set,xbt,"data container consisting in dict+dynar"); +XBT_LOG_NEW_DEFAULT_SUBCATEGORY(set,xbt, + "set: data container consisting in dict+dynar"); /*####[ Type definition ]####################################################*/ typedef struct xbt_set_ { @@ -26,15 +26,9 @@ typedef struct xbt_set_ { } s_xbt_set_t; /*####[ Memory ]############################################################*/ -/** - * xbt_set_new: - * @dst: where to - * - * Creates a new set. - */ +/** @brief Constructor */ xbt_set_t xbt_set_new (void) { xbt_set_t res=xbt_new(s_xbt_set_t,1); - xbt_error_t errcode; res->dict=xbt_dict_new (); res->dynar=xbt_dynar_new(sizeof(void*),NULL); @@ -42,12 +36,7 @@ xbt_set_t xbt_set_new (void) { return res; } -/** - * xbt_set_free: - * @set: - * - * Frees a set. - */ +/** @brief Destructor */ void xbt_set_free(xbt_set_t *set) { if (*set) { xbt_dict_free ( &( (*set)->dict ) ); @@ -57,16 +46,14 @@ void xbt_set_free(xbt_set_t *set) { } } -/** - * xbt_set_add: - * @set: set to populate - * @elm: element to add. - * @free_ctn: How to add the data +/** @brief Add an element to a set. * - * Add an element to a set. + * \param set set to populate + * \param elm element to add. + * \param free_func How to add the data * * elm->name must be set; - * elm->name_len is used as is unless it's <= 0 (in which case it's recomputed); + * if elm->name_len <= 0, it is recomputed. If >0, it's used as is; * elm->ID is attributed automatically. */ void xbt_set_add (xbt_set_t set, @@ -106,13 +93,11 @@ void xbt_set_add (xbt_set_t set, } -/** - * xbt_set_get_by_name: - * @set: - * @name: Name of the searched cell - * @dst: where to put the found data into - * - * get a data stored in the cell by providing its name. +/** @brief Retrive data by providing its name. + * + * \param set + * \param name Name of the searched cell + * \param dst where to put the found data into */ xbt_error_t xbt_set_get_by_name (xbt_set_t set, const char *name, @@ -122,16 +107,16 @@ xbt_error_t xbt_set_get_by_name (xbt_set_t set, DEBUG2("Lookup key %s: %s",name,xbt_error_name(errcode)); return errcode; } -/** - * xbt_set_get_by_name_ext: - * @set: - * @name: Name of the searched cell - * @name_len: length of the name, when strlen cannot be trusted - * @dst: where to put the found data into + +/** @brief Retrive data by providing its name and the length of the name * - * get a data stored in the cell by providing its name (and the length - * of the name, when strlen cannot be trusted because you don't use a char* - * as name, you weird guy). + * \param set + * \param name Name of the searched cell + * \param name_len length of the name, when strlen cannot be trusted + * \param dst where to put the found data into + * + * This is useful when strlen cannot be trusted because you don't use a char* + * as name, you weirdo. */ xbt_error_t xbt_set_get_by_name_ext(xbt_set_t set, const char *name, @@ -141,13 +126,12 @@ xbt_error_t xbt_set_get_by_name_ext(xbt_set_t set, return xbt_dict_get_ext (set->dict, name, name_len, (void**)dst); } -/** - * xbt_set_get_by_code: - * @set: - * @id: what you're looking for - * @dst: where to put the found data into +/** @brief Retrive data by providing its ID + * + * \param set + * \param id what you're looking for + * \param dst where to put the found data into * - * get a data stored in the cell by providing its id. * @warning, if the ID does not exists, you're getting into trouble */ xbt_error_t xbt_set_get_by_id (xbt_set_t set, @@ -171,13 +155,7 @@ typedef struct xbt_set_cursor_ { int val; } s_xbt_set_cursor_t; -/** - * xbt_set_cursor_first: - * @set: on what to let the cursor iterate - * @cursor: dest address - * - * Create the cursor if it does not exists. Rewind it in any case. - */ +/** @brief Create the cursor if it does not exists, rewind it in any case. */ void xbt_set_cursor_first (xbt_set_t set, xbt_set_cursor_t *cursor) { @@ -195,22 +173,14 @@ void xbt_set_cursor_first (xbt_set_t set, } } -/** - * xbt_set_cursor_step: - * @cursor: the cursor - * - * Move to the next element. - */ +/** @brief Move to the next element. */ void xbt_set_cursor_step (xbt_set_cursor_t cursor) { xbt_dynar_cursor_step(cursor->set->dynar, &( cursor->val ) ); } -/** - * xbt_set_cursor_get_or_free: - * @cursor: the cursor - * @Returns: true if it's ok, false if there is no more data - * - * Get current data +/** @brief Get current data + * + * \return true if it's ok, false if there is no more data */ int xbt_set_cursor_get_or_free (xbt_set_cursor_t *curs, xbt_set_elm_t *elm) {