pxd: initial work
[pspp] / src / data / relation.h
1 /* PSPP - a program for statistical analysis.
2    Copyright (C) 2012 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_RELATION_H
18 #define DATA_RELATION_H 1
19
20 #include "libpspp/compiler.h"
21 #include "data/column.h"
22
23 struct relation_column
24   {
25     struct hmap_node hmap_node;
26     const char *name;
27     struct column *column;
28   };
29
30 struct relation *relation_create (void);
31 bool relation_destroy (struct relation *);
32
33 void relation_add_column (struct relation *,
34                           const char *name, struct column *);
35 void relation_delete_column (struct relation *, const char *name);
36 void relation_rename_column (struct relation *, const char *old_name,
37                              const char *new_name);
38
39 const struct column *relation_get_column (const struct relation *,
40                                           const char *name);
41 struct column *relation_get_column_rw (struct relation *, const char *name);
42
43 struct pxd_object *relation_save (const struct relation *, struct pxd *);
44 struct relation *relation_load (struct pxd_object *, const struct pxd *);
45
46 #endif /* data/relation.h */