Fixed bug reporting the significance of paired value t-test.
[pspp-builds.git] / src / data / case.h
1 /* PSPP - a program for statistical analysis.
2    Copyright (C) 2004, 2007 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 DATA_CASE_H
18 #define DATA_CASE_H 1
19
20 #include <limits.h>
21 #include <stddef.h>
22 #include <stdbool.h>
23 #include "value.h"
24
25 struct variable;
26
27 /* A count of cases or the index of a case within a collection of
28    them. */
29 #define CASENUMBER_MAX LONG_MAX
30 typedef long int casenumber;
31
32 /* Opaque structure that represents a case.  Use accessor
33    functions instead of accessing any members directly.  Use
34    case_move() or case_clone() instead of copying.  */
35 struct ccase
36   {
37     struct case_data *case_data;        /* Actual data. */
38   };
39
40 void case_nullify (struct ccase *);
41 bool case_is_null (const struct ccase *);
42
43 void case_create (struct ccase *, size_t value_cnt);
44 void case_clone (struct ccase *, const struct ccase *);
45 void case_move (struct ccase *, struct ccase *);
46 void case_destroy (struct ccase *);
47
48 size_t case_get_value_cnt (const struct ccase *);
49
50 void case_resize (struct ccase *, size_t new_cnt);
51 void case_swap (struct ccase *, struct ccase *);
52
53 bool case_try_create (struct ccase *, size_t value_cnt);
54 bool case_try_clone (struct ccase *, const struct ccase *);
55
56 void case_copy (struct ccase *dst, size_t dst_idx,
57                 const struct ccase *src, size_t src_idx,
58                 size_t cnt);
59
60 void case_copy_out (const struct ccase *,
61                        size_t start_idx, union value *, size_t value_cnt);
62 void case_copy_in (struct ccase *,
63                        size_t start_idx, const union value *, size_t value_cnt);
64
65 const union value *case_data (const struct ccase *, const struct variable *);
66 double case_num (const struct ccase *, const struct variable *);
67 const char *case_str (const struct ccase *, const struct variable *);
68 union value *case_data_rw (struct ccase *, const struct variable *);
69
70 const union value *case_data_idx (const struct ccase *, size_t idx);
71 double case_num_idx (const struct ccase *, size_t idx);
72 const char *case_str_idx (const struct ccase *, size_t idx);
73 union value *case_data_rw_idx (struct ccase *, size_t idx);
74
75 int case_compare (const struct ccase *, const struct ccase *,
76                   const struct variable *const *, size_t var_cnt);
77 int case_compare_2dict (const struct ccase *, const struct ccase *,
78                         const struct variable *const *,
79                         const struct variable *const *,
80                         size_t var_cnt);
81
82 const union value *case_data_all (const struct ccase *);
83 union value *case_data_all_rw (struct ccase *);
84
85 #endif /* data/case.h */