ALIASES += varfields="\link ctfirvarfield CTF IR variant fields\endlink"
ALIASES += imgpacketstructure="@image html ctf-stream-packet.png \"Structure of a CTF packet.\""
ALIASES += imgtracestructure="@image html ctf-trace.png \"Structure of a CTF trace.\""
+ALIASES += noteexamplesassert="@note In the following examples, we use \c assert() to validate the results of the called functions."
OPTIMIZE_OUTPUT_FOR_C = YES
MARKDOWN_SUPPORT = YES
TOC_INCLUDE_HEADINGS = 0
"@srcdir@/dox/write-plugin.dox" \
"@srcdir@/dox/use-ctf-writer.dox" \
"@srcdir@/dox/examples.dox" \
+ "@srcdir@/dox/examples-ctfir.dox" \
"@srcdir@/dox/group-api-ref.dox" \
"@srcdir@/dox/group-ctf-ir.dox"
INPUT_ENCODING = UTF-8
--- /dev/null
+/**
+@page ctfirexamples CTF IR examples
+
+<strong>List of CTF IR examples</strong>:
+
+- @subpage ctfirfieldtypesexamples CTF IR field types examples
+
+@sa ctfir (API reference)
+
+
+@page ctfirfieldtypesexamples CTF IR field types examples
+
+This page contains usage examples of the \ref ctfirfieldtypes API.
+
+@noteexamplesassert
+
+
+@section ctfirfieldtypesexamples_intfieldtype Integer field type
+
+@sa ctfirintfieldtype
+
+@subsection ctfirfieldtypesexamples_intfieldtype0 Create a default, 16-bit integer field type
+
+@code{.c}
+#include <assert.h>
+#include <babeltrace/ctf-ir/field-types.h>
+
+struct bt_ctf_field_type *create_int_field_type(void)
+{
+ struct bt_ctf_field_type *field_type;
+
+ field_type = bt_ctf_field_type_integer_create(16);
+ assert(field_type);
+
+ return field_type;
+}
+@endcode
+
+@subsection ctfirfieldtypesexamples_intfieldtype1 Create a 23-bit, signed, big-endian integer field type
+
+@code{.c}
+#include <assert.h>
+#include <babeltrace/ctf-ir/field-types.h>
+
+struct bt_ctf_field_type *create_int_field_type(void)
+{
+ int ret;
+ struct bt_ctf_field_type *field_type;
+
+ field_type = bt_ctf_field_type_integer_create(23);
+ assert(field_type);
+
+ ret = bt_ctf_field_type_set_byte_order(field_type,
+ BT_CTF_BYTE_ORDER_BIG_ENDIAN);
+ assert(ret == 0);
+
+ ret = bt_ctf_field_type_integer_set_signed(field_type, 1);
+ assert(ret == 0);
+
+ return field_type;
+}
+@endcode
+
+@subsection ctfirfieldtypesexamples_intfieldtype2 Create an 8-bit integer field type, displayed in hexadecimal, mapped to a CTF IR clock class
+
+@code{.c}
+#include <assert.h>
+#include <babeltrace/ctf-ir/field-types.h>
+
+struct bt_ctf_field_type *create_int_field_type(
+ struct bt_ctf_clock_class *clock_class)
+{
+ int ret;
+ struct bt_ctf_field_type *field_type;
+
+ field_type = bt_ctf_field_type_integer_create(8);
+ assert(field_type);
+
+ ret = bt_ctf_field_type_integer_set_base(field_type,
+ BT_CTF_INTEGER_BASE_HEXADECIMAL);
+ assert(ret == 0);
+
+ ret = bt_ctf_field_type_integer_set_mapped_clock(field_type, clock_class);
+ assert(ret == 0);
+
+ return field_type;
+}
+@endcode
+
+
+@section ctfirfieldtypesexamples_floatfieldtype Floating point number field type
+
+@sa ctfirfloatfieldtype
+
+@subsection ctfirfieldtypesexamples_floatfieldtype0 Create a default floating point number field type
+
+@code{.c}
+#include <assert.h>
+#include <babeltrace/ctf-ir/field-types.h>
+
+struct bt_ctf_field_type *create_float_field_type(void)
+{
+ struct bt_ctf_field_type *field_type;
+
+ field_type = bt_ctf_field_type_floating_point_create();
+ assert(field_type);
+
+ return field_type;
+}
+@endcode
+
+@subsection ctfirfieldtypesexamples_floatfieldtype1 Create a "double", little-endian floating point number field type
+
+@code{.c}
+#include <assert.h>
+#include <babeltrace/ctf-ir/field-types.h>
+
+struct bt_ctf_field_type *create_float_field_type(void)
+{
+ int ret;
+ struct bt_ctf_field_type *field_type;
+
+ field_type = bt_ctf_field_type_floating_point_create();
+ assert(field_type);
+
+ ret = bt_ctf_field_type_set_byte_order(field_type,
+ BT_CTF_BYTE_ORDER_LITTLE_ENDIAN);
+ assert(ret == 0);
+
+ ret = bt_ctf_field_type_floating_point_set_exponent_digits(field_type, 11);
+ assert(ret == 0);
+
+ ret = bt_ctf_field_type_floating_point_set_mantissa_digits(field_type, 53);
+ assert(ret == 0);
+
+ return field_type;
+}
+@endcode
+*/