ZEDA
1.6.18
|
Macros | |
#define | zTreeClass(node_t, data_t) |
generate binary tree class. More... | |
#define | zTreeClassMethod(node_t, data_t, init, destroy) |
#define | zHeapClass(node_t, data_t) |
#define | zHeapClassMethod(node_t, data_t, init, destroy) |
#define | zTreeIsEmpty(t) ( (t)->size == 0 ) |
#define | zTreeIsLeaf(t) ( !(t)->child[0] && !(t)->child[1] ) |
#define | _zTreeParentID(n) ( (n)->parent->child[0] == (n) ? 0 : ( (n)->parent->child[1] == (n) ? 1 : -1 ) ) |
#define | _zTreeInitHeapMask(t, mask) |
#define | zTreeInit(node_t, node) node_t##Init( node ) |
#define | zTreeDestroy(node_t, tree) node_t##Destroy( tree ) |
#define | zTreeNodeAlloc(node_t, val) node_t##NodeAlloc( val ) |
#define | zTreeAddComplete(node_t, tree, val) node_t##AddComplete( tree, val ) |
#define | zTreeUpHeap(node_t, tree, node, cmp, util) node_t##UpHeap( tree, node, cmp, util ) |
#define | zTreeAddHeap(node_t, tree, val, cmp, util) node_t##AddHeap( tree, val, cmp, util ) |
#define | zTreeDownHeap(node_t, node, cmp, util) node_t##DownHeap( node, cmp, util ) |
#define | zTreeDeleteHeap(node_t, tree, cmp, util) node_t##DeleteHeap( tree, cmp, util ) |
#define | zTreeHeapify(node_t, tree, cmp, util) node_t##Heapify( tree, cmp, util ) |
#define zTreeClass | ( | node_t, | |
data_t | |||
) |
generate binary tree class.
A macro zTreeClass() generates a new binary tree class and prototypes of some associated methods.
The tree class tree_t defines a node that contains data with the type data_t and two pointers to children.
The methods to be generated are (node_t)Init(), (node_t)Destroy(), and (node_t)NodeAlloc(), where (node_t)s are replaced by the actual type name. The body implementation of those functions are generated by calling zTreeClassMethod(node_t, data_t);
The methods (node_t)UpHeap, (node_t)AddHeap(), (node_t)DownHeap, (node_t)DeleteHeap(), and (node_t)Heapify() are additionally defined by calling zHeapClass() and zHeapClassMethod() instead of zTreeClass() and zTreeClassMethod().
#define zTreeClassMethod | ( | node_t, | |
data_t, | |||
init, | |||
destroy | |||
) |
#define zHeapClass | ( | node_t, | |
data_t | |||
) |
#define zHeapClassMethod | ( | node_t, | |
data_t, | |||
init, | |||
destroy | |||
) |
#define zTreeIsEmpty | ( | t | ) | ( (t)->size == 0 ) |
#define zTreeIsLeaf | ( | t | ) | ( !(t)->child[0] && !(t)->child[1] ) |
#define _zTreeParentID | ( | n | ) | ( (n)->parent->child[0] == (n) ? 0 : ( (n)->parent->child[1] == (n) ? 1 : -1 ) ) |
#define _zTreeInitHeapMask | ( | t, | |
mask | |||
) |
#define zTreeInit | ( | node_t, | |
node | |||
) | node_t##Init( node ) |
#define zTreeDestroy | ( | node_t, | |
tree | |||
) | node_t##Destroy( tree ) |
#define zTreeNodeAlloc | ( | node_t, | |
val | |||
) | node_t##NodeAlloc( val ) |
#define zTreeAddComplete | ( | node_t, | |
tree, | |||
val | |||
) | node_t##AddComplete( tree, val ) |
#define zTreeUpHeap | ( | node_t, | |
tree, | |||
node, | |||
cmp, | |||
util | |||
) | node_t##UpHeap( tree, node, cmp, util ) |
#define zTreeAddHeap | ( | node_t, | |
tree, | |||
val, | |||
cmp, | |||
util | |||
) | node_t##AddHeap( tree, val, cmp, util ) |
#define zTreeDownHeap | ( | node_t, | |
node, | |||
cmp, | |||
util | |||
) | node_t##DownHeap( node, cmp, util ) |
#define zTreeDeleteHeap | ( | node_t, | |
tree, | |||
cmp, | |||
util | |||
) | node_t##DeleteHeap( tree, cmp, util ) |
#define zTreeHeapify | ( | node_t, | |
tree, | |||
cmp, | |||
util | |||
) | node_t##Heapify( tree, cmp, util ) |