1 /* PSPP - a program for statistical analysis.
2 Copyright (C) 2004, 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/>. */
20 #include "libpspp/str.h"
21 #include "output/chart-item.h"
22 #include "language/stats/freq.h"
26 struct chart_item chart_item;
39 struct chart_item *piechart_create (const struct variable *var,
40 const struct freq *, int n_slices);
42 /* This boilerplate for piechart, a subclass of chart_item, was
43 autogenerated by mk-class-boilerplate. */
46 #include "libpspp/cast.h"
48 extern const struct chart_item_class piechart_class;
50 /* Returns true if SUPER is a piechart, otherwise false. */
52 is_piechart (const struct chart_item *super)
54 return super->class == &piechart_class;
57 /* Returns SUPER converted to piechart. SUPER must be a piechart, as
58 reported by is_piechart. */
59 static inline struct piechart *
60 to_piechart (const struct chart_item *super)
62 assert (is_piechart (super));
63 return UP_CAST (super, struct piechart, chart_item);
66 /* Returns INSTANCE converted to chart_item. */
67 static inline struct chart_item *
68 piechart_super (const struct piechart *instance)
70 return CONST_CAST (struct chart_item *, &instance->chart_item);
73 /* Increments INSTANCE's reference count and returns INSTANCE. */
74 static inline struct piechart *
75 piechart_ref (const struct piechart *instance)
77 return to_piechart (chart_item_ref (&instance->chart_item));
80 /* Decrements INSTANCE's reference count, then destroys INSTANCE if
81 the reference count is now zero. */
83 piechart_unref (struct piechart *instance)
85 chart_item_unref (&instance->chart_item);
88 /* Returns true if INSTANCE's reference count is greater than 1,
91 piechart_is_shared (const struct piechart *instance)
93 return chart_item_is_shared (&instance->chart_item);
97 piechart_submit (struct piechart *instance)
99 chart_item_submit (&instance->chart_item);
102 #endif /* output/charts/piechart.h */