1 /* xbt/lib.h - api to a generic library */
3 /* Copyright (c) 2011. The SimGrid Team.
4 * All rights reserved. */
6 /* This program is free software; you can redistribute it and/or modify it
7 * under the terms of the license (GNU LGPL) which comes with this package. */
16 typedef struct s_xbt_lib {
19 void_f_pvoid_t *free_f; /* This is actually a table */
20 } s_xbt_lib_t, *xbt_lib_t;
22 #define xbt_lib_cursor_t xbt_dict_cursor_t
24 XBT_PUBLIC(xbt_lib_t) xbt_lib_new(void);
25 XBT_PUBLIC(void) xbt_lib_free(xbt_lib_t * lib);
26 XBT_PUBLIC(int) xbt_lib_add_level(xbt_lib_t lib, void_f_pvoid_t free_f);
27 XBT_PUBLIC(void) xbt_lib_set(xbt_lib_t lib, const char *name, int level,
29 XBT_PUBLIC(void *) xbt_lib_get_or_null(xbt_lib_t lib, const char *name,
32 #define xbt_lib_length(lib) xbt_dict_length((lib)->dict)
34 /** @def xbt_lib_foreach
36 #define xbt_lib_foreach(lib, cursor, key, data) \
37 xbt_dict_foreach((lib)->dict, cursor, key, data)
40 #endif /* _XBT_LIB_H */