1 /* PSPP - computes sample statistics.
2 Copyright (C) 1997-9, 2000, 2006 Free Software Foundation, Inc.
3 Written by Ben Pfaff <blp@gnu.org>.
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License as
7 published by the Free Software Foundation; either version 2 of the
8 License, or (at your option) any later version.
10 This program is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21 #define CASE_SOURCE_H 1
27 typedef struct write_case_data *write_case_data;
28 typedef bool write_case_func (write_case_data);
33 const struct case_source_class *class; /* Class. */
34 void *aux; /* Auxiliary data. */
37 /* A case source class. */
38 struct case_source_class
40 const char *name; /* Identifying name. */
42 /* Returns the exact number of cases that READ will pass to
43 WRITE_CASE, if known, or -1 otherwise. */
44 int (*count) (const struct case_source *);
46 /* Reads the cases one by one into C and for each one calls
47 WRITE_CASE passing the given AUX data.
48 Returns true if successful, false if an I/O error occurred. */
49 bool (*read) (struct case_source *,
51 write_case_func *write_case, write_case_data aux);
53 /* Destroys the source. */
54 void (*destroy) (struct case_source *);
58 struct case_source *create_case_source (const struct case_source_class *,
60 void free_case_source (struct case_source *);
62 bool case_source_is_class (const struct case_source *,
63 const struct case_source_class *);
65 #endif /* case-source.h */