* http://www.efficios.com/ctf
*/
+/* For bt_get() */
+#include <babeltrace/ref.h>
+
/* For bt_bool */
#include <babeltrace/types.h>
struct bt_field_type *int_field_type,
enum bt_string_encoding encoding);
+extern struct bt_clock_class *bt_field_type_integer_borrow_mapped_clock_class(
+ struct bt_field_type *int_field_type);
+
/**
@brief Returns the \link ctfirclockclass CTF IR clock class\endlink
mapped to the @intft \p int_field_type.
@sa bt_field_type_integer_set_mapped_clock_class(): Sets the mapped
clock class of a given integer field type.
*/
-extern struct bt_clock_class *bt_field_type_integer_get_mapped_clock_class(
- struct bt_field_type *int_field_type);
+static inline
+struct bt_clock_class *bt_field_type_integer_get_mapped_clock_class(
+ struct bt_field_type *int_field_type)
+{
+ return bt_get(bt_field_type_integer_borrow_mapped_clock_class(
+ int_field_type));
+}
/**
@brief Sets the \link ctfirclockclass CTF IR clock class\endlink mapped
extern struct bt_field_type *bt_field_type_enumeration_create(
struct bt_field_type *int_field_type);
+extern
+struct bt_field_type *bt_field_type_enumeration_borrow_container_field_type(
+ struct bt_field_type *enum_field_type);
+
/**
@brief Returns the @intft wrapped by the @enumft \p enum_field_type.
@postrefcountsame{enum_field_type}
@postsuccessrefcountretinc
*/
-extern
+static inline
struct bt_field_type *bt_field_type_enumeration_get_container_field_type(
- struct bt_field_type *enum_field_type);
+ struct bt_field_type *enum_field_type)
+{
+ return bt_get(bt_field_type_enumeration_borrow_container_field_type(
+ enum_field_type));
+}
/**
@brief Returns the number of mappings contained in the
extern int64_t bt_field_type_structure_get_field_count(
struct bt_field_type *struct_field_type);
+extern int bt_field_type_structure_borrow_field_by_index(
+ struct bt_field_type *struct_field_type,
+ const char **field_name, struct bt_field_type **field_type,
+ uint64_t index);
+
/**
@brief Returns the field of the @structft \p struct_field_type
at index \p index.
@sa bt_field_type_structure_get_field_type_by_name(): Finds a
structure field type's field by name.
*/
-extern int bt_field_type_structure_get_field_by_index(
+static inline
+int bt_field_type_structure_get_field_by_index(
struct bt_field_type *struct_field_type,
const char **field_name, struct bt_field_type **field_type,
- uint64_t index);
+ uint64_t index)
+{
+ int ret = bt_field_type_structure_borrow_field_by_index(
+ struct_field_type, field_name, field_type, index);
+
+ if (ret == 0 && field_type) {
+ bt_get(*field_type);
+ }
+
+ return ret;
+}
+
+extern
+struct bt_field_type *bt_field_type_structure_borrow_field_type_by_name(
+ struct bt_field_type *struct_field_type,
+ const char *field_name);
/**
@brief Returns the type of the field named \p field_name found in
@sa bt_field_type_structure_get_field_by_index(): Finds a
structure field type's field by index.
*/
-extern
+static inline
struct bt_field_type *bt_field_type_structure_get_field_type_by_name(
struct bt_field_type *struct_field_type,
- const char *field_name);
+ const char *field_name)
+{
+ return bt_get(bt_field_type_structure_borrow_field_type_by_name(
+ struct_field_type, field_name));
+}
/**
@brief Adds a field named \p field_name with the @ft
struct bt_field_type *element_field_type,
unsigned int length);
+extern struct bt_field_type *bt_field_type_array_borrow_element_field_type(
+ struct bt_field_type *array_field_type);
+
/**
@brief Returns the @ft of the @fields contained in
the @arrayfields described by the @arrayft \p array_field_type.
@postrefcountsame{array_field_type}
@postsuccessrefcountretinc
*/
-extern struct bt_field_type *bt_field_type_array_get_element_field_type(
- struct bt_field_type *array_field_type);
+static inline
+struct bt_field_type *bt_field_type_array_get_element_field_type(
+ struct bt_field_type *array_field_type)
+{
+ return bt_get(bt_field_type_array_borrow_element_field_type(
+ array_field_type));
+}
/**
@brief Returns the number of @fields contained in the
struct bt_field_type *element_field_type,
const char *length_name);
+extern struct bt_field_type *bt_field_type_sequence_borrow_element_field_type(
+ struct bt_field_type *sequence_field_type);
+
/**
@brief Returns the @ft of the @fields contained in the @seqft
described by the @seqft \p sequence_field_type.
@postrefcountsame{sequence_field_type}
@postsuccessrefcountretinc
*/
-extern struct bt_field_type *bt_field_type_sequence_get_element_field_type(
- struct bt_field_type *sequence_field_type);
+static inline
+struct bt_field_type *bt_field_type_sequence_get_element_field_type(
+ struct bt_field_type *sequence_field_type)
+{
+ return bt_get(bt_field_type_sequence_borrow_element_field_type(
+ sequence_field_type));
+}
/**
@brief Returns the length name of the @seqft \p sequence_field_type.
extern const char *bt_field_type_sequence_get_length_field_name(
struct bt_field_type *sequence_field_type);
+extern struct bt_field_path *bt_field_type_sequence_borrow_length_field_path(
+ struct bt_field_type *sequence_field_type);
+
/**
@brief Returns the length's CTF IR field path of the @seqft
\p sequence_field_type.
@sa bt_field_type_sequence_get_length_field_name(): Returns the
length's name of a given sequence field type.
*/
-extern struct bt_field_path *bt_field_type_sequence_get_length_field_path(
- struct bt_field_type *sequence_field_type);
+static inline
+struct bt_field_path *bt_field_type_sequence_get_length_field_path(
+ struct bt_field_type *sequence_field_type)
+{
+ return bt_get(bt_field_type_sequence_borrow_length_field_path(
+ sequence_field_type));
+}
/** @} */
struct bt_field_type *tag_field_type,
const char *tag_name);
+extern struct bt_field_type *bt_field_type_variant_borrow_tag_field_type(
+ struct bt_field_type *variant_field_type);
+
/**
@brief Returns the tag's @enumft of the @varft \p variant_field_type.
@postrefcountsame{variant_field_type}
@postsuccessrefcountretinc
*/
-extern struct bt_field_type *bt_field_type_variant_get_tag_field_type(
- struct bt_field_type *variant_field_type);
+static inline
+struct bt_field_type *bt_field_type_variant_get_tag_field_type(
+ struct bt_field_type *variant_field_type)
+{
+ return bt_get(bt_field_type_variant_borrow_tag_field_type(
+ variant_field_type));
+}
/**
@brief Returns the tag name of the @varft \p variant_field_type.
struct bt_field_type *variant_field_type,
const char *tag_name);
+extern struct bt_field_path *bt_field_type_variant_borrow_tag_field_path(
+ struct bt_field_type *variant_field_type);
+
/**
@brief Returns the tag's CTF IR field path of the @varft
\p variant_field_type.
@sa bt_field_type_variant_get_tag_name(): Returns the tag's
name of a given variant field type.
*/
-extern struct bt_field_path *bt_field_type_variant_get_tag_field_path(
- struct bt_field_type *variant_field_type);
+static inline
+struct bt_field_path *bt_field_type_variant_get_tag_field_path(
+ struct bt_field_type *variant_field_type)
+{
+ return bt_get(bt_field_type_variant_borrow_tag_field_path(
+ variant_field_type));
+}
/**
@brief Returns the number of fields (choices) contained in the @varft
extern int64_t bt_field_type_variant_get_field_count(
struct bt_field_type *variant_field_type);
+extern int bt_field_type_variant_borrow_field_by_index(
+ struct bt_field_type *variant_field_type,
+ const char **field_name,
+ struct bt_field_type **field_type, uint64_t index);
+
/**
@brief Returns the field (choice) of the @varft \p variant_field_type
at index \p index.
@sa bt_field_type_variant_get_field_type_from_tag(): Finds a variant
field type's field by current tag value.
*/
-extern int bt_field_type_variant_get_field_by_index(
+static inline
+int bt_field_type_variant_get_field_by_index(
struct bt_field_type *variant_field_type,
const char **field_name,
- struct bt_field_type **field_type, uint64_t index);
+ struct bt_field_type **field_type, uint64_t index)
+{
+ int ret = bt_field_type_variant_borrow_field_by_index(
+ variant_field_type, field_name, field_type, index);
+
+ if (ret == 0 && field_type) {
+ bt_get(*field_type);
+ }
+
+ return ret;
+}
+
+extern
+struct bt_field_type *bt_field_type_variant_borrow_field_type_by_name(
+ struct bt_field_type *variant_field_type,
+ const char *field_name);
/**
@brief Returns the type of the field (choice) named \p field_name
@sa bt_field_type_variant_get_field_type_from_tag(): Finds a variant
field type's field by current tag value.
*/
-extern
+static inline
struct bt_field_type *bt_field_type_variant_get_field_type_by_name(
struct bt_field_type *variant_field_type,
- const char *field_name);
+ const char *field_name)
+{
+ return bt_get(bt_field_type_variant_borrow_field_type_by_name(
+ variant_field_type, field_name));
+}
+
+extern
+struct bt_field_type *bt_field_type_variant_borrow_field_type_from_tag(
+ struct bt_field_type *variant_field_type,
+ struct bt_field *tag_field);
/**
@brief Returns the type of the field (choice) selected by the value of
@sa bt_field_type_variant_get_field_type_by_name(): Finds a variant
field type's field by name.
*/
-extern
+static inline
struct bt_field_type *bt_field_type_variant_get_field_type_from_tag(
struct bt_field_type *variant_field_type,
- struct bt_field *tag_field);
+ struct bt_field *tag_field)
+{
+ return bt_get(bt_field_type_variant_borrow_field_type_from_tag(
+ variant_field_type, tag_field));
+}
/**
@brief Adds a field (a choice) named \p field_name with the @ft