Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Some more xbt_error_t eradication; change mismatch_error to not_found_error where...
[simgrid.git] / src / xbt / dict_private.h
1 /* $Id$ */
2
3 /* dict_elm - elements of generic dictionnaries                             */
4 /* This file is not to be loaded from anywhere but dict.c                   */
5
6 /* Copyright (c) 2003, 2004 Martin Quinson. All rights reserved.            */
7
8 /* This program is free software; you can redistribute it and/or modify it
9  * under the terms of the license (GNU LGPL) which comes with this package. */
10
11 #ifndef _XBT_DICT_ELM_T_
12 #define _XBT_DICT_ELM_T_
13
14 #include "xbt/sysdep.h"
15 #include "xbt/log.h"
16 #include "xbt/error.h"
17 #include "xbt/ex.h"
18 #include "xbt/dynar.h"
19 #include "xbt/dict.h"
20
21 /*####[ Type definition ]####################################################*/
22 typedef struct xbt_dictelm_ {
23   char           *key;
24   int             key_len;
25   int             offset; /* offset on the key */
26   int             internal; /* true if it's only an internal node */
27   void           *content;
28   void_f_pvoid_t *free_f; /*pointer to the function to call to free this ctn*/
29
30   xbt_dynar_t    sub; /* sub */
31 } s_xbt_dictelm_t, *xbt_dictelm_t;
32
33 typedef struct xbt_dict_ {
34   s_xbt_dictelm_t *head;
35 } s_xbt_dict_t;
36
37 typedef struct xbt_dict_cursor_ s_xbt_dict_cursor_t;
38
39 /*####[ Function prototypes ]################################################*/
40 void  xbt_dictelm_free      (s_xbt_dictelm_t **pp_elm);
41
42 void  xbt_dictelm_set       (s_xbt_dictelm_t **pp_head,
43                              const char      *_key,
44                              void            *data,
45                              void_f_pvoid_t  *free_ctn);
46 void  xbt_dictelm_set_ext   (s_xbt_dictelm_t **pp_head,
47                              const char      *_key,
48                              int              key_len,
49                              void            *data,
50                              void_f_pvoid_t  *free_ctn);
51
52 void* xbt_dictelm_get       (s_xbt_dictelm_t *p_head, 
53                              const char     *key);
54 void* xbt_dictelm_get_ext   (s_xbt_dictelm_t *p_head,
55                              const char     *key,
56                              int             key_len);
57
58 void xbt_dictelm_remove    (s_xbt_dictelm_t *p_head,
59                             const char  *key);
60 void xbt_dictelm_remove_ext(s_xbt_dictelm_t *p_head,
61                             const char  *key,
62                             int          key_len);
63
64 void         xbt_dictelm_dump      (s_xbt_dictelm_t *p_head,
65                                      void_f_pvoid_t *output);
66
67 void         xbt_dictelm_print_fct (void *data);
68
69 #endif  /* _XBT_DICT_ELM_T_ */
70