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
26 typedef struct write_case_data *write_case_data;
27 typedef bool write_case_func (write_case_data);
32 const struct case_source_class *class; /* Class. */
33 void *aux; /* Auxiliary data. */
36 /* A case source class. */
37 struct case_source_class
39 const char *name; /* Identifying name. */
41 /* Returns the exact number of cases that READ will pass to
42 WRITE_CASE, if known, or -1 otherwise. */
43 int (*count) (const struct case_source *);
45 /* Reads the cases one by one into C and for each one calls
46 WRITE_CASE passing the given AUX data.
47 Returns true if successful, false if an I/O error occurred. */
48 bool (*read) (struct case_source *,
50 write_case_func *write_case, write_case_data aux);
52 /* Destroys the source. */
53 void (*destroy) (struct case_source *);
57 struct case_source *create_case_source (const struct case_source_class *,
59 void free_case_source (struct case_source *);
61 bool case_source_is_class (const struct case_source *,
62 const struct case_source_class *);
64 #endif /* case-source.h */