Change "union value" to dynamically allocate long strings.
[pspp-builds.git] / src / data / casewindow.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 /* Sliding window over a set of cases.
18
19    A casewindow is a queue of cases: cases may be added at the
20    head of the queue and deleted from the tail.  A casewindow is
21    initially maintained in memory and then, should it grow too
22    large, is dumped to disk.
23
24    Any case in the casewindow may be accessed, not just the case
25    at the head.  Cases are numbered relative to the tail: the
26    least recently added case is number 0, and so on. */
27
28 #ifndef DATA_CASEWINDOW_H
29 #define DATA_CASEWINDOW_H 1
30
31 #include <data/case.h>
32
33 struct caseproto;
34
35 struct casewindow *casewindow_create (const struct caseproto *,
36                                       casenumber max_in_core_cases);
37 bool casewindow_destroy (struct casewindow *);
38
39 void casewindow_push_head (struct casewindow *, struct ccase *);
40 void casewindow_pop_tail (struct casewindow *, casenumber cnt);
41 struct ccase *casewindow_get_case (const struct casewindow *,
42                                    casenumber case_idx);
43 const struct caseproto *casewindow_get_proto (const struct casewindow *);
44 casenumber casewindow_get_case_cnt (const struct casewindow *);
45
46 bool casewindow_error (const struct casewindow *);
47 void casewindow_force_error (struct casewindow *);
48 const struct taint *casewindow_get_taint (const struct casewindow *);
49
50 #endif /* data/casewindow.h */