X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/d13e000f56cfa4abba1c733cdc695a422b8ea39e..2a34c60af48746935a7495f736dcaa2e3e9c45a4:/src/xbt/dict.c diff --git a/src/xbt/dict.c b/src/xbt/dict.c index 96a2d5e5c0..2f4e3a8ab5 100644 --- a/src/xbt/dict.c +++ b/src/xbt/dict.c @@ -2,11 +2,10 @@ /* dict - a generic dictionnary, variation over the B-tree concept */ -/* Authors: Martin Quinson */ -/* Copyright (C) 2003 the OURAGAN project. */ +/* Copyright (c) 2003,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 "dict_private.h" @@ -15,18 +14,16 @@ #include + XBT_LOG_NEW_DEFAULT_SUBCATEGORY(dict,xbt, "Dictionaries provide the same functionnalities than hash tables"); - /*####[ Private prototypes ]#################################################*/ - /*####[ Code ]###############################################################*/ /** - * xbt_dict_new: - * - * @whereto: pointer to the destination + * @brief Constructor + * @return pointer to the destination * * Creates and initialize a new dictionnary */ @@ -37,8 +34,8 @@ xbt_dict_new(void) { return res; } /** - * xbt_dict_free: - * @dict: the dictionnary to be freed + * @brief Destructor + * @param dict the dictionnary to be freed * * Frees a cache structure with all its childs. */ @@ -55,14 +52,16 @@ xbt_dict_free(xbt_dict_t *dict) { } /** - * xbt_dict_set_ext: - * - * @dict: the container - * @key: the key to set the new data - * @data: the data to add in the dict - * - * set the @data in the structure under the @key, which can be any kind - * of data, as long as its length is provided in @key_len. + * \brief Add data to the dict (arbitrary key) + * \param dict the container + * \param key the key to set the new data + * \param key_len the size of the \a key + * \param data the data to add in the dict + * \param free_ctn function to call with (\a key as argument) when + * \a key is removed from the dictionnary + * + * set the \a data in the structure under the \a key, which can be any kind + * of data, as long as its length is provided in \a key_len. */ void xbt_dict_set_ext(xbt_dict_t dict, @@ -78,13 +77,15 @@ xbt_dict_set_ext(xbt_dict_t dict, } /** - * xbt_dict_set: + * \brief Add data to the dict (null-terminated key) * - * @head: the head of the dict - * @key: the key to set the new data - * @data: the data to add in the dict + * \param dict the head of the dict + * \param key the key to set the new data + * \param data the data to add in the dict + * \param free_ctn function to call with (\a key as argument) when + * \a key is removed from the dictionnary * - * set the @data in the structure under the @key, which is a + * set the \a data in the structure under the \a key, which is a * null terminated string. */ void @@ -99,14 +100,15 @@ xbt_dict_set(xbt_dict_t dict, } /** - * xbt_dict_get_ext: + * \brief Retrieve data from the dict (arbitrary key) * - * @dict: the dealer of data - * @key: the key to find data - * @data: the data that we are looking for - * @Returns: xbt_error + * \param dict the dealer of data + * \param key the key to find data + * \param key_len the size of the \a key + * \param data the data that we are looking for + * \return xbt_error * - * Search the given @key. mismatch_error when not found. + * Search the given \a key. mismatch_error when not found. */ xbt_error_t xbt_dict_get_ext(xbt_dict_t dict, @@ -120,14 +122,14 @@ xbt_dict_get_ext(xbt_dict_t dict, } /** - * xbt_dict_get: + * \brief Retrieve data from the dict (null-terminated key) * - * @dict: the dealer of data - * @key: the key to find data - * @data: the data that we are looking for - * @Returns: xbt_error + * \param dict the dealer of data + * \param key the key to find data + * \param data the data that we are looking for + * \return xbt_error * - * Search the given @key. mismatch_error when not found. + * Search the given \a key. mismatch_error when not found. */ xbt_error_t xbt_dict_get(xbt_dict_t dict, @@ -140,13 +142,14 @@ xbt_dict_get(xbt_dict_t dict, /** - * xbt_dict_remove_ext: + * \brief Remove data from the dict (arbitrary key) * - * @dict: the trash can - * @key: the key of the data to be removed - * @Returns: xbt_error_t + * \param dict the trash can + * \param key the key of the data to be removed + * \param key_len the size of the \a key + * \return xbt_error_t * - * Remove the entry associated with the given @key + * Remove the entry associated with the given \a key */ xbt_error_t xbt_dict_remove_ext(xbt_dict_t dict, @@ -158,13 +161,12 @@ xbt_dict_remove_ext(xbt_dict_t dict, } /** - * xbt_dict_remove: + * \brief Remove data from the dict (null-terminated key) * - * @head: the head of the dict - * @key: the key of the data to be removed - * @Returns: xbt_error_t + * \param dict the head of the dict + * \param key the key of the data to be removed * - * Remove the entry associated with the given @key + * Remove the entry associated with the given \a key */ xbt_error_t xbt_dict_remove(xbt_dict_t dict, @@ -177,14 +179,13 @@ xbt_dict_remove(xbt_dict_t dict, /** - * xbt_dict_dump: + * \brief Outputs the content of the structure (debuging purpose) * - * @dict: the exibitionist - * @output: a function to dump each data in the tree - * @Returns: xbt_error_t + * \param dict the exibitionist + * \param output a function to dump each data in the tree * - * Ouputs the content of the structure. (for debuging purpose). @ouput is a - * function to output the data. If NULL, data won't be displayed. + * Ouputs the content of the structure. (for debuging purpose). \a ouput is a + * function to output the data. If NULL, data won't be displayed, just the tree structure. */ void @@ -194,4 +195,3 @@ xbt_dict_dump(xbt_dict_t dict, printf("Dict %p:\n", (void*)dict); xbt_dictelm_dump(dict ? dict->head: NULL, output); } -