BT_CTF_BYTE_ORDER_NONE -> BT_CTF_BYTE_ORDER_UNSPECIFIED to match base
[babeltrace.git] / include / babeltrace / ctf-ir / field-types.h
index 6391f154e9680e60cba177878fd47c6663a8bdd1..29928986b809fb052d1e1f8e9584d803d5a83806 100644 (file)
@@ -30,6 +30,7 @@
  * http://www.efficios.com/ctf
  */
 
+#include <babeltrace/types.h>
 #include <stdint.h>
 #include <stddef.h>
 
@@ -211,16 +212,16 @@ struct bt_ctf_field_type_enumeration_mapping_iterator;
  * counterpart.
  */
 enum ctf_type_id {
-       CTF_TYPE_UNKNOWN = 0,
-       CTF_TYPE_INTEGER,
-       CTF_TYPE_FLOAT,
-       CTF_TYPE_ENUM,
-       CTF_TYPE_STRING,
-       CTF_TYPE_STRUCT,
-       CTF_TYPE_UNTAGGED_VARIANT,
-       CTF_TYPE_VARIANT,
-       CTF_TYPE_ARRAY,
-       CTF_TYPE_SEQUENCE,
+       CTF_TYPE_UNKNOWN = -1,
+       CTF_TYPE_INTEGER = 0,
+       CTF_TYPE_FLOAT = 1,
+       CTF_TYPE_ENUM = 2,
+       CTF_TYPE_STRING = 3,
+       CTF_TYPE_STRUCT = 4,
+       CTF_TYPE_UNTAGGED_VARIANT = 5,
+       CTF_TYPE_VARIANT = 5,
+       CTF_TYPE_ARRAY = 6,
+       CTF_TYPE_SEQUENCE = 7,
        NR_CTF_TYPES,
 };
 
