Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
b675d2b0e0b558e9ffc90f8e287c52cda7d82b8b
[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 /* Authors: Martin Quinson                                                  */
7 /* Copyright (C) 2003,2004 Martin Quinson.                                  */
8
9 /* This program is free software; you can redistribute it and/or modify it
10    under the terms of the license (GNU LGPL) which comes with this package. */
11
12 #ifndef _GRAS_DICT_ELM_T_
13 #define _GRAS_DICT_ELM_T_
14
15 #include "xbt/sysdep.h"
16 #include "xbt/log.h"
17 #include "xbt/error.h"
18 #include "xbt/dynar.h"
19 #include "xbt/dict.h"
20
21 /*####[ Type definition ]####################################################*/
22 typedef struct gras_dictelm_ {
23   char           *key;
24   int             key_len;
25   int             offset; /* offset on the key */
26   void           *content;
27   void_f_pvoid_t *free_ctn; /*pointer to the function to call to free this ctn*/
28
29   gras_dynar_t   *sub; /* sub */
30 } gras_dictelm_t;
31
32 struct gras_dict_ {
33   gras_dictelm_t *head;
34 };
35
36 /*####[ Function prototypes ]################################################*/
37 void gras_dictelm_free      (gras_dictelm_t **pp_elm);
38
39 void gras_dictelm_set       (gras_dictelm_t **pp_head,
40                              const char      *_key,
41                              void            *data,
42                              void_f_pvoid_t  *free_ctn);
43 void gras_dictelm_set_ext   (gras_dictelm_t **pp_head,
44                              const char      *_key,
45                              int              key_len,
46                              void            *data,
47                              void_f_pvoid_t  *free_ctn);
48
49 gras_error_t gras_dictelm_get       (gras_dictelm_t *p_head,
50                                      const char     *key,
51                                      /* OUT */void **data);
52 gras_error_t gras_dictelm_get_ext   (gras_dictelm_t *p_head,
53                                      const char     *key,
54                                      int             key_len,
55                                      /* OUT */void **data);
56
57 gras_error_t gras_dictelm_remove    (gras_dictelm_t *p_head,
58                                      const char  *key);
59 gras_error_t gras_dictelm_remove_ext(gras_dictelm_t *p_head,
60                                        const char  *key,
61                                        int          key_len);
62
63 void         gras_dictelm_dump      (gras_dictelm_t *p_head,
64                                      void_f_pvoid_t *output);
65
66 void         gras_dictelm_print_fct (void *data);
67
68 #endif  /* _GRAS_DICT_ELM_T_ */
69