1 /* PSPP - computes sample statistics.
2 Copyright (C) 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
19 #ifndef DATA_CASEWRITER_PROVIDER_H
20 #define DATA_CASEWRITER_PROVIDER_H 1
22 #include <data/casewriter.h>
24 struct casewriter_class
28 Writes case C to WRITER. Destroys C before returning.
30 If an I/O error occurs, this function should call
31 casewriter_force_error on WRITER. Some I/O error
32 detection may be deferred to the "destroy" member function
33 (e.g. writes to disk need not be flushed by "write") . */
34 void (*write) (struct casewriter *writer, void *aux, struct ccase *c);
38 Finalizes output and destroys WRITER.
40 If an I/O error is detected while finalizing output
41 (e.g. while flushing output to disk), this function should
42 call casewriter_force_error on WRITER. */
43 void (*destroy) (struct casewriter *writer, void *aux);
45 /* Optional: supply if practical and desired by clients.
47 Finalizes output to WRITER, destroys WRITER, and in its
48 place returns a casereader that can be used to read back
49 the data written to WRITER. WRITER will not be used again
50 after calling this function, even as an argument to
53 If an I/O error is detected while finalizing output
54 (e.g. while flushing output to disk), this function should
55 call casewriter_force_error on WRITER. The caller will
56 ensure that the error is propagated to the returned
58 struct casereader *(*convert_to_reader) (struct casewriter *, void *aux);
61 struct casewriter *casewriter_create (const struct casewriter_class *, void *);
63 #endif /* data/casewriter-provider.h */