1 /* PSPP - a program for statistical analysis.
2 Copyright (C) 2012 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/>. */
17 #ifndef OUTPUT_CHARTS_SL_PLOT_H
18 #define OUTPUT_CHARTS_SL_PLOT_H 1
20 #include "output/chart-item.h"
28 struct spreadlevel_plot_chart
30 struct chart_item chart_item;
32 /* Calculated parameters */
33 double y_lower, y_upper;
34 double x_lower, x_upper;
42 struct chart_item *spreadlevel_plot_create (const char *label, double slp);
44 void spreadlevel_plot_add (struct chart_item *, double spread, double level);
48 /* This boilerplate for spreadlevel_plot_chart, a subclass of chart_item, was
49 autogenerated by mk-class-boilerplate. */
52 #include "libpspp/cast.h"
54 extern const struct chart_item_class spreadlevel_plot_chart_class;
56 /* Returns true if SUPER is a spreadlevel_plot_chart, otherwise false. */
58 is_spreadlevel_plot_chart (const struct chart_item *super)
60 return super->class == &spreadlevel_plot_chart_class;
63 /* Returns SUPER converted to spreadlevel_plot_chart. SUPER must be a spreadlevel_plot_chart, as
64 reported by is_spreadlevel_plot_chart. */
65 static inline struct spreadlevel_plot_chart *
66 to_spreadlevel_plot_chart (const struct chart_item *super)
68 assert (is_spreadlevel_plot_chart (super));
69 return UP_CAST (super, struct spreadlevel_plot_chart, chart_item);
72 /* Returns INSTANCE converted to chart_item. */
73 static inline struct chart_item *
74 spreadlevel_plot_chart_super (const struct spreadlevel_plot_chart *instance)
76 return CONST_CAST (struct chart_item *, &instance->chart_item);
79 /* Increments INSTANCE's reference count and returns INSTANCE. */
80 static inline struct spreadlevel_plot_chart *
81 spreadlevel_plot_chart_ref (const struct spreadlevel_plot_chart *instance)
83 return to_spreadlevel_plot_chart (chart_item_ref (&instance->chart_item));
86 /* Decrements INSTANCE's reference count, then destroys INSTANCE if
87 the reference count is now zero. */
89 spreadlevel_plot_chart_unref (struct spreadlevel_plot_chart *instance)
91 chart_item_unref (&instance->chart_item);
94 /* Returns true if INSTANCE's reference count is greater than 1,
97 spreadlevel_plot_chart_is_shared (const struct spreadlevel_plot_chart *instance)
99 return chart_item_is_shared (&instance->chart_item);
103 spreadlevel_plot_chart_submit (struct spreadlevel_plot_chart *instance)
105 chart_item_submit (&instance->chart_item);