ir: add bt_ctf_field_path internal API
[babeltrace.git] / include / babeltrace / ctf-ir / event-types-internal.h
index 217a89488982ac12693a7225a894ea765da63006..b420a5799fa0920d0d472db21b934774b6ba4d0f 100644 (file)
 #include <babeltrace/ctf/events.h>
 #include <glib.h>
 
-typedef void(*type_freeze_func)(struct bt_ctf_field_type *);
-typedef int(*type_serialize_func)(struct bt_ctf_field_type *,
+typedef void (*type_freeze_func)(struct bt_ctf_field_type *);
+typedef int (*type_serialize_func)(struct bt_ctf_field_type *,
                struct metadata_context *);
 
+enum bt_ctf_node {
+       CTF_NODE_UNKNOWN = -1,
+       CTF_NODE_ENV = 0,
+       CTF_NODE_TRACE_PACKET_HEADER = 1,
+       CTF_NODE_STREAM_PACKET_CONTEXT = 2,
+       CTF_NODE_STREAM_EVENT_HEADER = 3,
+       CTF_NODE_STREAM_EVENT_CONTEXT = 4,
+       CTF_NODE_EVENT_CONTEXT = 5,
+       CTF_NODE_EVENT_FIELDS = 6,
+};
+
+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.
+        */
+       GArray *path_indexes;
+};
+
 struct bt_ctf_field_type {
        struct bt_ctf_ref ref_count;
        struct bt_declaration *declaration;
-       GString *alias_name;
        type_freeze_func freeze;
        type_serialize_func serialize;
        /*
@@ -97,7 +116,7 @@ struct bt_ctf_field_type_structure {
        struct bt_ctf_field_type parent;
        GHashTable *field_name_to_index;
        GPtrArray *fields; /* Array of pointers to struct structure_field */
-       struct declaration_enum declaration;
+       struct declaration_struct declaration;
 };
 
 struct bt_ctf_field_type_variant {
@@ -160,4 +179,27 @@ const char *bt_ctf_field_type_enumeration_get_mapping_name_signed(
 BT_HIDDEN
 void bt_ctf_field_type_set_native_byte_order(
                struct bt_ctf_field_type *type, int byte_order);
+
+/* Deep copy a field type */
+BT_HIDDEN
+struct bt_ctf_field_type *bt_ctf_field_type_copy(
+               struct bt_ctf_field_type *type);
+
+BT_HIDDEN
+struct bt_ctf_field_path *bt_ctf_field_path_create(void);
+
+BT_HIDDEN
+struct bt_ctf_field_path *bt_ctf_field_path_copy(
+               struct bt_ctf_field_path *path);
+
+BT_HIDDEN
+void bt_ctf_field_path_destroy(struct bt_ctf_field_path *path);
+
+BT_HIDDEN
+int bt_ctf_field_type_structure_get_field_name_index(
+               struct bt_ctf_field_type *structure, const char *name);
+
+BT_HIDDEN
+int bt_ctf_field_type_variant_get_field_name_index(
+               struct bt_ctf_field_type *variant, const char *name);
 #endif /* BABELTRACE_CTF_IR_EVENT_TYPES_INTERNAL_H */
This page took 0.024872 seconds and 4 git commands to generate.