source: trunk/gsdl/src/recpt/comtypes.h@ 871

Last change on this file since 871 was 871, checked in by sjboddie, 24 years ago

caught up with Davids changes

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