"show graph" action: Print a menu on the left side.
[collection4.git] / src / graph_instance.h
1 /**
2  * collection4 - graph_instance.h
3  * Copyright (C) 2010  Florian octo Forster
4  * 
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  * 
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Lesser General Public License for more details.
14  * 
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  * Boston, MA  02110-1301  USA
19  *
20  * Authors:
21  *   Florian octo Forster <ff at octo.it>
22  **/
23
24 #ifndef GRAPH_INSTANCE_H
25 #define GRAPH_INSTANCE_H 1
26
27 #include <time.h>
28
29 #include "graph_types.h"
30 #include "graph_ident.h"
31 #include "rrd_args.h"
32 #include "utils_array.h"
33
34 /*
35  * Methods
36  */
37 graph_instance_t *inst_create (graph_config_t *cfg,
38                 const graph_ident_t *ident);
39
40 void inst_destroy (graph_instance_t *inst);
41
42 int inst_add_file (graph_instance_t *inst, const graph_ident_t *file);
43
44 graph_instance_t *inst_get_selected (graph_config_t *cfg);
45
46 int inst_get_all_selected (graph_config_t *cfg,
47     graph_inst_callback_t callback, void *user_data);
48
49 int inst_get_params (graph_config_t *cfg, graph_instance_t *inst,
50     char *buffer, size_t buffer_size);
51
52 int inst_get_rrdargs (graph_config_t *cfg, graph_instance_t *inst,
53     rrd_args_t *args);
54
55 graph_ident_t *inst_get_selector (graph_instance_t *inst);
56
57 int inst_compare_ident (graph_instance_t *inst, const graph_ident_t *ident);
58
59 /* Returns true if "ident" matches the instance's selector. */
60 _Bool inst_ident_matches (graph_instance_t *inst, const graph_ident_t *ident);
61
62 /* Returns true if the instance's selector matches the (more general)
63  * "selector" ident. */
64 _Bool inst_matches_ident (graph_instance_t *inst,
65     const graph_ident_t *selector);
66
67 _Bool inst_matches_string (graph_config_t *cfg, graph_instance_t *inst,
68     const char *term);
69
70 /* Compares the given string with the appropriate field of the selector or, if
71  * the selector field is "/all/", iterates over all the files of the instance
72  * and checks the appropriate field. Returns true if the field of the selector
73  * or of one of the files matches. The string must match entirely but
74  * comparison is done case-insensitive. */
75 _Bool inst_matches_field (graph_instance_t *inst,
76     graph_ident_field_t field, const char *field_value);
77
78 int inst_describe (graph_config_t *cfg, graph_instance_t *inst,
79     char *buffer, size_t buffer_size);
80
81 time_t inst_get_mtime (graph_instance_t *inst);
82
83 #endif /* GRAPH_INSTANCE_H */
84 /* vim: set sw=2 sts=2 et fdm=marker : */