bt2: Adapt test_message_iterator.py and make it pass
[babeltrace.git] / bindings / python / bt2 / bt2 / stream_class.py
index 0f9ac121aff58634fcfab42309c9f5009602f67b..f2869cb98cd50f11fbfe0063ea6f242d78ae3390 100644 (file)
@@ -56,7 +56,9 @@ class StreamClass(object._SharedObject, collections.abc.Mapping):
 
             yield id
 
-    def create_event_class(self, id=None):
+    def create_event_class(self, id=None, name=None, log_level=None, emf_uri=None,
+                           specific_context_field_class=None,
+                           payload_field_class=None):
         if self.assigns_automatic_event_class_id:
             if id is not None:
                 raise bt2.CreationError('id provided, but stream class assigns automatic event class ids')
@@ -69,7 +71,24 @@ class StreamClass(object._SharedObject, collections.abc.Mapping):
             utils._check_uint64(id)
             ec_ptr = native_bt.event_class_create_with_id(self._ptr, id)
 
-        return bt2.event_class.EventClass._create_from_ptr(ec_ptr)
+        event_class = bt2.event_class.EventClass._create_from_ptr(ec_ptr)
+
+        if name is not None:
+            event_class._name = name
+
+        if log_level is not None:
+            event_class._log_level = log_level
+
+        if emf_uri is not None:
+            event_class._emf_uri = emf_uri
+
+        if specific_context_field_class is not None:
+            event_class._specific_context_field_class = specific_context_field_class
+
+        if payload_field_class is not None:
+            event_class._payload_field_class = payload_field_class
+
+        return event_class
 
     @property
     def trace_class(self):
@@ -205,10 +224,10 @@ class StreamClass(object._SharedObject, collections.abc.Mapping):
         if cc_ptr is None:
             return
 
-        return bt2.clock_class.ClockClass._create_from_ptr_and_get_ref(cc_ptr)
+        return bt2.clock_class._ClockClass._create_from_ptr_and_get_ref(cc_ptr)
 
     def _default_clock_class(self, clock_class):
-        utils._check_type(clock_class, bt2.clock_class.ClockClass)
+        utils._check_type(clock_class, bt2.clock_class._ClockClass)
         native_bt.stream_class_set_default_clock_class(
             self._ptr, clock_class._ptr)
 
This page took 0.023252 seconds and 4 git commands to generate.