source: trunk/gsdl/src/colservr/source.h@ 249

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

lots of stuff to do with getting documentaction working

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 2.9 KB
Line 
1/**********************************************************************
2 *
3 * source.h --
4 * Copyright (C) 1999 The New Zealand Digital Library Project
5 *
6 * PUT COPYRIGHT NOTICE HERE
7 *
8 * $Id: source.h 249 1999-04-30 02:00:48Z sjboddie $
9 *
10 *********************************************************************/
11
12
13#ifndef SOURCE_H
14#define SOURCE_H
15
16#include "gsdlconf.h"
17#include "text_t.h"
18#include "comtypes.h"
19
20
21class sourceclass {
22public:
23 sourceclass ();
24 virtual ~sourceclass ();
25
26 // configure should be called once for each configuration line
27 virtual void configure (const text_t &key, const text_tarray &cfgline);
28
29 // init should be called after all the configuration is done but
30 // before any other methods are called
31 virtual bool init (ostream &logout);
32
33 // translate_OID translates OIDs using ".pr", ."fc" etc.
34 virtual bool translate_OID (const text_t &OIDin, text_t &OIDout,
35 comerror_t &err, ostream &logout);
36
37 // get_metadata fills out the metadata if possible, if it is not responsable
38 // for the given OID then it will return false.
39 virtual bool get_metadata (const text_t &requestParams, const text_t &refParams,
40 const text_tarray &fields, const text_t &OID,
41 MetadataInfo_tarray &metadata,
42 comerror_t &err, ostream &logout);
43};
44
45
46// The sourceptr class does not 'own' the source. The
47// source should be deleted by the code which created it.
48class sourceptr {
49public:
50 sourceclass *s;
51
52 sourceptr () {s=NULL;}
53};
54
55typedef vector<sourceptr> sourceptrlist;
56
57// contains a list of sources
58class sourcelistclass {
59protected:
60 sourceptrlist sourceptrs;
61
62public:
63 // type support for sourcelistclass
64 typedef sourceptrlist::iterator iterator;
65 typedef sourceptrlist::const_iterator const_iterator;
66 typedef sourceptrlist::reference reference;
67 typedef sourceptrlist::const_reference const_reference;
68 typedef sourceptrlist::size_type size_type;
69
70 typedef sourceptrlist::difference_type difference_type;
71 typedef sourceptrlist::const_reverse_iterator const_reverse_iterator;
72 typedef sourceptrlist::reverse_iterator reverse_iterator;
73
74 // basic container support
75 iterator begin () {return sourceptrs.begin();}
76 const_iterator begin () const {return sourceptrs.begin();}
77 iterator end () {return sourceptrs.end();}
78 const_iterator end () const {return sourceptrs.end();}
79
80 void erase(iterator pos) {sourceptrs.erase(pos);}
81 void erase(iterator first, iterator last) {sourceptrs.erase(first, last);}
82 sourcelistclass &operator=(const sourcelistclass &x)
83 {sourceptrs=x.sourceptrs;return *this;}
84
85 bool empty () const {return sourceptrs.empty();}
86 size_type size() const {return sourceptrs.size();}
87
88
89 // added functionality
90 void clear () {sourceptrs.erase(sourceptrs.begin(),sourceptrs.end());}
91
92 // thesource remains the property of the calling code but
93 // should not be deleted until it is removed from this list.
94 void addsource (sourceclass *thesource);
95};
96
97
98
99#endif
Note: See TracBrowser for help on using the repository browser.