psppire: Sort by name or label case-insensitively in dictionary view.
[pspp.git] / src / data / casereader-shim.h
blob704d1d3de15ad778c1836692a952d43ad89e3283
1 /* PSPP - a program for statistical analysis.
2 Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc.
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.
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.
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/>. */
17 #ifndef DATA_CASEREADER_SHIM_H
18 #define DATA_CASEREADER_SHIM_H 1
20 /* Buffering shim for implementing clone and peek operations.
22 The "clone" and "peek" operations aren't implemented by all types of
23 casereaders, but we have to expose a uniform interface anyhow. The
24 casereader buffering shim can do this by interposing a buffer on top of an
25 existing casereader. The shim maintains a window of cases that spans the
26 positions of the original casereader and all of its clones (the "clone
27 set"), from the position of the casereader that has read the fewest cases to
28 the position of the casereader that has read the most.
30 Thus, if all of the casereaders in the clone set are at approximately the
31 same position, only a few cases are buffered and there is little
32 inefficiency. If, on the other hand, one casereader is not used to read any
33 cases at all, but another one is used to read all of the cases, the entire
34 contents of the casereader is copied into the buffer. This still might not
35 be so inefficient, given that case data in memory is shared across multiple
36 identical copies, but in the worst case the window implementation will write
37 cases to disk instead of maintaining them in-memory.
39 Casereader buffering shims are inserted automatically on the first call to
40 casereader_clone() or casereader_peek() for a casereader that does not
41 support those operations natively. Thus, there is ordinarily little reason
42 to intentionally insert a shim. */
44 struct casereader;
45 struct casereader_shim *casereader_shim_insert (struct casereader *);
46 void casereader_shim_slurp (struct casereader_shim *);
48 #endif /* data/casereader-shim.h */