From 7d659a7188dd2012d9e7a90168750757b4ef97ba Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Fri, 25 Jun 2010 11:31:11 +0200 Subject: [PATCH] src/graph_instance.[ch]: Implement "inst_get_all_selected". --- src/graph_instance.c | 23 +++++++++++++++++++++++ src/graph_instance.h | 3 +++ 2 files changed, 26 insertions(+) diff --git a/src/graph_instance.c b/src/graph_instance.c index 671430a..2d12873 100644 --- a/src/graph_instance.c +++ b/src/graph_instance.c @@ -286,6 +286,29 @@ graph_instance_t *inst_get_selected (graph_config_t *cfg) /* {{{ */ return (inst); } /* }}} graph_instance_t *inst_get_selected */ +int inst_get_all_selected (graph_config_t *cfg, /* {{{ */ + graph_inst_callback_t callback, void *user_data) +{ + graph_ident_t *ident; + int status; + + if ((cfg == NULL) || (callback == NULL)) + return (EINVAL); + + ident = inst_get_selector_from_params (); + if (ident == NULL) + { + fprintf (stderr, "inst_get_all_selected: " + "inst_get_selector_from_params failed\n"); + return (EINVAL); + } + + status = graph_inst_find_all_matching (cfg, ident, callback, user_data); + + ident_destroy (ident); + return (status); +} /* }}} int inst_get_all_selected */ + int inst_get_rrdargs (graph_config_t *cfg, /* {{{ */ graph_instance_t *inst, str_array_t *args) diff --git a/src/graph_instance.h b/src/graph_instance.h index b1d2df9..a6e7462 100644 --- a/src/graph_instance.h +++ b/src/graph_instance.h @@ -19,6 +19,9 @@ int inst_add_file (graph_instance_t *inst, const graph_ident_t *file); graph_instance_t *inst_get_selected (graph_config_t *cfg); +int inst_get_all_selected (graph_config_t *cfg, + graph_inst_callback_t callback, void *user_data); + int inst_get_params (graph_config_t *cfg, graph_instance_t *inst, char *buffer, size_t buffer_size); -- 2.11.0