51 os <<
" url=\"" << r.d_url <<
"\"/>";
60 os <<
"<?xml version=\"1.0\" encoding=\"US-ASCII\" standalone=\"yes\"?>" << endl;
61 os <<
"<!DOCTYPE ais SYSTEM \"http://xml.opendap.org/ais/ais_database.dtd\">" << endl;
62 os <<
"<ais xmlns=\"http://xml.opendap.org/ais\">" << endl;
64 for (AISResources::ResourceRegexpsCIter pos = ais_res.d_re.begin(); pos != ais_res.d_re.end(); ++pos) {
65 os <<
"<entry>" << endl;
67 os <<
"<primary regexp=\"" << pos->first <<
"\"/>" << endl;
72 os <<
"</entry>" << endl;
78 for (AISResources::ResourceMapCIter pos2 = ais_res.d_db.begin(); pos2 != ais_res.d_db.end(); ++pos2) {
79 os <<
"<entry>" << endl;
81 os <<
"<primary url=\"" << pos2->first <<
"\"/>" << endl;
86 os <<
"</entry>" << endl;
89 os <<
"</ais>" << endl;
114 ResourceMapIter pos = d_db.find(url);
115 if (pos == d_db.end()) {
116 d_db.insert(std::make_pair(url, rv));
120 pos->second.push_back(*i);
139 ResourceRegexpsIter pos = find_if(d_re.begin(), d_re.end(), [re](
const RVPair &p) { return re == p.first; });
140 if (pos == d_re.end()) {
141 d_re.push_back(std::make_pair(re, rv));
145 pos->second.push_back(*i);
163 return ((d_db.find(primary) != d_db.end()) || (find_if(d_re.begin(), d_re.end(), [primary](
const RVPair &p) {
164 Regex r(p.first.c_str());
165 return r.match(p.first) != -1;
189 const ResourceMapIter &i = d_db.find(primary);
196 const ResourceRegexpsIter &j = find_if(d_re.begin(), d_re.end(), [primary](
const RVPair &p) {
197 Regex r(p.first.c_str());
198 return r.match(p.first) != -1;
201 copy(j->second.begin(), j->second.end(), inserter(rv, rv.begin()));
219 parser.
intern(database,
this);
232 fos.open(filename.c_str());
237 fos << *
this << endl;
void intern(const string &database, AISResources *ais)
virtual void write_database(const string &filename)
virtual ResourceVector get_resource(const string &primary)
virtual bool has_resource(const string &primary) const
virtual void read_database(const string &database)
virtual void add_regexp_resource(const string ®exp, const Resource &ancillary)
virtual void add_url_resource(const string &url, const Resource &ancillary)
Associate a rule with an ancillary resource.
top level DAP object to house generic methods
vector< Resource > ResourceVector
ResourceVector::const_iterator ResourceVectorCIter
ostream & operator<<(ostream &os, const Resource &r)