2 * collection4 - graph_instance.h
3 * Copyright (C) 2010 Florian octo Forster
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.
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.
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
21 * Florian octo Forster <ff at octo.it>
24 #ifndef GRAPH_INSTANCE_H
25 #define GRAPH_INSTANCE_H 1
29 #include "graph_types.h"
30 #include "graph_ident.h"
32 #include "utils_array.h"
37 graph_instance_t *inst_create (graph_config_t *cfg,
38 const graph_ident_t *ident);
40 void inst_destroy (graph_instance_t *inst);
42 int inst_add_file (graph_instance_t *inst, const graph_ident_t *file);
44 graph_instance_t *inst_get_selected (graph_config_t *cfg);
46 int inst_get_all_selected (graph_config_t *cfg,
47 graph_inst_callback_t callback, void *user_data);
49 int inst_get_params (graph_config_t *cfg, graph_instance_t *inst,
50 char *buffer, size_t buffer_size);
52 int inst_get_rrdargs (graph_config_t *cfg, graph_instance_t *inst,
55 graph_ident_t *inst_get_selector (graph_instance_t *inst);
57 int inst_compare (const graph_instance_t *i0, const graph_instance_t *i1);
59 int inst_compare_ident (graph_instance_t *inst, const graph_ident_t *ident);
61 /* Returns true if "ident" matches the instance's selector. */
62 _Bool inst_ident_matches (graph_instance_t *inst, const graph_ident_t *ident);
64 /* Returns true if the instance's selector matches the (more general)
65 * "selector" ident. */
66 _Bool inst_matches_ident (graph_instance_t *inst,
67 const graph_ident_t *selector);
69 _Bool inst_matches_string (graph_config_t *cfg, graph_instance_t *inst,
72 /* Compares the given string with the appropriate field of the selector or, if
73 * the selector field is "/all/", iterates over all the files of the instance
74 * and checks the appropriate field. Returns true if the field of the selector
75 * or of one of the files matches. The string must match entirely but
76 * comparison is done case-insensitive. */
77 _Bool inst_matches_field (graph_instance_t *inst,
78 graph_ident_field_t field, const char *field_value);
80 int inst_describe (graph_config_t *cfg, graph_instance_t *inst,
81 char *buffer, size_t buffer_size);
83 time_t inst_get_mtime (graph_instance_t *inst);
85 #endif /* GRAPH_INSTANCE_H */
86 /* vim: set sw=2 sts=2 et fdm=marker : */