@@ -294,10 +295,6 @@ enum bt_ctf_field_type_id {
        /// \ref ctfirstructfieldtype
        BT_CTF_FIELD_TYPE_ID_STRUCT = CTF_TYPE_STRUCT,
 
-       /// @cond DOCUMENT
-       BT_CTF_TYPE_ID_UNTAGGED_VARIANT = CTF_TYPE_UNTAGGED_VARIANT,
-       /// @endcond
-
        /// \ref ctfirarrayfieldtype
        BT_CTF_FIELD_TYPE_ID_ARRAY = CTF_TYPE_ARRAY,
 
@@ -346,8 +343,8 @@ extern enum bt_ctf_field_type_id bt_ctf_field_type_get_type_id(
 @brief Returns whether or not the @ft \p field_type is a @intft.
 
 @param[in] field_type  Field type to check (can be \c NULL).
-@returns               1 if \p field_type is an integer field type,
-                       or 0 otherwise (including if \p field_type is
+@returns               #BT_TRUE if \p field_type is an integer field type,
+                       or #BT_FALSE otherwise (including if \p field_type is
                        \c NULL).
 
 @prenotnull{field_type}
@@ -356,14 +353,15 @@ extern enum bt_ctf_field_type_id bt_ctf_field_type_get_type_id(
 @sa bt_ctf_field_type_get_type_id(): Returns the type ID of a given
        field type.
 */
-extern int bt_ctf_field_type_is_integer(struct bt_ctf_field_type *field_type);
+extern bt_bool bt_ctf_field_type_is_integer(
+               struct bt_ctf_field_type *field_type);
 
 /**
 @brief Returns whether or not the @ft \p field_type is a @floatft.
 
 @param[in] field_type  Field type to check (can be \c NULL).
-@returns               1 if \p field_type is a floating point
-                       number field type,
+@returns               #BT_TRUE if \p field_type is a floating point
+                       #BT_FALSE field type,
                        or 0 otherwise (including if \p field_type is
                        \c NULL).
 
@@ -372,14 +370,15 @@ extern int bt_ctf_field_type_is_integer(struct bt_ctf_field_type *field_type);
 @sa bt_ctf_field_type_get_type_id(): Returns the type ID of a given
        field type.
 */
-extern int bt_ctf_field_type_is_floating_point(struct bt_ctf_field_type *field_type);
+extern bt_bool bt_ctf_field_type_is_floating_point(
+               struct bt_ctf_field_type *field_type);
 
 /**
 @brief Returns whether or not the @ft \p field_type is a @enumft.
 
 @param[in] field_type  Field type to check (can be \c NULL).
-@returns               1 if \p field_type is an enumeration field type,
-                       or 0 otherwise (including if \p field_type is
+@returns               #BT_TRUE if \p field_type is an enumeration field type,
+                       or #BT_FALSE otherwise (including if \p field_type is
                        \c NULL).
 
 @postrefcountsame{field_type}
@@ -387,14 +386,15 @@ extern int bt_ctf_field_type_is_floating_point(struct bt_ctf_field_type *field_t
 @sa bt_ctf_field_type_get_type_id(): Returns the type ID of a given
        field type.
 */
-extern int bt_ctf_field_type_is_enumeration(struct bt_ctf_field_type *field_type);
+extern bt_bool bt_ctf_field_type_is_enumeration(
+               struct bt_ctf_field_type *field_type);
 
 /**
 @brief Returns whether or not the @ft \p field_type is a @stringft.
 
 @param[in] field_type  Field type to check (can be \c NULL).
-@returns               1 if \p field_type is a string field type,
-                       or 0 otherwise (including if \p field_type is
+@returns               #BT_TRUE if \p field_type is a string field type,
+                       or #BT_FALSE otherwise (including if \p field_type is
                        \c NULL).
 
 @postrefcountsame{field_type}
@@ -402,14 +402,15 @@ extern int bt_ctf_field_type_is_enumeration(struct bt_ctf_field_type *field_type
 @sa bt_ctf_field_type_get_type_id(): Returns the type ID of a given
        field type.
 */
-extern int bt_ctf_field_type_is_string(struct bt_ctf_field_type *field_type);
+extern bt_bool bt_ctf_field_type_is_string(
+               struct bt_ctf_field_type *field_type);
 
 /**
 @brief Returns whether or not the @ft \p field_type is a @structft.
 
 @param[in] field_type  Field type to check (can be \c NULL).
-@returns               1 if \p field_type is a structure field type,
-                       or 0 otherwise (including if \p field_type is
+@returns               #BT_TRUE if \p field_type is a structure field type,
+                       or #BT_FALSE otherwise (including if \p field_type is
                        \c NULL).
 
 @postrefcountsame{field_type}
@@ -417,14 +418,15 @@ extern int bt_ctf_field_type_is_string(struct bt_ctf_field_type *field_type);
 @sa bt_ctf_field_type_get_type_id(): Returns the type ID of a given
        field type.
 */
-extern int bt_ctf_field_type_is_structure(struct bt_ctf_field_type *field_type);
+extern bt_bool bt_ctf_field_type_is_structure(
+               struct bt_ctf_field_type *field_type);
 
 /**
 @brief Returns whether or not the @ft \p field_type is a @arrayft.
 
 @param[in] field_type  Field type to check (can be \c NULL).
-@returns               1 if \p field_type is an array field type,
-                       or 0 otherwise (including if \p field_type is
+@returns               #BT_TRUE if \p field_type is an array field type,
+                       or #BT_FALSE otherwise (including if \p field_type is
                        \c NULL).
 
 @postrefcountsame{field_type}
@@ -432,14 +434,15 @@ extern int bt_ctf_field_type_is_structure(struct bt_ctf_field_type *field_type);
 @sa bt_ctf_field_type_get_type_id(): Returns the type ID of a given
        field type.
 */
-extern int bt_ctf_field_type_is_array(struct bt_ctf_field_type *field_type);
+extern bt_bool bt_ctf_field_type_is_array(
+               struct bt_ctf_field_type *field_type);
 
 /**
 @brief Returns whether or not the @ft \p field_type is a @seqft.
 
 @param[in] field_type  Field type to check (can be \c NULL).
-@returns               1 if \p field_type is a sequence field type,
-                       or 0 otherwise (including if \p field_type is
+@returns               #BT_TRUE if \p field_type is a sequence field type,
+                       or #BT_FALSE otherwise (including if \p field_type is
                        \c NULL).
 
 @postrefcountsame{field_type}
@@ -447,14 +450,15 @@ extern int bt_ctf_field_type_is_array(struct bt_ctf_field_type *field_type);
 @sa bt_ctf_field_type_get_type_id(): Returns the type ID of a given
        field type.
 */
-extern int bt_ctf_field_type_is_sequence(struct bt_ctf_field_type *field_type);
+extern bt_bool bt_ctf_field_type_is_sequence(
+               struct bt_ctf_field_type *field_type);
 
 /**
 @brief Returns whether or not the @ft \p field_type is a @varft.
 
 @param[in] field_type  Field type to check (can be \c NULL).
-@returns               1 if \p field_type is a variant field type,
-                       or 0 otherwise (including if \p field_type is
+@returns               #BT_TRUE if \p field_type is a variant field type,
+                       or #BT_FALSE otherwise (including if \p field_type is
                        \c NULL).
 
 @postrefcountsame{field_type}
@@ -462,7 +466,8 @@ extern int bt_ctf_field_type_is_sequence(struct bt_ctf_field_type *field_type);
 @sa bt_ctf_field_type_get_type_id(): Returns the type ID of a given
        field type.
 */
-extern int bt_ctf_field_type_is_variant(struct bt_ctf_field_type *field_type);
+extern bt_bool bt_ctf_field_type_is_variant(
+               struct bt_ctf_field_type *field_type);
 
 /** @} */
 
@@ -487,6 +492,12 @@ enum bt_ctf_byte_order {
        /// Native (default) byte order.
        BT_CTF_BYTE_ORDER_NATIVE = 0,
 
+       /**
+       Unspecified byte order; the initial native byte order of a
+       \link ctfirtraceclass CTF IR trace class\endlink.
+       */
+       BT_CTF_BYTE_ORDER_UNSPECIFIED,
+
        /// Little-endian.
        BT_CTF_BYTE_ORDER_LITTLE_ENDIAN,
 
@@ -748,6 +759,9 @@ enum bt_ctf_integer_base {
        /// Unknown, used for errors.
        BT_CTF_INTEGER_BASE_UNKNOWN = -1,
 
+       /// Unspecified by the tracer.
+       BT_CTF_INTEGER_BASE_UNSPECIFIED = 0,
+
        /// Binary.
        BT_CTF_INTEGER_BASE_BINARY = 2,
 
@@ -820,7 +834,7 @@ extern int bt_ctf_field_type_integer_get_size(
        the integer fields described by a given integer field type.
 */
 extern int bt_ctf_field_type_integer_set_size(
-               struct bt_ctf_field_type *int_field_type, size_t size);
+               struct bt_ctf_field_type *int_field_type, unsigned int size);
 
 /**
 @brief  Returns whether or not the @intfields described by the @intft
@@ -829,10 +843,9 @@ extern int bt_ctf_field_type_integer_set_size(
 @param[in] int_field_type      Integer field type which describes the
                                integer fields of which to get the
                                signedness.
-@returns                       1 if the integer fields described by
-                               \p int_field_type are signed, 0 if they
-                               are unsigned, or a negative value on
-                               error.
+@returns                       #BT_TRUE if the integer fields described by
+                               \p int_field_type are signed, #BT_FALSE if they
+                               are unsigned.
 
 @prenotnull{int_field_type}
 @preisintft{int_field_type}
@@ -841,11 +854,15 @@ extern int bt_ctf_field_type_integer_set_size(
 @sa bt_ctf_field_type_integer_set_is_signed(): Sets the signedness of the
        integer fields described by a given integer field type.
 */
-extern int bt_ctf_field_type_integer_is_signed(
+extern bt_bool bt_ctf_field_type_integer_is_signed(
                struct bt_ctf_field_type *int_field_type);
 
-/* Pre-2.0 CTF writer compatibility */
-#define bt_ctf_field_type_integer_get_signed bt_ctf_field_type_integer_is_signed
+/** @cond DOCUMENT */
+
+extern int bt_ctf_field_type_integer_get_signed(
+               struct bt_ctf_field_type *int_field_type);
+
+/** @endcond */
 
 /**
 @brief Sets whether or not the @intfields described by
@@ -855,21 +872,20 @@ extern int bt_ctf_field_type_integer_is_signed(
                                integer fields of which to set the
                                signedness.
 @param[in] is_signed           Signedness of the integer fields
-                               described by \p int_field_type; 0 means
-                               \em unsigned, 1 means \em signed.
+                               described by \p int_field_type; #BT_FALSE means
+                               \em unsigned, #BT_TRUE means \em signed.
 @returns                       0 on success, or a negative value on error.
 
 @prenotnull{int_field_type}
 @preisintft{int_field_type}
 @prehot{int_field_type}
-@pre \p is_signed is 0 or 1.
 @postrefcountsame{int_field_type}
 
 @sa bt_ctf_field_type_integer_is_signed(): Returns the signedness of
        the integer fields described by a given integer field type.
 */
 extern int bt_ctf_field_type_integer_set_is_signed(
-               struct bt_ctf_field_type *int_field_type, int is_signed);
+               struct bt_ctf_field_type *int_field_type, bt_bool is_signed);
 
 /* Pre-2.0 CTF writer compatibility */
 #define bt_ctf_field_type_integer_set_signed bt_ctf_field_type_integer_set_is_signed
@@ -883,8 +899,9 @@ extern int bt_ctf_field_type_integer_set_is_signed(
                                preferred display base.
 @returns                       Preferred display base of the integer
                                fields described by \p int_field_type,
-                               or #BT_CTF_INTEGER_BASE_UNKNOWN on
-                               error.
+                               #BT_CTF_INTEGER_BASE_UNSPECIFIED if
+                               not specified, or
+                               #BT_CTF_INTEGER_BASE_UNKNOWN on error.
 
 @prenotnull{int_field_type}
 @preisintft{int_field_type}
@@ -911,9 +928,9 @@ extern enum bt_ctf_integer_base bt_ctf_field_type_integer_get_base(
 @prenotnull{int_field_type}
 @preisintft{int_field_type}
 @prehot{int_field_type}
-@pre \p base is #BT_CTF_INTEGER_BASE_BINARY, #BT_CTF_INTEGER_BASE_OCTAL,
-       #BT_CTF_INTEGER_BASE_DECIMAL, or
-       #BT_CTF_INTEGER_BASE_HEXADECIMAL.
+@pre \p base is #BT_CTF_INTEGER_BASE_UNSPECIFIED,
+       #BT_CTF_INTEGER_BASE_BINARY, #BT_CTF_INTEGER_BASE_OCTAL,
+       #BT_CTF_INTEGER_BASE_DECIMAL, or #BT_CTF_INTEGER_BASE_HEXADECIMAL.
 @postrefcountsame{int_field_type}
 
 @sa bt_ctf_field_type_integer_get_base(): Returns the preferred display
@@ -1239,7 +1256,7 @@ An enumeration mapping has:
   value, both included in the range.
 
 You can add a mapping to an enumeration field type with
-bt_ctf_field_type_enumeration_add_mapping() or
+bt_ctf_field_type_enumeration_add_mapping_signed() or
 bt_ctf_field_type_enumeration_add_mapping_unsigned(), depending on the
 signedness of the wrapped @intft.
 
@@ -1566,10 +1583,13 @@ A mapping in \p enum_field_type can exist with the name \p name.
 @sa bt_ctf_field_type_enumeration_add_mapping_unsigned(): Adds an
        unsigned mapping to a given enumeration field type.
 */
-extern int bt_ctf_field_type_enumeration_add_mapping(
+extern int bt_ctf_field_type_enumeration_add_mapping_signed(
                struct bt_ctf_field_type *enum_field_type, const char *name,
                int64_t range_begin, int64_t range_end);
 
+/* Pre-2.0 CTF writer compatibility */
+#define bt_ctf_field_type_enumeration_add_mapping bt_ctf_field_type_enumeration_add_mapping_signed
+
 /**
 @brief Adds a mapping to the @enumft \p enum_field_type which maps
        the name \p name to the unsigned
@@ -1602,7 +1622,7 @@ A mapping in \p enum_field_type can exist with the name \p name.
 @pre \p range_end is greater than or equal to \p range_begin.
 @postrefcountsame{enum_field_type}
 
-@sa bt_ctf_field_type_enumeration_add_mapping(): Adds a signed
+@sa bt_ctf_field_type_enumeration_add_mapping_signed(): Adds a signed
        mapping to a given enumeration field type.
 */
 extern int bt_ctf_field_type_enumeration_add_mapping_unsigned(
This page took 0.028325 seconds and 4 git commands to generate.