flux-tree

flux-tree —

Synopsis




#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);

Description

Details

FLUX_TREE()

#define FLUX_TREE(x) ((FluxTree *) x)

x :

FLUX_TREE_FOR_EACH()

#define     FLUX_TREE_FOR_EACH(tree, c)

tree :
c :

FLUX_TREE_FOR_ALL()

#define     FLUX_TREE_FOR_ALL(tree, c)

tree :
c :

enum FluxTreeDataStorageType

typedef enum
{
  FLUX_TREE_NO_DATA,
  FLUX_TREE_DATA_IN_HEADER,
  FLUX_TREE_DATA_IN_MEMORY
}
FluxTreeDataStorageType;


struct FluxTree

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 */
};


flux_tree_new ()

FluxTree*   flux_tree_new                   (void);

Returns :

flux_tree_new_with_data ()

FluxTree*   flux_tree_new_with_data         (gconstpointer src,
                                             gint len);

src :
len :
Returns :

flux_tree_new_with_parent_and_data ()

FluxTree*   flux_tree_new_with_parent_and_data
                                            (FluxTree *parent,
                                             gconstpointer src,
                                             gint len);

parent :
src :
len :
Returns :

flux_tree_destroy ()

void        flux_tree_destroy               (FluxTree *tree);

tree :

flux_tree_reclaim ()

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

flux_tree_dup ()

FluxTree*   flux_tree_dup                   (FluxTree *tree);

tree :
Returns :

flux_tree_dup_all ()

FluxTree*   flux_tree_dup_all               (FluxTree *tree);

tree :
Returns :

flux_tree_split ()

FluxTree*   flux_tree_split                 (FluxTree *tree,
                                             guint32 pos);

tree :
pos :
Returns :

flux_tree_join ()

void        flux_tree_join                  (FluxTree *target,
                                             FluxTree *source);

target :
source :

flux_tree_set_ready()

#define   flux_tree_set_ready(tree, ready)         ((tree)->data_is_ready = (ready))

tree :
ready :

flux_tree_set_auto_root()

#define   flux_tree_set_auto_root(tree, auto_root) ((tree)->is_auto_root = (auto_root))

tree :
auto_root :

flux_tree_set_external_ref()

#define   flux_tree_set_external_ref(tree, ref)    ((tree)->has_external_ref = (ref))

tree :
ref :

flux_tree_has_data ()

gboolean    flux_tree_has_data              (FluxTree *tree);

tree :
Returns :

flux_tree_has_children ()

gboolean    flux_tree_has_children          (FluxTree *tree);

tree :
Returns :

flux_tree_is_ready()

#define   flux_tree_is_ready(tree)         ((tree)->data_is_ready    ? TRUE : FALSE)

tree :

flux_tree_is_auto_root()

#define   flux_tree_is_auto_root(tree)     ((tree)->is_auto_root     ? TRUE : FALSE)

tree :

flux_tree_has_external_ref()

#define   flux_tree_has_external_ref(tree) ((tree)->has_external_ref ? TRUE : FALSE)

tree :

flux_tree_get_depth ()

guint32     flux_tree_get_depth             (FluxTree *tree);

tree :
Returns :

flux_tree_stat_all ()

void        flux_tree_stat_all              (FluxTree *root,
                                             guint32 *count,
                                             guint32 *size);

root :
count :
size :

flux_tree_get_size_children ()

guint32     flux_tree_get_size_children     (FluxTree *root);

root :
Returns :

flux_tree_get_size_all ()

guint32     flux_tree_get_size_all          (FluxTree *root);

root :
Returns :

flux_tree_count_children ()

guint32     flux_tree_count_children        (FluxTree *tree);

tree :
Returns :

flux_tree_count_all ()

guint32     flux_tree_count_all             (FluxTree *tree);

tree :
Returns :

flux_tree_count_siblings ()

guint32     flux_tree_count_siblings        (FluxTree *tree);

tree :
Returns :

flux_tree_is_parent_of ()

gboolean    flux_tree_is_parent_of          (FluxTree *parent,
                                             FluxTree *child);

parent :
child :
Returns :

flux_tree_get_root ()

FluxTree*   flux_tree_get_root              (FluxTree *tree);

tree :
Returns :

flux_tree_get_parent ()

FluxTree*   flux_tree_get_parent            (FluxTree *tree);

tree :
Returns :

flux_tree_get_next ()

FluxTree*   flux_tree_get_next              (FluxTree *tree);

tree :
Returns :

flux_tree_get_prev ()

FluxTree*   flux_tree_get_prev              (FluxTree *tree);

