1 /* PSPP - a program for statistical analysis.
2 Copyright (C) 2004, 2008, 2009 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_NP_PLOT_H
18 #define OUTPUT_CHARTS_NP_PLOT_H 1
20 #include <output/chart-item.h>
24 /* An NP or DNP plot. */
27 struct chart_item chart_item;
29 struct casereader *data;
32 /* Copied directly from struct np. */
34 double dns_min, dns_max;
37 double slope, intercept;
38 double y_first, y_last;
39 double x_lower, x_upper;
43 struct chart_item *np_plot_create (const struct np *,
44 const struct casereader *,
46 struct chart_item *dnp_plot_create (const struct np *,
47 const struct casereader *,
50 /* This boilerplate for np_plot_chart, a subclass of chart_item, was
51 autogenerated by mk-class-boilerplate. */
54 #include <libpspp/cast.h>
56 extern const struct chart_item_class np_plot_chart_class;
58 /* Returns true if SUPER is a np_plot_chart, otherwise false. */
60 is_np_plot_chart (const struct chart_item *super)
62 return super->class == &np_plot_chart_class;
65 /* Returns SUPER converted to np_plot_chart. SUPER must be a np_plot_chart, as
66 reported by is_np_plot_chart. */
67 static inline struct np_plot_chart *
68 to_np_plot_chart (const struct chart_item *super)
70 assert (is_np_plot_chart (super));
71 return UP_CAST (super, struct np_plot_chart, chart_item);
74 /* Returns INSTANCE converted to chart_item. */
75 static inline struct chart_item *
76 np_plot_chart_super (const struct np_plot_chart *instance)
78 return CONST_CAST (struct chart_item *, &instance->chart_item);
81 /* Increments INSTANCE's reference count and returns INSTANCE. */
82 static inline struct np_plot_chart *
83 np_plot_chart_ref (const struct np_plot_chart *instance)
85 return to_np_plot_chart (chart_item_ref (&instance->chart_item));
88 /* Decrements INSTANCE's reference count, then destroys INSTANCE if
89 the reference count is now zero. */
91 np_plot_chart_unref (struct np_plot_chart *instance)
93 chart_item_unref (&instance->chart_item);
96 /* Returns true if INSTANCE's reference count is greater than 1,
99 np_plot_chart_is_shared (const struct np_plot_chart *instance)
101 return chart_item_is_shared (&instance->chart_item);
105 np_plot_chart_submit (struct np_plot_chart *instance)
107 chart_item_submit (&instance->chart_item);
110 #endif /* output/charts/np-plot.h */