X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=include%2Fbabeltrace%2Fctf-ir%2Fevent-types-internal.h;h=a8abef35ef6430c4d5ee42c9447094c7fddfd4f7;hb=09840de5d022697671dafe2bed427fa5c09b40b9;hp=8475198be676bc0f1860059c68807f98140c668f;hpb=5cec03e402aaee5fe314e03f366363a617a7d0c8;p=babeltrace.git diff --git a/include/babeltrace/ctf-ir/event-types-internal.h b/include/babeltrace/ctf-ir/event-types-internal.h index 8475198b..a8abef35 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 @@ -54,15 +54,18 @@ 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; }; 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; @@ -71,12 +74,27 @@ 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 { struct bt_ctf_field_type parent; struct declaration_integer declaration; struct bt_ctf_clock *mapped_clock; + + /* + * This is what the user sets and is never modified by internal + * code. + * + * This field must contain a `BT_CTF_BYTE_ORDER_*` value. + */ + enum bt_ctf_byte_order user_byte_order; }; struct enumeration_mapping { @@ -95,16 +113,30 @@ struct enumeration_mapping { struct bt_ctf_field_type_enumeration { struct bt_ctf_field_type parent; struct bt_ctf_field_type *container; - GPtrArray *entries; /* Array of pointers to struct enum_mapping */ + GPtrArray *entries; /* Array of ptrs to struct enumeration_mapping */ struct declaration_enum declaration; }; 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; + + /* + * This is what the user sets and is never modified by internal + * code. + * + * This field must contain a `BT_CTF_BYTE_ORDER_*` value. + */ + enum bt_ctf_byte_order user_byte_order; }; struct structure_field { @@ -190,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); @@ -216,10 +251,18 @@ 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); @@ -230,4 +273,23 @@ int bt_ctf_field_type_variant_set_field_index( struct bt_ctf_field_type *variant, struct bt_ctf_field_type *field, int index); +BT_HIDDEN +int bt_ctf_field_type_array_set_element_type(struct bt_ctf_field_type *array, + struct bt_ctf_field_type *element_type); + +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 */