Beispiel #1
0
    def __len__(self):
        count = 0

        for scope in _scopes:
            scope_ptr = nbt._bt_ctf_get_top_level_scope(self._e, scope)
            ret = nbt._bt_python_field_listcaller(self._e, scope_ptr)

            if isinstance(ret, list):
                count += ret[1]

        return count
Beispiel #2
0
    def __len__(self):
        count = 0

        for scope in _scopes:
            scope_ptr = nbt._bt_ctf_get_top_level_scope(self._e, scope)
            ret = nbt._bt_python_field_listcaller(self._e, scope_ptr)

            if isinstance(ret, list):
                count += ret[1]

        return count
Beispiel #3
0
    def _field_with_scope(self, field_name, scope):
        scope_ptr = nbt._bt_ctf_get_top_level_scope(self._e, scope)

        if scope_ptr is None:
            return None

        definition_ptr = nbt._bt_ctf_get_field(self._e, scope_ptr, field_name)

        if definition_ptr is None:
            return None

        field = _Definition(definition_ptr, scope)

        return field
Beispiel #4
0
    def _field_with_scope(self, field_name, scope):
        scope_ptr = nbt._bt_ctf_get_top_level_scope(self._e, scope)

        if scope_ptr is None:
            return None

        definition_ptr = nbt._bt_ctf_get_field(self._e, scope_ptr, field_name)

        if definition_ptr is None:
            return None

        field = _Definition(definition_ptr, scope)

        return field
Beispiel #5
0
    def _field_list_with_scope(self, scope):
        fields = []
        scope_ptr = nbt._bt_ctf_get_top_level_scope(self._e, scope)

        # Returns a list [list_ptr, count]. If list_ptr is NULL, SWIG will only
        # provide the "count" return value
        count = 0
        list_ptr = None
        ret = nbt._bt_python_field_listcaller(self._e, scope_ptr)

        if isinstance(ret, list):
            list_ptr, count = ret

        for i in range(count):
            definition_ptr = nbt._bt_python_field_one_from_list(list_ptr, i)

            if definition_ptr is not None:
                definition = _Definition(definition_ptr, scope)
                fields.append(definition)

        return fields
Beispiel #6
0
    def _field_list_with_scope(self, scope):
        fields = []
        scope_ptr = nbt._bt_ctf_get_top_level_scope(self._e, scope)

        # Returns a list [list_ptr, count]. If list_ptr is NULL, SWIG will only
        # provide the "count" return value
        count = 0
        list_ptr = None
        ret = nbt._bt_python_field_listcaller(self._e, scope_ptr)

        if isinstance(ret, list):
            list_ptr, count = ret

        for i in range(count):
            definition_ptr = nbt._bt_python_field_one_from_list(list_ptr, i)

            if definition_ptr is not None:
                definition = _Definition(definition_ptr, scope)
                fields.append(definition)

        return fields