Motr  M0
cursor.c File Reference
#include "lib/assert.h"
#include "xcode/xcode.h"
Include dependency graph for cursor.c:

Go to the source code of this file.

Functions

iteration

xcode provides an iteration interface to walk through the hierarchy of types and fields.

This interface consists of two functions: m0_xcode_next(), m0_xcode_skip() and m0_xcode_cursor data-type.

m0_xcode_next() takes a starting type (m0_xcode_type) and walks the tree of its fields, their types, their fields &c., all the way down to the atomic types.

m0_xcode_next() can be used to walk the tree in any "standard" order: preorder, inorder and postorder traversals are supported. To this end, m0_xcode_next() visits each tree node multiple times, setting the flag m0_xcode_cursor::xcu_stack[]::s_flag according to the order.

M0_INTERNAL void m0_xcode_cursor_init (struct m0_xcode_cursor *it, const struct m0_xcode_obj *obj)
 
M0_INTERNAL struct m0_xcode_cursor_frame * m0_xcode_cursor_top (struct m0_xcode_cursor *it)
 
M0_INTERNAL const struct m0_xcode_fieldm0_xcode_cursor_field (const struct m0_xcode_cursor *it)
 
M0_INTERNAL int m0_xcode_next (struct m0_xcode_cursor *it)
 
M0_INTERNAL void m0_xcode_skip (struct m0_xcode_cursor *it)