#include <stdint.h>
#include <stddef.h>
+/* For bt_get() */
+#include <babeltrace/ref.h>
+
/* For bt_bool */
#include <babeltrace/types.h>
*/
extern struct bt_field *bt_field_create(struct bt_field_type *field_type);
+extern struct bt_field_type *bt_field_borrow_type(struct bt_field *field);
+
/**
@brief Returns the parent @ft of the @field \p field.
@postrefcountsame{field}
@postsuccessrefcountretinc
*/
-extern struct bt_field_type *bt_field_get_type(struct bt_field *field);
+static inline
+struct bt_field_type *bt_field_get_type(struct bt_field *field)
+{
+ return bt_get(bt_field_borrow_type(field));
+}
/** @} */
@{
*/
+extern struct bt_field *bt_field_enumeration_borrow_container(
+ struct bt_field *enum_field);
+
/**
@brief Returns the @intfield, potentially creating it, wrapped by the
@enumfield \p enum_field.
@postrefcountsame{enum_field}
@postsuccessrefcountretinc
*/
-extern struct bt_field *bt_field_enumeration_get_container(
- struct bt_field *enum_field);
+static inline
+struct bt_field *bt_field_enumeration_get_container(
+ struct bt_field *enum_field)
+{
+ return bt_get(bt_field_enumeration_borrow_container(enum_field));
+}
/**
@brief Returns a @enumftiter on all the mappings of the field type of
@{
*/
+extern struct bt_field *bt_field_structure_borrow_field_by_name(
+ struct bt_field *struct_field, const char *name);
+
/**
@brief Returns the @field named \p name, potentially creating it,
in the @structfield \p struct_field.
@sa bt_field_structure_set_field_by_name(): Sets the field of a
given structure field by name.
*/
-extern struct bt_field *bt_field_structure_get_field_by_name(
- struct bt_field *struct_field, const char *name);
+static inline
+struct bt_field *bt_field_structure_get_field_by_name(
+ struct bt_field *struct_field, const char *name)
+{
+ return bt_get(bt_field_structure_borrow_field_by_name(struct_field,
+ name));
+}
+
+extern struct bt_field *bt_field_structure_borrow_field_by_index(
+ struct bt_field *struct_field, uint64_t index);
/**
@brief Returns the @field at index \p index in the @structfield
@sa bt_field_structure_set_field_by_name(): Sets the field of a
given structure field by name.
*/
-extern struct bt_field *bt_field_structure_get_field_by_index(
- struct bt_field *struct_field, uint64_t index);
+static inline
+struct bt_field *bt_field_structure_get_field_by_index(
+ struct bt_field *struct_field, uint64_t index)
+{
+ return bt_get(bt_field_structure_borrow_field_by_index(struct_field,
+ index));
+}
/**
@brief Sets the field of the @structfield \p struct_field named \p name
@{
*/
+extern struct bt_field *bt_field_array_borrow_field(
+ struct bt_field *array_field, uint64_t index);
+
/**
@brief Returns the @field at index \p index, potentially creating it,
in the @arrayfield \p array_field.
@postrefcountsame{array_field}
@postsuccessrefcountretinc
*/
-extern struct bt_field *bt_field_array_get_field(
- struct bt_field *array_field, uint64_t index);
+static inline
+struct bt_field *bt_field_array_get_field(
+ struct bt_field *array_field, uint64_t index)
+{
+ return bt_get(bt_field_array_borrow_field(array_field, index));
+}
/** @} */
@{
*/
+extern struct bt_field *bt_field_sequence_borrow_field(
+ struct bt_field *sequence_field, uint64_t index);
+
/**
@brief Returns the @field at index \p index, potentially creating it,
in the @seqfield \p sequence_field.
@postrefcountsame{sequence_field}
@postsuccessrefcountretinc
*/
-extern struct bt_field *bt_field_sequence_get_field(
- struct bt_field *sequence_field, uint64_t index);
+static inline
+struct bt_field *bt_field_sequence_get_field(
+ struct bt_field *sequence_field, uint64_t index)
+{
+ return bt_get(bt_field_sequence_borrow_field(sequence_field, index));
+}
+
+extern struct bt_field *bt_field_sequence_borrow_length(
+ struct bt_field *sequence_field);
/**
@brief Returns the length @intfield of the @seqfield \p sequence_field.
@sa bt_field_sequence_set_length(): Sets the length field of a given
sequence field.
*/
-extern struct bt_field *bt_field_sequence_get_length(
- struct bt_field *sequence_field);
+static inline
+struct bt_field *bt_field_sequence_get_length(
+ struct bt_field *sequence_field)
+{
+ return bt_get(bt_field_sequence_borrow_length(sequence_field));
+}
/**
@brief Sets the length @intfield of the @seqfield \p sequence_field
@{
*/
+extern struct bt_field *bt_field_variant_borrow_field(
+ struct bt_field *variant_field,
+ struct bt_field *tag_field);
+
/**
@brief Returns the @field, potentially creating it, selected by the
tag @intfield \p tag_field in the @varfield \p variant_field.
@postsuccessrefcountinc{tag_field}
@postsuccessrefcountretinc
*/
-extern struct bt_field *bt_field_variant_get_field(
+static inline
+struct bt_field *bt_field_variant_get_field(
struct bt_field *variant_field,
- struct bt_field *tag_field);
+ struct bt_field *tag_field)
+{
+ return bt_get(bt_field_variant_borrow_field(variant_field, tag_field));
+}
+
+extern struct bt_field *bt_field_variant_borrow_current_field(
+ struct bt_field *variant_field);
/**
@brief Returns the currently selected @field of the @varfield
@postrefcountsame{variant_field}
@postsuccessrefcountretinc
*/
-extern struct bt_field *bt_field_variant_get_current_field(
+static inline
+struct bt_field *bt_field_variant_get_current_field(
+ struct bt_field *variant_field)
+{
+ return bt_get(bt_field_variant_borrow_current_field(variant_field));
+}
+
+extern struct bt_field *bt_field_variant_borrow_tag(
struct bt_field *variant_field);
/**
@postsuccessrefcountretinc
@post <strong>On success</strong>, the returned field is a @enumfield.
*/
-extern struct bt_field *bt_field_variant_get_tag(
- struct bt_field *variant_field);
+static inline
+struct bt_field *bt_field_variant_get_tag(
+ struct bt_field *variant_field)
+{
+ return bt_get(bt_field_variant_borrow_tag(variant_field));
+}
/** @} */