e781628be48f38560affe2858f961dbbe43cd5c2
[pspp-builds.git] / src / data / case-tmpfile.h
1 /* PSPP - computes sample statistics.
2    Copyright (C) 2007 Free Software Foundation, Inc.
3
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.
8
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.
13
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
17    02110-1301, USA. */
18
19 /* Manager for temporary files, each of which stores an array of
20    like-size cases.
21
22    Partial and whole cases may be read from and written to a
23    case_tmpfile in random order.  The indexes of the cases
24    written in a case_tmpfile need not be sequential or start from
25    0 (although this will be inefficient if the file system does
26    not support sparse files).  The case_tmpfile does not track
27    which cases have been written, so the client is responsible
28    for reading data only from cases (or partial cases) that have
29    previously been written. */
30
31 #ifndef DATA_CASE_TMPFILE_H
32 #define DATA_CASE_TMPFILE_H 1
33
34 #include <data/case.h>
35
36 struct case_tmpfile *case_tmpfile_create (size_t value_cnt);
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 bool case_tmpfile_get_case (const struct case_tmpfile *,
47                             casenumber, struct ccase *);
48
49 bool case_tmpfile_put_values (struct case_tmpfile *,
50                               casenumber, size_t start_value,
51                               const union value[], size_t value_cnt);
52 bool case_tmpfile_put_case (struct case_tmpfile *,
53                             casenumber, struct ccase *);
54
55 #endif /* data/case-tmpfile.h */