Flux Reference Manual |
---|
flux-tree —
#define FLUX_TREE (x) #define FLUX_TREE_FOR_EACH (tree, c) #define FLUX_TREE_FOR_ALL (tree, c) enum FluxTreeDataStorageType; struct FluxTree; FluxTree* flux_tree_new (void); FluxTree* flux_tree_new_with_data (gconstpointer src, gint len); FluxTree* flux_tree_new_with_parent_and_data (FluxTree *parent, gconstpointer src, gint len); void flux_tree_destroy (FluxTree *tree); void flux_tree_reclaim (FluxTree *tree); FluxTree* flux_tree_dup (FluxTree *tree); FluxTree* flux_tree_dup_all (FluxTree *tree); FluxTree* flux_tree_split (FluxTree *tree, guint32 pos); void flux_tree_join (FluxTree *target, FluxTree *source); #define flux_tree_set_ready (tree, ready) #define flux_tree_set_auto_root (tree, auto_root) #define flux_tree_set_external_ref (tree, ref) gboolean flux_tree_has_data (FluxTree *tree); gboolean flux_tree_has_children (FluxTree *tree); #define flux_tree_is_ready (tree) #define flux_tree_is_auto_root (tree) #define flux_tree_has_external_ref (tree) guint32 flux_tree_get_depth (FluxTree *tree); void flux_tree_stat_all (FluxTree *root, guint32 *count, guint32 *size); guint32 flux_tree_get_size_children (FluxTree *root); guint32 flux_tree_get_size_all (FluxTree *root); guint32 flux_tree_count_children (FluxTree *tree); guint32 flux_tree_count_all (FluxTree *tree); guint32 flux_tree_count_siblings (FluxTree *tree); gboolean flux_tree_is_parent_of (FluxTree *parent, FluxTree *child); FluxTree* flux_tree_get_root (FluxTree *tree); FluxTree* flux_tree_get_parent (FluxTree *tree); FluxTree* flux_tree_get_next (FluxTree *tree); FluxTree* flux_tree_get_prev (FluxTree *tree); FluxTree* flux_tree_get_first_child (FluxTree *tree); FluxTree* flux_tree_get_last_child (FluxTree *tree); FluxTree* flux_tree_get_nth_child (FluxTree *tree, gint n); FluxTree* flux_tree_get_first_sibling (FluxTree *tree); FluxTree* flux_tree_get_last_sibling (FluxTree *tree); FluxTree* flux_tree_get_nth_sibling (FluxTree *tree, gint n); FluxTree* flux_tree_get_next_infix (FluxTree *tree, FluxTree *top); FluxTree* flux_tree_get_common_parent (FluxTree *tree_0, FluxTree *tree_1); FluxTree* flux_tree_get_next_in_breadth_with_level (FluxTree *tree, int depth, int level); FluxTree* flux_tree_get_next_in_same_depth (FluxTree *tree); #define flux_tree_get_next_in_breadth (tree, depth) void flux_tree_add_as_first_child (FluxTree *parent_tree, FluxTree *tree); void flux_tree_add_as_last_child (FluxTree *parent_tree, FluxTree *tree); void flux_tree_add_as_first_sibling (FluxTree *sibling_tree, FluxTree *tree); void flux_tree_add_as_last_sibling (FluxTree *sibling_tree, FluxTree *tree); void flux_tree_add_before (FluxTree *next_tree, FluxTree *tree); void flux_tree_add_after (FluxTree *prev_tree, FluxTree *tree); #define flux_tree_add (parent_tree, tree) void flux_tree_swap (FluxTree *tree_0, FluxTree *tree_1); void flux_tree_detach (FluxTree *tree); gboolean flux_tree_is_ancestor (FluxTree *ancestor, FluxTree *tree); void flux_tree_data_swap (FluxTree *tree_0, FluxTree *tree_1); void flux_tree_data_delete (FluxTree *tree); #define flux_tree_data_get_size (tree) void flux_tree_data_set_size (FluxTree *tree, gint len); void flux_tree_data_set (FluxTree *tree, gconstpointer src, guint32 len); void flux_tree_data_set_bytes (FluxTree *tree, gconstpointer src, guint32 start, guint32 len); void flux_tree_data_set_str (FluxTree *tree, const gchar *str); void flux_tree_data_append_bytes (FluxTree *tree, gconstpointer src, guint32 len); void flux_tree_data_prepend_bytes (FluxTree *tree, gconstpointer src, guint32 len); guint32 flux_tree_data_get_bytes (FluxTree *tree, gpointer dest, guint32 start, guint32 len); gchar* flux_tree_data_get_str (FluxTree *tree); int flux_tree_cmp (FluxTree *tree_0, FluxTree *tree_1); int flux_tree_casecmp (FluxTree *tree_0, FluxTree *tree_1); int flux_tree_memcmp (FluxTree *tree, gconstpointer p, guint32 len); int flux_tree_memcasecmp (FluxTree *tree, gconstpointer p, guint32 len); #define flux_tree_strcmp (tree, s) #define flux_tree_strcasecmp (tree, s) size_t flux_tree_spn_from (FluxTree *tree, const gchar *accept, size_t start); size_t flux_tree_cspn_from (FluxTree *tree, const gchar *reject, size_t start); #define flux_tree_spn (tree, accept) #define flux_tree_cspn (tree, reject) int flux_tree_chr (FluxTree *tree, int c); int flux_tree_rchr (FluxTree *tree, int c); FluxTree* flux_tree_find_first_sibling (FluxTree *tree, gpointer data, guint32 len); FluxTree* flux_tree_find_last_sibling (FluxTree *tree, gpointer data, guint32 len); FluxTree* flux_tree_find_next (FluxTree *tree, gpointer data, guint32 len); FluxTree* flux_tree_find_prev (FluxTree *tree, gpointer data, guint32 len); FluxTree* flux_tree_find_first_child (FluxTree *tree, gpointer data, guint32 len); FluxTree* flux_tree_find_last_child (FluxTree *tree, gpointer data, guint32 len); guint32 flux_tree_hash (FluxTree *tree); guint32 flux_tree_hash_all (FluxTree *tree); FluxTree* flux_tree_scan_from_file (FILE *in); void flux_tree_print_to_file (FluxTree *tree, FILE *out, FluxPrintMode mode);
typedef enum { FLUX_TREE_NO_DATA, FLUX_TREE_DATA_IN_HEADER, FLUX_TREE_DATA_IN_MEMORY } FluxTreeDataStorageType;
struct FluxTree { FluxTree *parent; FluxTree *child_first, *child_last; FluxTree *next, *prev; guint16 data_is_ready : 1; /* Data is fully loaded (for constructors) */ guint16 is_auto_root : 1; /* Node was created to maintain a single root */ guint16 has_external_ref : 1; /* Node is referenced by external wrappers */ guint16 data_storage_type; guint32 size; gpointer data; /* Pointer to metadata, pointer to data, or data embedded in field */ };
FluxTree* flux_tree_new_with_data (gconstpointer src, gint len);
src : | |
len : | |
Returns : |
FluxTree* flux_tree_new_with_parent_and_data (FluxTree *parent, gconstpointer src, gint len);
parent : | |
src : | |
len : | |
Returns : |
void flux_tree_reclaim (FluxTree *tree);
Free a tree from memory, and all data associated with it. This function will stop at the first tree that has external references, as determined by flux_tree_has_external_ref().
tree : | root of the tree to reclaim |
#define flux_tree_set_ready(tree, ready) ((tree)->data_is_ready = (ready))
tree : | |
ready : |
#define flux_tree_set_auto_root(tree, auto_root) ((tree)->is_auto_root = (auto_root))
tree : | |
auto_root : |
#define flux_tree_set_external_ref(tree, ref) ((tree)->has_external_ref = (ref))
tree : | |
ref : |
#define flux_tree_is_auto_root(tree) ((tree)->is_auto_root ? TRUE : FALSE)
tree : |
#define flux_tree_has_external_ref(tree) ((tree)->has_external_ref ? TRUE : FALSE)
tree : |
void flux_tree_stat_all (FluxTree *root, guint32 *count, guint32 *size);
root : | |
count : | |
size : |
guint32 flux_tree_get_size_children (FluxTree *root);
root : | |
Returns : |
gboolean flux_tree_is_parent_of (FluxTree *parent, FluxTree *child);
parent : | |
child : | |
Returns : |
FluxTree* flux_tree_get_nth_child (FluxTree *tree, gint n);
tree : | |
n : | |
Returns : |
FluxTree* flux_tree_get_first_sibling (FluxTree *tree);
tree : | |
Returns : |
FluxTree* flux_tree_get_last_sibling (FluxTree *tree);
tree : | |
Returns : |
FluxTree* flux_tree_get_nth_sibling (FluxTree *tree, gint n);
tree : | |
n : | |
Returns : |
FluxTree* flux_tree_get_next_infix (FluxTree *tree, FluxTree *top);
tree : | |
top : | |
Returns : |
FluxTree* flux_tree_get_common_parent (FluxTree *tree_0, FluxTree *tree_1);
tree_0 : | |
tree_1 : | |
Returns : |
FluxTree* flux_tree_get_next_in_breadth_with_level (FluxTree *tree, int depth, int level);
tree : | |
depth : | |
level : | |
Returns : |
FluxTree* flux_tree_get_next_in_same_depth (FluxTree *tree);
tree : | |
Returns : |
void flux_tree_add_as_first_child (FluxTree *parent_tree, FluxTree *tree);
parent_tree : | |
tree : |
void flux_tree_add_as_last_child (FluxTree *parent_tree, FluxTree *tree);
parent_tree : | |
tree : |
void flux_tree_add_as_first_sibling (FluxTree *sibling_tree, FluxTree *tree);
sibling_tree : | |
tree : |
void flux_tree_add_as_last_sibling (FluxTree *sibling_tree, FluxTree *tree);
sibling_tree : | |
tree : |
void flux_tree_add_before (FluxTree *next_tree, FluxTree *tree);
next_tree : | |
tree : |
void flux_tree_add_after (FluxTree *prev_tree, FluxTree *tree);
prev_tree : | |
tree : |
#define flux_tree_add(parent_tree, tree) flux_tree_add_as_last_child (parent_tree, tree)
parent_tree : | |
tree : |
gboolean flux_tree_is_ancestor (FluxTree *ancestor, FluxTree *tree);
ancestor : | |
tree : | |
Returns : |
void flux_tree_data_swap (FluxTree *tree_0, FluxTree *tree_1);
tree_0 : | |
tree_1 : |
void flux_tree_data_set (FluxTree *tree, gconstpointer src, guint32 len);
tree : | |
src : | |
len : |
void flux_tree_data_set_bytes (FluxTree *tree, gconstpointer src, guint32 start, guint32 len);
tree : | |
src : | |
start : | |
len : |
void flux_tree_data_set_str (FluxTree *tree, const gchar *str);
tree : | |
str : |
void flux_tree_data_append_bytes (FluxTree *tree, gconstpointer src, guint32 len);
tree : | |
src : | |
len : |
void flux_tree_data_prepend_bytes (FluxTree *tree, gconstpointer src, guint32 len);
tree : | |
src : | |
len : |
guint32 flux_tree_data_get_bytes (FluxTree *tree, gpointer dest, guint32 start, guint32 len);
tree : | |
dest : | |
start : | |
len : | |
Returns : |
int flux_tree_casecmp (FluxTree *tree_0, FluxTree *tree_1);
tree_0 : | |
tree_1 : | |
Returns : |
int flux_tree_memcmp (FluxTree *tree, gconstpointer p, guint32 len);
tree : | |
p : | |
len : | |
Returns : |
int flux_tree_memcasecmp (FluxTree *tree, gconstpointer p, guint32 len);
tree : | |
p : | |
len : | |
Returns : |
#define flux_tree_strcmp(tree, s) (flux_tree_memcmp ((tree), (s), strlen (s)))
tree : | |
s : |
#define flux_tree_strcasecmp(tree, s) (flux_tree_memcasecmp ((tree), (s), strlen (s)))
tree : | |
s : |
size_t flux_tree_spn_from (FluxTree *tree, const gchar *accept, size_t start);
tree : | |
accept : | |
start : | |
Returns : |
size_t flux_tree_cspn_from (FluxTree *tree, const gchar *reject, size_t start);
tree : | |
reject : | |
start : | |
Returns : |
#define flux_tree_spn(tree, accept) flux_tree_spn_from(tree, accept, 0)
tree : | |
accept : |
#define flux_tree_cspn(tree, reject) flux_tree_cspn_from(tree, reject, 0)
tree : | |
reject : |
FluxTree* flux_tree_find_first_sibling (FluxTree *tree, gpointer data, guint32 len);
tree : | |
data : | |
len : | |
Returns : |
FluxTree* flux_tree_find_last_sibling (FluxTree *tree, gpointer data, guint32 len);
tree : | |
data : | |
len : | |
Returns : |
FluxTree* flux_tree_find_next (FluxTree *tree, gpointer data, guint32 len);
tree : | |
data : | |
len : | |
Returns : |
FluxTree* flux_tree_find_prev (FluxTree *tree, gpointer data, guint32 len);
tree : | |
data : | |
len : | |
Returns : |
FluxTree* flux_tree_find_first_child (FluxTree *tree, gpointer data, guint32 len);
tree : | |
data : | |
len : | |
Returns : |
FluxTree* flux_tree_find_last_child (FluxTree *tree, gpointer data, guint32 len);
tree : | |
data : | |
len : | |
Returns : |
void flux_tree_print_to_file (FluxTree *tree, FILE *out, FluxPrintMode mode);
tree : | |
out : | |
mode : |
<< Tree Processing | flux-comm >> |