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

Last change on this file since 757 was 722, checked in by davidb, 25 years ago

Collection building support through web pages
and internal and external link handling for collection documents

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