*
* * the element itself is represented aby the xbt_dictelm_t;
*
- * * the element can store any number of associated facets/data structures
- * (corresponding to the different layers of SimGrid or its extensions)
- * in ((void**)dictelt->content)[level];
+ * * the element can store any number of associated facets/data structures (corresponding to the different layers of
+ * SimGrid or its extensions) in ((void**)dictelt->content)[level];
*
* * each level is allocated in the lib with `xbt_lib_add_level`.
*
* xbt_lib_set(foo_lib, id, AUTH_FOO_LEVEL, auth);
* </pre>
*/
-typedef struct s_xbt_lib {
+struct s_xbt_lib {
xbt_dict_t dict;
int levels;
void_f_pvoid_t *free_f; /* This is actually a table */
-} s_xbt_lib_t, *xbt_lib_t;
+};
+typedef struct s_xbt_lib s_xbt_lib_t;
+typedef struct s_xbt_lib* xbt_lib_t;
#define xbt_lib_cursor_t xbt_dict_cursor_t
XBT_PUBLIC(xbt_lib_t) xbt_lib_new(void);
XBT_PUBLIC(void) xbt_lib_free(xbt_lib_t * lib);
XBT_PUBLIC(int) xbt_lib_add_level(xbt_lib_t lib, void_f_pvoid_t free_f);
-XBT_PUBLIC(void) xbt_lib_set(xbt_lib_t lib, const char *name, int level,
- void *obj);
+XBT_PUBLIC(void) xbt_lib_set(xbt_lib_t lib, const char *name, int level, void *obj);
XBT_PUBLIC(void) xbt_lib_unset(xbt_lib_t lib, const char *key, int level, int invoke_callback);
-XBT_PUBLIC(void *) xbt_lib_get_or_null(xbt_lib_t lib, const char *name,
- int level);
+XBT_PUBLIC(void *) xbt_lib_get_or_null(xbt_lib_t lib, const char *name, int level);
XBT_PUBLIC(xbt_dictelm_t) xbt_lib_get_elm_or_null(xbt_lib_t lib, const char *key);
XBT_PUBLIC(void *) xbt_lib_get_level(xbt_dictelm_t elm, int level);
XBT_PUBLIC(void) xbt_lib_remove(xbt_lib_t lib, const char *key);
xbt_dict_foreach((lib)->dict, cursor, key, data)
SG_END_DECL()
+
+#ifdef __cplusplus
+namespace simgrid {
+namespace xbt {
+ inline void destroy(xbt_lib_t l)
+ {
+ xbt_lib_free(&l);
+ }
+}
+}
+#endif
+
#endif /* _XBT_LIB_H */