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
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