pxd: initial work
[pspp] / src / data / vec.h
1 /* PSPP - a program for statistical analysis.
2    Copyright (C) 2013 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_VEC_H
18 #define DATA_VEC_H 1
19
20 struct vec;
21
22 struct vec *vec_new (int width);
23
24 struct vec *vec_ref (const struct vec *);
25 void vec_unref (struct vec *);
26
27 int vec_width (const struct vec *);
28 casenumber vec_count (const struct vec *);
29
30 void vec_get (const struct vec *, casenumber, union value *);
31
32 struct vec *vec_put (struct vec *, casenumber, const union value *);
33 struct vec *vec_insert (struct vec *, casenumber before,
34                         const union value *);
35 struct vec *vec_delete (struct vec *, casenumber start, casenumber n);
36
37 struct vec *vec_head (struct vec *, casenumber n);
38 struct vec *vec_tail (struct vec *, casenumber n);
39
40 struct vec *vec_delete_head (struct vec *, casenumber n);
41 struct vec *vec_delete_tail (struct vec *, casenumber n);
42 struct vec *vec_range (struct vec *, casenumber first, casenumber last);
43
44 struct pxd_object *vec_save (const struct vec *, struct pxd *);
45 struct vec *vec_load (struct pxd_object *, const struct pxd *);
46
47 #endif /* data/vec.h */