src/graph_instance.[ch]: Implement "inst_get_all_selected".
[collection4.git] / src / graph_instance.h
1 #ifndef GRAPH_INSTANCE_H
2 #define GRAPH_INSTANCE_H 1
3
4 #include <time.h>
5
6 #include "graph_types.h"
7 #include "graph_ident.h"
8 #include "utils_array.h"
9
10 /*
11  * Methods
12  */
13 graph_instance_t *inst_create (graph_config_t *cfg,
14                 const graph_ident_t *ident);
15
16 void inst_destroy (graph_instance_t *inst);
17
18 int inst_add_file (graph_instance_t *inst, const graph_ident_t *file);
19
20 graph_instance_t *inst_get_selected (graph_config_t *cfg);
21
22 int inst_get_all_selected (graph_config_t *cfg,
23     graph_inst_callback_t callback, void *user_data);
24
25 int inst_get_params (graph_config_t *cfg, graph_instance_t *inst,
26     char *buffer, size_t buffer_size);
27
28 int inst_get_rrdargs (graph_config_t *cfg, graph_instance_t *inst,
29     str_array_t *args);
30
31 graph_ident_t *inst_get_selector (graph_instance_t *inst);
32
33 int inst_compare_ident (graph_instance_t *inst, const graph_ident_t *ident);
34
35 _Bool inst_matches_ident (graph_instance_t *inst, const graph_ident_t *ident);
36
37 _Bool inst_matches_string (graph_config_t *cfg, graph_instance_t *inst,
38     const char *term);
39
40 /* Compares the given string with the appropriate field of the selector or, if
41  * the selector field is "/all/", iterates over all the files of the instance
42  * and checks the appropriate field. Returns true if the field of the selector
43  * or of one of the files matches. The string must match entirely but
44  * comparison is done case-insensitive. */
45 _Bool inst_matches_field (graph_instance_t *inst,
46     graph_ident_field_t field, const char *field_value);
47
48 int inst_describe (graph_config_t *cfg, graph_instance_t *inst,
49     char *buffer, size_t buffer_size);
50
51 time_t inst_get_mtime (graph_instance_t *inst);
52
53 #endif /* GRAPH_INSTANCE_H */
54 /* vim: set sw=2 sts=2 et fdm=marker : */