1 /* PSPP - computes sample statistics.
2 Copyright (C) 1997-9, 2000, 2006 Free Software Foundation, Inc.
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.
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.
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
20 #define CASE_SOURCE_H 1
29 const struct case_source_class *class; /* Class. */
30 void *aux; /* Auxiliary data. */
33 /* A case source class. */
34 struct case_source_class
36 const char *name; /* Identifying name. */
38 /* Returns the exact number of cases that READ will pass to
39 WRITE_CASE, if known, or -1 otherwise. */
40 int (*count) (const struct case_source *);
42 /* Reads one case into C.
43 Returns true if successful, false at end of file or if an
44 I/O error occurred. */
45 bool (*read) (struct case_source *, struct ccase *);
47 /* Destroys the source.
48 Returns true if successful read, false if an I/O occurred
49 during destruction or previously. */
50 bool (*destroy) (struct case_source *);
54 struct case_source *create_case_source (const struct case_source_class *,
56 bool free_case_source (struct case_source *);
58 bool case_source_is_class (const struct case_source *,
59 const struct case_source_class *);
61 #endif /* case-source.h */