1 /* PSPP - a program for statistical analysis.
2 Copyright (C) 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/>. */
17 #ifndef OUTPUT_CHARTS_SCREE_H
18 #define OUTPUT_CHARTS_SCREE_H 1
20 #include <gsl/gsl_vector.h>
21 #include "output/chart-item.h"
26 struct chart_item chart_item;
31 /* Create a "Scree Plot" of EIGENVALUES with LABEL on the X Axis */
32 struct scree *scree_create (const gsl_vector *eigenvalues, const char *label);
34 /* Return the chart underlying SCREE */
35 struct chart *scree_get_chart (struct scree *scree);
37 /* This boilerplate for scree, a subclass of chart_item, was
38 autogenerated by mk-class-boilerplate. */
41 #include "libpspp/cast.h"
43 extern const struct chart_item_class scree_class;
45 /* Returns true if SUPER is a scree, otherwise false. */
47 is_scree (const struct chart_item *super)
49 return super->class == &scree_class;
52 /* Returns SUPER converted to scree. SUPER must be a scree, as
53 reported by is_scree. */
54 static inline struct scree *
55 to_scree (const struct chart_item *super)
57 assert (is_scree (super));
58 return UP_CAST (super, struct scree, chart_item);
61 /* Returns INSTANCE converted to chart_item. */
62 static inline struct chart_item *
63 scree_super (const struct scree *instance)
65 return CONST_CAST (struct chart_item *, &instance->chart_item);
68 /* Increments INSTANCE's reference count and returns INSTANCE. */
69 static inline struct scree *
70 scree_ref (const struct scree *instance)
72 return to_scree (chart_item_ref (&instance->chart_item));
75 /* Decrements INSTANCE's reference count, then destroys INSTANCE if
76 the reference count is now zero. */
78 scree_unref (struct scree *instance)
80 chart_item_unref (&instance->chart_item);
83 /* Returns true if INSTANCE's reference count is greater than 1,
86 scree_is_shared (const struct scree *instance)
88 return chart_item_is_shared (&instance->chart_item);
92 scree_submit (struct scree *instance)
94 chart_item_submit (&instance->chart_item);
97 #endif /* output/charts/scree.h */