Merge branch 'master' of verplant.org:/var/lib/git/collection4
[collection4.git] / src / graph.h
1 #ifndef GRAPH_H
2 #define GRAPH_H 1
3
4 #include "graph_types.h"
5 #include "graph_ident.h"
6 #include "oconfig.h"
7 #include "utils_array.h"
8
9 /*
10  * Functions
11  */
12 graph_config_t *graph_create (const graph_ident_t *selector);
13
14 void graph_destroy (graph_config_t *graph);
15
16 int graph_config_add (const oconfig_item_t *ci);
17
18 int graph_add_file (graph_config_t *cfg, const graph_ident_t *file);
19
20 int graph_get_title (graph_config_t *cfg,
21     char *buffer, size_t buffer_size);
22
23 int graph_get_params (graph_config_t *cfg, char *buffer, size_t buffer_size);
24
25 graph_ident_t *graph_get_selector (graph_config_t *cfg);
26
27 graph_def_t *graph_get_defs (graph_config_t *cfg);
28
29 int graph_add_def (graph_config_t *cfg, graph_def_t *def);
30
31 _Bool graph_matches_ident (graph_config_t *cfg, const graph_ident_t *ident);
32
33 /* Compares the given string with the appropriate field of the selector. If the
34  * selector field is "/all/" or "/any/", returns true without checking the
35  * instances. See "graph_inst_search_field" for finding all matching instances.
36  * */
37 _Bool graph_matches_field (graph_config_t *cfg,
38     graph_ident_field_t field, const char *field_value);
39
40 int graph_inst_foreach (graph_config_t *cfg,
41     inst_callback_t cb, void *user_data);
42
43 graph_instance_t *graph_inst_find_exact (graph_config_t *cfg,
44     graph_ident_t *ident);
45
46 graph_instance_t *graph_inst_find_matching (graph_config_t *cfg,
47     const graph_ident_t *ident);
48
49 int graph_inst_search (graph_config_t *cfg, const char *term,
50     graph_inst_callback_t callback, void *user_data);
51
52 /* Iterates over all instances and calls "inst_matches_field". If that method
53  * returns true, calls the callback with the graph and instance pointers. */
54 int graph_inst_search_field (graph_config_t *cfg,
55     graph_ident_field_t field, const char *field_value,
56     graph_inst_callback_t callback, void *user_data);
57
58 int graph_compare (graph_config_t *cfg, const graph_ident_t *ident);
59
60 int graph_clear_instances (graph_config_t *cfg);
61
62 int graph_get_rrdargs (graph_config_t *cfg, graph_instance_t *inst,
63     str_array_t *args);
64
65 #endif /* GRAPH_H */
66 /* vim: set sw=2 sts=2 et fdm=marker : */