Private info (buf) moved from struct rset_control to struct rset.
[idzebra-moved-to-github.git] / include / rset.h
1 /*
2  * Copyright (C) 1994-1995, Index Data I/S 
3  * All rights reserved.
4  * Sebastian Hammer, Adam Dickmeiss
5  *
6  * $Log: rset.h,v $
7  * Revision 1.10  1995-10-12 12:40:36  adam
8  * Private info (buf) moved from struct rset_control to struct rset.
9  * Member control in rset is statically set in rset_create.
10  *
11  * Revision 1.9  1995/10/10  14:00:01  adam
12  * Function rset_open changed its wflag parameter to general flags.
13  *
14  * Revision 1.8  1995/10/06  14:37:53  adam
15  * New result set method: r_score.
16  * Local no (sysno) and score is transferred to retrieveCtrl.
17  *
18  * Revision 1.7  1995/09/07  13:58:08  adam
19  * New parameter: result-set file descriptor (RSFD) to support multiple
20  * positions within the same result-set.
21  * Boolean operators: and, or, not implemented.
22  *
23  * Revision 1.6  1995/09/06  16:10:58  adam
24  * More work on boolean sets.
25  *
26  * Revision 1.5  1995/09/04  15:20:13  adam
27  * More work on temp sets. is_open member removed.
28  *
29  * Revision 1.4  1995/09/04  09:09:52  adam
30  * String arg in dict lookup is const.
31  * Minor changes.
32  *
33  * Revision 1.3  1994/11/22  13:15:27  quinn
34  * Simple
35  *
36  * Revision 1.2  1994/11/04  13:21:21  quinn
37  * Working.
38  *
39  * Revision 1.1  1994/11/03  14:13:22  quinn
40  * Result set manipulation
41  *
42  */
43
44 #ifndef RSET_H
45 #define RSET_H
46
47 #include <stdlib.h>
48
49 typedef void *RSFD;
50
51 typedef struct rset *RSET;
52
53 typedef struct rset_control
54 {
55     char *desc; /* text description of set type (for debugging) */
56     void *(*f_create)(const struct rset_control *sel, void *parms);
57     RSFD (*f_open)(RSET ct, int wflag);
58     void (*f_close)(RSFD rfd);
59     void (*f_delete)(RSET ct);
60     void (*f_rewind)(RSFD rfd);
61     int (*f_count)(RSET ct);
62     int (*f_read)(RSFD rfd, void *buf);
63     int (*f_write)(RSFD rfd, const void *buf);
64     int (*f_score)(RSFD rfd, int *score);
65 } rset_control;
66
67 typedef struct rset
68 {
69     const rset_control *control;
70     void *buf;
71 } rset;
72
73 #define RSETF_READ       0
74 #define RSETF_WRITE      1
75
76 #define RSETF_SORT_SYSNO 0
77 #define RSETF_SORT_RANK  2
78
79 RSET rset_create(const rset_control *sel, void *parms);       /* parameters? */
80
81 /* int rset_open(RSET rs, int wflag); */
82 #define rset_open(rs, wflag) ((*(rs)->control->f_open)((rs), (wflag)))
83
84 /* void rset_close(RSET rs); */
85 #define rset_close(rs, rfd) ((*(rs)->control->f_close)((rfd)))
86
87 void rset_delete(RSET rs);
88
89 /* void rset_rewind(RSET rs); */
90 #define rset_rewind(rs, rfd) ((*(rs)->control->f_rewind)((rfd)))
91
92 /* int rset_count(RSET rs); */
93 #define rset_count(rs) ((*(rs)->control->f_count)(rs))
94
95 /* int rset_read(RSET rs, void *buf); */
96 #define rset_read(rs, fd, buf) ((*(rs)->control->f_read)((fd), (buf)))
97
98 /* int rset_write(RSET rs, const void *buf); */
99 #define rset_write(rs, fd, buf) ((*(rs)->control->f_write)((fd), (buf)))
100
101 /* int rset_score(RSET rs, int *buf); */
102 #define rset_score(rs, fd, score) ((*(rs)->control->f_score)((fd), (score)))
103
104 #endif