1 /* PSPP - a program for statistical analysis.
2 Copyright (C) 2009, 2011 Free Software Foundation, Inc.
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>. */
19 #include "output/charts/roc-chart.h"
21 #include "data/casereader.h"
22 #include "language/stats/roc.h"
23 #include "output/chart-item-provider.h"
25 #include "gl/xalloc.h"
28 #define _(msgid) gettext (msgid)
31 roc_chart_create (bool reference)
33 struct roc_chart *rc = xmalloc (sizeof *rc);
34 chart_item_init (&rc->chart_item, &roc_chart_class, NULL);
35 rc->reference = reference;
38 rc->allocated_vars = 0;
43 roc_chart_add_var (struct roc_chart *rc, const char *var_name,
44 const struct casereader *cutpoint_reader)
48 if (rc->n_vars >= rc->allocated_vars)
49 rc->vars = x2nrealloc (rc->vars, &rc->allocated_vars, sizeof *rc->vars);
51 rv = &rc->vars[rc->n_vars++];
52 rv->name = xstrdup (var_name);
53 rv->cutpoint_reader = casereader_clone (cutpoint_reader);
57 roc_chart_destroy (struct chart_item *chart_item)
59 struct roc_chart *rc = UP_CAST (chart_item, struct roc_chart, chart_item);
62 for (i = 0; i < rc->n_vars; i++)
64 struct roc_var *rv = &rc->vars[i];
66 casereader_destroy (rv->cutpoint_reader);
72 const struct chart_item_class roc_chart_class =