X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=src%2Fbindings%2Fpython%2Fbt2%2Fbt2%2Fevent_class.py;h=8d9d54dcc8fe7fae316a23a7d6b4343b23cfa6e5;hb=5783664e46332216fd38a7b287258a7c9543af57;hp=00aae1b1def18a490ede769621f317e9d7db5753;hpb=cfbd7cf3bde05e8a6606478889dcd663604ef7b5;p=babeltrace.git diff --git a/src/bindings/python/bt2/bt2/event_class.py b/src/bindings/python/bt2/bt2/event_class.py index 00aae1b1..8d9d54dc 100644 --- a/src/bindings/python/bt2/bt2/event_class.py +++ b/src/bindings/python/bt2/bt2/event_class.py @@ -21,9 +21,10 @@ # THE SOFTWARE. from bt2 import native_bt, object, utils -import bt2.field_class -import bt2.value -import bt2.event +from bt2 import field_class as bt2_field_class +from bt2 import value as bt2_value +from bt2 import event as bt2_event +from bt2 import stream_class as bt2_stream_class import bt2 @@ -54,7 +55,20 @@ class _EventClass(object._SharedObject): sc_ptr = native_bt.event_class_borrow_stream_class(self._ptr) if sc_ptr is not None: - return bt2.stream_class._StreamClass._create_from_ptr_and_get_ref(sc_ptr) + 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): @@ -126,11 +140,11 @@ class _EventClass(object._SharedObject): if fc_ptr is None: return - return bt2.field_class._create_field_class_from_ptr_and_get_ref(fc_ptr) + return bt2_field_class._create_field_class_from_ptr_and_get_ref(fc_ptr) def _specific_context_field_class(self, context_field_class): if context_field_class is not None: - utils._check_type(context_field_class, bt2.field_class._StructureFieldClass) + utils._check_type(context_field_class, bt2_field_class._StructureFieldClass) status = native_bt.event_class_set_specific_context_field_class( self._ptr, context_field_class._ptr ) @@ -147,11 +161,11 @@ class _EventClass(object._SharedObject): if fc_ptr is None: return - return bt2.field_class._create_field_class_from_ptr_and_get_ref(fc_ptr) + return bt2_field_class._create_field_class_from_ptr_and_get_ref(fc_ptr) def _payload_field_class(self, payload_field_class): if payload_field_class is not None: - utils._check_type(payload_field_class, bt2.field_class._StructureFieldClass) + utils._check_type(payload_field_class, bt2_field_class._StructureFieldClass) status = native_bt.event_class_set_payload_field_class( self._ptr, payload_field_class._ptr )