-#ifndef BABELTRACE2_VALUE_H
-#define BABELTRACE2_VALUE_H
-
/*
- * Copyright (c) 2010-2019 EfficiOS Inc. and Linux Foundation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
+ * SPDX-License-Identifier: MIT
*
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * Copyright (C) 2010-2019 EfficiOS Inc. and Linux Foundation
*/
+#ifndef BABELTRACE2_VALUE_H
+#define BABELTRACE2_VALUE_H
+
+/* IWYU pragma: private, include <babeltrace2/babeltrace.h> */
+
#ifndef __BT_IN_BABELTRACE_H
# error "Please include <babeltrace2/babeltrace.h> instead."
#endif
@sa bt_value_is_map() —
Returns whether or not a value is a map value.
*/
-extern bt_value_type bt_value_get_type(const bt_value *value);
+extern bt_value_type bt_value_get_type(const bt_value *value) __BT_NOEXCEPT;
/*!
@brief
*/
static inline
bt_bool bt_value_type_is(const bt_value_type type,
- const bt_value_type other_type)
+ const bt_value_type other_type) __BT_NOEXCEPT
{
return (type & other_type) == other_type;
}
The null value singleton.
*/
static inline
-bt_bool bt_value_is_null(const bt_value *value)
+bt_bool bt_value_is_null(const bt_value *value) __BT_NOEXCEPT
{
return bt_value_get_type(value) == BT_VALUE_TYPE_NULL;
}
type.
*/
static inline
-bt_bool bt_value_is_bool(const bt_value *value)
+bt_bool bt_value_is_bool(const bt_value *value) __BT_NOEXCEPT
{
return bt_value_get_type(value) == BT_VALUE_TYPE_BOOL;
}
type.
*/
static inline
-bt_bool bt_value_is_unsigned_integer(const bt_value *value)
+bt_bool bt_value_is_unsigned_integer(const bt_value *value) __BT_NOEXCEPT
{
return bt_value_get_type(value) == BT_VALUE_TYPE_UNSIGNED_INTEGER;
}
type.
*/
static inline
-bt_bool bt_value_is_signed_integer(const bt_value *value)
+bt_bool bt_value_is_signed_integer(const bt_value *value) __BT_NOEXCEPT
{
return bt_value_get_type(value) == BT_VALUE_TYPE_SIGNED_INTEGER;
}
type.
*/
static inline
-bt_bool bt_value_is_real(const bt_value *value)
+bt_bool bt_value_is_real(const bt_value *value) __BT_NOEXCEPT
{
return bt_value_get_type(value) == BT_VALUE_TYPE_REAL;
}
type.
*/
static inline
-bt_bool bt_value_is_string(const bt_value *value)
+bt_bool bt_value_is_string(const bt_value *value) __BT_NOEXCEPT
{
return bt_value_get_type(value) == BT_VALUE_TYPE_STRING;
}
type.
*/
static inline
-bt_bool bt_value_is_array(const bt_value *value)
+bt_bool bt_value_is_array(const bt_value *value) __BT_NOEXCEPT
{
return bt_value_get_type(value) == BT_VALUE_TYPE_ARRAY;
}
type.
*/
static inline
-bt_bool bt_value_is_map(const bt_value *value)
+bt_bool bt_value_is_map(const bt_value *value) __BT_NOEXCEPT
{
return bt_value_get_type(value) == BT_VALUE_TYPE_MAP;
}
@sa bt_value_bool_create_init() —
Creates a boolean value with a given initial raw value.
*/
-extern bt_value *bt_value_bool_create(void);
+extern bt_value *bt_value_bool_create(void) __BT_NOEXCEPT;
/*!
@brief
@sa bt_value_bool_create() —
Creates a boolean value initialized to #BT_FALSE.
*/
-extern bt_value *bt_value_bool_create_init(bt_bool raw_value);
+extern bt_value *bt_value_bool_create_init(bt_bool raw_value) __BT_NOEXCEPT;
/*!
@brief
@sa bt_value_bool_get() —
Returns the raw value of a boolean value.
*/
-extern void bt_value_bool_set(bt_value *value, bt_bool raw_value);
+extern void bt_value_bool_set(bt_value *value, bt_bool raw_value) __BT_NOEXCEPT;
/*!
@brief
@sa bt_value_bool_set() —
Sets the raw value of a boolean value.
*/
-extern bt_bool bt_value_bool_get(const bt_value *value);
+extern bt_bool bt_value_bool_get(const bt_value *value) __BT_NOEXCEPT;
/*! @} */
@sa bt_value_integer_unsigned_create_init() —
Creates an unsigned integer value with a given initial raw value.
*/
-extern bt_value *bt_value_integer_unsigned_create(void);
+extern bt_value *bt_value_integer_unsigned_create(void) __BT_NOEXCEPT;
/*!
@brief
@sa bt_value_bool_create() —
Creates an unsigned integer value initialized to 0.
*/
-extern bt_value *bt_value_integer_unsigned_create_init(uint64_t raw_value);
+extern bt_value *bt_value_integer_unsigned_create_init(uint64_t raw_value) __BT_NOEXCEPT;
/*!
@brief
Returns the raw value of an unsigned integer value.
*/
extern void bt_value_integer_unsigned_set(bt_value *value,
- uint64_t raw_value);
+ uint64_t raw_value) __BT_NOEXCEPT;
/*!
@brief
@sa bt_value_integer_unsigned_set() —
Sets the raw value of an unsigned integer value.
*/
-extern uint64_t bt_value_integer_unsigned_get(const bt_value *value);
+extern uint64_t bt_value_integer_unsigned_get(const bt_value *value) __BT_NOEXCEPT;
/*! @} */
@sa bt_value_integer_signed_create_init() —
Creates a signed integer value with a given initial raw value.
*/
-extern bt_value *bt_value_integer_signed_create(void);
+extern bt_value *bt_value_integer_signed_create(void) __BT_NOEXCEPT;
/*!
@brief
@sa bt_value_bool_create() —
Creates a signed integer value initialized to 0.
*/
-extern bt_value *bt_value_integer_signed_create_init(int64_t raw_value);
+extern bt_value *bt_value_integer_signed_create_init(int64_t raw_value) __BT_NOEXCEPT;
/*!
@brief
@sa bt_value_integer_signed_get() —
Returns the raw value of a signed integer value.
*/
-extern void bt_value_integer_signed_set(bt_value *value, int64_t raw_value);
+extern void bt_value_integer_signed_set(bt_value *value, int64_t raw_value) __BT_NOEXCEPT;
/*!
@brief
@sa bt_value_integer_signed_set() —
Sets the raw value of a signed integer value.
*/
-extern int64_t bt_value_integer_signed_get(const bt_value *value);
+extern int64_t bt_value_integer_signed_get(const bt_value *value) __BT_NOEXCEPT;
/*! @} */
@sa bt_value_real_create_init() —
Creates a real value with a given initial raw value.
*/
-extern bt_value *bt_value_real_create(void);
+extern bt_value *bt_value_real_create(void) __BT_NOEXCEPT;
/*!
@brief
@sa bt_value_real_create() —
Creates a real value initialized to 0.
*/
-extern bt_value *bt_value_real_create_init(double raw_value);
+extern bt_value *bt_value_real_create_init(double raw_value) __BT_NOEXCEPT;
/*!
@brief
@sa bt_value_real_get() —
Returns the raw value of a real value.
*/
-extern void bt_value_real_set(bt_value *value, double raw_value);
+extern void bt_value_real_set(bt_value *value, double raw_value) __BT_NOEXCEPT;
/*!
@brief
@sa bt_value_real_set() —
Sets the raw value of a real value.
*/
-extern double bt_value_real_get(const bt_value *value);
+extern double bt_value_real_get(const bt_value *value) __BT_NOEXCEPT;
/*! @} */
@sa bt_value_string_create_init() —
Creates a string value with a given initial raw value.
*/
-extern bt_value *bt_value_string_create(void);
+extern bt_value *bt_value_string_create(void) __BT_NOEXCEPT;
/*!
@brief
@sa bt_value_string_create() —
Creates an empty string value.
*/
-extern bt_value *bt_value_string_create_init(const char *raw_value);
+extern bt_value *bt_value_string_create_init(const char *raw_value) __BT_NOEXCEPT;
/*!
@brief
Returns the raw value of a string value.
*/
extern bt_value_string_set_status bt_value_string_set(bt_value *value,
- const char *raw_value);
+ const char *raw_value) __BT_NOEXCEPT;
/*!
@brief
@sa bt_value_string_set() —
Sets the raw value of a string value.
*/
-extern const char *bt_value_string_get(const bt_value *value);
+extern const char *bt_value_string_get(const bt_value *value) __BT_NOEXCEPT;
/*! @} */
@returns
New array value reference, or \c NULL on memory error.
*/
-extern bt_value *bt_value_array_create(void);
+extern bt_value *bt_value_array_create(void) __BT_NOEXCEPT;
/*!
@brief
Creates and appends an empty map value to an array value.
*/
extern bt_value_array_append_element_status bt_value_array_append_element(
- bt_value *value, bt_value *element_value);
+ bt_value *value, bt_value *element_value) __BT_NOEXCEPT;
/*!
@brief
Appends an existing value to an array value.
*/
extern bt_value_array_append_element_status
-bt_value_array_append_bool_element(bt_value *value, bt_bool raw_value);
+bt_value_array_append_bool_element(bt_value *value, bt_bool raw_value) __BT_NOEXCEPT;
/*!
@brief
*/
extern bt_value_array_append_element_status
bt_value_array_append_unsigned_integer_element(bt_value *value,
- uint64_t raw_value);
+ uint64_t raw_value) __BT_NOEXCEPT;
/*!
@brief
*/
extern bt_value_array_append_element_status
bt_value_array_append_signed_integer_element(bt_value *value,
- int64_t raw_value);
+ int64_t raw_value) __BT_NOEXCEPT;
/*!
@brief
Appends an existing value to an array value.
*/
extern bt_value_array_append_element_status
-bt_value_array_append_real_element(bt_value *value, double raw_value);
+bt_value_array_append_real_element(bt_value *value, double raw_value) __BT_NOEXCEPT;
/*!
@brief
Appends an existing value to an array value.
*/
extern bt_value_array_append_element_status
-bt_value_array_append_string_element(bt_value *value, const char *raw_value);
+bt_value_array_append_string_element(bt_value *value, const char *raw_value) __BT_NOEXCEPT;
/*!
@brief
*/
extern bt_value_array_append_element_status
bt_value_array_append_empty_array_element(bt_value *value,
- bt_value **element_value);
+ bt_value **element_value) __BT_NOEXCEPT;
/*!
@brief
*/
extern bt_value_array_append_element_status
bt_value_array_append_empty_map_element(bt_value *value,
- bt_value **element_value);
+ bt_value **element_value) __BT_NOEXCEPT;
/*!
@brief
*/
extern 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);
+ bt_value *element_value) __BT_NOEXCEPT;
/*!
@brief
\c const version of this function.
*/
extern bt_value *bt_value_array_borrow_element_by_index(bt_value *value,
- uint64_t index);
+ uint64_t index) __BT_NOEXCEPT;
/*!
@brief
See bt_value_array_borrow_element_by_index().
*/
extern const bt_value *bt_value_array_borrow_element_by_index_const(
- const bt_value *value, uint64_t index);
+ const bt_value *value, uint64_t index) __BT_NOEXCEPT;
/*!
@brief
@sa bt_value_array_is_empty() —
Returns whether or not an array value is empty.
*/
-extern uint64_t bt_value_array_get_length(const bt_value *value);
+extern uint64_t bt_value_array_get_length(const bt_value *value) __BT_NOEXCEPT;
/*!
@brief
Returns the length of an array value.
*/
static inline
-bt_bool bt_value_array_is_empty(const bt_value *value)
+bt_bool bt_value_array_is_empty(const bt_value *value) __BT_NOEXCEPT
{
return bt_value_array_get_length(value) == 0;
}
@returns
New map value reference, or \c NULL on memory error.
*/
-extern bt_value *bt_value_map_create(void);
+extern bt_value *bt_value_map_create(void) __BT_NOEXCEPT;
/*!
@brief
Creates a map value and uses it to insert an entry in a map value.
*/
extern bt_value_map_insert_entry_status bt_value_map_insert_entry(
- bt_value *value, const char *key, bt_value *entry_value);
+ bt_value *value, const char *key,
+ bt_value *entry_value) __BT_NOEXCEPT;
/*!
@brief
Inserts an entry with an existing value in a map value.
*/
extern bt_value_map_insert_entry_status bt_value_map_insert_bool_entry(
- bt_value *value, const char *key, bt_bool raw_value);
+ bt_value *value, const char *key, bt_bool raw_value)
+ __BT_NOEXCEPT;
/*!
@brief
*/
extern bt_value_map_insert_entry_status
bt_value_map_insert_unsigned_integer_entry(bt_value *value, const char *key,
- uint64_t raw_value);
+ uint64_t raw_value) __BT_NOEXCEPT;
/*!
@brief
*/
extern bt_value_map_insert_entry_status
bt_value_map_insert_signed_integer_entry(bt_value *value, const char *key,
- int64_t raw_value);
+ int64_t raw_value) __BT_NOEXCEPT;
/*!
@brief
Inserts an entry with an existing value in a map value.
*/
extern bt_value_map_insert_entry_status bt_value_map_insert_real_entry(
- bt_value *value, const char *key, double raw_value);
+ bt_value *value, const char *key, double raw_value)
+ __BT_NOEXCEPT;
/*!
@brief
*/
extern bt_value_map_insert_entry_status
bt_value_map_insert_string_entry(bt_value *value, const char *key,
- const char *raw_value);
+ const char *raw_value) __BT_NOEXCEPT;
/*!
@brief
*/
extern bt_value_map_insert_entry_status
bt_value_map_insert_empty_array_entry(bt_value *value, const char *key,
- bt_value **entry_value);
+ bt_value **entry_value) __BT_NOEXCEPT;
/*!
@brief
*/
extern bt_value_map_insert_entry_status
bt_value_map_insert_empty_map_entry(bt_value *value, const char *key,
- bt_value **entry_value);
+ bt_value **entry_value) __BT_NOEXCEPT;
/*!
@brief
Returns whether or not a map value has an entry with a given key.
*/
extern bt_value *bt_value_map_borrow_entry_value(
- bt_value *value, const char *key);
+ bt_value *value, const char *key) __BT_NOEXCEPT;
/*!
@brief
See bt_value_map_borrow_entry_value().
*/
extern const bt_value *bt_value_map_borrow_entry_value_const(
- const bt_value *value, const char *key);
+ const bt_value *value, const char *key) __BT_NOEXCEPT;
/*!
@brief
*/
extern 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);
+ void *user_data) __BT_NOEXCEPT;
/*!
@brief
extern 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);
+ void *user_data) __BT_NOEXCEPT;
/*!
@brief
@sa bt_value_map_is_empty() —
Returns whether or not a map value is empty.
*/
-extern uint64_t bt_value_map_get_size(const bt_value *value);
+extern uint64_t bt_value_map_get_size(const bt_value *value) __BT_NOEXCEPT;
/*!
@brief
Returns the size of a map value.
*/
static inline
-bt_bool bt_value_map_is_empty(const bt_value *value)
+bt_bool bt_value_map_is_empty(const bt_value *value) __BT_NOEXCEPT
{
return bt_value_map_get_size(value) == 0;
}
Borrows the value of a specific map value entry.
*/
extern bt_bool bt_value_map_has_entry(const bt_value *value,
- const char *key);
+ const char *key) __BT_NOEXCEPT;
/*!
@brief
Deep-copies a value.
*/
extern bt_value_map_extend_status bt_value_map_extend(
- bt_value *value, const bt_value *extension_value);
+ bt_value *value, const bt_value *extension_value) __BT_NOEXCEPT;
/*! @} */
@bt_pre_not_null{copy_value}
*/
extern bt_value_copy_status bt_value_copy(const bt_value *value,
- bt_value **copy_value);
+ bt_value **copy_value) __BT_NOEXCEPT;
/*!
@brief
@bt_pre_not_null{b_value}
*/
extern bt_bool bt_value_is_equal(const bt_value *a_value,
- const bt_value *b_value);
+ const bt_value *b_value) __BT_NOEXCEPT;
/*! @} */
@sa bt_value_put_ref() —
Decrements the reference count of a value.
*/
-extern void bt_value_get_ref(const bt_value *value);
+extern void bt_value_get_ref(const bt_value *value) __BT_NOEXCEPT;
/*!
@brief
@sa bt_value_get_ref() —
Increments the reference count of a value.
*/
-extern void bt_value_put_ref(const bt_value *value);
+extern void bt_value_put_ref(const bt_value *value) __BT_NOEXCEPT;
/*!
@brief