+ /*
+ * We disallow the creation of an event if its event class has not been
+ * associated to a stream class.
+ */
+ if (!stream_class) {
+ goto error;
+ }
+
+ /* A stream class should always have an existing event header type */
+ assert(stream_class->event_header_type);
+
+ /* The event class was frozen when added to its stream class */
+ assert(event_class->frozen);
+
+ /* Validate the trace (if any), the stream class, and the event class */
+ trace = bt_ctf_stream_class_get_trace(stream_class);
+ if (trace) {
+ packet_header_type = bt_ctf_trace_get_packet_header_type(trace);
+ trace_valid = trace->valid;
+ assert(trace_valid);
+ environment = trace->environment;
+ }
+
+ packet_context_type = bt_ctf_stream_class_get_packet_context_type(
+ stream_class);
+ event_header_type = bt_ctf_stream_class_get_event_header_type(
+ stream_class);
+ stream_event_ctx_type = bt_ctf_stream_class_get_event_context_type(
+ stream_class);
+ event_context_type = bt_ctf_event_class_get_context_type(event_class);
+ event_payload_type = bt_ctf_event_class_get_payload_type(event_class);
+ ret = bt_ctf_validate_class_types(environment, packet_header_type,
+ packet_context_type, event_header_type, stream_event_ctx_type,
+ event_context_type, event_payload_type, trace_valid,
+ stream_class->valid, event_class->valid,
+ &validation_output, validation_flags);
+ BT_PUT(packet_header_type);
+ BT_PUT(packet_context_type);
+ BT_PUT(event_header_type);
+ BT_PUT(stream_event_ctx_type);
+ BT_PUT(event_context_type);
+ BT_PUT(event_payload_type);
+ if (ret) {