1 | /**********************************************************************
|
---|
2 | *
|
---|
3 | * comtypes.h --
|
---|
4 | * Copyright (C) 1999 The New Zealand Digital Library Project
|
---|
5 | *
|
---|
6 | * A component of the Greenstone digital library software
|
---|
7 | * from the New Zealand Digital Library Project at the
|
---|
8 | * University of Waikato, New Zealand.
|
---|
9 | *
|
---|
10 | * This program is free software; you can redistribute it and/or modify
|
---|
11 | * it under the terms of the GNU General Public License as published by
|
---|
12 | * the Free Software Foundation; either version 2 of the License, or
|
---|
13 | * (at your option) any later version.
|
---|
14 | *
|
---|
15 | * This program is distributed in the hope that it will be useful,
|
---|
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
18 | * GNU General Public License for more details.
|
---|
19 | *
|
---|
20 | * You should have received a copy of the GNU General Public License
|
---|
21 | * along with this program; if not, write to the Free Software
|
---|
22 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
---|
23 | *
|
---|
24 | *********************************************************************/
|
---|
25 |
|
---|
26 |
|
---|
27 | #ifndef COMTYPES_H
|
---|
28 | #define COMTYPES_H
|
---|
29 |
|
---|
30 | #include "gsdlconf.h"
|
---|
31 | #include "text_t.h"
|
---|
32 |
|
---|
33 | #if defined(GSDL_USE_OBJECTSPACE)
|
---|
34 | # include <ospace\std\vector>
|
---|
35 | # include <ospace\std\list>
|
---|
36 | # include <ospace\std\map>
|
---|
37 | #elif defined(GSDL_USE_STL_H)
|
---|
38 | # include <vector.h>
|
---|
39 | # include <list.h>
|
---|
40 | # include <map.h>
|
---|
41 | #else
|
---|
42 | # include <vector>
|
---|
43 | # include <list>
|
---|
44 | # include <map>
|
---|
45 | #endif
|
---|
46 |
|
---|
47 |
|
---|
48 | enum comerror_t {noError, authenticationFailure, protocolError,
|
---|
49 | configurationError, systemProblem};
|
---|
50 | text_t get_comerror_string (comerror_t err);
|
---|
51 |
|
---|
52 | // ShortColInfo ::= SEQUENCE {
|
---|
53 | // name GeneralString,
|
---|
54 | // host GeneralString,
|
---|
55 | // port INTEGER
|
---|
56 | // }
|
---|
57 | struct ShortColInfo_t {
|
---|
58 | void clear ();
|
---|
59 | ShortColInfo_t () {clear();}
|
---|
60 |
|
---|
61 | text_t name;
|
---|
62 | text_t host;
|
---|
63 | int port;
|
---|
64 | };
|
---|
65 |
|
---|
66 |
|
---|
67 | // ColInfoResponse ::= SEQUENCE {
|
---|
68 | // shortInfo [0] IMPLICIT ShortCollectionInfo,
|
---|
69 | // isPublic [2] IMPLICIT BOOLEAN, -- whether has anonymous access
|
---|
70 | // isBeta [3] IMPLICIT BOOLEAN, -- beta if still under development
|
---|
71 | // buildDate [4] IMPLICIT GeneralizedTime,
|
---|
72 | // ccsCols [5] IMPLICIT StringSet, -- collections that form cross-col search
|
---|
73 | // languages [6] IMPLICIT StringSet, -- languages in the collection
|
---|
74 | // numDocs [7] IMPLICIT INTEGER,
|
---|
75 | // numSections [8] IMPLICIT INTEGER OPTIONAL,
|
---|
76 | // numWords [9] IMPLICIT INTEGER OPTIONAL,
|
---|
77 | // numBytes [10] IMPLICIT INTEGER OPTIONAL
|
---|
78 | // collectionmeta [11] IMPLICIT StringSet
|
---|
79 | // format [12] IMPLICIT StringSet
|
---|
80 | // building [13] IMPLICIT StringSet
|
---|
81 | // receptionist [14] IMPLICIT GeneralString
|
---|
82 | // buildType [15] IMPLICIT GeneralString
|
---|
83 | // }
|
---|
84 | struct ColInfoResponse_t {
|
---|
85 | void clear ();
|
---|
86 | ColInfoResponse_t () {clear();}
|
---|
87 |
|
---|
88 | ShortColInfo_t shortInfo;
|
---|
89 | bool isPublic;
|
---|
90 | bool isBeta;
|
---|
91 | unsigned long buildDate;
|
---|
92 | text_tarray ccsCols; // empty if collection does not use cross-collection searching
|
---|
93 | text_tarray languages;
|
---|
94 | unsigned long numDocs; // 0 if not known
|
---|
95 | unsigned long numSections; // 0 if not known
|
---|
96 | unsigned long numWords; // 0 if not known
|
---|
97 | unsigned long numBytes; // 0 if not known
|
---|
98 | text_tmap collectionmeta;
|
---|
99 | text_tmap format;
|
---|
100 | text_tmap building;
|
---|
101 | text_t receptionist;
|
---|
102 | text_t buildType; // 'mg' or 'mgpp'
|
---|
103 | };
|
---|
104 |
|
---|
105 |
|
---|
106 | // -- filter options which might be supported for the QueryFilter
|
---|
107 | // --
|
---|
108 | // -- onePerQuery StartResults integer
|
---|
109 | // -- onePerQuery EndResults integer
|
---|
110 | // -- onePerQuery QueryType enumerated (boolean, ranked)
|
---|
111 | // -- onePerTerm Term string ???
|
---|
112 | // -- onePerTerm Casefold boolean
|
---|
113 | // -- onePerTerm Stem boolean
|
---|
114 | // -- onePerTerm Index enumerated
|
---|
115 | // -- onePerTerm Subcollection enumerated
|
---|
116 | // --
|
---|
117 | // -- filter options which might be supported for the BrowseFilter
|
---|
118 | // --
|
---|
119 | // -- onePerQuery StartResults integer
|
---|
120 | // -- onePerQuery EndResults integer
|
---|
121 | // -- onePerQuery ParentNode string ("" will return the browsing available)
|
---|
122 | // --
|
---|
123 | // -- The NullFilter always returns the set it was given, it doesn't have
|
---|
124 | // -- any options
|
---|
125 |
|
---|
126 | // InfoFiltersResponse ::= SEQUENCE {
|
---|
127 | // filterNames StringSet
|
---|
128 | // }
|
---|
129 | struct InfoFiltersResponse_t {
|
---|
130 | void clear ();
|
---|
131 |
|
---|
132 | text_tset filterNames;
|
---|
133 | };
|
---|
134 |
|
---|
135 | // InfoFilterOptionsRequest ::= SEQUENCE {
|
---|
136 | // filterName GeneralString
|
---|
137 | // }
|
---|
138 | struct InfoFilterOptionsRequest_t {
|
---|
139 | void clear ();
|
---|
140 |
|
---|
141 | text_t filterName;
|
---|
142 | };
|
---|
143 |
|
---|
144 | // FilterOption ::= SEQUENCE {
|
---|
145 | // name GeneralString,
|
---|
146 | // type ENUMERATED {booleant(0), integert(1), enumeratedt(2), stringt(3)},
|
---|
147 | // repeatable ENUMERATED {onePerQuery(0), onePerTerm(1), nPerTerm(2)},
|
---|
148 | // defaultValue GeneralString,
|
---|
149 | // -- the interpretation of the validValues depends on the type
|
---|
150 | // -- for boolean: the first value is the false value, the second is true value
|
---|
151 | // -- for integer: the first value is the minimum, the second the maximum
|
---|
152 | // -- for enumerated: all values a listed
|
---|
153 | // -- for string: this value is ignored
|
---|
154 | // validValues StringSequence
|
---|
155 | // }
|
---|
156 | struct FilterOption_t {
|
---|
157 | void clear ();
|
---|
158 | void check_defaultValue ();
|
---|
159 | FilterOption_t () {clear();}
|
---|
160 |
|
---|
161 | text_t name;
|
---|
162 |
|
---|
163 | enum type_t {booleant=0, integert=1, enumeratedt=2, stringt=3};
|
---|
164 | type_t type;
|
---|
165 |
|
---|
166 | enum repeatable_t {onePerQuery=0, onePerTerm=1, nPerTerm=2};
|
---|
167 | repeatable_t repeatable;
|
---|
168 |
|
---|
169 | text_t defaultValue;
|
---|
170 | text_tarray validValues;
|
---|
171 | };
|
---|
172 |
|
---|
173 | bool operator==(const FilterOption_t &x, const FilterOption_t &y);
|
---|
174 | bool operator<(const FilterOption_t &x, const FilterOption_t &y);
|
---|
175 |
|
---|
176 |
|
---|
177 | typedef map<text_t, FilterOption_t, lttext_t> FilterOption_tmap;
|
---|
178 |
|
---|
179 |
|
---|
180 | // InfoFilterOptionsResponse ::= SEQUENCE {
|
---|
181 | // filterOptions SET OF FilterOption
|
---|
182 | // }
|
---|
183 | struct InfoFilterOptionsResponse_t {
|
---|
184 | void clear ();
|
---|
185 |
|
---|
186 | FilterOption_tmap filterOptions;
|
---|
187 | };
|
---|
188 |
|
---|
189 |
|
---|
190 | // OptionValue ::= SEQUENCE {
|
---|
191 | // name GeneralString,
|
---|
192 | // value GeneralString
|
---|
193 | // }
|
---|
194 | struct OptionValue_t {
|
---|
195 | void clear ();
|
---|
196 |
|
---|
197 | text_t name;
|
---|
198 | text_t value;
|
---|
199 | };
|
---|
200 |
|
---|
201 | typedef vector<OptionValue_t> OptionValue_tarray;
|
---|
202 |
|
---|
203 |
|
---|
204 | // -- Terms are presented in the same order that they are requested,
|
---|
205 | // -- any information relating to the terms is in reference to the
|
---|
206 | // -- index specified for that term.
|
---|
207 | //
|
---|
208 | // FilterRequest ::= SEQUENCE {
|
---|
209 | // filterName [0] GeneralString,
|
---|
210 | // filterOptions [1] IMPLICIT SEQUENCE OF OptionValue,
|
---|
211 | // docSet [2] IMPLICIT StringSequence, -- the OID "" represents everything
|
---|
212 | // filterResultOptions [3] IMPLICIT BIT STRING {termFreq(0), matchTerms(1), OID(2),
|
---|
213 | // subCol(3), ranking(4), docFreq(5),
|
---|
214 | // metadata(6)}
|
---|
215 | //
|
---|
216 | // -- the next set of options are for the metadata request,
|
---|
217 | // -- they can be left blank if metadata is not wanted
|
---|
218 | // requestParams [4] IMPLICIT GeneralString, -- used to negotiate the metadata content
|
---|
219 | // refParams [5] IMPLICIT GeneralString, -- used to decide whether to return a
|
---|
220 | // -- reference to the data or the actual data
|
---|
221 | // fields [6] IMPLICIT StringSet
|
---|
222 | // getParents [7] IMPLICIT BOOLEAN -- gets metadata of all parents too
|
---|
223 | // }
|
---|
224 | #define FRtermFreq 1
|
---|
225 | #define FRmatchTerms 2
|
---|
226 | #define FROID 4
|
---|
227 | #define FRsubCol 8
|
---|
228 | #define FRranking 16
|
---|
229 | #define FRdocFreq 32
|
---|
230 | #define FRmetadata 64
|
---|
231 | // used to indicate a full text browse query for mgpp
|
---|
232 | #define FRfullTextBrowse 128
|
---|
233 |
|
---|
234 | struct FilterRequest_t {
|
---|
235 | void clear ();
|
---|
236 | FilterRequest_t () {clear();}
|
---|
237 |
|
---|
238 | text_t filterName;
|
---|
239 | OptionValue_tarray filterOptions;
|
---|
240 | text_tarray docSet; // empty if not used
|
---|
241 | int filterResultOptions; // use the FR* defines above
|
---|
242 |
|
---|
243 | text_t requestParams; // empty if not used
|
---|
244 | text_t refParams; // empty if not used
|
---|
245 | text_tset fields; // empty if not used
|
---|
246 | bool getParents; // defaults to false
|
---|
247 | };
|
---|
248 |
|
---|
249 |
|
---|
250 | // TermInfo ::= SEQUENCE {
|
---|
251 | // term [0] GeneralString,
|
---|
252 | // freq [1] IMPLICIT INTEGER, -- 0 if not requested
|
---|
253 | // matchTerms [2] IMPLICIT StringSequence -- empty if not requested
|
---|
254 | // }
|
---|
255 | struct TermInfo_t {
|
---|
256 | void clear ();
|
---|
257 | TermInfo_t () {clear();}
|
---|
258 |
|
---|
259 | text_t term;
|
---|
260 | int freq; // 0 if not requested
|
---|
261 | text_tarray matchTerms; // empty if not requested
|
---|
262 | };
|
---|
263 |
|
---|
264 | typedef vector<TermInfo_t> TermInfo_tarray;
|
---|
265 |
|
---|
266 |
|
---|
267 | // MetadataInfo ::= SEQUENCE {
|
---|
268 | // params [0] IMPLICIT GeneralString,
|
---|
269 | // isRef [1] IMPLICIT BOOLEAN,
|
---|
270 | // values [3] IMPLICIT SEQUENCE OF GeneralString,
|
---|
271 | // name [4] IMPLICIT GeneralString
|
---|
272 | // }
|
---|
273 | struct MetadataInfo_t {
|
---|
274 | text_t params;
|
---|
275 | bool isRef;
|
---|
276 | text_tarray values;
|
---|
277 | MetadataInfo_t *parent;
|
---|
278 |
|
---|
279 | void clear ();
|
---|
280 | MetadataInfo_t ();
|
---|
281 | MetadataInfo_t (const MetadataInfo_t &x); // copy constructor
|
---|
282 | ~MetadataInfo_t ();
|
---|
283 | MetadataInfo_t &operator=(const MetadataInfo_t &x);
|
---|
284 | };
|
---|
285 |
|
---|
286 | typedef map<text_t, MetadataInfo_t, lttext_t> MetadataInfo_tmap;
|
---|
287 |
|
---|
288 | // ResultDocInfo ::= SEQUENCE {
|
---|
289 | // OID [0] IMPLICIT GeneralString,
|
---|
290 | // ranking [1] IMPLICIT INTEGER, -- 0 if not requested, range 0-10000
|
---|
291 | // docFreq [2] IMPLICIT SEQUENCE OF INTEGER, -- empty if not requested
|
---|
292 | // metadata [3] IMPLICIT SEQUENCE OF MetadataInfo, -- no longer a SEQUENCE (SET maybe??)
|
---|
293 | // classifier_metadata_type [4] IMPLICIT GeneralString, -- empty if not requested
|
---|
294 | // classifier_metadata_offset [5] IMPLICIT INTEGER, -- 0 if not requested
|
---|
295 | // }
|
---|
296 | struct ResultDocInfo_t {
|
---|
297 | void clear ();
|
---|
298 | ResultDocInfo_t () {clear();}
|
---|
299 |
|
---|
300 | text_t OID;
|
---|
301 | int result_num; // place in results list
|
---|
302 | int ranking; // 0 if not requested (real ranking*10000)
|
---|
303 | int num_terms_matched; // not available on all versions of mg
|
---|
304 | int num_phrase_match; // not available on all versions of mg
|
---|
305 | vector<int> docFreq; // empty if not requested
|
---|
306 | MetadataInfo_tmap metadata; // empty if not requested
|
---|
307 | text_t classifier_metadata_type; // empty if not requested
|
---|
308 | int classifier_metadata_offset; // 0 if not requested
|
---|
309 | ResultDocInfo_t &operator=(const ResultDocInfo_t &x);
|
---|
310 | };
|
---|
311 |
|
---|
312 | typedef vector<ResultDocInfo_t> ResultDocInfo_tarray;
|
---|
313 |
|
---|
314 |
|
---|
315 | // FilterResponse ::= SEQUENCE {
|
---|
316 | // numDocs [0] IMPLICIT INTEGER,
|
---|
317 | // isApprox [1] ENUMERATED {Exact(0), Approximate(1), MoreThan(2)}, -- whether numDocs is approximate
|
---|
318 | // termInfo [2] IMPLICIT SEQUENCE OF TermInfo, -- empty if not required
|
---|
319 | // docInfo [3] IMPLICIT SEQUENCE OF ResultDocInfo -- empty if not required
|
---|
320 | // }
|
---|
321 |
|
---|
322 | enum isapprox {Exact=0, Approximate=1, MoreThan=2};
|
---|
323 |
|
---|
324 | struct FilterResponse_t {
|
---|
325 | void clear ();
|
---|
326 | FilterResponse_t () {clear();}
|
---|
327 |
|
---|
328 | int numDocs;
|
---|
329 | isapprox isApprox;
|
---|
330 | TermInfo_tarray termInfo; // empty if not requested
|
---|
331 | ResultDocInfo_tarray docInfo; // empty if not requested
|
---|
332 |
|
---|
333 | FilterResponse_t &operator=(const FilterResponse_t &x);
|
---|
334 | };
|
---|
335 |
|
---|
336 |
|
---|
337 | // DocumentRequest ::= SEQUENCE {
|
---|
338 | // OID GeneralString,
|
---|
339 | // docType GeneralString,
|
---|
340 | // docFormat GeneralString
|
---|
341 | // }
|
---|
342 | struct DocumentRequest_t {
|
---|
343 | void clear ();
|
---|
344 | DocumentRequest_t () {clear();}
|
---|
345 |
|
---|
346 | text_t OID;
|
---|
347 | text_t docType;
|
---|
348 | text_t docFormat;
|
---|
349 | };
|
---|
350 |
|
---|
351 |
|
---|
352 | // DocumentResponse ::= SEQUENCE {
|
---|
353 | // doc OCTET STRING
|
---|
354 | // }
|
---|
355 |
|
---|
356 | struct DocumentResponse_t {
|
---|
357 | void clear ();
|
---|
358 | DocumentResponse_t () {clear();}
|
---|
359 |
|
---|
360 | text_t doc;
|
---|
361 | };
|
---|
362 |
|
---|
363 |
|
---|
364 | #endif
|
---|
365 |
|
---|