source: trunk/gsdl/src/colservr/collectserver.h@ 190

Last change on this file since 190 was 186, checked in by sjboddie, 25 years ago

Provided stub functions for the protocol

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 4.3 KB
Line 
1/**********************************************************************
2 *
3 * collectserver.h --
4 * Copyright (C) 1999 The New Zealand Digital Library Project
5 *
6 * PUT COPYRIGHT NOTICE HERE
7 *
8 * $Id: collectserver.h 186 1999-03-03 23:28:29Z sjboddie $
9 *
10 *********************************************************************/
11
12
13#ifndef COLLECTSERVER_H
14#define COLLECTSERVER_H
15
16#include "gsdlconf.h"
17#include "text_t.h"
18#include "comtypes.h"
19
20#if defined(GSDL_USE_OBJECTSPACE)
21# include <ospace\std\iostream>
22#elif defined(GSDL_USE_IOS_H)
23# include <iostream.h>
24#else
25# include <iostream>
26#endif
27
28#if defined(GSDL_USE_OBJECTSPACE)
29# include <ospace\std\map>
30#elif defined(GSDL_USE_STL_H)
31# include <map.h>
32#else
33# include <map>
34#endif
35
36
37struct colservrconf {
38 text_t gsdlhome;
39 text_t collection;
40 text_t collectdir;
41};
42
43class collectserver {
44protected:
45 colservrconf configinfo;
46 ColInfoResponse_t collectinfo;
47public:
48 collectserver ();
49 virtual ~collectserver ();
50
51 // configure should be called for each line in the
52 // configuration files to configure the collection server and everything
53 // it contains. The configuration should take place just before initialisation.
54 virtual void configure (const text_t &key, const text_tarray &cfgline);
55 void configure (const text_t &key, const text_t &value);
56 const colservrconf &get_configinfo () {return configinfo;}
57 text_t get_collection_name () {return configinfo.collection;}
58
59 // init should be called after the collection name has been set and
60 // all initialisation is done. init returns true if the initialisation
61 // was successful, if false is returned then no other functions
62 // should be called (without producing meaningless output).
63 virtual bool init (ostream &logout);
64
65 void get_collectinfo (ColInfoResponse_t &reponse,
66 comerror_t &err, ostream &logout);
67
68 virtual void get_filteroptions (InfoFilterOptionsResponse_t &response,
69 comerror_t &err, ostream &logout);
70
71 virtual void filter (const FilterRequest_t &request,
72 FilterResponse_t &response,
73 comerror_t &err, ostream &logout);
74
75 virtual void get_metadataoptions (MetadataInfoResponse_t &response,
76 comerror_t &err, ostream &logout);
77
78 virtual void get_metadata (const MetadataRequest_t &request,
79 MetadataResponse_t &response,
80 comerror_t &err, ostream &logout);
81};
82
83
84// The collectserverptr function does not 'own' the collectserver. The
85// collectserver should be deleted by the code which created it.
86class collectserverptr {
87public:
88 collectserver *c;
89
90 collectserverptr () {c=NULL;}
91};
92
93typedef map<text_t, collectserverptr, lttext_t> collectserverptrmap;
94
95// contains a list of collectservers indexed by their name
96class collectservermapclass {
97protected:
98 collectserverptrmap collectserverptrs;
99
100public:
101 // type support for collectserverptrmap
102 typedef collectserverptrmap::iterator iterator;
103 typedef collectserverptrmap::const_iterator const_iterator;
104 typedef collectserverptrmap::reference reference;
105 typedef collectserverptrmap::const_reference const_reference;
106 typedef collectserverptrmap::size_type size_type;
107
108 typedef collectserverptrmap::difference_type difference_type;
109 typedef collectserverptrmap::const_reverse_iterator const_reverse_iterator;
110 typedef collectserverptrmap::reverse_iterator reverse_iterator;
111
112 // basic container support
113 iterator begin () {return collectserverptrs.begin();}
114 const_iterator begin () const {return collectserverptrs.begin();}
115 iterator end () {return collectserverptrs.end();}
116 const_iterator end () const {return collectserverptrs.end();}
117
118 void erase(iterator pos) {collectserverptrs.erase(pos);}
119 void erase(iterator first, iterator last) {collectserverptrs.erase(first, last);}
120 collectservermapclass &operator=(const collectservermapclass &x)
121 {collectserverptrs=x.collectserverptrs;return *this;}
122
123 bool empty () const {return collectserverptrs.empty();}
124 size_type size() const {return collectserverptrs.size();}
125
126
127 // added functionality
128 void clear () {collectserverptrs.erase(collectserverptrs.begin(),collectserverptrs.end());}
129
130 // thecollectserver remains the property of the calling code but
131 // should not be deleted until it is removed from this list.
132 void addcollectserver (collectserver *thecollectserver);
133
134 // getcollectserver will return NULL if the collectserver could not be found
135 collectserver *getcollectserver (const text_t &collection);
136};
137
138
139#endif
Note: See TracBrowser for help on using the repository browser.