+/* PSPP - a program for statistical analysis.
+ Copyright (C) 2015 Free Software Foundation, Inc.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#ifndef BARCHART_H
+#define BARCHART_H
+
+#include "libpspp/str.h"
+#include "output/chart-item.h"
+
+struct barchart
+ {
+ struct chart_item chart_item;
+ struct slice *bars;
+ int n_bars;
+ double largest;
+ char *ylabel;
+ };
+
+struct chart_item *barchart_create (const char *title, const char *ylabel,
+ const struct slice *, int n_bars);
+\f
+/* This boilerplate for barchart, a subclass of chart_item, was
+ autogenerated by mk-class-boilerplate. */
+
+#include <assert.h>
+#include "libpspp/cast.h"
+
+extern const struct chart_item_class barchart_class;
+
+/* Returns true if SUPER is a barchart, otherwise false. */
+static inline bool
+is_barchart (const struct chart_item *super)
+{
+ return super->class == &barchart_class;
+}
+
+/* Returns SUPER converted to barchart. SUPER must be a barchart, as
+ reported by is_barchart. */
+static inline struct barchart *
+to_barchart (const struct chart_item *super)
+{
+ assert (is_barchart (super));
+ return UP_CAST (super, struct barchart, chart_item);
+}
+
+/* Returns INSTANCE converted to chart_item. */
+static inline struct chart_item *
+barchart_super (const struct barchart *instance)
+{
+ return CONST_CAST (struct chart_item *, &instance->chart_item);
+}
+
+/* Increments INSTANCE's reference count and returns INSTANCE. */
+static inline struct barchart *
+barchart_ref (const struct barchart *instance)
+{
+ return to_barchart (chart_item_ref (&instance->chart_item));
+}
+
+/* Decrements INSTANCE's reference count, then destroys INSTANCE if
+ the reference count is now zero. */
+static inline void
+barchart_unref (struct barchart *instance)
+{
+ chart_item_unref (&instance->chart_item);
+}
+
+/* Returns true if INSTANCE's reference count is greater than 1,
+ false otherwise. */
+static inline bool
+barchart_is_shared (const struct barchart *instance)
+{
+ return chart_item_is_shared (&instance->chart_item);
+}
+
+static inline void
+barchart_submit (struct barchart *instance)
+{
+ chart_item_submit (&instance->chart_item);
+}
+\f
+#endif /* output/charts/barchart.h */