lib: make discarded events/packets support and clock snapshots optional
[babeltrace.git] / bindings / python / bt2 / bt2 / stream_class.py
index c599dc2a01bd32597a21bf06db8707419002907f..20dd006c9880327098a8eec4d82ecd81c7d590c3 100644 (file)
@@ -61,12 +61,12 @@ class StreamClass(object._SharedObject, collections.abc.Mapping):
                            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')
+                raise ValueError('id provided, but stream class assigns automatic event class ids')
 
             ec_ptr = native_bt.event_class_create(self._ptr)
         else:
             if id is None:
-                raise bt2.CreationError('id not provided, but stream class does not assign automatic event class ids')
+                raise ValueError('id not provided, but stream class does not assign automatic event class ids')
 
             utils._check_uint64(id)
             ec_ptr = native_bt.event_class_create_with_id(self._ptr, id)
@@ -148,6 +148,40 @@ class StreamClass(object._SharedObject, collections.abc.Mapping):
 
     _packets_have_default_end_clock_snapshot = property(fset=_packets_have_default_end_clock_snapshot)
 
+    @property
+    def supports_discarded_events(self):
+        return native_bt.stream_class_supports_discarded_events(self._ptr)
+
+    def _set_supports_discarded_events(self, supports, with_cs=False):
+        utils._check_bool(supports)
+        utils._check_bool(with_cs)
+
+        if not supports and with_cs:
+            raise ValueError('cannot not support discarded events, but have default clock snapshots')
+
+        native_bt.stream_class_set_supports_discarded_events(self._ptr, supports, with_cs)
+
+    @property
+    def discarded_events_have_default_clock_snapshots(self):
+        return native_bt.stream_class_discarded_events_have_default_clock_snapshots(self._ptr)
+
+    @property
+    def supports_discarded_packets(self):
+        return native_bt.stream_class_supports_discarded_packets(self._ptr)
+
+    def _set_supports_discarded_packets(self, supports, with_cs):
+        utils._check_bool(supports)
+        utils._check_bool(with_cs)
+
+        if not supports and with_cs:
+            raise ValueError('cannot not support discarded packets, but have default clock snapshots')
+
+        native_bt.stream_class_set_supports_discarded_packets(self._ptr, supports, with_cs)
+
+    @property
+    def discarded_packets_have_default_clock_snapshots(self):
+        return native_bt.stream_class_discarded_packets_have_default_clock_snapshots(self._ptr)
+
     @property
     def id(self):
         id = native_bt.stream_class_get_id(self._ptr)
@@ -224,10 +258,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.048309 seconds and 4 git commands to generate.