1 /* @include ajurldata *********************************************************
2 **
3 ** AJAX url data structures
4 **
5 ** @author Copyright (C) 2010 Peter Rice
6 ** @version $Revision: 1.7 $
7 ** @modified Oct 5 pmr First version
8 ** @modified $Date: 2012/04/26 17:36:15 $ by $Author: mks $
9 ** @@
10 **
11 ** This library is free software; you can redistribute it and/or
12 ** modify it under the terms of the GNU Lesser General Public
13 ** License as published by the Free Software Foundation; either
14 ** version 2.1 of the License, or (at your option) any later version.
15 **
16 ** This library is distributed in the hope that it will be useful,
17 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19 ** Lesser General Public License for more details.
20 **
21 ** You should have received a copy of the GNU Lesser General Public
22 ** License along with this library; if not, write to the Free Software
23 ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
24 ** MA  02110-1301,  USA.
25 **
26 ******************************************************************************/
27 
28 #ifndef AJURLDATA_H
29 #define AJURLDATA_H
30 
31 /* ========================================================================= */
32 /* ============================= include files ============================= */
33 /* ========================================================================= */
34 
35 #include "ajdefine.h"
36 #include "ajtextdata.h"
37 #include "ajresourcedata.h"
38 
39 AJ_BEGIN_DECLS
40 
41 
42 
43 
44 /* ========================================================================= */
45 /* =============================== constants =============================== */
46 /* ========================================================================= */
47 
48 
49 
50 
51 /* ========================================================================= */
52 /* ============================== public data ============================== */
53 /* ========================================================================= */
54 
55 
56 
57 
58 /* @data AjPUrl ***************************************************************
59 **
60 ** Ajax url object.
61 **
62 ** Holds the url itself, plus associated information.
63 **
64 ** @alias AjSUrl
65 ** @alias AjOUrl
66 **
67 ** @attr Id        [AjPStr]  Id of term
68 ** @attr Db        [AjPStr]  Database name from input
69 ** @attr Setdb     [AjPStr]  Database name from command line
70 ** @attr Full      [AjPStr]  Full name
71 ** @attr Qry       [AjPStr]  Query for re-reading
72 ** @attr Formatstr [AjPStr]  Input format name
73 ** @attr Filename  [AjPStr]  Original filename
74 ** @attr Lines     [AjPStr*]  Full text
75 ** @attr Resqry    [AjPResquery]  Resource query
76 ** @attr Fpos      [ajlong]  File position
77 ** @attr Format    [AjEnum]  Input format enum
78 ** @attr Count     [ajuint]  Number of lines read
79 ** @@
80 ******************************************************************************/
81 
82 typedef struct AjSUrl
83 {
84     AjPStr  Id;
85     AjPStr  Db;
86     AjPStr  Setdb;
87     AjPStr  Full;
88     AjPStr  Qry;
89     AjPStr  Formatstr;
90     AjPStr  Filename;
91     AjPStr *Lines;
92     AjPResquery Resqry;
93     ajlong  Fpos;
94     AjEnum  Format;
95     ajuint Count;
96 } AjOUrl;
97 
98 #define AjPUrl AjOUrl*
99 
100 
101 
102 
103 /* @data AjPUrlin *************************************************************
104 **
105 ** Ajax url input object.
106 **
107 ** Holds the input specification and information needed to read
108 ** the url and possible further entries
109 **
110 ** @alias AjSUrlin
111 ** @alias AjOUrlin
112 **
113 ** @attr Input [AjPTextin] General text input object
114 ** @attr Resource [AjPResource] Resource object
115 ** @attr UrlList [AjPList] Result URLs list
116 ** @attr QryList [AjPList] Resource query objects for result URLs list
117 ** @attr UrlData [void*] Format data for reuse, e.g. multiple term input
118 **                         (unused in current code)
119 ** @attr Identifiers [AjPStr] Identifiers of source entry
120 ** @attr Accession [AjPStr] Accession number of source entry
121 ** @attr IdTypes [AjPStr] Identifier types in DRCAT
122 ** @attr IsSwiss [AjBool] True if URL is from a SwissProt reference
123 ** @attr IsEmbl [AjBool] True if URL is from an Embl/GenBank/DDBJ reference
124 ** @@
125 ******************************************************************************/
126 
127 typedef struct AjSUrlin
128 {
129     AjPTextin Input;
130     AjPResource Resource;
131     AjPList UrlList;
132     AjPList QryList;
133     void *UrlData;
134     AjPStr Identifiers;
135     AjPStr Accession;
136     AjPStr IdTypes;
137     AjBool IsSwiss;
138     AjBool IsEmbl;
139 } AjOUrlin;
140 
141 #define AjPUrlin AjOUrlin*
142 
143 
144 
145 
146 /* @data AjPUrlall ************************************************************
147 **
148 ** Ajax URL all (stream) object.
149 **
150 ** Inherits an AjPUrl but allows more URLs to be read from the
151 ** same input by also inheriting the AjPUrlin input object.
152 **
153 ** @alias AjSUrlall
154 ** @alias AjOUrlall
155 **
156 ** @attr Url [AjPUrl] Current URL
157 ** @attr Urlin [AjPUrlin] URL input for reading next
158 ** @attr Totterms [ajulong] Count of terms so far
159 ** @attr Count [ajuint] Count of terms so far
160 ** @attr Multi [AjBool] True if multiple values are expected
161 ** @attr Returned [AjBool] if true: URL object has been returned to a new
162 **                         owner and is not to be deleted by the destructor
163 ** @attr Padding [char[4]] Padding to alignment boundary
164 ** @@
165 ******************************************************************************/
166 
167 typedef struct AjSUrlall
168 {
169     AjPUrl Url;
170     AjPUrlin Urlin;
171     ajulong Totterms;
172     ajuint Count;
173     AjBool Multi;
174     AjBool Returned;
175     char Padding[4];
176 } AjOUrlall;
177 
178 #define AjPUrlall AjOUrlall*
179 
180 
181 
182 
183 /* @data AjPUrlAccess *********************************************************
184 **
185 ** Ajax url access database reading object.
186 **
187 ** Holds information needed to read an url entry from a database.
188 ** Access methods are defined for each known database type.
189 **
190 ** Url entries are read from the database using the defined
191 ** database access function, which is usually a static function
192 ** within ajurldb.c
193 **
194 ** This should be a static data object but is needed for the definition
195 ** of AjPUrlin.
196 **
197 ** @alias AjSUrlAccess
198 ** @alias AjOUrlAccess
199 **
200 ** @attr Name [const char*] Access method name used in emboss.default
201 ** @attr Access [AjBool function] Access function
202 ** @attr AccessFree [AjBool function] Access cleanup function
203 ** @attr Qlink [const char*] Supported query link operators
204 ** @attr Desc [const char*] Description
205 ** @attr Alias [AjBool] Alias for another name
206 ** @attr Entry [AjBool] Supports retrieval of single entries
207 ** @attr Query [AjBool] Supports retrieval of selected entries
208 ** @attr All [AjBool] Supports retrieval of all entries
209 ** @attr Chunked [AjBool] Supports retrieval of entries in chunks
210 ** @attr Padding [AjBool] Padding to alignment boundary
211 ** @@
212 ******************************************************************************/
213 
214 typedef struct AjSUrlAccess
215 {
216     const char *Name;
217     AjBool (*Access)(AjPUrlin urlin);
218     AjBool (*AccessFree)(void* qry);
219     const char* Qlink;
220     const char* Desc;
221     AjBool Alias;
222     AjBool Entry;
223     AjBool Query;
224     AjBool All;
225     AjBool Chunked;
226     AjBool Padding;
227 } AjOUrlAccess;
228 
229 #define AjPUrlAccess AjOUrlAccess*
230 
231 
232 
233 
234 /* ========================================================================= */
235 /* =========================== public functions ============================ */
236 /* ========================================================================= */
237 
238 
239 
240 
241 /*
242 ** Prototype definitions
243 */
244 
245 /*
246 ** End of prototype definitions
247 */
248 
249 
250 
251 
252 AJ_END_DECLS
253 
254 #endif /* !AJURLDATA_H */
255