1 /* PSPP - a program for statistical analysis.
2 Copyright (C) 2004, 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/>. */
20 #include <libpspp/str.h>
21 #include <output/chart-item.h>
25 struct chart_item chart_item;
36 struct chart_item *piechart_create (const char *title,
37 const struct slice *, int n_slices);
39 /* This boilerplate for piechart, a subclass of chart_item, was
40 autogenerated by mk-class-boilerplate. */
43 #include <libpspp/cast.h>
45 extern const struct chart_item_class piechart_class;
47 /* Returns true if SUPER is a piechart, otherwise false. */
49 is_piechart (const struct chart_item *super)
51 return super->class == &piechart_class;
54 /* Returns SUPER converted to piechart. SUPER must be a piechart, as
55 reported by is_piechart. */
56 static inline struct piechart *
57 to_piechart (const struct chart_item *super)
59 assert (is_piechart (super));
60 return UP_CAST (super, struct piechart, chart_item);
63 /* Returns INSTANCE converted to chart_item. */
64 static inline struct chart_item *
65 piechart_super (const struct piechart *instance)
67 return CONST_CAST (struct chart_item *, &instance->chart_item);
70 /* Increments INSTANCE's reference count and returns INSTANCE. */
71 static inline struct piechart *
72 piechart_ref (const struct piechart *instance)
74 return to_piechart (chart_item_ref (&instance->chart_item));
77 /* Decrements INSTANCE's reference count, then destroys INSTANCE if
78 the reference count is now zero. */
80 piechart_unref (struct piechart *instance)
82 chart_item_unref (&instance->chart_item);
85 /* Returns true if INSTANCE's reference count is greater than 1,
88 piechart_is_shared (const struct piechart *instance)
90 return chart_item_is_shared (&instance->chart_item);
94 piechart_submit (struct piechart *instance)
96 chart_item_submit (&instance->chart_item);
99 #endif /* output/charts/piechart.h */