libSBML C++ API  5.18.0
SBMLResolverRegistry Class Reference

Detailed Description

comp Registry of all SBML resolvers.

This class of objects is defined by libSBML only and has no direct equivalent in terms of SBML components. It is a class used in the implementation of extra functionality provided by libSBML.

LibSBML provides facilities for resolving SBML documents in various ways from a given URI. Resolvers are implemented as objects derived from the class SBMLResolver.

The resolver registry maintains a list of known resolvers and provides methods for discovering them. It is implemented as a singleton object of class SBMLResolverRegistry. Callers can use the method SBMLResolverRegistry::getNumResolvers() to find out how many resolvers are registered, then use SBMLResolverRegistry::getResolverByIndex() to iterate over each one;

See also
SBMLFileResolver

Public Member Functions

int addOwnedSBMLDocument (const SBMLDocument *doc)
 Adds the given SBMLDocument* to the registry of SBML documents that will need to be deleted. More...
 
int addResolver (const SBMLResolver *resolver)
 Adds the given resolver to the registry of SBML resolvers. More...
 
int getNumResolvers () const
 Returns the number of resolvers known by the registry. More...
 
SBMLResolvergetResolverByIndex (int index) const
 Returns the resolver with the given index number. More...
 
int removeResolver (int index)
 Removes the resolver with the given index. More...
 
virtual SBMLDocumentresolve (const std::string &uri, const std::string baseUri="") const
 Resolves the document for the given URI. More...
 
virtual SBMLUriresolveUri (const std::string &uri, const std::string baseUri="") const
 Resolves the full URI for the given URI without actually reading the document. More...
 
virtual ~SBMLResolverRegistry ()
 Destructor. More...
 

Static Public Member Functions

static void deleteResolerRegistryInstance ()
 deletes the static resolver registry instance More...
 
static SBMLResolverRegistrygetInstance ()
 Returns the singleton instance for the resolver registry. More...
 

Constructor & Destructor Documentation

virtual SBMLResolverRegistry::~SBMLResolverRegistry ( )
virtual

Destructor.

Member Function Documentation

int SBMLResolverRegistry::addOwnedSBMLDocument ( const SBMLDocument doc)

Adds the given SBMLDocument* to the registry of SBML documents that will need to be deleted.

When calculating reference cycles, sometimes we need SBML Documents to persist, but nobody else owns them directly. We hand them to the registry here so they can be cleaned up

Parameters
docthe SBML Document to add to the registry.
Returns
integer value indicating success/failure of the function. The value is drawn from the enumeration OperationReturnValues_t. The possible values returned by this function are:
int SBMLResolverRegistry::addResolver ( const SBMLResolver resolver)

Adds the given resolver to the registry of SBML resolvers.

Parameters
resolverthe resolver to add to the registry.
Returns
integer value indicating success/failure of the function. The value is drawn from the enumeration OperationReturnValues_t. The possible values returned by this function are:
Examples:
SBMLHttpResolverExample.cpp.
void SBMLResolverRegistry::deleteResolerRegistryInstance ( )
static

deletes the static resolver registry instance

SBMLResolverRegistry & SBMLResolverRegistry::getInstance ( )
static

Returns the singleton instance for the resolver registry.

Prior to using the registry, callers have to obtain a copy of the registry. This static method provides the means for doing that.

Returns
the singleton for the resolver registry.
Examples:
SBMLHttpResolverExample.cpp.
int SBMLResolverRegistry::getNumResolvers ( ) const

Returns the number of resolvers known by the registry.

Returns
the number of registered resolvers.
See also
getResolverByIndex()
SBMLResolver * SBMLResolverRegistry::getResolverByIndex ( int  index) const

Returns the resolver with the given index number.

Resolvers are given arbitrary index numbers by the registry. Callers can use the method SBMLResolverRegistry::getNumResolvers() to find out how many resolvers are registered, then use this method to iterate over the list and obtain each one in turn.

Parameters
indexthe zero-based index of the resolver to fetch.
Returns
the resolver with the given index number, or NULL if the number is less than 0 or there is no resolver at the given index position.
int SBMLResolverRegistry::removeResolver ( int  index)

Removes the resolver with the given index.

Parameters
indexthe index of the resolver to be removed.
Returns
integer value indicating success/failure of the function. The value is drawn from the enumeration OperationReturnValues_t. The possible values returned by this function are:
virtual SBMLDocument* SBMLResolverRegistry::resolve ( const std::string &  uri,
const std::string  baseUri = "" 
) const
virtual

Resolves the document for the given URI.

Parameters
urithe URI to the target document.
baseUribase URI, in case the URI is a relative one.
Returns
the document, if this resolver can resolve the document or NULL.
virtual SBMLUri* SBMLResolverRegistry::resolveUri ( const std::string &  uri,
const std::string  baseUri = "" 
) const
virtual

Resolves the full URI for the given URI without actually reading the document.

Parameters
urithe URI to the target document.
baseUribase URI, in case the URI is a relative one.
Returns
the full URI to the document, if this resolver can resolve the document or NULL.