+/**
+ * collection4 - graph_instance.c
+ * Copyright (C) 2010 Florian octo Forster
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301 USA
+ *
+ * Authors:
+ * Florian octo Forster <ff at octo.it>
+ **/
+
#include <stdlib.h>
#include <string.h>
#include <errno.h>
struct def_callback_data_s
{
graph_instance_t *inst;
- str_array_t *args;
+ rrd_args_t *args;
};
typedef struct def_callback_data_s def_callback_data_t;
{
def_callback_data_t *data = user_data;
graph_instance_t *inst = data->inst;
- str_array_t *args = data->args;
+ rrd_args_t *args = data->args;
size_t i;
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)
+ rrd_args_t *args)
{
def_callback_data_t data = { inst, args };
graph_def_t *defs;
return (0);
} /* }}} int inst_get_params */
+int inst_compare (const graph_instance_t *i0, /* {{{ */
+ const graph_instance_t *i1)
+{
+ return (ident_compare (i0->select, i1->select));
+} /* }}} int inst_compare */
+
int inst_compare_ident (graph_instance_t *inst, /* {{{ */
const graph_ident_t *ident)
{
return (ident_compare (inst->select, ident));
} /* }}} int inst_compare_ident */
-_Bool inst_matches_ident (graph_instance_t *inst, /* {{{ */
+_Bool inst_ident_matches (graph_instance_t *inst, /* {{{ */
const graph_ident_t *ident)
{
+#if C4_DEBUG
if ((inst == NULL) || (ident == NULL))
return (0);
+#endif
return (ident_matches (inst->select, ident));
+} /* }}} _Bool inst_ident_matches */
+
+_Bool inst_matches_ident (graph_instance_t *inst, /* {{{ */
+ const graph_ident_t *ident)
+{
+ if ((inst == NULL) || (ident == NULL))
+ return (0);
+
+ return (ident_matches (ident, inst->select));
} /* }}} _Bool inst_matches_ident */
_Bool inst_matches_string (graph_config_t *cfg, /* {{{ */