libdap Updated for version 3.21.1
libdap4 is an implementation of OPeNDAP's DAP protocol.
|
Manage AIS resources. More...
#include <AISResources.h>
Public Member Functions | |
AISResources () | |
AISResources (const string &database) throw (AISDatabaseReadFailed) | |
virtual | ~AISResources () |
Methods used by the AISDatabaseParser class | |
virtual void | add_url_resource (const string &url, const Resource &ancillary) |
virtual void | add_url_resource (const string &url, const ResourceVector &rv) |
virtual void | add_regexp_resource (const string ®exp, const Resource &ancillary) |
virtual void | add_regexp_resource (const string ®exp, const ResourceVector &rv) |
virtual bool | has_resource (const string &primary) const |
virtual ResourceVector | get_resource (const string &primary) |
virtual void | read_database (const string &database) |
virtual void | write_database (const string &filename) |
Friends | |
class | AISResourcesTest |
ostream & | operator<< (ostream &os, const AISResources &ais_res) |
Manage AIS resources.
Maintain a database of AIS resources. Groups of AIS resources are accessed using a primary resource. The AISResources object is the in-memory database of mappings between 'primary' and 'ancillary' resources.
Note that read_database() takes filenames because the underlying XML parser library uses filenames. The write_database() method takes a filename to be symmetrical.
Definition at line 69 of file AISResources.h.
|
inline |
Build an empty instance.
Definition at line 122 of file AISResources.h.
libdap::AISResources::AISResources | ( | const string & | database | ) | ||
throw | ( | AISDatabaseReadFailed ) |
Use an existing AIS database to build an instance.
database | Pathname of the database/document. |
Definition at line 96 of file AISResources.cc.
|
inlinevirtual |
Definition at line 125 of file AISResources.h.
|
virtual |
Add the given ancillary resource to the in-memory collection of mappings between regular expressions and ancillary data sources.
re | The target of the new mapping. This is a regular expression. |
ancillary | Match this ancillary resource to the target (primary). |
Definition at line 128 of file AISResources.cc.
|
virtual |
Add a vector of AIS resources for the given primary data source regular expression. If there is already an entry for the primary, append the new ancillary resources to those.
re | The target of the new mapping. |
rv | Ancillary resources matched to this primary resource. |
Definition at line 138 of file AISResources.cc.
|
virtual |
Add the given ancillary resource to the in-memory collection of mappings between primary and ancillary data sources.
url | The target of the new mapping. |
ancillary | Match this ancillary resource to the target (primary). |
Definition at line 104 of file AISResources.cc.
|
virtual |
Add a vector of AIS resources for the given primary data source URL. If there is already an entry for the primary, append the new ancillary resources to those.
url | The target of the new mapping. |
rv | Ancillary resources matched to this primary resource. |
Definition at line 113 of file AISResources.cc.
|
virtual |
Return a vector of AIS Resource objects which are bound to the given primary resource. If a given primary
resource has both an explicit entry for itself and matches a regular expression, the AIS resources for both will be combined in one ResourceVector and returned.
Aside from reading the database, this is the main workhorse for this class. Once a database has been read, a client uses has_resource() to see if a Data URL has anything in the database and then calls this method to get a vector of those things.
primary | The URL of the primary resource |
NoSuchPrimaryResource | thrown if primary is not present in the current mapping. |
Definition at line 187 of file AISResources.cc.
|
virtual |
Return True if the given primary resource is listed in the current set of AIS resource mappings. That is, return true if there are some AIS resources registered for the given primary resource.
primary | The URL of the primary resource. That is, a Data Source URL. |
primary
. Definition at line 157 of file AISResources.cc.
|
virtual |
Read the AIS database (an XML file) and internalize it. This method is almost always used to build an in-memory database that has_resource() and get_resource() use.
database | A file/pathname to the AIS database. |
AISDatabaseReadFailed | thrown if the database could not be read. |
Definition at line 216 of file AISResources.cc.
|
virtual |
Write the current in-memory mapping of primary and ancillary resources to the named file so that the read_database() method can read them and recreate the in-memory mapping.
filename | A local file; write the database to this file. Create if necessary. |
AISDatabaseWriteFailed | thrown if the database could not be written. |
Definition at line 230 of file AISResources.cc.
|
friend |
Definition at line 117 of file AISResources.h.
|
friend |
Output the XML for a collection of AIS resources. This function is a friend of the AISResource class.
Definition at line 59 of file AISResources.cc.