X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=src%2Fbindings%2Fpython%2Fbt2%2Fbt2%2Fstream.py;h=264d5477f45fc948253db6abb702f3d071003c18;hb=5783664e46332216fd38a7b287258a7c9543af57;hp=308924e937384e003a074869c22a4abece677f52;hpb=e071d36f57dc014a7892fe603cab7e7a36bf348c;p=babeltrace.git diff --git a/src/bindings/python/bt2/bt2/stream.py b/src/bindings/python/bt2/bt2/stream.py index 308924e9..264d5477 100644 --- a/src/bindings/python/bt2/bt2/stream.py +++ b/src/bindings/python/bt2/bt2/stream.py @@ -23,9 +23,9 @@ from bt2 import native_bt, utils from bt2 import object as bt2_object from bt2 import packet as bt2_packet -from bt2 import event as bt2_event from bt2 import trace as bt2_trace from bt2 import stream_class as bt2_stream_class +from bt2 import value as bt2_value import bt2 @@ -51,6 +51,19 @@ class _Stream(bt2_object._SharedObject): _name = property(fset=_name) + @property + def user_attributes(self): + ptr = native_bt.stream_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.stream_set_user_attributes(self._ptr, value._ptr) + + _user_attributes = property(fset=_user_attributes) + @property def id(self): id = native_bt.stream_get_id(self._ptr)