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

Last change on this file since 533 was 533, checked in by sjboddie, 25 years ago

added GPL notice

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 9.8 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 533 1999-09-07 04:57: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// languages [5] IMPLICIT StringSet, -- languages in the collection
75// numDocs [6] IMPLICIT INTEGER,
76// numWords [7] IMPLICIT INTEGER OPTIONAL,
77// numBytes [8] IMPLICIT INTEGER OPTIONAL
78// format [9] IMPLICIT StringSet
79// receptionist [10] IMPLICIT GeneralString
80// }
81struct ColInfoResponse_t {
82 void clear ();
83 ColInfoResponse_t () {clear();}
84
85 ShortColInfo_t shortInfo;
86 bool isPublic;
87 bool isBeta;
88 unsigned long buildDate;
89 text_tarray languages;
90 unsigned long numDocs; // 0 if not known
91 unsigned long numWords; // 0 if not known
92 unsigned long numBytes; // 0 if not known
93 text_tmap format;
94 text_t receptionist;
95};
96
97
98// -- filter options which might be supported for the QueryFilter
99// --
100// -- onePerQuery StartResults integer
101// -- onePerQuery EndResults integer
102// -- onePerQuery QueryType enumerated (boolean, ranked)
103// -- onePerTerm Term string ???
104// -- onePerTerm Casefold boolean
105// -- onePerTerm Stem boolean
106// -- onePerTerm Index enumerated
107// -- onePerTerm Subcollection enumerated
108// --
109// -- filter options which might be supported for the BrowseFilter
110// --
111// -- onePerQuery StartResults integer
112// -- onePerQuery EndResults integer
113// -- onePerQuery ParentNode string ("" will return the browsing available)
114// --
115// -- The NullFilter always returns the set it was given, it doesn't have
116// -- any options
117
118// InfoFiltersResponse ::= SEQUENCE {
119// filterNames StringSet
120// }
121struct InfoFiltersResponse_t {
122 void clear ();
123
124 text_tset filterNames;
125};
126
127// InfoFilterOptionsRequest ::= SEQUENCE {
128// filterName GeneralString
129// }
130struct InfoFilterOptionsRequest_t {
131 void clear ();
132
133 text_t filterName;
134};
135
136// FilterOption ::= SEQUENCE {
137// name GeneralString,
138// type ENUMERATED {booleant(0), integert(1), enumeratedt(2), stringt(3)},
139// repeatable ENUMERATED {onePerQuery(0), onePerTerm(1), nPerTerm(2)},
140// defaultValue GeneralString,
141// -- the interpretation of the validValues depends on the type
142// -- for boolean: the first value is the false value, the second is true value
143// -- for integer: the first value is the minimum, the second the maximum
144// -- for enumerated: all values a listed
145// -- for string: this value is ignored
146// validValues StringSequence
147// }
148struct FilterOption_t {
149 void clear ();
150 void check_defaultValue ();
151 FilterOption_t () {clear();}
152
153 text_t name;
154
155 enum type_t {booleant=0, integert=1, enumeratedt=2, stringt=3};
156 type_t type;
157
158 enum repeatable_t {onePerQuery=0, onePerTerm=1, nPerTerm=2};
159 repeatable_t repeatable;
160
161 text_t defaultValue;
162 text_tarray validValues;
163};
164
165bool operator==(const FilterOption_t &x, const FilterOption_t &y);
166bool operator<(const FilterOption_t &x, const FilterOption_t &y);
167
168
169typedef map<text_t, FilterOption_t, lttext_t> FilterOption_tmap;
170
171
172// InfoFilterOptionsResponse ::= SEQUENCE {
173// filterOptions SET OF FilterOption
174// }
175struct InfoFilterOptionsResponse_t {
176 void clear ();
177
178 FilterOption_tmap filterOptions;
179};
180
181
182// OptionValue ::= SEQUENCE {
183// name GeneralString,
184// value GeneralString
185// }
186struct OptionValue_t {
187 void clear ();
188
189 text_t name;
190 text_t value;
191};
192
193typedef vector<OptionValue_t> OptionValue_tarray;
194
195
196// -- Terms are presented in the same order that they are requested,
197// -- any information relating to the terms is in reference to the
198// -- index specified for that term.
199// -- Metadata is presented in the same order that it is requested.
200//
201// FilterRequest ::= SEQUENCE {
202// filterName [0] GeneralString,
203// filterOptions [1] IMPLICIT SEQUENCE OF OptionValue,
204// docSet [2] IMPLICIT StringSequence, -- the OID "" represents everything
205// filterResultOptions [3] IMPLICIT BIT STRING {termFreq(0), matchTerms(1), OID(2),
206// subCol(3), ranking(4), docFreq(5),
207// metadata(6)}
208//
209// -- the next set of options are for the metadata request,
210// -- they can be left blank if metadata is not wanted
211// requestParams [4] IMPLICIT GeneralString, -- used to negotiate the metadata content
212// refParams [5] IMPLICIT GeneralString, -- used to decide whether to return a
213// -- reference to the data or the actual data
214// fields [6] IMPLICIT StringSequence
215// getParents [7] IMPLICIT BOOLEAN -- gets metadata of all parents too
216// }
217#define FRtermFreq 1
218#define FRmatchTerms 2
219#define FROID 4
220#define FRsubCol 8
221#define FRranking 16
222#define FRdocFreq 32
223#define FRmetadata 64
224
225struct FilterRequest_t {
226 void clear ();
227 FilterRequest_t () {clear();}
228
229 text_t filterName;
230 OptionValue_tarray filterOptions;
231 text_tarray docSet; // empty if not used
232 int filterResultOptions; // use the FR* defines above
233
234 text_t requestParams; // empty if not used
235 text_t refParams; // empty if not used
236 text_tarray fields; // empty if not used
237 bool getParents; // defaults to false
238};
239
240
241// TermInfo ::= SEQUENCE {
242// term [0] GeneralString,
243// freq [1] IMPLICIT INTEGER, -- 0 if not requested
244// matchTerms [2] IMPLICIT StringSequence -- empty if not requested
245// }
246struct TermInfo_t {
247 void clear ();
248 TermInfo_t () {clear();}
249
250 text_t term;
251 int freq; // 0 if not requested
252 text_tarray matchTerms; // empty if not requested
253};
254
255typedef vector<TermInfo_t> TermInfo_tarray;
256
257
258// MetadataInfo ::= SEQUENCE {
259// params [0] IMPLICIT GeneralString,
260// isRef [1] IMPLICIT BOOLEAN,
261// values [3] IMPLICIT SEQUENCE OF GeneralString,
262// name [4] IMPLICIT GeneralString
263// }
264struct MetadataInfo_t {
265 void clear ();
266 MetadataInfo_t () {clear();}
267
268 text_t params;
269 bool isRef;
270 text_tarray values;
271 text_t name;
272};
273
274typedef vector<MetadataInfo_t> MetadataInfo_tarray;
275
276
277// ResultDocInfo ::= SEQUENCE {
278// OID [0] IMPLICIT GeneralString,
279// ranking [1] IMPLICIT INTEGER, -- 0 if not requested, range 0-10000
280// docFreq [2] IMPLICIT SEQUENCE OF INTEGER, -- empty if not requested
281// metadata [3] IMPLICIT SEQUENCE OF MetadataInfo
282// }
283struct ResultDocInfo_t {
284 void clear ();
285 ResultDocInfo_t () {clear();}
286
287 text_t OID;
288 int result_num; // place in results list
289 int ranking; // 0 if not requested (real ranking*10000)
290 int num_terms_matched; // not available on all versions of mg
291 int num_phrase_match; // not available on all versions of mg
292
293 vector<int> docFreq; // empty if not requested
294 MetadataInfo_tarray metadata; // empty if not requested
295
296 ResultDocInfo_t &operator=(const ResultDocInfo_t &x);
297};
298
299typedef vector<ResultDocInfo_t> ResultDocInfo_tarray;
300
301
302// FilterResponse ::= SEQUENCE {
303// numDocs [0] IMPLICIT INTEGER,
304// isApprox [1] ENUMERATED {Exact(0), Approximate(1), MoreThan(2)}, -- whether numDocs is approximate
305// termInfo [2] IMPLICIT SEQUENCE OF TermInfo, -- empty if not required
306// docInfo [3] IMPLICIT SEQUENCE OF ResultDocInfo -- empty if not required
307// }
308
309enum isapprox {Exact=0, Approximate=1, MoreThan=2};
310
311struct FilterResponse_t {
312 void clear ();
313 FilterResponse_t () {clear();}
314
315 int numDocs;
316 isapprox isApprox;
317 TermInfo_tarray termInfo; // empty if not requested
318 ResultDocInfo_tarray docInfo; // empty if not requested
319};
320
321
322// DocumentRequest ::= SEQUENCE {
323// OID GeneralString,
324// docType GeneralString,
325// docFormat GeneralString
326// }
327struct DocumentRequest_t {
328 void clear ();
329 DocumentRequest_t () {clear();}
330
331 text_t OID;
332 text_t docType;
333 text_t docFormat;
334};
335
336
337// DocumentResponse ::= SEQUENCE {
338// doc OCTET STRING
339// }
340
341struct DocumentResponse_t {
342 void clear ();
343 DocumentResponse_t () {clear();}
344
345 text_t doc;
346};
347
348
349#endif
Note: See TracBrowser for help on using the repository browser.