Layered split file for FREQUENCIES works.
[pspp] / src / data / vardict.h
1 /* PSPP - a program for statistical analysis.
2    Copyright (C) 1997-9, 2000, 2009 Free Software Foundation, Inc.
3
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.
8
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.
13
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/>. */
16
17 #ifndef DATA_VARDICT_H
18 #define DATA_VARDICT_H 1
19
20 /* Interface between dictionary and variable code.
21    This header file should only be included by variable.c and
22    dictionary.c. */
23
24 struct dictionary ;
25
26 /* Binds a variable to a dictionary. */
27 struct vardict_info
28   {
29     struct dictionary *dict;
30     struct variable *var;
31     struct hmap_node name_node; /* In struct dictionary's name_map. */
32     int case_index;     /* Index into case of variable data. */
33   };
34
35 /* Called by dictionary code, defined in variable.c. */
36 struct vardict_info *var_get_vardict (const struct variable *);
37 void var_set_vardict (struct variable *, struct vardict_info *);
38 bool var_has_vardict (const struct variable *);
39 void var_clear_vardict (struct variable *);
40
41 /* Called by variable.c, defined in dictionary.c. */
42 void dict_var_changed (const struct variable *v, unsigned int what, struct variable *ov);
43
44 int vardict_get_dict_index (const struct vardict_info *);
45
46 static inline int
47 vardict_get_case_index (const struct vardict_info *vardict)
48 {
49   return vardict->case_index;
50 }
51
52 static inline struct dictionary *
53 vardict_get_dictionary (const struct vardict_info *vardict)
54 {
55   return vardict->dict;
56 }
57
58 #endif /* data/vardict.h */