delphyne
ResourceInspector Class Reference

Detailed Description

A singleton for resource reflection.

#include <include/delphyne/utility/resources/inspection.h>

Public Member Functions

 DELPHYNE_NO_COPY_NO_MOVE_NO_ASSIGN (ResourceInspector)
 
void AssociateExtension (const std::string &extension, const ResourceType *type)
 Associates a resource name extension to a given type. More...
 
std::unique_ptr< ResourceGetResource (const ignition::common::URI &uri) const
 Retrieves a representation of the resource pointed by uri. More...
 
std::vector< ignition::common::URI > GetDependencies (const ignition::common::URI &uri) const
 Extracts the list of resources that the resource pointed by uri depends on (see GetResource()). More...
 

Static Public Member Functions

static ResourceInspectorInstance ()
 Returns singleton instance. More...
 

Member Function Documentation

◆ AssociateExtension()

void AssociateExtension ( const std::string &  extension,
const ResourceType type 
)

Associates a resource name extension to a given type.

Parameters
extensionName extension (as in .txt).
typeResource type to associate.
Exceptions
std::logic_errorif given type is null
std::runtime_errorif given extension is already associated to a type.

◆ DELPHYNE_NO_COPY_NO_MOVE_NO_ASSIGN()

DELPHYNE_NO_COPY_NO_MOVE_NO_ASSIGN ( ResourceInspector  )

◆ GetDependencies()

std::vector< ignition::common::URI > GetDependencies ( const ignition::common::URI &  uri) const

Extracts the list of resources that the resource pointed by uri depends on (see GetResource()).

Parameters
uriIdentifier of the resource to extract dependencies from, to be resolved against the current Package (see PackageManager class documentation).
Returns
The URIs of the dependencies, if any, or an empty vector if the resource type is unknown (see AssociateExtension()).

◆ GetResource()

std::unique_ptr< Resource > GetResource ( const ignition::common::URI &  uri) const

Retrieves a representation of the resource pointed by uri.

Parameters
uriIdentifier of the resource, to be resolved against the current Package (see PackageManager class documentation).
Returns
Resource representation or nullptr if its type is unknown to the inspector.
Exceptions
std::runtime_errorif uri is not valid.
std::runtime_errorif uri points to a non-local resource.

◆ Instance()

ResourceInspector * Instance ( )
static

Returns singleton instance.


The documentation for this class was generated from the following files: