1#ifndef BABELTRACE2_VALUE_H
2#define BABELTRACE2_VALUE_H
26#ifndef __BT_IN_BABELTRACE_H
27# error "Please include <babeltrace2/babeltrace.h> instead."
33#include <babeltrace2/types.h>
389 return (type & other_type) == other_type;
1020 const char *raw_value);
1184 uint64_t raw_value);
1443 const bt_value *value, uint64_t index);
1644 uint64_t raw_value);
1713 bt_value *value,
const char *key,
double raw_value);
1748 const char *raw_value);
1870 const bt_value *value,
const char *key);
2089 const bt_value *value,
void *user_data);
2422#define BT_VALUE_PUT_REF_AND_RESET(_value) \
2424 bt_value_put_ref(_value); \
2453#define BT_VALUE_MOVE_REF(_dst, _src) \
2455 bt_value_put_ref(_dst); \
int bt_bool
Babeltrace 2 boolean type.
Definition types.h:140
bt_value_map_insert_entry_status bt_value_map_insert_entry(bt_value *value, const char *key, bt_value *entry_value)
Inserts or replaces an entry with the key key and the value entry_value in the map value value.
uint64_t bt_value_integer_unsigned_get(const bt_value *value)
Returns the raw value of the unsigned integer value value.
bt_value_array_set_element_by_index_status
Status codes for bt_value_array_set_element_by_index().
Definition value.h:1350
bt_value_map_foreach_entry_func_status(* bt_value_map_foreach_entry_func)(const char *key, bt_value *value, void *user_data)
User function for bt_value_map_foreach_entry().
Definition value.h:1933
bt_value * bt_value_string_create_init(const char *raw_value)
Creates and returns a string value initialized to a copy of raw_value.
bt_value * bt_value_real_create(void)
Creates and returns a real value initialized to 0.
bt_value * bt_value_integer_unsigned_create_init(uint64_t raw_value)
Creates and returns an unsigned integer value initialized to raw_value.
bt_value_map_extend_status
Status codes for bt_value_map_extend().
Definition value.h:2209
bt_value * bt_value_integer_signed_create(void)
Creates and returns a signed integer value initialized to 0.
bt_value_array_set_element_by_index_status bt_value_array_set_element_by_index(bt_value *value, uint64_t index, bt_value *element_value)
Sets the element of the array value value at index index to the value element_value.
bt_value_map_insert_entry_status bt_value_map_insert_bool_entry(bt_value *value, const char *key, bt_bool raw_value)
Creates a boolean value initialized to raw_value and inserts or replaces an entry with the key key an...
bt_value_map_foreach_entry_const_status
Status codes for bt_value_map_foreach_entry_const().
Definition value.h:2095
double bt_value_real_get(const bt_value *value)
Returns the raw value of the real value value.
bt_value_array_append_element_status bt_value_array_append_string_element(bt_value *value, const char *raw_value)
Creates a string value initialized to a copy of raw_value and appends it to the array value value.
bt_value_map_insert_entry_status
Status codes for the bt_value_map_insert_*() functions.
Definition value.h:1507
struct bt_value bt_value
Value.
Definition types.h:107
bt_value_map_foreach_entry_func_status
Status codes for bt_value_map_foreach_entry_func.
Definition value.h:1876
bt_value_array_append_element_status bt_value_array_append_unsigned_integer_element(bt_value *value, uint64_t raw_value)
Creates an unsigned integer value initialized to raw_value and appends it to the array value value.
static bt_bool bt_value_is_signed_integer(const bt_value *value)
Returns whether or not the value value is a signed integer value.
Definition value.h:492
void bt_value_get_ref(const bt_value *value)
Increments the reference count of the value value.
void bt_value_put_ref(const bt_value *value)
Decrements the reference count of the value value.
bt_value_array_append_element_status bt_value_array_append_empty_map_element(bt_value *value, bt_value **element_value)
Creates an empty map value and appends it to the array value value.
bt_value_map_insert_entry_status bt_value_map_insert_unsigned_integer_entry(bt_value *value, const char *key, uint64_t raw_value)
Creates an unsigned integer value initialized to raw_value and inserts or replaces an entry with the ...
bt_value * bt_value_map_create(void)
Creates and returns an empty map value.
bt_value_type bt_value_get_type(const bt_value *value)
Returns the type enumerator of the value value.
bt_value_map_foreach_entry_status bt_value_map_foreach_entry(bt_value *value, bt_value_map_foreach_entry_func user_func, void *user_data)
Iterates the entries of the map value value, calling user_func for each entry.
bt_value * bt_value_integer_unsigned_create(void)
Creates and returns an unsigned integer value initialized to 0.
void bt_value_bool_set(bt_value *value, bt_bool raw_value)
Sets the raw value of the boolean value value to raw_value.
const char * bt_value_string_get(const bt_value *value)
Returns the raw value of the string value value.
bt_value * bt_value_string_create(void)
Creates and returns an empty string value.
bt_value_map_foreach_entry_const_func_status(* bt_value_map_foreach_entry_const_func)(const char *key, const bt_value *value, void *user_data)
User function for bt_value_map_foreach_entry_const_func().
Definition value.h:2088
static bt_bool bt_value_is_real(const bt_value *value)
Returns whether or not the value value is a real value.
Definition value.h:516
bt_value_map_insert_entry_status bt_value_map_insert_empty_array_entry(bt_value *value, const char *key, bt_value **entry_value)
Creates an empty array value and inserts or replaces an entry with the key key and this value in the ...
void bt_value_integer_signed_set(bt_value *value, int64_t raw_value)
Sets the raw value of the signed integer value value to raw_value.
uint64_t bt_value_map_get_size(const bt_value *value)
Returns the size of the map value value.
bt_value_map_foreach_entry_const_func_status
Status codes for bt_value_map_foreach_entry_const_func.
Definition value.h:2031
bt_value_map_insert_entry_status bt_value_map_insert_string_entry(bt_value *value, const char *key, const char *raw_value)
Creates a string value initialized to a copy of raw_value and inserts or replaces an entry with the k...
static bt_bool bt_value_is_unsigned_integer(const bt_value *value)
Returns whether or not the value value is an unsigned integer value.
Definition value.h:467
static bt_bool bt_value_is_map(const bt_value *value)
Returns whether or not the value value is a map value.
Definition value.h:588
bt_bool bt_value_bool_get(const bt_value *value)
Returns the raw value of the boolean value value.
bt_value * bt_value_real_create_init(double raw_value)
Creates and returns a real value initialized to raw_value.
static bt_bool bt_value_map_is_empty(const bt_value *value)
Returns whether or not the map value value is empty.
Definition value.h:2177
static bt_bool bt_value_type_is(const bt_value_type type, const bt_value_type other_type)
Returns whether or not the value type type conceptually is the value type other_type.
Definition value.h:386
bt_value_map_insert_entry_status bt_value_map_insert_real_entry(bt_value *value, const char *key, double raw_value)
Creates a real value initialized to raw_value and inserts or replaces an entry with the key key and t...
bt_value *const bt_value_null
The null value singleton.
bt_value_map_insert_entry_status bt_value_map_insert_signed_integer_entry(bt_value *value, const char *key, int64_t raw_value)
Creates a signed integer value initialized to raw_value and inserts or replaces an entry with the key...
bt_value_array_append_element_status bt_value_array_append_element(bt_value *value, bt_value *element_value)
Appends the value element_value to the array value value.
bt_value_copy_status
Status codes for bt_value_copy().
Definition value.h:2302
bt_value_string_set_status bt_value_string_set(bt_value *value, const char *raw_value)
Sets the raw value of the string value value to a copy of raw_value.
static bt_bool bt_value_is_string(const bt_value *value)
Returns whether or not the value value is a string value.
Definition value.h:540
static bt_bool bt_value_is_array(const bt_value *value)
Returns whether or not the value value is an array value.
Definition value.h:564
bt_value_map_foreach_entry_status
Status codes for bt_value_map_foreach_entry().
Definition value.h:1940
void bt_value_real_set(bt_value *value, double raw_value)
Sets the raw value of the real value value to raw_value.
static bt_bool bt_value_is_null(const bt_value *value)
Returns whether or not the value value is a null value.
Definition value.h:418
bt_value_copy_status bt_value_copy(const bt_value *value, bt_value **copy_value)
Deep-copies a value object.
bt_value_array_append_element_status bt_value_array_append_empty_array_element(bt_value *value, bt_value **element_value)
Creates an empty array value and appends it to the array value value.
int64_t bt_value_integer_signed_get(const bt_value *value)
Returns the raw value of the signed integer value value.
void bt_value_integer_unsigned_set(bt_value *value, uint64_t raw_value)
Sets the raw value of the unsigned integer value value to raw_value.
bt_value_array_append_element_status bt_value_array_append_signed_integer_element(bt_value *value, int64_t raw_value)
Creates a signed integer value initialized to raw_value and appends it to the array value value.
static bt_bool bt_value_is_bool(const bt_value *value)
Returns whether or not the value value is a boolean value.
Definition value.h:442
bt_value_array_append_element_status
Status codes for the bt_value_array_append_*() functions.
Definition value.h:1067
bt_value_map_insert_entry_status bt_value_map_insert_empty_map_entry(bt_value *value, const char *key, bt_value **entry_value)
Creates an empty map value and inserts or replaces an entry with the key key and this value in the ma...
bt_bool bt_value_map_has_entry(const bt_value *value, const char *key)
Returns whether or not the map value value has an entry with the key key.
bt_value * bt_value_bool_create_init(bt_bool raw_value)
Creates and returns a boolean value initialized to raw_value.
bt_value_string_set_status
Status codes for bt_value_string_set().
Definition value.h:981
bt_value_array_append_element_status bt_value_array_append_real_element(bt_value *value, double raw_value)
Creates a real value initialized to raw_value and appends it to the array value value.
bt_value * bt_value_integer_signed_create_init(int64_t raw_value)
Creates and returns a signed integer value initialized to raw_value.
bt_value * bt_value_map_borrow_entry_value(bt_value *value, const char *key)
Borrows the value of the entry with the key key in the map value value.
bt_bool bt_value_is_equal(const bt_value *a_value, const bt_value *b_value)
Returns whether or not the value a_value is equal, recursively, to b_value.
bt_value * bt_value_bool_create(void)
Creates and returns a boolean value initialized to BT_FALSE.
bt_value_map_extend_status bt_value_map_extend(bt_value *value, const bt_value *extension_value)
Extends the map value value with the map value extension_value.
const bt_value * bt_value_map_borrow_entry_value_const(const bt_value *value, const char *key)
Borrows the value of the entry with the key key in the map value value (const version).
const bt_value * bt_value_array_borrow_element_by_index_const(const bt_value *value, uint64_t index)
Borrows the element at index index from the array value value (const version).
bt_value_map_foreach_entry_const_status bt_value_map_foreach_entry_const(const bt_value *value, bt_value_map_foreach_entry_const_func user_func, void *user_data)
Iterates the entries of the map value value, calling user_func for each entry (const version).
bt_value_type
Value type enumerators.
Definition value.h:248
bt_value * bt_value_array_borrow_element_by_index(bt_value *value, uint64_t index)
Borrows the element at index index from the array value value.
static bt_bool bt_value_array_is_empty(const bt_value *value)
Returns whether or not the array value value is empty.
Definition value.h:1480
uint64_t bt_value_array_get_length(const bt_value *value)
Returns the length of the array value value.
bt_value * bt_value_array_create(void)
Creates and returns an empty array value.
bt_value_array_append_element_status bt_value_array_append_bool_element(bt_value *value, bt_bool raw_value)
Creates a boolean value initialized to raw_value and appends it to the array value value.
@ BT_VALUE_ARRAY_SET_ELEMENT_BY_INDEX_STATUS_OK
Success.
Definition value.h:1355
@ BT_VALUE_ARRAY_SET_ELEMENT_BY_INDEX_STATUS_MEMORY_ERROR
Out of memory.
Definition value.h:1361
@ BT_VALUE_MAP_EXTEND_STATUS_MEMORY_ERROR
Out of memory.
Definition value.h:2220
@ BT_VALUE_MAP_EXTEND_STATUS_OK
Success.
Definition value.h:2214
@ BT_VALUE_MAP_FOREACH_ENTRY_CONST_STATUS_MEMORY_ERROR
Out of memory.
Definition value.h:2118
@ BT_VALUE_MAP_FOREACH_ENTRY_CONST_STATUS_USER_ERROR
User function error.
Definition value.h:2112
@ BT_VALUE_MAP_FOREACH_ENTRY_CONST_STATUS_INTERRUPTED
User function interrupted the iteration process.
Definition value.h:2106
@ BT_VALUE_MAP_FOREACH_ENTRY_CONST_STATUS_OK
Success.
Definition value.h:2100
@ BT_VALUE_MAP_FOREACH_ENTRY_CONST_STATUS_ERROR
Other error.
Definition value.h:2124
@ BT_VALUE_MAP_INSERT_ENTRY_STATUS_OK
Success.
Definition value.h:1512
@ BT_VALUE_MAP_INSERT_ENTRY_STATUS_MEMORY_ERROR
Out of memory.
Definition value.h:1518
@ BT_VALUE_MAP_FOREACH_ENTRY_FUNC_STATUS_MEMORY_ERROR
Out of memory.
Definition value.h:1893
@ BT_VALUE_MAP_FOREACH_ENTRY_FUNC_STATUS_INTERRUPT
Interrupt the iteration process.
Definition value.h:1887
@ BT_VALUE_MAP_FOREACH_ENTRY_FUNC_STATUS_ERROR
User error.
Definition value.h:1899
@ BT_VALUE_MAP_FOREACH_ENTRY_FUNC_STATUS_OK
Success.
Definition value.h:1881
@ BT_VALUE_MAP_FOREACH_ENTRY_CONST_FUNC_STATUS_INTERRUPT
Interrupt the iteration process.
Definition value.h:2042
@ BT_VALUE_MAP_FOREACH_ENTRY_CONST_FUNC_STATUS_MEMORY_ERROR
Out of memory.
Definition value.h:2048
@ BT_VALUE_MAP_FOREACH_ENTRY_CONST_FUNC_STATUS_OK
Success.
Definition value.h:2036
@ BT_VALUE_MAP_FOREACH_ENTRY_CONST_FUNC_STATUS_ERROR
User error.
Definition value.h:2054
@ BT_VALUE_COPY_STATUS_OK
Success.
Definition value.h:2307
@ BT_VALUE_COPY_STATUS_MEMORY_ERROR
Out of memory.
Definition value.h:2313
@ BT_VALUE_MAP_FOREACH_ENTRY_STATUS_ERROR
Other error.
Definition value.h:1969
@ BT_VALUE_MAP_FOREACH_ENTRY_STATUS_MEMORY_ERROR
Out of memory.
Definition value.h:1963
@ BT_VALUE_MAP_FOREACH_ENTRY_STATUS_OK
Success.
Definition value.h:1945
@ BT_VALUE_MAP_FOREACH_ENTRY_STATUS_INTERRUPTED
User function interrupted the iteration process.
Definition value.h:1951
@ BT_VALUE_MAP_FOREACH_ENTRY_STATUS_USER_ERROR
User function error.
Definition value.h:1957
@ BT_VALUE_ARRAY_APPEND_ELEMENT_STATUS_MEMORY_ERROR
Out of memory.
Definition value.h:1078
@ BT_VALUE_ARRAY_APPEND_ELEMENT_STATUS_OK
Success.
Definition value.h:1072
@ BT_VALUE_STRING_SET_STATUS_OK
Success.
Definition value.h:986
@ BT_VALUE_STRING_SET_STATUS_MEMORY_ERROR
Out of memory.
Definition value.h:992
@ BT_VALUE_TYPE_BOOL
Boolean value.
Definition value.h:259
@ BT_VALUE_TYPE_INTEGER
Integer value.
Definition value.h:267
@ BT_VALUE_TYPE_STRING
String value.
Definition value.h:295
@ BT_VALUE_TYPE_UNSIGNED_INTEGER
Unsigned integer value.
Definition value.h:275
@ BT_VALUE_TYPE_MAP
Map value.
Definition value.h:307
@ BT_VALUE_TYPE_NULL
Null value.
Definition value.h:253
@ BT_VALUE_TYPE_SIGNED_INTEGER
Signed integer value.
Definition value.h:283
@ BT_VALUE_TYPE_REAL
Real value.
Definition value.h:289
@ BT_VALUE_TYPE_ARRAY
Array value.
Definition value.h:301