1 /* PSPP - a program for statistical analysis.
2 Copyright (C) 1997-9, 2000, 2006, 2007, 2009, 2010, 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/>. */
23 #include "data/transformations.h"
30 struct dataset *dataset_create (struct session *, const char *);
31 struct dataset *dataset_clone (struct dataset *, const char *);
32 void dataset_destroy (struct dataset *);
34 void dataset_clear (struct dataset *);
36 const char *dataset_name (const struct dataset *);
37 void dataset_set_name (struct dataset *, const char *);
39 struct session *dataset_session (const struct dataset *);
40 void dataset_set_session (struct dataset *, struct session *);
42 struct dictionary *dataset_dict (const struct dataset *);
43 void dataset_set_dict (struct dataset *, struct dictionary *);
45 const struct casereader *dataset_source (const struct dataset *);
46 bool dataset_has_source (const struct dataset *ds);
47 bool dataset_set_source (struct dataset *, struct casereader *);
48 struct casereader *dataset_steal_source (struct dataset *);
50 unsigned int dataset_seqno (const struct dataset *);
52 struct dataset_callbacks
54 /* Called whenever a procedure completes execution or whenever the
55 dictionary within the dataset is modified (though not when it is
56 replaced by a new dictionary). */
57 void (*changed) (void *aux);
59 /* Called whenever a transformation is added or removed. NON_EMPTY is true
60 if after the change there is at least one transformation, false if there
61 are no transformations. */
62 void (*transformations_changed) (bool non_empty, void *aux);
65 void dataset_set_callbacks (struct dataset *, const struct dataset_callbacks *,
68 /* Dataset GUI window display status. */
71 DATASET_ASIS, /* Current state unchanged. */
72 DATASET_FRONT, /* Display and raise to top. */
73 DATASET_MINIMIZED, /* Display as icon. */
74 DATASET_HIDDEN /* Do not display. */
76 enum dataset_display dataset_get_display (const struct dataset *);
77 void dataset_set_display (struct dataset *, enum dataset_display);
79 /* Transformations. */
81 void add_transformation (struct dataset *ds,
82 trns_proc_func *, trns_free_func *, void *);
83 void add_transformation_with_finalizer (struct dataset *ds,
86 trns_free_func *, void *);
87 size_t next_transformation (const struct dataset *ds);
89 bool proc_cancel_all_transformations (struct dataset *ds);
90 struct trns_chain *proc_capture_transformations (struct dataset *ds);
92 void proc_start_temporary_transformations (struct dataset *ds);
93 bool proc_in_temporary_transformations (const struct dataset *ds);
94 bool proc_make_temporary_transformations_permanent (struct dataset *ds);
95 bool proc_cancel_temporary_transformations (struct dataset *ds);
99 void proc_discard_output (struct dataset *ds);
101 bool proc_execute (struct dataset *ds);
102 time_t time_of_last_procedure (struct dataset *ds);
104 struct casereader *proc_open_filtering (struct dataset *, bool filter);
105 struct casereader *proc_open (struct dataset *);
106 bool proc_is_open (const struct dataset *);
107 bool proc_commit (struct dataset *);
109 bool dataset_end_of_command (struct dataset *);
111 const struct ccase *lagged_case (const struct dataset *ds, int n_before);
112 void dataset_need_lag (struct dataset *ds, int n_before);
114 /* Private interface for use by session code. */
116 void dataset_set_session__(struct dataset *, struct session *);
118 #endif /* dataset.h */