ATLAS Offline Software
avl-tree.h
Go to the documentation of this file.
1 /*
2 
3 Copyright (c) 2005-2008, Simon Howard
4 
5 Permission to use, copy, modify, and/or distribute this software
6 for any purpose with or without fee is hereby granted, provided
7 that the above copyright notice and this permission notice appear
8 in all copies.
9 
10 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
11 WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
12 WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
13 AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
14 CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
15 LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
16 NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
17 CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 
19  */
20 
54 #ifndef ALGORITHM_AVLTREE_H
55 #define ALGORITHM_AVLTREE_H
56 
57 #ifdef __cplusplus
58 extern "C" {
59 #endif
60 
67 typedef struct _AVLTree AVLTree;
68 
73 typedef void *AVLTreeKey;
74 
79 typedef void *AVLTreeValue;
80 
85 #define AVL_TREE_NULL ((void *) 0)
86 
97 typedef struct _AVLTreeNode AVLTreeNode;
98 
103 typedef enum {
107 
119 typedef int (*AVLTreeCompareFunc)(AVLTreeValue value1, AVLTreeValue value2);
120 
130 
138 
151 
160 
173 
185 
200 
210 
219 
228 
239 
249 
258 
271 
280 
281 #ifdef __cplusplus
282 }
283 #endif
284 
285 #endif /* #ifndef ALGORITHM_AVLTREE_H */
286 
AVL_TREE_NODE_LEFT
@ AVL_TREE_NODE_LEFT
Definition: avl-tree.h:104
avl_tree_node_child
AVLTreeNode * avl_tree_node_child(AVLTreeNode *node, AVLTreeNodeSide side)
Find the child of a given tree node.
avl_tree_subtree_height
int avl_tree_subtree_height(AVLTreeNode *node)
Find the height of a subtree.
avl_tree_to_array
AVLTreeValue * avl_tree_to_array(AVLTree *tree)
Convert the keys in an AVL tree into a C array.
AVLTreeValue
void * AVLTreeValue
A value stored in an AVLTree.
Definition: avl-tree.h:79
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
avl_tree_node_parent
AVLTreeNode * avl_tree_node_parent(AVLTreeNode *node)
Find the parent node of a given tree node.
avl_tree_new
AVLTree * avl_tree_new(AVLTreeCompareFunc compare_func)
Create a new AVL tree.
avl_tree_node_key
AVLTreeKey avl_tree_node_key(AVLTreeNode *node)
Retrieve the key for a given tree node.
tree
TChain * tree
Definition: tile_monitor.h:30
avl_tree_remove
int avl_tree_remove(AVLTree *tree, AVLTreeKey key)
Remove an entry from a tree, specifying the key of the node to remove.
athena.value
value
Definition: athena.py:122
avl_tree_free
void avl_tree_free(AVLTree *tree)
Destroy an AVL tree.
AVLTree
struct _AVLTree AVLTree
An AVL tree balanced binary tree.
Definition: avl-tree.h:67
AVLTreeCompareFunc
int(* AVLTreeCompareFunc)(AVLTreeValue value1, AVLTreeValue value2)
Type of function used to compare keys in an AVL tree.
Definition: avl-tree.h:119
TRT::Hit::side
@ side
Definition: HitInfo.h:83
AVLTreeNodeSide
AVLTreeNodeSide
An AVLTreeNode can have left and right children.
Definition: avl-tree.h:103
avl_tree_num_entries
int avl_tree_num_entries(AVLTree *tree)
Retrieve the number of entries in the tree.
AVL_TREE_NODE_RIGHT
@ AVL_TREE_NODE_RIGHT
Definition: avl-tree.h:105
AVLTreeNode
struct _AVLTreeNode AVLTreeNode
A node in an AVL tree.
Definition: avl-tree.h:97
AVLTreeKey
void * AVLTreeKey
A key for an AVLTree.
Definition: avl-tree.h:73
avl_tree_remove_node
void avl_tree_remove_node(AVLTree *tree, AVLTreeNode *node)
Remove a node from a tree.
avl_tree_root_node
AVLTreeNode * avl_tree_root_node(AVLTree *tree)
Find the root node of a tree.
avl_tree_lookup_node
AVLTreeNode * avl_tree_lookup_node(AVLTree *tree, AVLTreeKey key)
Search an AVL tree for a node with a particular key.
avl_tree_insert
AVLTreeNode * avl_tree_insert(AVLTree *tree, AVLTreeKey key, AVLTreeValue value)
Insert a new key-value pair into an AVL tree.
avl_tree_lookup
AVLTreeValue avl_tree_lookup(AVLTree *tree, AVLTreeKey key)
Search an AVL tree for a value corresponding to a particular key.
avl_tree_node_value
AVLTreeValue avl_tree_node_value(AVLTreeNode *node)
Retrieve the value at a given tree node.
node
Definition: memory_hooks-stdcmalloc.h:74
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37