X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=include%2Fbabeltrace%2Fctf-ir%2Fevent-types-internal.h;h=ed085dabf27bce5bb3544f3e8160ee7108ad8a76;hb=83509119a945fc77faff869daaf48627e1c4b3fa;hp=8ae102b041e30c2b13936954603045bd717882f3;hpb=736133f1ae231a5bf12d45be43066d6825450efe;p=babeltrace.git diff --git a/include/babeltrace/ctf-ir/event-types-internal.h b/include/babeltrace/ctf-ir/event-types-internal.h index 8ae102b0..ed085dab 100644 --- a/include/babeltrace/ctf-ir/event-types-internal.h +++ b/include/babeltrace/ctf-ir/event-types-internal.h @@ -28,11 +28,11 @@ */ #include -#include #include #include #include #include +#include #include #include #include @@ -41,8 +41,28 @@ 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_object base; struct bt_declaration *declaration; type_freeze_func freeze; type_serialize_func serialize; @@ -103,6 +123,7 @@ struct bt_ctf_field_type_variant { struct bt_ctf_field_type parent; GString *tag_name; struct bt_ctf_field_type_enumeration *tag; + struct bt_ctf_field_path *tag_path; GHashTable *field_name_to_index; GPtrArray *fields; /* Array of pointers to struct structure_field */ struct declaration_variant declaration; @@ -119,6 +140,7 @@ struct bt_ctf_field_type_sequence { struct bt_ctf_field_type parent; struct bt_ctf_field_type *element_type; GString *length_field_name; + struct bt_ctf_field_path *length_field_path; struct declaration_sequence declaration; }; @@ -165,12 +187,55 @@ 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); +/* Replace an existing field's type in a structure */ +BT_HIDDEN +int bt_ctf_field_type_structure_set_field_index( + struct bt_ctf_field_type *structure, + struct bt_ctf_field_type *field, int index); + BT_HIDDEN int bt_ctf_field_type_variant_get_field_name_index( struct bt_ctf_field_type *variant, const char *name); + +BT_HIDDEN +int bt_ctf_field_type_sequence_set_length_field_path( + struct bt_ctf_field_type *type, + struct bt_ctf_field_path *path); + +BT_HIDDEN +struct bt_ctf_field_path *bt_ctf_field_type_sequence_get_length_field_path( + struct bt_ctf_field_type *type); + +BT_HIDDEN +int bt_ctf_field_type_variant_set_tag_field_path(struct bt_ctf_field_type *type, + struct bt_ctf_field_path *path); + +BT_HIDDEN +struct bt_ctf_field_path *bt_ctf_field_type_variant_get_tag_field_path( + struct bt_ctf_field_type *type); + +BT_HIDDEN +int bt_ctf_field_type_variant_set_tag(struct bt_ctf_field_type *type, + struct bt_ctf_field_type *tag); + +/* Replace an existing field's type in a variant */ +BT_HIDDEN +int bt_ctf_field_type_variant_set_field_index( + struct bt_ctf_field_type *variant, + struct bt_ctf_field_type *field, int index); + #endif /* BABELTRACE_CTF_IR_EVENT_TYPES_INTERNAL_H */