dataset: Rename functions with "dataset_" prefix.
[pspp-builds.git] / src / data / dataset.h
1 /* PSPP - a program for statistical analysis.
2    Copyright (C) 1997-9, 2000, 2006, 2007, 2009, 2010, 2011 Free Software Foundation, Inc.
3
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.
8
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.
13
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/>. */
16
17 #ifndef PROCEDURE_H
18 #define PROCEDURE_H 1
19
20 #include <time.h>
21 #include <stdbool.h>
22
23 #include "data/transformations.h"
24 #include "libpspp/compiler.h"
25
26 struct casereader;
27 struct dataset;
28 struct dictionary;
29 \f
30 struct dataset *dataset_create (void);
31 void dataset_destroy (struct dataset *);
32
33 void dataset_clear (struct dataset *);
34
35 struct dictionary *dataset_dict (const struct dataset *);
36 void dataset_set_dict (struct dataset *, struct dictionary *);
37
38 const struct casereader *dataset_source (const struct dataset *);
39 bool dataset_has_source (const struct dataset *ds);
40 bool dataset_set_source (struct dataset *, struct casereader *);
41 struct casereader *dataset_steal_source (struct dataset *);
42
43 void dataset_set_callback (struct dataset *, void (*cb) (void *), void *);
44
45 void dataset_set_default_syntax_encoding (struct dataset *, const char *);
46 const char *dataset_get_default_syntax_encoding (const struct dataset *);
47 \f
48 /* Transformations. */
49
50 void add_transformation (struct dataset *ds,
51                          trns_proc_func *, trns_free_func *, void *);
52 void add_transformation_with_finalizer (struct dataset *ds,
53                                         trns_finalize_func *,
54                                         trns_proc_func *,
55                                         trns_free_func *, void *);
56 size_t next_transformation (const struct dataset *ds);
57
58 bool proc_cancel_all_transformations (struct dataset *ds);
59 struct trns_chain *proc_capture_transformations (struct dataset *ds);
60
61 void proc_start_temporary_transformations (struct dataset *ds);
62 bool proc_in_temporary_transformations (const struct dataset *ds);
63 bool proc_make_temporary_transformations_permanent (struct dataset *ds);
64 bool proc_cancel_temporary_transformations (struct dataset *ds);
65 \f
66 /* Procedures. */
67
68 typedef void transformation_change_callback_func (bool non_empty, void *aux);
69
70
71 void dataset_add_transform_change_callback (struct dataset *,
72                                             transformation_change_callback_func *, void *);
73
74 void proc_discard_output (struct dataset *ds);
75
76 bool proc_execute (struct dataset *ds);
77 time_t time_of_last_procedure (struct dataset *ds);
78
79 struct casereader *proc_open_filtering (struct dataset *, bool filter);
80 struct casereader *proc_open (struct dataset *);
81 bool proc_is_open (const struct dataset *);
82 bool proc_commit (struct dataset *);
83
84 bool dataset_end_of_command (struct dataset *);
85 \f
86 const struct ccase *lagged_case (const struct dataset *ds, int n_before);
87 void dataset_need_lag (struct dataset *ds, int n_before);
88
89 #endif /* dataset.h */