Simple data structures / objects in plain C Snapshot
Classes | Defines | Typedefs | Enumerations | Functions
tree.h File Reference
#include <cutils/base.h>

Go to the source code of this file.

Classes

struct  tagTREENODE

Defines

#define TREE_NEXTLEVEL_LAST
#define TREE_NEXTLEVEL_LEFT
#define TREE_FOREACH_CHILD(current, node)
#define TREE_FOREACH_CHILD_REVERSE(current, node)
#define TREE_FOREACH_PREORDER(current, tree)
#define TREE_FOREACH_PREORDER_END
#define TREE_FOREACH_POSTORDER(current, tree)
#define TREE_FOREACH_POSTORDER_END

Typedefs

typedef struct tagTREENODE TREENODE
typedef int(* TREE_VISITOR )(TREENODE *entry, void *context)
typedef void(* TREE_VISITOR_V )(TREENODE *entry, void *context)
typedef int(* TREE_VISITOR_EXT_V )(TREENODE *entry, TREE_VISIT_EVENT visit, void *context)

Enumerations

enum  TREE_INSERT_MODE { TREE_INSERT_FIRST, TREE_INSERT_LAST }
enum  TREE_VISIT_EVENT { TREE_PREORDER, TREE_POSTORDER }

Functions

M_INLINE void TREE_init_root (TREENODE *tree)
M_INLINE TREENODETREE_parent (TREENODE *node)
M_INLINE TREENODETREE_left_sibling (TREENODE *node)
M_INLINE TREENODETREE_right_sibling (TREENODE *node)
M_INLINE TREENODETREE_leftmost_sibling (TREENODE *node)
M_INLINE TREENODETREE_rightmost_sibling (TREENODE *node)
M_INLINE TREENODETREE_first_child (TREENODE *node)
M_INLINE TREENODETREE_last_child (TREENODE *node)
M_INLINE int TREE_insert_right_sibling (TREENODE *current, TREENODE *newnode, int node_is_leaf)
M_INLINE int TREE_insert_left_sibling (TREENODE *current, TREENODE *newnode, int node_is_leaf)
M_INLINE void TREE_insert_child (TREENODE *parent, TREENODE *newnode, TREE_INSERT_MODE mode, int node_is_leaf)
M_INLINE void TREE_merge_childs (TREENODE *parent, TREE_INSERT_MODE mode, TREENODE *newnode)
M_INLINE TREENODETREE_unlink_node (TREENODE *node)
M_INLINE size_t TREE_count_child_nodes (TREENODE *current)
M_INLINE TREENODETREE_preorder_next (TREENODE *current)
M_INLINE void TREE_foreach_child (TREENODE *lst, TREE_VISITOR_V eval, void *context)
 iterate over all elements of a list of child nodes, callback is invoked for either element of the list. list is traversed from first element to the last element.
M_INLINE void TREE_foreach_child_reverse (TREENODE *lst, TREE_VISITOR_V eval, void *context)
M_INLINE TREENODETREE_findif_child (TREENODE *tree, TREE_VISITOR eval, void *context, int32_t *retval)
 find an element within the list of child nodes. callback is invoked for each element of the list, in forward direction from first element to last element; when the callback returns non zero value the iteration stops as we have found what we searched for.
M_INLINE TREENODETREE_findif_child_reverse (TREENODE *tree, TREE_VISITOR eval, void *context, int32_t *retval)
M_INLINE TREENODETREE_postorder_next (TREENODE *current, TREENODE *prev)
M_INLINE void TREE_foreach_preorder (TREENODE *node, TREE_VISITOR_V visit, void *context)
M_INLINE TREENODETREE_find_preorder (TREENODE *node, TREE_VISITOR visit, void *context)
M_INLINE void TREE_foreach_postorder (TREENODE *node, TREE_VISITOR_V visit, void *context)
M_INLINE TREENODETREE_find_postorder (TREENODE *node, TREE_VISITOR visit, void *context)
M_INLINE int TREE_check_tree (TREENODE *root)
 check tree for consistency errors

Define Documentation

#define TREE_NEXTLEVEL_LAST

Definition at line 14 of file tree.h.

#define TREE_NEXTLEVEL_LEFT

Definition at line 15 of file tree.h.