예제 #1
0
    def __next__(self):
        if self._at == len(self._variant_field_type):
            raise StopIteration

        ret, name, field_type_ptr = native_bt.ctf_field_type_variant_get_field(self._variant_field_type._ptr, self._at)
        utils._handle_ret(ret, "cannot get variant field type object's field")
        native_bt.put(field_type_ptr)
        self._at += 1
        return name
예제 #2
0
    def __len__(self):
        if self._is_private:
            pub_ptr = native_bt.component_from_private(self._component._ptr)
            count = self._get_port_count_fn(pub_ptr)
            native_bt.put(pub_ptr)
        else:
            count = self._get_port_count_fn(self._component._ptr)

        assert(count >= 0)
        return count
예제 #3
0
    def __len__(self):
        if self._is_private:
            pub_ptr = native_bt.component_from_private(self._component._ptr)
            count = self._get_port_count_fn(pub_ptr)
            native_bt.put(pub_ptr)
        else:
            count = self._get_port_count_fn(self._component._ptr)

        assert (count >= 0)
        return count
예제 #4
0
    def __next__(self):
        if self._at == len(self._variant_field_class):
            raise StopIteration

        ret, name, field_class_ptr = native_bt.field_class_variant_get_field_by_index(
            self._variant_field_class._ptr, self._at)
        assert (ret == 0)
        native_bt.put(field_class_ptr)
        self._at += 1
        return name
예제 #5
0
    def __next__(self):
        if self._at == len(self._variant_field_class):
            raise StopIteration

        ret, name, field_class_ptr = native_bt.field_class_variant_get_field_by_index(self._variant_field_class._ptr,
                                                                                    self._at)
        assert(ret == 0)
        native_bt.put(field_class_ptr)
        self._at += 1
        return name
예제 #6
0
    def _get_clock_value_cycles(self, clock_class_ptr):
        clock_value_ptr = native_bt.ctf_event_get_clock_value(self._ptr,
                                                              clock_class_ptr)

        if clock_value_ptr is None:
            return

        ret, cycles = native_bt.ctf_clock_value_get_value(clock_value_ptr)
        native_bt.put(clock_value_ptr)
        utils._handle_ret(ret, "cannot get clock value object's cycles")
        return cycles
예제 #7
0
파일: event.py 프로젝트: tdrjnr/babeltrace
    def _get_clock_value_cycles(self, clock_class_ptr):
        clock_value_ptr = native_bt.ctf_event_get_clock_value(
            self._ptr, clock_class_ptr)

        if clock_value_ptr is None:
            return

        ret, cycles = native_bt.ctf_clock_value_get_value(clock_value_ptr)
        native_bt.put(clock_value_ptr)
        utils._handle_ret(ret, "cannot get clock value object's cycles")
        return cycles
예제 #8
0
    def component(self):
        comp_ptr = native_bt.private_port_get_private_component(self._ptr)

        if comp_ptr is None:
            return

        pub_comp_ptr = native_bt.component_from_private(comp_ptr)
        assert (pub_comp_ptr)
        comp = bt2.component._create_generic_component_from_ptr(pub_comp_ptr)
        native_bt.put(comp_ptr)
        return comp
예제 #9
0
    def __next__(self):
        if self._at == len(self._struct_field_class):
            raise StopIteration

        get_fc_by_index = native_bt.field_class_structure_get_field_by_index
        ret, name, field_class_ptr = get_fc_by_index(
            self._struct_field_class._ptr, self._at)
        assert (ret == 0)
        native_bt.put(field_class_ptr)
        self._at += 1
        return name
예제 #10
0
    def __next__(self):
        if self._at == len(self._struct_field_class):
            raise StopIteration

        get_fc_by_index = native_bt.field_class_structure_get_field_by_index
        ret, name, field_class_ptr = get_fc_by_index(self._struct_field_class._ptr,
                                                    self._at)
        assert(ret == 0)
        native_bt.put(field_class_ptr)
        self._at += 1
        return name
예제 #11
0
파일: port.py 프로젝트: abusque/babeltrace
    def component(self):
        comp_ptr = native_bt.private_port_get_private_component(self._ptr)

        if comp_ptr is None:
            return

        pub_comp_ptr = native_bt.component_from_private(comp_ptr)
        assert(pub_comp_ptr)
        comp = bt2.component._create_generic_component_from_ptr(pub_comp_ptr)
        native_bt.put(comp_ptr)
        return comp
