ir: fields.c: fix public function names to get/set struct. field
[babeltrace.git] / include / babeltrace / ctf-ir / fields.h
index 5120d9e41739f665335c4947311c8112a0b41a1f..15468f4f014c5763ed091710f3afb15e7c27aafe 100644 (file)
@@ -32,6 +32,8 @@
 
 #include <stdint.h>
 #include <stddef.h>
+#include <babeltrace/ctf-ir/field-types.h>
+#include <babeltrace/types.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -83,17 +85,18 @@ contained fields with the following getters if such fields do not exist
 yet:
 
 - bt_ctf_field_enumeration_get_container()
-- bt_ctf_field_structure_get_field()
+- bt_ctf_field_structure_get_field_by_name()
 - bt_ctf_field_array_get_field()
 - bt_ctf_field_sequence_get_field()
 - bt_ctf_field_variant_get_field()
 
 If you already have a field object, you can also assign it to a specific
-name within a @structfield with bt_ctf_field_structure_set_field().
+name within a @structfield with
+bt_ctf_field_structure_set_field_by_name().
 
 You can get a reference to the @ft which was used to create a field with
 bt_ctf_field_get_type(). You can get the
-\link #bt_ctf_type_id type ID\endlink of this field type directly with
+\link #bt_ctf_field_type_id type ID\endlink of this field type directly with
 bt_ctf_field_get_type_id().
 
 You can get a deep copy of a field with bt_ctf_field_copy(). The field
