src/graph_instance.[ch]: Implement "inst_get_all_selected".
authorFlorian Forster <ff@octo.it>
Fri, 25 Jun 2010 09:31:11 +0000 (11:31 +0200)
committerFlorian Forster <octo@leeloo.lan.home.verplant.org>
Fri, 25 Jun 2010 09:31:11 +0000 (11:31 +0200)
src/graph_instance.c
src/graph_instance.h

index 671430a..2d12873 100644 (file)
@@ -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)
index b1d2df9..a6e7462 100644 (file)
@@ -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);