MQTT C Client Libraries Internals: Tree.c File Reference

| MQTT C Client Libraries Internals

Macros | Functions
Tree.c File Reference

functions which apply to tree structures. More...

`#include "Tree.h"`
`#include <stdlib.h>`
`#include <stdio.h>`
`#include <string.h>`
`#include "Heap.h"`
Include dependency graph for Tree.c:

## Macros
#define | TREE_C /* so that malloc/free/realloc aren't redefined by Heap.h */
#define | LEFT 0
#define | RIGHT 1
#define | max(a, b) (a > b) ? a : b;

## Functions
int | isRed (Node *aNode)
int | isBlack (Node *aNode)
void | TreeRotate (Tree *aTree, Node *curnode, int direction, int index)
Node * | TreeBAASub (Tree *aTree, Node *curnode, int which, int index)
void | TreeBalanceAfterAdd (Tree *aTree, Node *curnode, int index)
void * | TreeAddByIndex (Tree *aTree, void *content, size_t size, int index)
| Add an item to a tree. More...
Node * | TreeFindIndex1 (Tree *aTree, void *key, int index, int value)
Node * | TreeFindContentIndex (Tree *aTree, void *key, int index)
Node * | TreeMinimum (Node *curnode)
Node * | TreeSuccessor (Node *curnode)
Node * | TreeNextElementIndex (Tree *aTree, Node *curnode, int index)
Node * | TreeBARSub (Tree *aTree, Node *curnode, int which, int index)
void | TreeBalanceAfterRemove (Tree *aTree, Node *curnode, int index)
void * | TreeRemoveIndex (Tree *aTree, void *content, int index)
| Remove an item from a tree. More...
void | TreeInitializeNoMalloc (Tree *aTree, int(*compare)(void *, void *, int))
Tree * | TreeInitialize (int(*compare)(void *, void *, int))
| Allocates and initializes a new tree structure. More...
void | TreeAddIndex (Tree *aTree, int(*compare)(void *, void *, int))
void | TreeFree (Tree *aTree)
void * | TreeAdd (Tree *aTree, void *content, size_t size)
Node * | TreeFindIndex (Tree *aTree, void *key, int index)
Node * | TreeFind (Tree *aTree, void *key)
Node * | TreeNextElement (Tree *aTree, Node *curnode)
void * | TreeRemoveNodeIndex (Tree *aTree, Node *curnode, int index)
| Remove an item from a tree. More...
void * | TreeRemove (Tree *aTree, void *content)
void * | TreeRemoveKeyIndex (Tree *aTree, void *key, int index)
void * | TreeRemoveKey (Tree *aTree, void *key)
int | TreeIntCompare (void *a, void *b, int content)
int | TreePtrCompare (void *a, void *b, int content)
int | TreeStringCompare (void *a, void *b, int content)

## Detailed Description

functions which apply to tree structures.

These trees can hold data of any sort, pointed to by the content pointer of the Node structure.

## Function Documentation

## ◆ TreeAddByIndex()

void * TreeAddByIndex | ( | Tree * | aTree,
|  | void * | content,
|  | size_t | size,
|  | int | index
| ) |  |

Add an item to a tree.

Parameters

  aTree | the list to which the item is to be added
  content | the list item content itself
  size | the size of the element

Here is the call graph for this function:

## ◆ TreeInitialize()

Tree* TreeInitialize | ( | int(*)(void *, void *, int) | compare | ) |

Allocates and initializes a new tree structure.

Returns
  a pointer to the new tree structure

Here is the call graph for this function:

## ◆ TreeRemoveIndex()

void * TreeRemoveIndex | ( | Tree * | aTree,
|  | void * | content,
|  | int | index
| ) |  |

Remove an item from a tree.

Parameters

  aTree | the list to which the item is to be added
  curnode | the list item content itself

## ◆ TreeRemoveNodeIndex()

void* TreeRemoveNodeIndex | ( | Tree * | aTree,
|  | Node * | curnode,
|  | int | index
| ) |  |

Remove an item from a tree.

Parameters

  aTree | the list to which the item is to be added
  curnode | the list item content itself