ir: refactor FT validation and resolving
[babeltrace.git] / include / babeltrace / ctf-ir / event-types-internal.h
index ec114eb00369f8412f8d6b4f00dbc5dd058676d2..a8abef35ef6430c4d5ee42c9447094c7fddfd4f7 100644 (file)
@@ -54,9 +54,12 @@ enum bt_ctf_node {
 
 struct bt_ctf_field_path {
        enum bt_ctf_node root;
+
        /*
         * Array of integers (int) indicating the index in either
-        * structures or variants that make-up the path to a field.
+        * structures, variants, arrays, or sequences that make up
+        * the path to a field type. -1 means the "current element
+        * of an array or sequence type".
         */
        GArray *path_indexes;
 };
@@ -71,6 +74,13 @@ struct bt_ctf_field_type {
         * a field has been instanciated from it.
         */
        int frozen;
+
+       /*
+        * This flag indicates if the field type is valid. A valid
+        * field type is _always_ frozen. All the nested field types of
+        * a valid field type are also valid (and thus frozen).
+        */
+       int valid;
 };
 
 struct bt_ctf_field_type_integer {
@@ -110,6 +120,12 @@ struct bt_ctf_field_type_enumeration {
 struct bt_ctf_field_type_floating_point {
        struct bt_ctf_field_type parent;
        struct declaration_float declaration;
+
+       /*
+        * The `declaration` field above contains 3 pointers pointing
+        * to the fields below. This avoids unnecessary dynamic
+        * allocations.
+        */
        struct declaration_integer sign;
        struct declaration_integer mantissa;
        struct declaration_integer exp;
@@ -206,6 +222,9 @@ struct bt_ctf_field_type *bt_ctf_field_type_copy(
 BT_HIDDEN
 struct bt_ctf_field_path *bt_ctf_field_path_create(void);
 
+BT_HIDDEN
+void bt_ctf_field_path_clear(struct bt_ctf_field_path *field_path);
+
 BT_HIDDEN
 struct bt_ctf_field_path *bt_ctf_field_path_copy(
                struct bt_ctf_field_path *path);
@@ -262,4 +281,15 @@ BT_HIDDEN
 int bt_ctf_field_type_sequence_set_element_type(struct bt_ctf_field_type *array,
                struct bt_ctf_field_type *element_type);
 
+BT_HIDDEN
+int bt_ctf_field_type_get_field_count(struct bt_ctf_field_type *type);
+
+BT_HIDDEN
+struct bt_ctf_field_type *bt_ctf_field_type_get_field_at_index(
+               struct bt_ctf_field_type *type, int index);
+
+BT_HIDDEN
+int bt_ctf_field_type_get_field_index(struct bt_ctf_field_type *type,
+               const char *name);
+
 #endif /* BABELTRACE_CTF_IR_EVENT_TYPES_INTERNAL_H */
This page took 0.024558 seconds and 4 git commands to generate.