X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=blobdiff_plain;f=include%2Fbabeltrace2%2Fvalue.h;h=1375940990bc8380cce0b5105c8c5686813dcdd1;hp=c248174521e1c8a11d65e2fd560622d8b25a0aae;hb=d24d56638469189904fb6ddbb3c725817b3e9417;hpb=15caa1ca4fac30bd196602bd136e48fda3892de2 diff --git a/include/babeltrace2/value.h b/include/babeltrace2/value.h index c2481745..13759409 100644 --- a/include/babeltrace2/value.h +++ b/include/babeltrace2/value.h @@ -29,9 +29,14 @@ /* For bt_bool, bt_value */ #include -/* For bt_value_status, bt_value_type */ +/* For bt_value_type */ #include +/* For __BT_FUNC_STATUS_* */ +#define __BT_FUNC_STATUS_ENABLE +#include +#undef __BT_FUNC_STATUS_ENABLE + #ifdef __cplusplus extern "C" { #endif @@ -66,41 +71,56 @@ extern bt_value *bt_value_string_create(void); extern bt_value *bt_value_string_create_init(const char *val); -extern bt_value_status bt_value_string_set(bt_value *string_obj, +typedef enum bt_value_string_set_status { + BT_VALUE_STRING_SET_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR, + BT_VALUE_STRING_SET_STATUS_OK = __BT_FUNC_STATUS_OK, +} bt_value_string_set_status; + +extern bt_value_string_set_status bt_value_string_set(bt_value *string_obj, const char *val); extern bt_value *bt_value_array_create(void); -extern bt_value *bt_value_array_borrow_element_by_index( - bt_value *array_obj, uint64_t index); +extern bt_value *bt_value_array_borrow_element_by_index(bt_value *array_obj, + uint64_t index); -extern bt_value_status bt_value_array_append_element( - bt_value *array_obj, - bt_value *element_obj); +typedef enum bt_value_array_append_element_status { + BT_VALUE_ARRAY_APPEND_ELEMENT_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR, + BT_VALUE_ARRAY_APPEND_ELEMENT_STATUS_OK = __BT_FUNC_STATUS_OK, +} bt_value_array_append_element_status; -extern bt_value_status bt_value_array_append_bool_element( - bt_value *array_obj, bt_bool val); +extern bt_value_array_append_element_status bt_value_array_append_element( + bt_value *array_obj, bt_value *element_obj); -extern bt_value_status bt_value_array_append_unsigned_integer_element( - bt_value *array_obj, uint64_t val); +extern bt_value_array_append_element_status +bt_value_array_append_bool_element(bt_value *array_obj, bt_bool val); -extern bt_value_status bt_value_array_append_signed_integer_element( - bt_value *array_obj, int64_t val); +extern bt_value_array_append_element_status +bt_value_array_append_unsigned_integer_element(bt_value *array_obj, + uint64_t val); -extern bt_value_status bt_value_array_append_real_element( - bt_value *array_obj, double val); +extern bt_value_array_append_element_status +bt_value_array_append_signed_integer_element(bt_value *array_obj, int64_t val); -extern bt_value_status bt_value_array_append_string_element( - bt_value *array_obj, const char *val); +extern bt_value_array_append_element_status +bt_value_array_append_real_element(bt_value *array_obj, double val); -extern bt_value_status bt_value_array_append_empty_array_element( - bt_value *array_obj); +extern bt_value_array_append_element_status +bt_value_array_append_string_element(bt_value *array_obj, const char *val); -extern bt_value_status bt_value_array_append_empty_map_element( - bt_value *array_obj); +extern bt_value_array_append_element_status +bt_value_array_append_empty_array_element(bt_value *array_obj); -extern bt_value_status bt_value_array_set_element_by_index( - bt_value *array_obj, uint64_t index, +extern bt_value_array_append_element_status +bt_value_array_append_empty_map_element(bt_value *array_obj); + +typedef enum bt_value_array_set_element_by_index_status { + BT_VALUE_ARRAY_SET_ELEMENT_BY_INDEX_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR, + BT_VALUE_ARRAY_SET_ELEMENT_BY_INDEX_STATUS_OK = __BT_FUNC_STATUS_OK, +} bt_value_array_set_element_by_index_status; + +extern bt_value_array_set_element_by_index_status +bt_value_array_set_element_by_index(bt_value *array_obj, uint64_t index, bt_value *element_obj); extern bt_value *bt_value_map_create(void); @@ -111,38 +131,52 @@ extern bt_value *bt_value_map_borrow_entry_value( typedef bt_bool (* bt_value_map_foreach_entry_func)(const char *key, bt_value *object, void *data); -extern bt_value_status bt_value_map_foreach_entry( - bt_value *map_obj, - bt_value_map_foreach_entry_func func, void *data); +typedef enum bt_value_map_foreach_entry_status { + BT_VALUE_MAP_FOREACH_ENTRY_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR, + BT_VALUE_MAP_FOREACH_ENTRY_STATUS_OK = __BT_FUNC_STATUS_OK, + BT_VALUE_MAP_FOREACH_ENTRY_STATUS_CANCELED = __BT_FUNC_STATUS_CANCELED, +} bt_value_map_foreach_entry_status; -extern bt_value_status bt_value_map_insert_entry( - bt_value *map_obj, const char *key, - bt_value *element_obj); +extern bt_value_map_foreach_entry_status bt_value_map_foreach_entry( + bt_value *map_obj, bt_value_map_foreach_entry_func func, + void *data); -extern bt_value_status bt_value_map_insert_bool_entry( +typedef enum bt_value_map_insert_entry_status { + BT_VALUE_MAP_INSERT_ENTRY_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR, + BT_VALUE_MAP_INSERT_ENTRY_STATUS_OK = __BT_FUNC_STATUS_OK, +} bt_value_map_insert_entry_status; + +extern bt_value_map_insert_entry_status bt_value_map_insert_entry( + bt_value *map_obj, const char *key, bt_value *element_obj); + +extern bt_value_map_insert_entry_status bt_value_map_insert_bool_entry( bt_value *map_obj, const char *key, bt_bool val); -extern bt_value_status bt_value_map_insert_unsigned_integer_entry( - bt_value *map_obj, const char *key, uint64_t val); +extern bt_value_map_insert_entry_status +bt_value_map_insert_unsigned_integer_entry(bt_value *map_obj, const char *key, + uint64_t val); -extern bt_value_status bt_value_map_insert_signed_integer_entry( - bt_value *map_obj, const char *key, int64_t val); +extern bt_value_map_insert_entry_status +bt_value_map_insert_signed_integer_entry(bt_value *map_obj, const char *key, + int64_t val); -extern bt_value_status bt_value_map_insert_real_entry( +extern bt_value_map_insert_entry_status bt_value_map_insert_real_entry( bt_value *map_obj, const char *key, double val); -extern bt_value_status bt_value_map_insert_string_entry( - bt_value *map_obj, const char *key, +extern bt_value_map_insert_entry_status +bt_value_map_insert_string_entry(bt_value *map_obj, const char *key, const char *val); -extern bt_value_status bt_value_map_insert_empty_array_entry( - bt_value *map_obj, const char *key); +extern bt_value_map_insert_entry_status +bt_value_map_insert_empty_array_entry(bt_value *map_obj, const char *key); -extern bt_value_status bt_value_map_insert_empty_map_entry( - bt_value *map_obj, const char *key); +extern bt_value_map_insert_entry_status +bt_value_map_insert_empty_map_entry(bt_value *map_obj, const char *key); #ifdef __cplusplus } #endif +#include + #endif /* BABELTRACE_VALUES_H */