def event_class_with_id(self, id): utils._check_int64(id) ec_ptr = native_bt.ctf_stream_class_get_event_class_by_id( self._ptr, id) utils._handle_ptr( ec_ptr, "cannot get stream class object's event class object") return bt2.EventClass._create_from_ptr(ec_ptr)
def _value_to_int(self, value): if not isinstance(value, numbers.Real): raise TypeError('expecting a number object') value = int(value) utils._check_int64(value) return value
def seek_to_time(self, origin, time): utils._check_int64(origin) utils._check_int64(time) status = native_bt.notification_iterator_seek_time(self._ptr, origin, time) self._handle_status(status, 'unexpected error: cannot seek notification iterator to time')
def __getitem__(self, key): utils._check_int64(key) ec_ptr = native_bt.stream_class_get_event_class_by_id(self._ptr, key) if ec_ptr is None: raise KeyError(key) return bt2.EventClass._create_from_ptr(ec_ptr)
def __getitem__(self, key): utils._check_int64(key) sc_ptr = native_bt.trace_get_stream_class_by_id(self._ptr, key) if sc_ptr is None: raise KeyError(key) return bt2.StreamClass._create_from_ptr(sc_ptr)
def __getitem__(self, key): utils._check_int64(key) ec_ptr = self._borrow_event_class_ptr_by_id(self._ptr, key) if ec_ptr is None: raise KeyError(key) return self._event_class_cls._create_from_ptr_and_get_ref(ec_ptr)
def mappings_by_value(self, value): if self.is_signed: utils._check_int64(value) iter_ptr = native_bt.field_class_enumeration_find_mappings_by_signed_value(self._ptr, value) else: utils._check_uint64(value) iter_ptr = native_bt.field_class_enumeration_find_mappings_by_unsigned_value(self._ptr, value) return self._get_mapping_iter(iter_ptr)
def can_seek_ns_from_origin(self, ns_from_origin): utils._check_int64(ns_from_origin) (status, res) = native_bt.message_iterator_can_seek_ns_from_origin( self._ptr, ns_from_origin) utils._handle_func_status( status, 'cannot check whether or not message iterator can seek given ns from origin', ) return res != 0
def mappings_by_value(self, value): if self.is_signed: utils._check_int64(value) iter_ptr = native_bt.ctf_field_type_enumeration_find_mappings_by_signed_value(self._ptr, value) else: utils._check_uint64(value) iter_ptr = native_bt.ctf_field_type_enumeration_find_mappings_by_unsigned_value(self._ptr, value) return self._get_mapping_iter(iter_ptr)
def seek_ns_from_origin(self, ns_from_origin): utils._check_int64(ns_from_origin) # Forget about buffered messages, they won't be valid after seeking. self._current_msgs.clear() self._at = 0 status = native_bt.message_iterator_seek_ns_from_origin( self._ptr, ns_from_origin) utils._handle_func_status( status, 'message iterator cannot seek given ns from origin')
def _value_to_int(self, value): if not isinstance(value, numbers.Real): raise TypeError('expecting a real number object') value = int(value) if self.field_class.is_signed: utils._check_int64(value) else: utils._check_uint64(value) return value
def _value_to_int(self, value): if not isinstance(value, numbers.Real): raise TypeError('expecting a real number object') value = int(value) if self.field_type.is_signed: utils._check_int64(value) else: utils._check_uint64(value) return value
def append_mapping(self, name, lower, upper=None): utils._check_str(name) if upper is None: upper = lower if self.is_signed: add_fn = native_bt.ctf_field_type_enumeration_add_mapping utils._check_int64(lower) utils._check_int64(upper) else: add_fn = native_bt.ctf_field_type_enumeration_add_mapping_unsigned utils._check_uint64(lower) utils._check_uint64(upper) ret = add_fn(self._ptr, name, lower, upper) utils._handle_ret(ret, "cannot add mapping to enumeration field type object")
def add_mapping(self, name, lower, upper=None): utils._check_str(name) if upper is None: upper = lower if self.is_signed: add_fn = native_bt.field_class_enumeration_add_mapping_signed utils._check_int64(lower) utils._check_int64(upper) else: add_fn = native_bt.field_class_enumeration_add_mapping_unsigned utils._check_uint64(lower) utils._check_uint64(upper) ret = add_fn(self._ptr, name, lower, upper) utils._handle_ret(ret, "cannot add mapping to enumeration field class object")
def id(self, id): utils._check_int64(id) ret = native_bt.ctf_event_class_set_id(self._ptr, id) utils._handle_ret(ret, "cannot set event class object's ID")
def __init__(self, seconds=0, cycles=0): utils._check_int64(seconds) utils._check_int64(cycles) self._seconds = seconds self._cycles = cycles
def _time(self, time): utils._check_int64(time) ret = native_bt.ctf_clock_set_time(self._ptr, time)
def id(self, id): utils._check_int64(id) status = native_bt.stream_class_set_id(self._ptr, id) utils._handle_func_status(status, "cannot set stream class object's ID")
def id(self, id): utils._check_int64(id) ret = native_bt.stream_class_set_id(self._ptr, id) utils._handle_ret(ret, "cannot set stream class object's ID")
def event_class_with_id(self, id): utils._check_int64(id) ec_ptr = native_bt.ctf_stream_class_get_event_class_by_id(self._ptr, id) utils._handle_ptr(ec_ptr, "cannot get stream class object's event class object") return bt2.EventClass._create_from_ptr(ec_ptr)
def _get_mapping_labels_for_value(enum_ptr, value): utils._check_int64(value) return native_bt.field_class_enumeration_signed_get_mapping_labels_for_value( enum_ptr, value)