예제 #12
0
    def __next__(self):
        if self._at == len(self._trace_clock_classes):
            raise StopIteration

        trace_ptr = self._trace_clock_classes._trace._ptr
        cc_ptr = native_bt.ctf_trace_get_clock_class(trace_ptr, self._at)
        utils._handle_ptr(cc_ptr, "cannot get trace class object's clock class")
        name = native_bt.ctf_clock_class_get_name(cc_ptr)
        native_bt.put(cc_ptr)
        utils._handle_ptr(name, "cannot get clock class object's name")
        self._at += 1
        return name
예제 #13
0
파일: trace.py 프로젝트: abusque/babeltrace
    def __next__(self):
        if self._at == len(self._trace_clock_classes):
            raise StopIteration

        trace_ptr = self._trace_clock_classes._trace._ptr
        cc_ptr = native_bt.trace_get_clock_class_by_index(trace_ptr, self._at)
        assert(cc_ptr)
        name = native_bt.clock_class_get_name(cc_ptr)
        native_bt.put(cc_ptr)
        assert(name is not None)
        self._at += 1
        return name
예제 #14
0
    def __next__(self):
        if self._at == len(self._stream_class):
            raise StopIteration

        ec_ptr = native_bt.ctf_stream_class_get_event_class(self._stream_class._ptr,
                                                            self._at)
        utils._handle_ptr(ec_ptr, "cannot get stream class object's event class object")
        name = native_bt.ctf_event_class_get_name(ec_ptr)
        native_bt.put(ec_ptr)
        utils._handle_ptr(name, "cannot get event class object's name")
        self._at += 1
        return name
예제 #15
0
    def __next__(self):
        if self._at == len(self._trace_clock_classes):
            raise StopIteration

        trace_ptr = self._trace_clock_classes._trace._ptr
        cc_ptr = native_bt.trace_get_clock_class_by_index(trace_ptr, self._at)
        assert(cc_ptr)
        name = native_bt.clock_class_get_name(cc_ptr)
        native_bt.put(cc_ptr)
        assert(name is not None)
        self._at += 1
        return name
예제 #16
0
    def __next__(self):
        if self._at == len(self._trace):
            raise StopIteration

        sc_ptr = native_bt.trace_get_stream_class_by_index(self._trace._ptr,
                                                           self._at)
        assert(sc_ptr)
        id = native_bt.stream_class_get_id(sc_ptr)
        native_bt.put(sc_ptr)
        assert(id >= 0)
        self._at += 1
        return id
예제 #17
0
    def __next__(self):
        if self._at == len(self._stream_class):
            raise StopIteration

        ec_ptr = native_bt.stream_class_get_event_class_by_index(self._stream_class._ptr,
                                                                 self._at)
        assert(ec_ptr)
        ev_id = native_bt.event_class_get_id(ec_ptr)
        native_bt.put(ec_ptr)
        utils._handle_ret(ev_id, "cannot get event class object's ID")
        self._at += 1
        return ev_id
예제 #18
0
파일: trace.py 프로젝트: abusque/babeltrace
    def __next__(self):
        if self._at == len(self._trace):
            raise StopIteration

        sc_ptr = native_bt.trace_get_stream_class_by_index(self._trace._ptr,
                                                           self._at)
        assert(sc_ptr)
        id = native_bt.stream_class_get_id(sc_ptr)
        native_bt.put(sc_ptr)
        assert(id >= 0)
        self._at += 1
        return id
예제 #19
0
파일: trace.py 프로젝트: tdrjnr/babeltrace
    def __next__(self):
        if self._at == len(self._trace_clock_classes):
            raise StopIteration

        trace_ptr = self._trace_clock_classes._trace._ptr
        cc_ptr = native_bt.ctf_trace_get_clock_class(trace_ptr, self._at)
        utils._handle_ptr(cc_ptr,
                          "cannot get trace class object's clock class")
        name = native_bt.ctf_clock_class_get_name(cc_ptr)
        native_bt.put(cc_ptr)
        utils._handle_ptr(name, "cannot get clock class object's name")
        self._at += 1
        return name
