Revision fc0b0416 libavutil/tree.h

View differences:

libavutil/tree.h
22 22
#define TREE_H
23 23

  
24 24
struct AVTreeNode;
25
void *av_tree_find(const struct AVTreeNode *t, void *key, int (*cmp)(void *key, const void *b), void *next[2]);
26
void *av_tree_insert(struct AVTreeNode **tp, void *key, int (*cmp)(void *key, const void *b));
25

  
26
/**
27
 * Finds an element.
28
 * @param root a pointer to the root node of the tree
29
 * @param next if next is not NULL then next[0] will contain the previous element and
30
 *             next[1] the next element if either doesnt exist then the corresponding
31
 *             entry in next is unchanged
32
 * @return an element with cmp(key, elem)==0 or NULL if no such element exists in
33
 *         the tree
34
 */
35
void *av_tree_find(const struct AVTreeNode *root, void *key, int (*cmp)(void *key, const void *b), void *next[2]);
36

  
37
/**
38
 * Finds a element for which cmp(key, elem)==0, if no such element is found key
39
 * is inserted into the tree.
40
 * @param rootp a pointer to a pointer to the root node of the tree note the
41
 *              root node can change during insertions, this is required to
42
 *              keep the tree balanced
43
 *
44
 * @return if no insertion happened, the found element
45
 *         if a insertion happened, then either key or NULL is returned (which it is
46
 *         depends on the tree state and the implemenattion, you should make no
47
 *         asumtations that its one or the other in code)
48
 */
49
void *av_tree_insert(struct AVTreeNode **rootp, void *key, int (*cmp)(void *key, const void *b));
27 50
void av_tree_destroy(struct AVTreeNode *t);
28 51

  
29 52
#endif /* TREE_H */

Also available in: Unified diff