Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Enable timestamping of messages emitted out of any user process (such as the terminai...
[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/ex.h"
17 #include "xbt/dynar.h"
18 #include "xbt/dict.h"
19
20 /*####[ Type definition ]####################################################*/
21 typedef struct xbt_dictelm_ {
22   char           *key;
23   int             key_len;
24   int             offset; /* offset on the key */
25   int             internal; /* true if it's only an internal node */
26   void           *content;
27   void_f_pvoid_t *free_f; /*pointer to the function to call to free this ctn*/
28
29   xbt_dynar_t    sub; /* sub */
30 } s_xbt_dictelm_t, *xbt_dictelm_t;
31
32 typedef struct xbt_dict_ {
33   s_xbt_dictelm_t *head;
34 } s_xbt_dict_t;
35
36 typedef struct xbt_dict_cursor_ s_xbt_dict_cursor_t;
37
38 /*####[ Function prototypes ]################################################*/
39 void  xbt_dictelm_free      (s_xbt_dictelm_t **pp_elm);
40
41 void  xbt_dictelm_set       (s_xbt_dictelm_t **pp_head,
42                              const char      *_key,
43                              void            *data,
44                              void_f_pvoid_t  *free_ctn);
45 void  xbt_dictelm_set_ext   (s_xbt_dictelm_t **pp_head,
46                              const char      *_key,
47                              int              key_len,
48                              void            *data,
49                              void_f_pvoid_t  *free_ctn);
50
51 void* xbt_dictelm_get       (s_xbt_dictelm_t *p_head, 
52                              const char     *key);
53 void* xbt_dictelm_get_ext   (s_xbt_dictelm_t *p_head,
54                              const char     *key,
55                              int             key_len);
56
57 void xbt_dictelm_remove    (s_xbt_dictelm_t *p_head,
58                             const char  *key);
59 void xbt_dictelm_remove_ext(s_xbt_dictelm_t *p_head,
60                             const char  *key,
61                             int          key_len);
62
63 void         xbt_dictelm_dump      (s_xbt_dictelm_t *p_head,
64                                      void_f_pvoid_t *output);
65
66 void         xbt_dictelm_print_fct (void *data);
67
68 #endif  /* _XBT_DICT_ELM_T_ */
69