Changeset 472 for trunk/gsdl/src


Ignore:
Timestamp:
1999-08-25T16:50:00+12:00 (25 years ago)
Author:
sjboddie
Message:

changed FilterRequest_t::docSet into an array

Location:
trunk/gsdl/src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/src/colservr/collectserver.cpp

    r466 r472  
    1313/*
    1414   $Log$
     15   Revision 1.13  1999/08/25 04:50:00  sjboddie
     16   changed FilterRequest_t::docSet into an array
     17
    1518   Revision 1.12  1999/08/20 01:05:41  sjboddie
    1619   fixed a bug (or created another one)
     
    199202  // translate any ".fc", ".pr" etc. stuff in the docSet
    200203  text_t translatedOID;
    201   text_tset translatedOIDs;
    202   text_tset::iterator doc_here = request.docSet.begin();
    203   text_tset::iterator doc_end = request.docSet.end();
     204  text_tarray translatedOIDs;
     205  text_tarray::iterator doc_here = request.docSet.begin();
     206  text_tarray::iterator doc_end = request.docSet.end();
    204207  while (doc_here != doc_end) {
    205208    if (needs_translating (*doc_here)) {
     
    215218    source_here++;
    216219      }
    217       translatedOIDs.insert (translatedOID);
     220      translatedOIDs.push_back (translatedOID);
    218221    } else {
    219       translatedOIDs.insert (*doc_here);
     222      translatedOIDs.push_back (*doc_here);
    220223    }
    221224    doc_here ++;
  • trunk/gsdl/src/colservr/filter.cpp

    r398 r472  
    1212/*
    1313   $Log$
     14   Revision 1.7  1999/08/25 04:49:33  sjboddie
     15   changed FilterRequest_t::docSet into an array
     16
    1417   Revision 1.6  1999/07/16 03:42:23  sjboddie
    1518   changed isApprox
     
    111114      (request.filterResultOptions & FRmetadata)) {
    112115    // copy the OIDs from the request to the response
    113     text_tset::const_iterator here = request.docSet.begin();
    114     text_tset::const_iterator end = request.docSet.end();
     116    text_tarray::const_iterator here = request.docSet.begin();
     117    text_tarray::const_iterator end = request.docSet.end();
    115118    while (here != end) {
    116119      resultdoc.OID = (*here);
     
    244247}
    245248
     249void intersect (text_tarray &set1, const text_tarray &set2) {
     250  text_tarray resultset;
     251
     252  text_tarray::const_iterator set1_here = set1.begin();
     253  text_tarray::const_iterator set1_end = set1.end();
     254
     255  while (set1_here != set1_end) {
     256    if (in_set (set2, *set1_here))
     257      resultset.push_back (*set1_here);
     258    set1_here ++;
     259  }
     260  set1 = resultset;
     261}
    246262
    247263// tests to see if el is in set
     
    267283  return false;
    268284}
     285
     286bool in_set (const text_tarray &set1, const text_t &el) {
     287  text_t::const_iterator here = el.begin();
     288  text_t::const_iterator end = el.begin();
     289  text_t tryel, tryel_add;
     290  bool first = true;
     291
     292  // the element is in the set if any of its parents are
     293  // in the set
     294  do {
     295    // get next possible element to try
     296    here = getdelimitstr (here, end, '.', tryel_add);
     297    if (!first) tryel += ".";
     298    first = false;
     299    tryel += tryel_add;
     300
     301    // see if this element is in the set
     302    text_tarray::const_iterator here = set1.begin();
     303    text_tarray::const_iterator end = set1.end();
     304    while (here != end) {
     305      if (*here == tryel) break;
     306      here ++;
     307    }
     308    if (here != end) return true;
     309  } while (here != end);
     310
     311  return false;
     312}
  • trunk/gsdl/src/colservr/filter.h

    r249 r472  
    113113void intersect (text_tset &set1, const text_tset &set2);
    114114void intersect (text_tarray &set1, const text_tset &set2);
     115void intersect (text_tarray &set1, const text_tarray &set2);
    115116
    116117// tests to see if el is in set
    117118bool in_set (const text_tset &set1, const text_t &el);
     119bool in_set (const text_tarray &set1, const text_t &el);
    118120
    119121#endif
  • trunk/gsdl/src/recpt/OIDtools.cpp

    r445 r472  
    1212/*
    1313   $Log$
     14   Revision 1.14  1999/08/25 04:45:25  sjboddie
     15   changed FilterRequest_t::docSet into an array
     16
    1417   Revision 1.13  1999/08/10 22:44:06  sjboddie
    1518   altered the get_contents function so it's now passed metadata
     
    115118bool get_info (const text_t &OID, const text_t &collection,
    116119           const text_tarray &metadata, bool getParents,
    117            recptproto *collectproto,FilterResponse_t &response,
     120           recptproto *collectproto, FilterResponse_t &response,
    118121           ostream &logout) {
    119122
     
    127130  request.getParents = getParents;
    128131  request.fields = metadata;
    129   request.docSet.insert (OID);
     132  request.docSet.push_back (OID);
    130133 
    131134  collectproto->filter (collection, request, response, err, logout);
     
    143146bool get_info (const text_tarray &OIDs, const text_t &collection,
    144147           const text_tarray &metadata, bool getParents,
    145            recptproto *collectproto,FilterResponse_t &response,
     148           recptproto *collectproto, FilterResponse_t &response,
    146149           ostream &logout) {
    147150
     
    157160  request.fields = metadata;
    158161
    159   text_tarray::const_iterator thisOID = OIDs.begin();
    160   text_tarray::const_iterator endOID = OIDs.end();
    161   while (thisOID != endOID) {
    162     request.docSet.insert (*thisOID);
    163     thisOID ++;
    164   }
     162  request.docSet = OIDs;
    165163 
    166164  collectproto->filter (collection, request, response, err, logout);
  • trunk/gsdl/src/recpt/OIDtools.h

    r445 r472  
    3737bool get_info (const text_tarray &OIDs, const text_t &collection,
    3838           const text_tarray &metadata, bool getParents,
    39            recptproto *collectproto,FilterResponse_t &response,
     39           recptproto *collectproto, FilterResponse_t &response,
    4040           ostream &logout);
    4141
  • trunk/gsdl/src/recpt/comtypes.h

    r459 r472  
    209209  text_t filterName;
    210210  OptionValue_tarray filterOptions;
    211   text_tset docSet;        // empty if not used
     211  text_tarray docSet;        // empty if not used
    212212  int filterResultOptions; // use the FR* defines above
    213213
Note: See TracChangeset for help on using the changeset viewer.