1 /* PSPP - computes sample statistics.
2 Copyright (C) 2004, 2007 Free Software Foundation, Inc.
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License as
6 published by the Free Software Foundation; either version 2 of the
7 License, or (at your option) any later version.
9 This program is distributed in the hope that it will be useful, but
10 WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 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, write to the Free Software
16 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
33 void (*var_added) (struct dictionary *, int, void *);
34 void (*var_deleted) (struct dictionary *, int, void *);
35 void (*var_changed) (struct dictionary *, int, void *);
36 void (*weight_changed) (struct dictionary *, int, void *);
37 void (*filter_changed) (struct dictionary *, int, void *);
38 void (*split_changed) (struct dictionary *, void *);
42 struct dictionary *dict_create (void);
43 struct dictionary *dict_clone (const struct dictionary *);
44 void dict_set_callbacks (struct dictionary *, const struct dict_callbacks *,
46 void dict_copy_callbacks (struct dictionary *, const struct dictionary *);
49 void dict_clear (struct dictionary *);
50 void dict_clear_aux (struct dictionary *);
51 void dict_destroy (struct dictionary *);
53 size_t dict_get_var_cnt (const struct dictionary *);
54 struct variable *dict_get_var (const struct dictionary *, size_t idx);
55 inline void dict_get_vars (const struct dictionary *,
56 const struct variable ***vars, size_t *cnt,
57 unsigned exclude_classes);
58 void dict_get_vars_mutable (const struct dictionary *,
59 struct variable ***vars, size_t *cnt,
60 unsigned exclude_classes);
62 struct variable *dict_create_var (struct dictionary *, const char *,
65 struct variable *dict_create_var_assert (struct dictionary *, const char *,
67 struct variable *dict_clone_var (struct dictionary *, const struct variable *,
69 struct variable *dict_clone_var_assert (struct dictionary *,
70 const struct variable *, const char *);
72 struct variable *dict_lookup_var (const struct dictionary *, const char *);
73 struct variable *dict_lookup_var_assert (const struct dictionary *,
75 bool dict_contains_var (const struct dictionary *, const struct variable *);
76 void dict_delete_var (struct dictionary *, struct variable *);
77 void dict_delete_vars (struct dictionary *,
78 struct variable *const *, size_t count);
79 void dict_delete_consecutive_vars (struct dictionary *d,
80 size_t idx, size_t count);
81 void dict_delete_scratch_vars (struct dictionary *);
82 void dict_reorder_var (struct dictionary *d, struct variable *v,
84 void dict_reorder_vars (struct dictionary *,
85 struct variable *const *, size_t count);
86 void dict_rename_var (struct dictionary *, struct variable *, const char *);
87 bool dict_rename_vars (struct dictionary *,
88 struct variable **, char **new_names,
89 size_t count, char **err_name);
92 struct variable *dict_get_weight (const struct dictionary *);
93 double dict_get_case_weight (const struct dictionary *,
94 const struct ccase *, bool *);
95 void dict_set_weight (struct dictionary *, struct variable *);
97 struct variable *dict_get_filter (const struct dictionary *);
98 void dict_set_filter (struct dictionary *, struct variable *);
100 size_t dict_get_case_limit (const struct dictionary *);
101 void dict_set_case_limit (struct dictionary *, size_t);
103 int dict_get_next_value_idx (const struct dictionary *);
104 size_t dict_get_case_size (const struct dictionary *);
106 void dict_compact_values (struct dictionary *);
107 size_t dict_get_compacted_value_cnt (const struct dictionary *);
108 int *dict_get_compacted_dict_index_to_case_index (const struct dictionary *);
109 bool dict_compacting_would_shrink (const struct dictionary *);
110 bool dict_compacting_would_change (const struct dictionary *);
112 struct dict_compactor *dict_make_compactor (const struct dictionary *);
113 void dict_compactor_compact (const struct dict_compactor *,
114 struct ccase *, const struct ccase *);
115 void dict_compactor_destroy (struct dict_compactor *);
117 const struct variable *const *dict_get_split_vars (const struct dictionary *);
118 size_t dict_get_split_cnt (const struct dictionary *);
119 void dict_set_split_vars (struct dictionary *,
120 struct variable *const *, size_t cnt);
121 void dict_unset_split_var (struct dictionary *d,
124 const char *dict_get_label (const struct dictionary *);
125 void dict_set_label (struct dictionary *, const char *);
127 /* Fixed length of lines in dictionary documents. */
128 #define DOC_LINE_LENGTH 80
130 const char *dict_get_documents (const struct dictionary *);
131 void dict_set_documents (struct dictionary *, const char *);
132 void dict_clear_documents (struct dictionary *);
133 void dict_add_document_line (struct dictionary *, const char *);
134 size_t dict_get_document_line_cnt (const struct dictionary *);
135 void dict_get_document_line (const struct dictionary *,
136 size_t, struct string *);
138 bool dict_create_vector (struct dictionary *,
140 struct variable **, size_t cnt);
141 void dict_create_vector_assert (struct dictionary *,
143 struct variable **, size_t cnt);
144 const struct vector *dict_get_vector (const struct dictionary *,
146 size_t dict_get_vector_cnt (const struct dictionary *);
147 const struct vector *dict_lookup_vector (const struct dictionary *,
149 void dict_clear_vectors (struct dictionary *);
151 void dict_assign_short_names (struct dictionary *);
153 /* Called only from variable.c */
154 void dict_var_changed (const struct variable *v);
156 #endif /* dictionary.h */