Make API CTF-agnostic
[babeltrace.git] / include / babeltrace / ctf-ir / trace-internal.h
index dc0b7069e196f39457049ac66031eea703f411dd..30b0ba4f697a62d2c0f6aef05e264f10cb13fe80 100644 (file)
  * SOFTWARE.
  */
 
-#include <babeltrace/ctf-writer/ref-internal.h>
+#include <babeltrace/assert-pre-internal.h>
 #include <babeltrace/ctf-ir/trace.h>
-#include <babeltrace/ctf-ir/event-types.h>
-#include <babeltrace/ctf-ir/event-fields.h>
+#include <babeltrace/ctf-ir/stream-class-internal.h>
+#include <babeltrace/ctf-ir/field-types.h>
+#include <babeltrace/ctf-ir/fields.h>
+#include <babeltrace/ctf-ir/attributes-internal.h>
+#include <babeltrace/ctf-ir/clock-class-internal.h>
+#include <babeltrace/object-internal.h>
+#include <babeltrace/object-pool-internal.h>
 #include <babeltrace/babeltrace-internal.h>
+#include <babeltrace/values.h>
+#include <babeltrace/types.h>
 #include <glib.h>
 #include <sys/types.h>
-#include <uuid/uuid.h>
-
-enum field_type_alias {
-       FIELD_TYPE_ALIAS_UINT5_T = 0,
-       FIELD_TYPE_ALIAS_UINT8_T,
-       FIELD_TYPE_ALIAS_UINT16_T,
-       FIELD_TYPE_ALIAS_UINT27_T,
-       FIELD_TYPE_ALIAS_UINT32_T,
-       FIELD_TYPE_ALIAS_UINT64_T,
-       NR_FIELD_TYPE_ALIAS,
-};
+#include <babeltrace/compat/uuid-internal.h>
 
-struct bt_ctf_trace {
-       struct bt_ctf_ref ref_count;
-       int frozen;
-       uuid_t uuid;
-       int byte_order;
-       GPtrArray *environment; /* Array of pointers to environment_variable */
-       GPtrArray *clocks; /* Array of pointers to bt_ctf_clock */
-       GPtrArray *stream_classes; /* Array of ptrs to bt_ctf_stream_class */
-       GPtrArray *streams; /* Array of ptrs to bt_ctf_stream */
-       struct bt_ctf_field_type *packet_header_type;
-       uint64_t next_stream_id;
-};
+struct bt_trace {
+       struct bt_object base;
 
-struct environment_variable {
-       GString *name, *value;
-};
+       struct {
+               GString *str;
+
+               /* NULL or `str->str` above */
+               const char *value;
+       } name;
+
+       struct {
+               uint8_t uuid[BABELTRACE_UUID_LEN];
+
+               /* NULL or `uuid` above */
+               bt_uuid value;
+       } uuid;
+
+       struct bt_value *environment;
 
-struct metadata_context {
-       GString *string;
-       GString *field_name;
-       unsigned int current_indentation_level;
+       /* Array of `struct bt_stream_class *` */
+       GPtrArray *stream_classes;
+
+       /* Array of `struct bt_stream *` */
+       GPtrArray *streams;
+
+       /*
+        * Stream class (weak) to number of instantiated streams, used
+        * to automatically assign stream IDs per stream class.
+        */
+       GHashTable *stream_classes_stream_count;
+
+       struct bt_field_type *packet_header_ft;
+       bool assigns_automatic_stream_class_id;
+
+       GArray *is_static_listeners;
+       bool is_static;
+       bool in_remove_listener;
+
+       /* Pool of `struct bt_field_wrapper *` */
+       struct bt_object_pool packet_header_field_pool;
+
+       bool frozen;
 };
 
-/* Checks that the string does not contain a reserved keyword */
 BT_HIDDEN
-int validate_identifier(const char *string);
+void _bt_trace_freeze(struct bt_trace *trace);
+
+#ifdef BT_DEV_MODE
+# define bt_trace_freeze               _bt_trace_freeze
+#else
+# define bt_trace_freeze(_trace)
+#endif
 
 BT_HIDDEN
-const char *get_byte_order_string(int byte_order);
+void bt_trace_add_stream(struct bt_trace *trace, struct bt_stream *stream);
 
 BT_HIDDEN
-struct bt_ctf_field_type *get_field_type(enum field_type_alias alias);
+uint64_t bt_trace_get_automatic_stream_id(struct bt_trace *trace,
+               struct bt_stream_class *stream_class);
 
 #endif /* BABELTRACE_CTF_IR_TRACE_INTERNAL_H */
This page took 0.027294 seconds and 4 git commands to generate.