String-indexed search tree for Commotion object system. More...
#include <stdlib.h>
#include <stddef.h>
#include <stdbool.h>
#include <stdint.h>
#include "debug.h"
#include "obj.h"
#include "list.h"
#include "tree.h"
#include "util.h"
#include "extern/halloc.h"
Macros | |
#define | _DEFINE_TREE(L) |
Functions | |
_DEFINE_TREE (16) | |
_DEFINE_TREE (32) | |
_treenode_t * | co_tree_root (const co_obj_t *tree) |
return root node of tree object More... | |
co_obj_t * | co_node_key (_treenode_t *node) |
return key object for given node More... | |
co_obj_t * | co_node_value (_treenode_t *node) |
return value object for given node More... | |
ssize_t | co_tree_length (co_obj_t *tree) |
return length (number of key-value pairs) of given tree More... | |
_treenode_t * | co_tree_find_node (_treenode_t *root, const char *key, const size_t klen) |
find node in given tree More... | |
co_obj_t * | co_tree_find (const co_obj_t *root, const char *key, const size_t klen) |
return value from given tree that corresponds to key More... | |
co_obj_t * | co_tree_delete (co_obj_t *root, const char *key, const size_t klen) |
delete value from given tree that corresponds to key More... | |
int | co_tree_insert (co_obj_t *root, const char *key, const size_t klen, co_obj_t *value) |
insert object into given tree and associate with key More... | |
int | co_tree_insert_unsafe (co_obj_t *root, const char *key, const size_t klen, co_obj_t *value) |
insert object into given tree and associate with key, where value is not tied to tree More... | |
int | co_tree_insert_force (co_obj_t *root, const char *key, const size_t klen, co_obj_t *value) |
insert object into given tree and associate with key (overwrite if it exists) More... | |
int | co_tree_insert_unsafe_force (co_obj_t *root, const char *key, const size_t klen, co_obj_t *value) |
insert object into given tree and associate with key, where value is not tied to tree (overwrite if it exists) More... | |
int | co_tree_set_str (co_obj_t *root, const char *key, const size_t klen, const char *value, const size_t vlen) |
set value contained in an object in the tree with a specified key (if a string) More... | |
int | co_tree_set_int (co_obj_t *root, const char *key, const size_t klen, const signed long value) |
set value contained in an object in the tree with a specified key (if an int) More... | |
int | co_tree_set_uint (co_obj_t *root, const char *key, const size_t klen, const unsigned long value) |
set value contained in an object in the tree with a specified key (if an unsigned int) More... | |
int | co_tree_set_float (co_obj_t *root, const char *key, const size_t klen, const double value) |
set value contained in an object in the tree with a specified key (if a float) More... | |
int | co_tree_process (co_obj_t *tree, const co_iter_t iter, void *context) |
process tree with given iterator function More... | |
void | co_tree_destroy (co_obj_t *root) |
free tree structure More... | |
size_t | co_tree_raw (char *output, const size_t olen, const co_obj_t *tree) |
dump raw representation of tree More... | |
size_t | co_tree_import (co_obj_t **tree, const char *input, const size_t ilen) |
import raw representation of tree More... | |
void | co_tree_print_indent (co_obj_t *tree, int indent) |
print tree with indent More... | |
int | co_tree_print (co_obj_t *tree) |
print tree More... | |
int | co_tree_print_raw (co_obj_t *tree) |
print raw dump of tree More... | |
Detailed Description
String-indexed search tree for Commotion object system.
Macro Definition Documentation
#define _DEFINE_TREE | ( | L | ) |
Function Documentation
co_obj_t* co_node_key | ( | _treenode_t * | node | ) |
co_obj_t* co_node_value | ( | _treenode_t * | node | ) |
delete value from given tree that corresponds to key
- Parameters
-
root tree object key key to search for klen length of key
void co_tree_destroy | ( | co_obj_t * | root | ) |
return value from given tree that corresponds to key
- Parameters
-
root tree object key key to search for klen length of key
References co_tree_find_node(), and co_tree_root().
Referenced by co_cmd_desc(), co_cmd_exec(), co_cmd_hook(), co_cmd_hook_str(), co_cmd_usage(), co_profile_get(), co_profile_get_float(), co_profile_get_int(), co_profile_get_str(), co_profile_get_uint(), and co_response_get().
_treenode_t* co_tree_find_node | ( | _treenode_t * | root, |
const char * | key, | ||
const size_t | klen | ||
) |
find node in given tree
- Parameters
-
root tree in which to search key key to search for klen length of key
Referenced by co_tree_find(), co_tree_insert(), co_tree_insert_unsafe(), co_tree_set_float(), co_tree_set_int(), co_tree_set_str(), and co_tree_set_uint().
size_t co_tree_import | ( | co_obj_t ** | tree, |
const char * | input, | ||
const size_t | ilen | ||
) |
import raw representation of tree
- Parameters
-
tree target pointer of new, imported tree object input input buffer ilen length of input buffer
References co_list_import(), co_tree_import(), and co_tree_insert().
Referenced by co_list_import(), and co_tree_import().
insert object into given tree and associate with key
- Parameters
-
root tree object key key to search for klen length of key value value object to insert
References co_tree_find_node(), and co_tree_root().
Referenced by co_tree_import(), and dispatcher_cb().
int co_tree_insert_unsafe | ( | co_obj_t * | root, |
const char * | key, | ||
const size_t | klen, | ||
co_obj_t * | value | ||
) |
insert object into given tree and associate with key, where value is not tied to tree
- Parameters
-
root tree object key key to search for klen length of key value value object to insert
References co_tree_find_node(), and co_tree_root().
ssize_t co_tree_length | ( | co_obj_t * | tree | ) |
int co_tree_print | ( | co_obj_t * | tree | ) |
print tree
- Parameters
-
tree tree object to print
References co_tree_print_indent().
Referenced by co_response_print().
void co_tree_print_indent | ( | co_obj_t * | tree, |
int | indent | ||
) |
print tree with indent
- Parameters
-
tree tree object to print indent level of indent
References co_tree_root().
Referenced by co_tree_print().
int co_tree_print_raw | ( | co_obj_t * | tree | ) |
print raw dump of tree
- Parameters
-
tree tree object to print
References co_tree_root().
int co_tree_process | ( | co_obj_t * | tree, |
const co_iter_t | iter, | ||
void * | context | ||
) |
process tree with given iterator function
- Parameters
-
tree tree object to process iter iterator function context additional arguments to iterator
Referenced by co_cmd_process().
size_t co_tree_raw | ( | char * | output, |
const size_t | olen, | ||
const co_obj_t * | tree | ||
) |
dump raw representation of tree
- Parameters
-
output output buffer olen length of output buffer tree tree to dump
References co_tree_root().
Referenced by co_list_raw(), and co_response_alloc().
_treenode_t* co_tree_root | ( | const co_obj_t * | tree | ) |
return root node of tree object
- Parameters
-
tree tree object that contains root
Referenced by co_profile_export_file(), co_tree_find(), co_tree_insert(), co_tree_insert_unsafe(), co_tree_print_indent(), co_tree_print_raw(), co_tree_raw(), co_tree_set_float(), co_tree_set_int(), co_tree_set_str(), and co_tree_set_uint().
int co_tree_set_float | ( | co_obj_t * | root, |
const char * | key, | ||
const size_t | klen, | ||
const double | value | ||
) |
set value contained in an object in the tree with a specified key (if a float)
- Parameters
-
root tree object key key to search for klen length of key value value to insert
References co_tree_find_node(), and co_tree_root().
Referenced by co_profile_set_float().
int co_tree_set_int | ( | co_obj_t * | root, |
const char * | key, | ||
const size_t | klen, | ||
const signed long | value | ||
) |
set value contained in an object in the tree with a specified key (if an int)
- Parameters
-
root tree object key key to search for klen length of key value value to insert
References co_tree_find_node(), and co_tree_root().
Referenced by co_profile_set_int().
int co_tree_set_str | ( | co_obj_t * | root, |
const char * | key, | ||
const size_t | klen, | ||
const char * | value, | ||
const size_t | vlen | ||
) |
set value contained in an object in the tree with a specified key (if a string)
- Parameters
-
root tree object key key to search for klen length of key value value to insert vlen length of value
References co_tree_find_node(), and co_tree_root().
Referenced by co_profile_set_str().
int co_tree_set_uint | ( | co_obj_t * | root, |
const char * | key, | ||
const size_t | klen, | ||
const unsigned long | value | ||
) |
set value contained in an object in the tree with a specified key (if an unsigned int)
- Parameters
-
root tree object key key to search for klen length of key value value to insert
References co_tree_find_node(), and co_tree_root().
Referenced by co_profile_set_uint().
Generated on Fri Jun 6 2014 13:22:05 for commotiond by 1.8.7