1 /* PSPP - a program for statistical analysis.
2 Copyright (C) 2006, 2009, 2011 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_CASEWRITER_PROVIDER_H
18 #define DATA_CASEWRITER_PROVIDER_H 1
20 #include "data/casewriter.h"
22 struct casewriter_class
26 Writes case C to WRITER. Ownership of C is transferred to
29 If an I/O error occurs, this function should call
30 casewriter_force_error on WRITER. Some I/O error
31 detection may be deferred to the "destroy" member function
32 (e.g. writes to disk need not be flushed by "write") . */
33 void (*write) (struct casewriter *writer, void *aux, struct ccase *c);
37 Finalizes output and destroys WRITER.
39 If an I/O error is detected while finalizing output
40 (e.g. while flushing output to disk), this function should
41 call casewriter_force_error on WRITER. */
42 void (*destroy) (struct casewriter *writer, void *aux);
44 /* Optional: supply if practical and desired by clients.
46 Finalizes output to WRITER, destroys WRITER, and in its
47 place returns a casereader that can be used to read back
48 the data written to WRITER. WRITER will not be used again
49 after calling this function, even as an argument to
52 If an I/O error is detected while finalizing output
53 (e.g. while flushing output to disk), this function should
54 call casewriter_force_error on WRITER. The caller will
55 ensure that the error is propagated to the returned
57 struct casereader *(*convert_to_reader) (struct casewriter *, void *aux);
60 struct casewriter *casewriter_create (const struct caseproto *,
61 const struct casewriter_class *, void *);
63 #endif /* data/casewriter-provider.h */