Add bt_ctf_field_type_copy() which allows deep copy of IR types
[babeltrace.git] / include / babeltrace / ctf-ir / event-types-internal.h
index 27e4a17503eef04700056a1f4f3a42473ea95813..8c3ce2b833e9a9b7011555371e498c3b95b4fc2b 100644 (file)
@@ -4,7 +4,7 @@
 /*
  * BabelTrace - CTF IR: Event types internal
  *
- * Copyright 2013 EfficiOS Inc.
+ * Copyright 2013, 2014 Jérémie Galarneau <jeremie.galarneau@efficios.com>
  *
  * Author: Jérémie Galarneau <jeremie.galarneau@efficios.com>
  *
@@ -31,7 +31,7 @@
 #include <babeltrace/ctf-writer/ref-internal.h>
 #include <babeltrace/ctf-writer/event-fields.h>
 #include <babeltrace/ctf-writer/writer.h>
-#include <babeltrace/ctf-writer/writer-internal.h>
+#include <babeltrace/ctf-ir/trace-internal.h>
 #include <babeltrace/babeltrace-internal.h>
 #include <babeltrace/types.h>
 #include <babeltrace/ctf/events.h>
@@ -44,6 +44,7 @@ typedef int(*type_serialize_func)(struct bt_ctf_field_type *,
 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;
        /*
@@ -56,11 +57,19 @@ struct bt_ctf_field_type {
 struct bt_ctf_field_type_integer {
        struct bt_ctf_field_type parent;
        struct declaration_integer declaration;
+       struct bt_ctf_clock *mapped_clock;
 };
 
 struct enumeration_mapping {
-       int64_t range_start;
-       int64_t range_end;
+       union {
+               uint64_t _unsigned;
+               int64_t _signed;
+       } range_start;
+
+       union {
+               uint64_t _unsigned;
+               int64_t _signed;
+       } range_end;
        GQuark string;
 };
 
@@ -88,7 +97,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 {
@@ -123,31 +132,38 @@ BT_HIDDEN
 void bt_ctf_field_type_freeze(struct bt_ctf_field_type *type);
 
 BT_HIDDEN
-enum ctf_type_id bt_ctf_field_type_get_type_id(
-               struct bt_ctf_field_type *type);
+struct bt_ctf_field_type *bt_ctf_field_type_variant_get_field_type_signed(
+               struct bt_ctf_field_type_variant *variant, int64_t tag_value);
 
 BT_HIDDEN
-struct bt_ctf_field_type *bt_ctf_field_type_structure_get_type(
-               struct bt_ctf_field_type_structure *structure,
-               const char *name);
+struct bt_ctf_field_type *bt_ctf_field_type_variant_get_field_type_unsigned(
+               struct bt_ctf_field_type_variant *variant, uint64_t tag_value);
 
 BT_HIDDEN
-struct bt_ctf_field_type *bt_ctf_field_type_array_get_element_type(
-               struct bt_ctf_field_type_array *array);
+int bt_ctf_field_type_serialize(struct bt_ctf_field_type *type,
+               struct metadata_context *context);
 
 BT_HIDDEN
-struct bt_ctf_field_type *bt_ctf_field_type_sequence_get_element_type(
-               struct bt_ctf_field_type_sequence *sequence);
+int bt_ctf_field_type_validate(struct bt_ctf_field_type *type);
 
 BT_HIDDEN
-struct bt_ctf_field_type *bt_ctf_field_type_variant_get_field_type(
-               struct bt_ctf_field_type_variant *variant, int64_t tag_value);
+const char *bt_ctf_field_type_enumeration_get_mapping_name_unsigned(
+               struct bt_ctf_field_type_enumeration *enumeration_type,
+               uint64_t value);
 
 BT_HIDDEN
-int bt_ctf_field_type_serialize(struct bt_ctf_field_type *type,
-               struct metadata_context *context);
+const char *bt_ctf_field_type_enumeration_get_mapping_name_signed(
+               struct bt_ctf_field_type_enumeration *enumeration_type,
+               int64_t value);
 
+/* Override field type's byte order only if it is set to "native" */
 BT_HIDDEN
-int bt_ctf_field_type_validate(struct bt_ctf_field_type *type);
+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);
 
 #endif /* BABELTRACE_CTF_IR_EVENT_TYPES_INTERNAL_H */
This page took 0.062296 seconds and 4 git commands to generate.