source: trunk/greenorg/src/recpt/comtypes.h@ 9483

Last change on this file since 9483 was 5503, checked in by sjboddie, 21 years ago

* empty log message *

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