Esempio n. 1
0
    def _events(self, begin_pos_ptr, end_pos_ptr):
        ctf_it_ptr = nbt._bt_ctf_iter_create(self._tc, begin_pos_ptr, end_pos_ptr)

        if ctf_it_ptr is None:
            raise NotImplementedError("Creation of multiple iterators is unsupported.")

        while True:
            ev_ptr = nbt._bt_ctf_iter_read_event(ctf_it_ptr)

            if ev_ptr is None:
                break

            ev = Event.__new__(Event)
            ev._e = ev_ptr

            try:
                yield ev
            except GeneratorExit:
                break

            ret = nbt._bt_iter_next(nbt._bt_ctf_get_iter(ctf_it_ptr))

            if ret != 0:
                break

        nbt._bt_ctf_iter_destroy(ctf_it_ptr)
Esempio n. 2
0
    def _events(self, begin_pos_ptr, end_pos_ptr):
        ctf_it_ptr = nbt._bt_ctf_iter_create(self._tc, begin_pos_ptr,
                                             end_pos_ptr)

        if ctf_it_ptr is None:
            raise NotImplementedError(
                "Creation of multiple iterators is unsupported.")

        while True:
            ev_ptr = nbt._bt_ctf_iter_read_event(ctf_it_ptr)

            if ev_ptr is None:
                break

            ev = Event.__new__(Event)
            ev._e = ev_ptr

            try:
                yield ev
            except GeneratorExit:
                break

            ret = nbt._bt_iter_next(nbt._bt_ctf_get_iter(ctf_it_ptr))

            if ret != 0:
                break

        nbt._bt_ctf_iter_destroy(ctf_it_ptr)
Esempio n. 3
0
    def _timestamp_at_pos(self, pos_ptr):
        ctf_it_ptr = nbt._bt_ctf_iter_create(self._tc, pos_ptr, pos_ptr)

        if ctf_it_ptr is None:
            raise NotImplementedError("Creation of multiple iterators is unsupported.")

        ev_ptr = nbt._bt_ctf_iter_read_event(ctf_it_ptr)
        nbt._bt_ctf_iter_destroy(ctf_it_ptr)

        ev = Event.__new__(Event)
        ev._e = ev_ptr

        return ev.timestamp
Esempio n. 4
0
    def _timestamp_at_pos(self, pos_ptr):
        ctf_it_ptr = nbt._bt_ctf_iter_create(self._tc, pos_ptr, pos_ptr)

        if ctf_it_ptr is None:
            raise NotImplementedError(
                "Creation of multiple iterators is unsupported.")

        ev_ptr = nbt._bt_ctf_iter_read_event(ctf_it_ptr)
        nbt._bt_ctf_iter_destroy(ctf_it_ptr)

        ev = Event.__new__(Event)
        ev._e = ev_ptr

        return ev.timestamp
Esempio n. 5
0
    def _events(self, begin_pos_ptr, end_pos_ptr):
        if self.intersect_mode:
            if not self.has_intersection:
                # There are no events to provide.
                return

            ctf_it_ptr = nbt._bt_python_ctf_iter_create_intersect(
                self._tc, begin_pos_ptr, end_pos_ptr
            )
        else:
            ctf_it_ptr = nbt._bt_ctf_iter_create(
                self._tc, begin_pos_ptr, end_pos_ptr
            )

        if ctf_it_ptr is None:
            raise NotImplementedError("Creation of multiple iterators is unsupported.")

        while True:
            ev_ptr = nbt._bt_ctf_iter_read_event(ctf_it_ptr)

            if ev_ptr is None:
                break

            ev = Event.__new__(Event)
            ev._e = ev_ptr

            try:
                yield ev
            except GeneratorExit:
                break

            ret = nbt._bt_iter_next(nbt._bt_ctf_get_iter(ctf_it_ptr))

            if ret != 0:
                break

        nbt._bt_ctf_iter_destroy(ctf_it_ptr)
Esempio n. 6
0
    def _events(self, begin_pos_ptr, end_pos_ptr):
        if self.intersect_mode:
            if not self.has_intersection:
                # There are no events to provide.
                return

            ctf_it_ptr = nbt._bt_python_ctf_iter_create_intersect(
                self._tc, begin_pos_ptr, end_pos_ptr)
        else:
            ctf_it_ptr = nbt._bt_ctf_iter_create(self._tc, begin_pos_ptr,
                                                 end_pos_ptr)

        if ctf_it_ptr is None:
            raise NotImplementedError(
                "Creation of multiple iterators is unsupported.")

        while True:
            ev_ptr = nbt._bt_ctf_iter_read_event(ctf_it_ptr)

            if ev_ptr is None:
                break

            ev = Event.__new__(Event)
            ev._e = ev_ptr

            try:
                yield ev
            except GeneratorExit:
                break

            ret = nbt._bt_iter_next(nbt._bt_ctf_get_iter(ctf_it_ptr))

            if ret != 0:
                break

        nbt._bt_ctf_iter_destroy(ctf_it_ptr)