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