Example #1
0
    def __init__(self, name, frequency, description=None, precision=None,
                 offset=None, is_absolute=None, uuid=None):
        utils._check_str(name)
        utils._check_uint64(frequency)
        ptr = native_bt.clock_class_create(name, frequency)

        if ptr is None:
            raise bt2.CreationError('cannot create clock class object')

        super().__init__(ptr)

        if description is not None:
            self.description = description

        if frequency is not None:
            self.frequency = frequency

        if precision is not None:
            self.precision = precision

        if offset is not None:
            self.offset = offset

        if is_absolute is not None:
            self.is_absolute = is_absolute

        if uuid is not None:
            self.uuid = uuid
    def __init__(self, name, frequency, description=None, precision=None,
                 offset=None, is_absolute=None, uuid=None):
        utils._check_str(name)
        utils._check_uint64(frequency)
        ptr = native_bt.clock_class_create(name, frequency)

        if ptr is None:
            raise bt2.CreationError('cannot create clock class object')

        super().__init__(ptr)

        if description is not None:
            self.description = description

        if frequency is not None:
            self.frequency = frequency

        if precision is not None:
            self.precision = precision

        if offset is not None:
            self.offset = offset

        if is_absolute is not None:
            self.is_absolute = is_absolute

        if uuid is not None:
            self.uuid = uuid
Example #3
0
    def _create_clock_class(
        self,
        frequency=None,
        name=None,
        user_attributes=None,
        description=None,
        precision=None,
        offset=None,
        origin_is_unix_epoch=True,
        uuid=None,
    ):
        ptr = self._bt_as_self_component_ptr(self._bt_ptr)
        cc_ptr = native_bt.clock_class_create(ptr)

        if cc_ptr is None:
            raise bt2._MemoryError('could not create clock class')

        cc = bt2_clock_class._ClockClass._create_from_ptr(cc_ptr)

        if frequency is not None:
            cc._frequency = frequency

        if name is not None:
            cc._name = name

        if user_attributes is not None:
            cc._user_attributes = user_attributes

        if description is not None:
            cc._description = description

        if precision is not None:
            cc._precision = precision

        if offset is not None:
            cc._offset = offset

        cc._origin_is_unix_epoch = origin_is_unix_epoch

        if uuid is not None:
            cc._uuid = uuid

        return cc