예제 #20
0
    def __next__(self):
        if self._at == len(self._stream_class):
            raise StopIteration

        ec_ptr = native_bt.ctf_stream_class_get_event_class(
            self._stream_class._ptr, self._at)
        utils._handle_ptr(
            ec_ptr, "cannot get stream class object's event class object")
        name = native_bt.ctf_event_class_get_name(ec_ptr)
        native_bt.put(ec_ptr)
        utils._handle_ptr(name, "cannot get event class object's name")
        self._at += 1
        return name
예제 #21
0
    def __next__(self):
        if self._at == len(self._trace):
            raise StopIteration

        sc_ptr = native_bt.ctf_trace_get_stream_class(self._trace._ptr,
                                                      self._at)
        utils._handle_ptr(sc_ptr, "cannot get trace class object's stream class object")
        id = native_bt.ctf_stream_class_get_id(sc_ptr)
        native_bt.put(sc_ptr)

        if utils._is_m1ull(id):
            raise bt2.Error("cannot get stream class object's ID")

        self._at += 1
        return id
예제 #22
0
파일: trace.py 프로젝트: tdrjnr/babeltrace
    def __next__(self):
        if self._at == len(self._trace):
            raise StopIteration

        sc_ptr = native_bt.ctf_trace_get_stream_class(self._trace._ptr,
                                                      self._at)
        utils._handle_ptr(
            sc_ptr, "cannot get trace class object's stream class object")
        id = native_bt.ctf_stream_class_get_id(sc_ptr)
        native_bt.put(sc_ptr)

        if utils._is_m1ull(id):
            raise bt2.Error("cannot get stream class object's ID")

        self._at += 1
        return id
예제 #23
0
    def __len__(self):
        count = 0
        total = native_bt.plugin_get_component_class_count(self._plugin._ptr)

        for at in range(total):
            comp_cls_ptr = native_bt.plugin_get_component_class_by_index(
                self._plugin._ptr, at)
            assert (comp_cls_ptr)
            cc_type = native_bt.component_class_get_type(comp_cls_ptr)

            if cc_type == self._comp_cls_type:
                count += 1

            native_bt.put(comp_cls_ptr)

        return count
예제 #24
0
    def __len__(self):
        count = 0
        total = native_bt.plugin_get_component_class_count(self._plugin._ptr)

        for at in range(total):
            comp_cls_ptr = native_bt.plugin_get_component_class_by_index(self._plugin._ptr,
                                                                         at)
            assert(comp_cls_ptr)
            cc_type = native_bt.component_class_get_type(comp_cls_ptr)

            if cc_type == self._comp_cls_type:
                count += 1

            native_bt.put(comp_cls_ptr)

        return count
예제 #25
0
    def __next__(self):
        if self._at == len(self._comp_ports):
            raise StopIteration

        comp_ports = self._comp_ports
        comp_ptr = comp_ports._component._ptr
        port_ptr = comp_ports._get_port_at_index_fn(comp_ptr, self._at)
        assert(port_ptr)

        if comp_ports._is_private:
            port_pub_ptr = native_bt.port_from_private(port_ptr)
            name = native_bt.port_get_name(port_pub_ptr)
            native_bt.put(port_pub_ptr)
        else:
            name = native_bt.port_get_name(port_ptr)

        assert(name is not None)
        native_bt.put(port_ptr)
        self._at += 1
        return name
예제 #26
0
    def __next__(self):
        if self._at == len(self._comp_ports):
            raise StopIteration

        comp_ports = self._comp_ports
        comp_ptr = comp_ports._component._ptr
        port_ptr = comp_ports._get_port_at_index_fn(comp_ptr, self._at)
        assert (port_ptr)

        if comp_ports._is_private:
            port_pub_ptr = native_bt.port_from_private(port_ptr)
            name = native_bt.port_get_name(port_pub_ptr)
            native_bt.put(port_pub_ptr)
        else:
            name = native_bt.port_get_name(port_ptr)

        assert (name is not None)
        native_bt.put(port_ptr)
        self._at += 1
        return name