tree :
Returns :

flux_tree_get_first_child ()

FluxTree*   flux_tree_get_first_child       (FluxTree *tree);

tree :
Returns :

flux_tree_get_last_child ()

FluxTree*   flux_tree_get_last_child        (FluxTree *tree);

tree :
Returns :

flux_tree_get_nth_child ()

FluxTree*   flux_tree_get_nth_child         (FluxTree *tree,
                                             gint n);

tree :
n :
Returns :

flux_tree_get_first_sibling ()

FluxTree*   flux_tree_get_first_sibling     (FluxTree *tree);

tree :
Returns :

flux_tree_get_last_sibling ()

FluxTree*   flux_tree_get_last_sibling      (FluxTree *tree);

tree :
Returns :

flux_tree_get_nth_sibling ()

FluxTree*   flux_tree_get_nth_sibling       (FluxTree *tree,
                                             gint n);

tree :
n :
Returns :

flux_tree_get_next_infix ()

FluxTree*   flux_tree_get_next_infix        (FluxTree *tree,
                                             FluxTree *top);

tree :
top :
Returns :

flux_tree_get_common_parent ()

FluxTree*   flux_tree_get_common_parent     (FluxTree *tree_0,
                                             FluxTree *tree_1);

tree_0 :
tree_1 :
Returns :

flux_tree_get_next_in_breadth_with_level ()

FluxTree*   flux_tree_get_next_in_breadth_with_level
                                            (FluxTree *tree,
                                             int depth,
                                             int level);

tree :
depth :
level :
Returns :

flux_tree_get_next_in_same_depth ()

FluxTree*   flux_tree_get_next_in_same_depth
                                            (FluxTree *tree);

tree :
Returns :

flux_tree_get_next_in_breadth()

#define     flux_tree_get_next_in_breadth(tree, depth)

tree :
depth :

flux_tree_add_as_first_child ()

void        flux_tree_add_as_first_child    (FluxTree *parent_tree,
                                             FluxTree *tree);

parent_tree :
tree :

flux_tree_add_as_last_child ()

void        flux_tree_add_as_last_child     (FluxTree *parent_tree,
                                             FluxTree *tree);

parent_tree :
tree :

flux_tree_add_as_first_sibling ()

void        flux_tree_add_as_first_sibling  (FluxTree *sibling_tree,
                                             FluxTree *tree);

sibling_tree :
tree :

flux_tree_add_as_last_sibling ()

void        flux_tree_add_as_last_sibling   (FluxTree *sibling_tree,
                                             FluxTree *tree);

sibling_tree :
tree :

flux_tree_add_before ()

void        flux_tree_add_before            (FluxTree *next_tree,
                                             FluxTree *tree);

next_tree :
tree :

flux_tree_add_after ()

void        flux_tree_add_after             (FluxTree *prev_tree,
                                             FluxTree *tree);

prev_tree :
tree :

flux_tree_add()

#define   flux_tree_add(parent_tree, tree) flux_tree_add_as_last_child (parent_tree, tree)

parent_tree :
tree :

flux_tree_swap ()

void        flux_tree_swap                  (FluxTree *tree_0,
                                             FluxTree *tree_1);

tree_0 :
tree_1 :

flux_tree_detach ()

void        flux_tree_detach                (FluxTree *tree);

tree :

flux_tree_is_ancestor ()

gboolean    flux_tree_is_ancestor           (FluxTree *ancestor,
                                             FluxTree *tree);

ancestor :
tree :
Returns :

flux_tree_data_swap ()

void        flux_tree_data_swap             (FluxTree *tree_0,
                                             FluxTree *tree_1);

tree_0 :
tree_1 :

flux_tree_data_delete ()

void        flux_tree_data_delete           (FluxTree *tree);

tree :

flux_tree_data_get_size()

#define   flux_tree_data_get_size(tree)    ((tree)->size)

tree :

flux_tree_data_set_size ()

void        flux_tree_data_set_size         (FluxTree *tree,
                                             gint len);

tree :
len :

flux_tree_data_set ()

void        flux_tree_data_set              (FluxTree *tree,
                                             gconstpointer src,
                                             guint32 len);

tree :
src :
len :

flux_tree_data_set_bytes ()

void        flux_tree_data_set_bytes        (FluxTree *tree,
                                             gconstpointer src,
                                             guint32 start,
                                             guint32 len);

tree :
src :
start :
len :

flux_tree_data_set_str ()

void        flux_tree_data_set_str          (FluxTree *tree,
                                             const gchar *str);

tree :
str :

