X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=src%2Fbindings%2Fpython%2Fbt2%2Fbt2%2Fclock_class.py;h=953a2185b2d8c3926d1b57873c959237379d4b2c;hb=5783664e46332216fd38a7b287258a7c9543af57;hp=a8247dfbf4244ea72b53fbed26d480b4549b67d3;hpb=48be9a9176ef8d3a81390d43769093d91e9d5227;p=babeltrace.git diff --git a/src/bindings/python/bt2/bt2/clock_class.py b/src/bindings/python/bt2/bt2/clock_class.py index a8247dfb..953a2185 100644 --- a/src/bindings/python/bt2/bt2/clock_class.py +++ b/src/bindings/python/bt2/bt2/clock_class.py @@ -21,6 +21,7 @@ # THE SOFTWARE. from bt2 import native_bt, object, utils +from bt2 import value as bt2_value import uuid as uuidp @@ -51,6 +52,19 @@ class _ClockClass(object._SharedObject): _get_ref = staticmethod(native_bt.clock_class_get_ref) _put_ref = staticmethod(native_bt.clock_class_put_ref) + @property + def user_attributes(self): + ptr = native_bt.clock_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.clock_class_set_user_attributes(self._ptr, value._ptr) + + _user_attributes = property(fset=_user_attributes) + @property def name(self): return native_bt.clock_class_get_name(self._ptr)