예제 #27
0
    def __next__(self):
        plugin_ptr = self._plugin_comp_cls._plugin._ptr
        comp_cls_type = self._plugin_comp_cls._comp_cls_type
        total = native_bt.plugin_get_component_class_count(plugin_ptr)

        while True:
            if self._at == total:
                raise StopIteration

            comp_cls_ptr = native_bt.plugin_get_component_class_by_index(
                plugin_ptr, self._at)
            assert (comp_cls_ptr)
            cc_type = native_bt.component_class_get_type(comp_cls_ptr)
            self._at += 1

            if cc_type == comp_cls_type:
                break

            native_bt.put(comp_cls_ptr)

        name = native_bt.component_class_get_name(comp_cls_ptr)
        native_bt.put(comp_cls_ptr)
        assert (name is not None)
        return name
예제 #28
0
    def __next__(self):
        plugin_ptr = self._plugin_comp_cls._plugin._ptr
        comp_cls_type = self._plugin_comp_cls._comp_cls_type
        total = native_bt.plugin_get_component_class_count(plugin_ptr)

        while True:
            if self._at == total:
                raise StopIteration

            comp_cls_ptr = native_bt.plugin_get_component_class_by_index(plugin_ptr,
                                                                         self._at)
            assert(comp_cls_ptr)
            cc_type = native_bt.component_class_get_type(comp_cls_ptr)
            self._at += 1

            if cc_type == comp_cls_type:
                break

            native_bt.put(comp_cls_ptr)

        name = native_bt.component_class_get_name(comp_cls_ptr)
        native_bt.put(comp_cls_ptr)
        assert(name is not None)
        return name
예제 #29
0
 def __del__(self):
     ptr = getattr(self, '_ptr', None)
     native_bt.put(ptr)
     self._ptr = None
예제 #30
0
 def name(self):
     pub_ptr = native_bt.component_from_private(self._ptr)
     name = native_bt.component_get_name(pub_ptr)
     native_bt.put(pub_ptr)
     assert (name is not None)
     return name
예제 #31
0
 def graph(self):
     pub_ptr = native_bt.component_from_private(self._ptr)
     ptr = native_bt.component_get_graph(pub_ptr)
     native_bt.put(pub_ptr)
     assert (ptr)
     return bt2.Graph._create_from_ptr(ptr)
예제 #32
0
 def component_class(self):
     pub_ptr = native_bt.component_from_private(self._ptr)
     cc_ptr = native_bt.component_get_class(pub_ptr)
     native_bt.put(pub_ptr)
     assert (cc_ptr)
     return _create_generic_component_class_from_ptr(cc_ptr)
예제 #33
0
 def __del__(self):
     if not self._belongs_to_native_component:
         self._belongs_to_native_component = True
         native_bt.py3_component_on_del(self)
         native_bt.put(self._ptr)
예제 #34
0
 def __del__(cls):
     if hasattr(cls, '_cc_ptr'):
         native_bt.put(cls._cc_ptr)
예제 #35
0
 def name(self):
     pub_ptr = native_bt.component_from_private(self._ptr)
     name = native_bt.component_get_name(pub_ptr)
     native_bt.put(pub_ptr)
     assert(name is not None)
     return name
예제 #36
0
 def graph(self):
     pub_ptr = native_bt.component_from_private(self._ptr)
     ptr = native_bt.component_get_graph(pub_ptr)
     native_bt.put(pub_ptr)
     assert(ptr)
     return bt2.Graph._create_from_ptr(ptr)
예제 #37
0
 def component_class(self):
     pub_ptr = native_bt.component_from_private(self._ptr)
     cc_ptr = native_bt.component_get_class(pub_ptr)
     native_bt.put(pub_ptr)
     assert(cc_ptr)
     return _create_generic_component_class_from_ptr(cc_ptr)
예제 #38
0
 def __del__(cls):
     if hasattr(cls, '_cc_ptr'):
         native_bt.put(cls._cc_ptr)
예제 #39
0
 def __del__(self):
     pub_ptr = getattr(self, '_pub_ptr', None)
     native_bt.put(pub_ptr)
     self._pub_ptr = None
     super().__del__()
예제 #40
0
 def __del__(self):
     ptr = getattr(self, '_ptr', None)
     native_bt.put(ptr)
예제 #41
0
 def __del__(self):
     if not self._belongs_to_native_component:
         self._belongs_to_native_component = True
         native_bt.py3_component_on_del(self)
         native_bt.put(self._ptr)