source: main/tags/2.53/gsdl/src/recpt/comtypes.h@ 33212

Last change on this file since 33212 was 8977, checked in by jrm21, 19 years ago

added compare function to multimap for old VC 4.2 compiler

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