@@ -187,12 +190,12 @@ extern struct bt_ctf_field_type *bt_ctf_field_get_type(
 @param[in] field       Field of which to get the type ID of its
                        parent field type..
 @returns               Type ID of the parent field type of \p field,
-                       or #BT_CTF_TYPE_ID_UNKNOWN on error.
+                       or #BT_CTF_FIELD_TYPE_ID_UNKNOWN on error.
 
 @prenotnull{field}
 @postrefcountsame{field}
 
-@sa #bt_ctf_type_id: CTF IR field type ID.
+@sa #bt_ctf_field_type_id: CTF IR field type ID.
 @sa bt_ctf_field_is_integer(): Returns whether or not a given field is a
        @intfield.
 @sa bt_ctf_field_is_floating_point(): Returns whether or not a given
@@ -210,7 +213,7 @@ extern struct bt_ctf_field_type *bt_ctf_field_get_type(
 @sa bt_ctf_field_is_variant(): Returns whether or not a given field is a
        @varfield.
 */
-extern enum bt_ctf_type_id bt_ctf_field_get_type_id(struct bt_ctf_field *field);
+extern enum bt_ctf_field_type_id bt_ctf_field_get_type_id(struct bt_ctf_field *field);
 
 /*
  * bt_ctf_field_signed_integer_get_value: get a signed integer field's value
@@ -229,8 +232,8 @@ extern int bt_ctf_field_signed_integer_get_value(struct bt_ctf_field *integer,
 @brief Returns whether or not the @field \p field is a @intfield.
 
 @param[in] field       Field to check (can be \c NULL).
-@returns                1 if \p field is an integer field, or 0
-                       otherwise (including if \p field is
+@returns                #BT_TRUE if \p field is an integer field, or
+                       #BT_FALSE otherwise (including if \p field is
                        \c NULL).
 
 @prenotnull{field}
@@ -239,14 +242,14 @@ extern int bt_ctf_field_signed_integer_get_value(struct bt_ctf_field *integer,
 @sa bt_ctf_field_get_type_id(): Returns the type ID of a given
        field's type.
 */
-extern int bt_ctf_field_is_integer(struct bt_ctf_field *field);
+extern bt_bool bt_ctf_field_is_integer(struct bt_ctf_field *field);
 
 /**
 @brief Returns whether or not the @field \p field is a @floatfield.
 
 @param[in] field       Field to check (can be \c NULL).
-@returns                1 if \p field is a floating point number field,
-                       or 0 otherwise (including if \p field is
+@returns                #BT_TRUE if \p field is a floating point number fiel
+                       #BT_FALSE or 0 otherwise (including if \p field is
                        \c NULL).
 
 @prenotnull{field}
@@ -255,14 +258,14 @@ extern int bt_ctf_field_is_integer(struct bt_ctf_field *field);
 @sa bt_ctf_field_get_type_id(): Returns the type ID of a given
        field's type.
 */
-extern int bt_ctf_field_is_floating_point(struct bt_ctf_field *field);
+extern bt_bool bt_ctf_field_is_floating_point(struct bt_ctf_field *field);
 
 /**
 @brief Returns whether or not the @field \p field is a @enumfield.
 
 @param[in] field       Field to check (can be \c NULL).
-@returns                1 if \p field is an enumeration field, or 0
-                       otherwise (including if \p field is
+@returns                #BT_TRUE if \p field is an enumeration field, or
+                       #BT_FALSE otherwise (including if \p field is
                        \c NULL).
 
 @prenotnull{field}
@@ -271,14 +274,14 @@ extern int bt_ctf_field_is_floating_point(struct bt_ctf_field *field);
 @sa bt_ctf_field_get_type_id(): Returns the type ID of a given
        field's type.
 */
-extern int bt_ctf_field_is_enumeration(struct bt_ctf_field *field);
+extern bt_bool bt_ctf_field_is_enumeration(struct bt_ctf_field *field);
 
 /**
 @brief Returns whether or not the @field \p field is a @stringfield.
 
 @param[in] field       Field to check (can be \c NULL).
-@returns                1 if \p field is a string field, or 0
-                       otherwise (including if \p field is
+@returns                #BT_TRUE if \p field is a string field, or
+                       #BT_FALSE otherwise (including if \p field is
                        \c NULL).
 
 @prenotnull{field}
@@ -287,14 +290,14 @@ extern int bt_ctf_field_is_enumeration(struct bt_ctf_field *field);
 @sa bt_ctf_field_get_type_id(): Returns the type ID of a given
        field's type.
 */
-extern int bt_ctf_field_is_string(struct bt_ctf_field *field);
+extern bt_bool bt_ctf_field_is_string(struct bt_ctf_field *field);
 
 /**
 @brief Returns whether or not the @field \p field is a @structfield.
 
 @param[in] field       Field to check (can be \c NULL).
-@returns                1 if \p field is a structure field, or 0
-                       otherwise (including if \p field is
+@returns                #BT_TRUE if \p field is a structure field, or
+                       #BT_FALSE otherwise (including if \p field is
                        \c NULL).
 
 @prenotnull{field}
@@ -303,14 +306,14 @@ extern int bt_ctf_field_is_string(struct bt_ctf_field *field);
 @sa bt_ctf_field_get_type_id(): Returns the type ID of a given
        field's type.
 */
-extern int bt_ctf_field_is_structure(struct bt_ctf_field *field);
+extern bt_bool bt_ctf_field_is_structure(struct bt_ctf_field *field);
 
 /**
 @brief Returns whether or not the @field \p field is a @arrayfield.
 
 @param[in] field       Field to check (can be \c NULL).
-@returns                1 if \p field is an array field, or 0
-                       otherwise (including if \p field is
+@returns                #BT_TRUE if \p field is an array field, or
+                       #BT_FALSE otherwise (including if \p field is
                        \c NULL).
 
 @prenotnull{field}
@@ -319,14 +322,14 @@ extern int bt_ctf_field_is_structure(struct bt_ctf_field *field);
 @sa bt_ctf_field_get_type_id(): Returns the type ID of a given
        field's type.
 */
-extern int bt_ctf_field_is_array(struct bt_ctf_field *field);
+extern bt_bool bt_ctf_field_is_array(struct bt_ctf_field *field);
 
 /**
 @brief Returns whether or not the @field \p field is a @seqfield.
 
 @param[in] field       Field to check (can be \c NULL).
-@returns                1 if \p field is a sequence field, or 0
-                       otherwise (including if \p field is
+@returns                #BT_TRUE if \p field is a sequence field, or
+                       #BT_FALSE otherwise (including if \p field is
                        \c NULL).
 
 @prenotnull{field}
@@ -335,14 +338,14 @@ extern int bt_ctf_field_is_array(struct bt_ctf_field *field);
 @sa bt_ctf_field_get_type_id(): Returns the type ID of a given
        field's type.
 */
-extern int bt_ctf_field_is_sequence(struct bt_ctf_field *field);
+extern bt_bool bt_ctf_field_is_sequence(struct bt_ctf_field *field);
 
 /**
 @brief Returns whether or not the @field \p field is a @varfield.
 
 @param[in] field       Field to check (can be \c NULL).
-@returns                1 if \p field is a variant field, or 0
-                       otherwise (including if \p field is
+@returns                #BT_TRUE if \p field is a variant field, or
+                       #BT_FALSE otherwise (including if \p field is
                        \c NULL).
 
 @prenotnull{field}
@@ -351,7 +354,7 @@ extern int bt_ctf_field_is_sequence(struct bt_ctf_field *field);
 @sa bt_ctf_field_get_type_id(): Returns the type ID of a given
        field's type.
 */
-extern int bt_ctf_field_is_variant(struct bt_ctf_field *field);
+extern bt_bool bt_ctf_field_is_variant(struct bt_ctf_field *field);
 
 /** @} */
 
@@ -826,10 +829,10 @@ contains an ordered list of zero or more named @fields which can be
 different @fts, and which is described by a @structft.
 
 To set the value of a specific field of a structure field, you need to
-first get the field with bt_ctf_field_structure_get_field() or
+first get the field with bt_ctf_field_structure_get_field_by_name() or
 bt_ctf_field_structure_get_field_by_index(). If you already have a
 field object, you can assign it to a specific name within a structure
-field with bt_ctf_field_structure_set_field().
+field with bt_ctf_field_structure_set_field_by_name().
 
 @sa ctfirstructfieldtype
 @sa ctfirfields
@@ -859,12 +862,15 @@ exist.
 
 @sa bt_ctf_field_structure_get_field_by_index(): Returns the field of a
        given structure field by index.
-@sa bt_ctf_field_structure_set_field(): Sets the field of a given
-       structure field.
+@sa bt_ctf_field_structure_set_field_by_name(): Sets the field of a
+       given structure field by name.
 */
-extern struct bt_ctf_field *bt_ctf_field_structure_get_field(
+extern struct bt_ctf_field *bt_ctf_field_structure_get_field_by_name(
                struct bt_ctf_field *struct_field, const char *name);
 
+/* Pre-2.0 CTF writer compatibility */
+#define bt_ctf_field_structure_get_field bt_ctf_field_structure_get_field_by_name
+
 /**
 @brief  Returns the @field at index \p index in the @structfield
        \p struct_field.
@@ -883,13 +889,13 @@ extern struct bt_ctf_field *bt_ctf_field_structure_get_field(
 @postrefcountsame{struct_field}
 @postsuccessrefcountretinc
 
-@sa bt_ctf_field_structure_get_field(): Returns the field of a
+@sa bt_ctf_field_structure_get_field_by_name(): Returns the field of a
+       given structure field by name.
+@sa bt_ctf_field_structure_set_field_by_name(): Sets the field of a
        given structure field by name.
-@sa bt_ctf_field_structure_set_field(): Sets the field of a given
-       structure field.
 */
 extern struct bt_ctf_field *bt_ctf_field_structure_get_field_by_index(
-               struct bt_ctf_field *struct_field, int index);
+               struct bt_ctf_field *struct_field, uint64_t index);
 
 /**
 @brief Sets the field of the @structfield \p struct_field named \p name
@@ -928,10 +934,11 @@ bt_ctf_trace_get_packet_header_type() for the parent trace class of
 
 @sa bt_ctf_field_structure_get_field_by_index(): Returns the field of a
        given structure field by index.
-@sa bt_ctf_field_structure_get_field(): Returns the field of a
+@sa bt_ctf_field_structure_get_field_by_name(): Returns the field of a
        given structure field by name.
 */
-extern int bt_ctf_field_structure_set_field(struct bt_ctf_field *struct_field,
+extern int bt_ctf_field_structure_set_field_by_name(
+               struct bt_ctf_field *struct_field,
                const char *name, struct bt_ctf_field *field);
 
 /** @} */
This page took 0.034056 seconds and 4 git commands to generate.