Change "union value" to dynamically allocate long strings.
[pspp-builds.git] / src / data / case-tmpfile.h
1 /* PSPP - a program for statistical analysis.
2    Copyright (C) 2007, 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 /* Manager for temporary files, each of which stores an array of
18    like-size cases.
19
20    Partial and whole cases may be read from and written to a
21    case_tmpfile in random order.  The indexes of the cases
22    written in a case_tmpfile need not be sequential or start from
23    0 (although this will be inefficient if the file system does
24    not support sparse files).  The case_tmpfile does not track
25    which cases have been written, so the client is responsible
26    for reading data only from cases (or partial cases) that have
27    previously been written. */
28
29 #ifndef DATA_CASE_TMPFILE_H
30 #define DATA_CASE_TMPFILE_H 1
31
32 #include <data/case.h>
33
34 struct caseproto;
35
36 struct case_tmpfile *case_tmpfile_create (const struct caseproto *);
37 bool case_tmpfile_destroy (struct case_tmpfile *);
38
39 bool case_tmpfile_error (const struct case_tmpfile *);
40 void case_tmpfile_force_error (struct case_tmpfile *);
41 const struct taint *case_tmpfile_get_taint (const struct case_tmpfile *);
42
43 bool case_tmpfile_get_values (const struct case_tmpfile *,
44                               casenumber, size_t start_value,
45                               union value[], size_t value_cnt);
46 struct ccase *case_tmpfile_get_case (const struct case_tmpfile *, casenumber);
47
48 bool case_tmpfile_put_values (struct case_tmpfile *,
49                               casenumber, size_t start_value,
50                               const union value[], size_t value_cnt);
51 bool case_tmpfile_put_case (struct case_tmpfile *,
52                             casenumber, struct ccase *);
53
54 #endif /* data/case-tmpfile.h */