f375ecc63c7827abcc2ad648e7c8972d353876e7
[pspp-builds.git] / src / dictionary.h
1 /* PSPP - computes sample statistics.
2    Copyright (C) 2004 Free Software Foundation, Inc.
3    Written by Ben Pfaff <blp@gnu.org>.
4
5    This program is free software; you can redistribute it and/or
6    modify it under the terms of the GNU General Public License as
7    published by the Free Software Foundation; either version 2 of the
8    License, or (at your option) any later version.
9
10    This program is distributed in the hope that it will be useful, but
11    WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13    General Public License for more details.
14
15    You should have received a copy of the GNU General Public License
16    along with this program; if not, write to the Free Software
17    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
18    02111-1307, USA. */
19
20 #ifndef DICTIONARY_H
21 #define DICTIONARY_H
22
23 #include <stddef.h>
24
25 /* Dictionary. */ 
26
27 struct variable;
28 struct dictionary *dict_create (void);
29 struct dictionary *dict_clone (const struct dictionary *);
30 void dict_clear (struct dictionary *);
31 void dict_clear_aux (struct dictionary *);
32 void dict_destroy (struct dictionary *);
33
34 size_t dict_get_var_cnt (const struct dictionary *);
35 struct variable *dict_get_var (const struct dictionary *, size_t idx);
36 void dict_get_vars (const struct dictionary *,
37                     struct variable ***vars, size_t *cnt,
38                     unsigned exclude_classes);
39
40 struct variable *dict_create_var (struct dictionary *, const char *,
41                                   int width);
42 struct variable *dict_create_var_assert (struct dictionary *, const char *,
43                                   int width);
44 struct variable *dict_clone_var (struct dictionary *, const struct variable *,
45                                  const char *);
46 void dict_rename_var (struct dictionary *, struct variable *, const char *);
47
48 struct variable *dict_lookup_var (const struct dictionary *, const char *);
49 struct variable *dict_lookup_var_assert (const struct dictionary *,
50                                          const char *);
51 int dict_contains_var (const struct dictionary *, const struct variable *);
52 void dict_delete_var (struct dictionary *, struct variable *);
53 void dict_delete_vars (struct dictionary *,
54                        struct variable *const *, size_t count);
55 void dict_reorder_vars (struct dictionary *,
56                         struct variable *const *, size_t count);
57 int dict_rename_vars (struct dictionary *,
58                       struct variable **, char **new_names,
59                       size_t count, char **err_name);
60
61 struct ccase;
62 struct variable *dict_get_weight (const struct dictionary *);
63 double dict_get_case_weight (const struct dictionary *, 
64                              const struct ccase *, int *);
65 void dict_set_weight (struct dictionary *, struct variable *);
66
67 struct variable *dict_get_filter (const struct dictionary *);
68 void dict_set_filter (struct dictionary *, struct variable *);
69
70 int dict_get_case_limit (const struct dictionary *);
71 void dict_set_case_limit (struct dictionary *, int);
72
73 int dict_get_next_value_idx (const struct dictionary *);
74 size_t dict_get_case_size (const struct dictionary *);
75
76 void dict_compact_values (struct dictionary *);
77 void dict_compact_case (const struct dictionary *,
78                         struct ccase *, const struct ccase *);
79 size_t dict_get_compacted_value_cnt (const struct dictionary *);
80 int *dict_get_compacted_idx_to_fv (const struct dictionary *);
81
82 struct variable *const *dict_get_split_vars (const struct dictionary *);
83 size_t dict_get_split_cnt (const struct dictionary *);
84 void dict_set_split_vars (struct dictionary *,
85                           struct variable *const *, size_t cnt);
86
87 const char *dict_get_label (const struct dictionary *);
88 void dict_set_label (struct dictionary *, const char *);
89
90 const char *dict_get_documents (const struct dictionary *);
91 void dict_set_documents (struct dictionary *, const char *);
92
93 int dict_create_vector (struct dictionary *,
94                         const char *name,
95                         struct variable **, size_t cnt);
96 const struct vector *dict_get_vector (const struct dictionary *,
97                                       size_t idx);
98 size_t dict_get_vector_cnt (const struct dictionary *);
99 const struct vector *dict_lookup_vector (const struct dictionary *,
100                                          const char *name);
101 void dict_clear_vectors (struct dictionary *);
102
103 #endif /* dictionary.h */