bt2: template borrow_user_attributes method in _TraceClassConst, _StreamClassConst...
authorSimon Marchi <simon.marchi@efficios.com>
Wed, 11 Sep 2019 15:35:50 +0000 (11:35 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 3 Oct 2019 14:45:10 +0000 (10:45 -0400)
Change-Id: I74fc9a490278930f980ed8994b98fd7af37c959b
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2029
CI-Build: Francis Deslauriers <francis.deslauriers@efficios.com>
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
src/bindings/python/bt2/bt2/clock_class.py
src/bindings/python/bt2/bt2/stream_class.py
src/bindings/python/bt2/bt2/trace_class.py

index 3e5297bcc359375ab93a5ba79def235ac70c4657..71827b884006d13b40fbcca9f52cab4e4d599e47 100644 (file)
@@ -54,10 +54,13 @@ class _ClockClassConst(object._SharedObject):
     _create_value_from_ptr_and_get_ref = staticmethod(
         bt2_value._create_from_const_ptr_and_get_ref
     )
+    _borrow_user_attributes_ptr = staticmethod(
+        native_bt.clock_class_borrow_user_attributes_const
+    )
 
     @property
     def user_attributes(self):
-        ptr = native_bt.clock_class_borrow_user_attributes(self._ptr)
+        ptr = self._borrow_user_attributes_ptr(self._ptr)
         assert ptr is not None
         return self._create_value_from_ptr_and_get_ref(ptr)
 
@@ -108,6 +111,9 @@ class _ClockClass(_ClockClassConst):
     _create_value_from_ptr_and_get_ref = staticmethod(
         bt2_value._create_from_ptr_and_get_ref
     )
+    _borrow_user_attributes_ptr = staticmethod(
+        native_bt.clock_class_borrow_user_attributes
+    )
 
     def _user_attributes(self, user_attributes):
         value = bt2_value.create_value(user_attributes)
index 8a65fac7f8ba92a2c94c500975001ba79d81cf15..609fe3b29dbb8223589c1d96ae41515eea0f1017 100644 (file)
@@ -50,6 +50,9 @@ class _StreamClassConst(object._SharedObject, collections.abc.Mapping):
     _borrow_default_clock_class_ptr = staticmethod(
         native_bt.stream_class_borrow_default_clock_class_const
     )
+    _borrow_user_attributes_ptr = staticmethod(
+        native_bt.stream_class_borrow_user_attributes_const
+    )
 
     _event_class_cls = property(lambda _: bt2_event_class._EventClassConst)
     _trace_class_cls = property(lambda _: bt2_trace_class._TraceClassConst)
@@ -88,7 +91,7 @@ class _StreamClassConst(object._SharedObject, collections.abc.Mapping):
 
     @property
     def user_attributes(self):
-        ptr = native_bt.stream_class_borrow_user_attributes(self._ptr)
+        ptr = self._borrow_user_attributes_ptr(self._ptr)
         assert ptr is not None
         return bt2_value._create_from_ptr_and_get_ref(ptr)
 
@@ -193,6 +196,10 @@ class _StreamClass(_StreamClassConst):
     _borrow_default_clock_class_ptr = staticmethod(
         native_bt.stream_class_borrow_default_clock_class
     )
+    _borrow_user_attributes_ptr = staticmethod(
+        native_bt.stream_class_borrow_user_attributes
+    )
+
     _event_class_cls = property(lambda s: bt2_event_class._EventClass)
     _trace_class_cls = property(lambda s: bt2_trace_class._TraceClass)
     _clock_class_cls = property(lambda s: bt2_clock_class._ClockClass)
index 94343552b01031238c32dab38e7c23e52fd371f8..e3162915e2ec944281bc9b06c77ebe4f277b92d1 100644 (file)
@@ -47,6 +47,9 @@ class _TraceClassConst(object._SharedObject, collections.abc.Mapping):
     _borrow_stream_class_ptr_by_id = staticmethod(
         native_bt.trace_class_borrow_stream_class_by_id_const
     )
+    _borrow_user_attributes_ptr = staticmethod(
+        native_bt.trace_class_borrow_user_attributes_const
+    )
     _stream_class_pycls = bt2_stream_class._StreamClassConst
     _create_value_from_ptr_and_get_ref = staticmethod(
         bt2_value._create_from_const_ptr_and_get_ref
@@ -54,7 +57,7 @@ class _TraceClassConst(object._SharedObject, collections.abc.Mapping):
 
     @property
     def user_attributes(self):
-        ptr = native_bt.trace_class_borrow_user_attributes(self._ptr)
+        ptr = self._borrow_user_attributes_ptr(self._ptr)
         assert ptr is not None
         return self._create_value_from_ptr_and_get_ref(ptr)
 
@@ -117,6 +120,9 @@ class _TraceClass(_TraceClassConst):
     _borrow_stream_class_ptr_by_id = staticmethod(
         native_bt.trace_class_borrow_stream_class_by_id
     )
+    _borrow_user_attributes_ptr = staticmethod(
+        native_bt.trace_class_borrow_user_attributes
+    )
     _stream_class_pycls = bt2_stream_class._StreamClass
     _create_value_from_ptr_and_get_ref = staticmethod(
         bt2_value._create_from_ptr_and_get_ref
This page took 0.02827 seconds and 4 git commands to generate.