bt2: add user attributes property support
[babeltrace.git] / src / bindings / python / bt2 / bt2 / event_class.py
index dfef62137f3315e10b195d73e87a1455256b1c3e..8d9d54dcc8fe7fae316a23a7d6b4343b23cfa6e5 100644 (file)
@@ -57,6 +57,19 @@ class _EventClass(object._SharedObject):
         if sc_ptr is not None:
             return bt2_stream_class._StreamClass._create_from_ptr_and_get_ref(sc_ptr)
 
+    @property
+    def user_attributes(self):
+        ptr = native_bt.event_class_borrow_user_attributes(self._ptr)
+        assert ptr is not None
+        return bt2_value._create_from_ptr_and_get_ref(ptr)
+
+    def _user_attributes(self, user_attributes):
+        value = bt2_value.create_value(user_attributes)
+        utils._check_type(value, bt2_value.MapValue)
+        native_bt.event_class_set_user_attributes(self._ptr, value._ptr)
+
+    _user_attributes = property(fset=_user_attributes)
+
     @property
     def name(self):
         return native_bt.event_class_get_name(self._ptr)
This page took 0.030365 seconds and 4 git commands to generate.