flux_tree_data_append_bytes ()

void        flux_tree_data_append_bytes     (FluxTree *tree,
                                             gconstpointer src,
                                             guint32 len);

tree :
src :
len :

flux_tree_data_prepend_bytes ()

void        flux_tree_data_prepend_bytes    (FluxTree *tree,
                                             gconstpointer src,
                                             guint32 len);

tree :
src :
len :

flux_tree_data_get_bytes ()

guint32     flux_tree_data_get_bytes        (FluxTree *tree,
                                             gpointer dest,
                                             guint32 start,
                                             guint32 len);

tree :
dest :
start :
len :
Returns :

flux_tree_data_get_str ()

gchar*      flux_tree_data_get_str          (FluxTree *tree);

tree :
Returns :

flux_tree_cmp ()

int         flux_tree_cmp                   (FluxTree *tree_0,
                                             FluxTree *tree_1);

tree_0 :
tree_1 :
Returns :

flux_tree_casecmp ()

int         flux_tree_casecmp               (FluxTree *tree_0,
                                             FluxTree *tree_1);

tree_0 :
tree_1 :
Returns :

flux_tree_memcmp ()

int         flux_tree_memcmp                (FluxTree *tree,
                                             gconstpointer p,
                                             guint32 len);

tree :
p :
len :
Returns :

flux_tree_memcasecmp ()

int         flux_tree_memcasecmp            (FluxTree *tree,
                                             gconstpointer p,
                                             guint32 len);

tree :
p :
len :
Returns :

flux_tree_strcmp()

#define   flux_tree_strcmp(tree, s)        (flux_tree_memcmp ((tree), (s), strlen (s)))

tree :
s :

flux_tree_strcasecmp()

#define   flux_tree_strcasecmp(tree, s)    (flux_tree_memcasecmp ((tree), (s), strlen (s)))

tree :
s :

flux_tree_spn_from ()

size_t      flux_tree_spn_from              (FluxTree *tree,
                                             const gchar *accept,
                                             size_t start);

tree :
accept :
start :
Returns :

flux_tree_cspn_from ()

size_t      flux_tree_cspn_from             (FluxTree *tree,
                                             const gchar *reject,
                                             size_t start);

tree :
reject :
start :
Returns :

flux_tree_spn()

#define   flux_tree_spn(tree, accept)      flux_tree_spn_from(tree, accept, 0)

tree :
accept :

flux_tree_cspn()

#define   flux_tree_cspn(tree, reject)     flux_tree_cspn_from(tree, reject, 0)

tree :
reject :

flux_tree_chr ()

int         flux_tree_chr                   (FluxTree *tree,
                                             int c);

tree :
c :
Returns :

flux_tree_rchr ()

int         flux_tree_rchr                  (FluxTree *tree,
                                             int c);

tree :
c :
Returns :

flux_tree_find_first_sibling ()

FluxTree*   flux_tree_find_first_sibling    (FluxTree *tree,
                                             gpointer data,
                                             guint32 len);

tree :
data :
len :
Returns :

flux_tree_find_last_sibling ()

FluxTree*   flux_tree_find_last_sibling     (FluxTree *tree,
                                             gpointer data,
                                             guint32 len);

tree :
data :
len :
Returns :

flux_tree_find_next ()

FluxTree*   flux_tree_find_next             (FluxTree *tree,
                                             gpointer data,
                                             guint32 len);

tree :
data :
len :
Returns :

flux_tree_find_prev ()

FluxTree*   flux_tree_find_prev             (FluxTree *tree,
                                             gpointer data,
                                             guint32 len);

tree :
data :
len :
Returns :

flux_tree_find_first_child ()

FluxTree*   flux_tree_find_first_child      (FluxTree *tree,
                                             gpointer data,
                                             guint32 len);

tree :
data :
len :
Returns :

flux_tree_find_last_child ()

FluxTree*   flux_tree_find_last_child       (FluxTree *tree,
                                             gpointer data,
                                             guint32 len);

tree :
data :
len :
Returns :

flux_tree_hash ()

guint32     flux_tree_hash                  (FluxTree *tree);

tree :
Returns :

flux_tree_hash_all ()

guint32     flux_tree_hash_all              (FluxTree *tree);

tree :
Returns :

flux_tree_scan_from_file ()

FluxTree*   flux_tree_scan_from_file        (FILE *in);

in :
Returns :

flux_tree_print_to_file ()

void        flux_tree_print_to_file         (FluxTree *tree,
                                             FILE *out,
                                             FluxPrintMode mode);

tree :
out :
mode :