Loading...
Searching...
No Matches
resolver.h File Reference
+ Include dependency graph for resolver.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  ArResolver
 Interface for the asset resolution system. More...
 

Functions

AR_API ArResolverArGetResolver ()
 Returns the configured asset resolver.
 
AR_API void ArSetPreferredResolver (const std::string &resolverTypeName)
 Set the preferred ArResolver subclass used by ArGetResolver.
 
Advanced API
Warning
These functions should typically not be used by consumers except in very specific cases. Consumers who want to retrieve an ArResolver to perform asset resolution should use ArGetResolver.
AR_API ArResolverArGetUnderlyingResolver ()
 Returns the underlying ArResolver instance used by ArGetResolver.
 
AR_API std::vector< TfTypeArGetAvailableResolvers ()
 Returns list of TfTypes for available ArResolver subclasses.
 
AR_API std::unique_ptr< ArResolverArCreateResolver (const TfType &resolverType)
 Construct an instance of the ArResolver subclass specified by resolverType.
 

Function Documentation

◆ ArCreateResolver()

AR_API std::unique_ptr< ArResolver > ArCreateResolver ( const TfType resolverType)

Construct an instance of the ArResolver subclass specified by resolverType.

This function will load the plugin for the given resolverType and construct and return a new instance of the specified ArResolver subclass. If an error occurs, coding errors will be emitted and this function will return an ArDefaultResolver instance.

Note that this function does not change the resolver used by ArGetResolver to an instance of resolverType.

This function is not safe to call concurrently with itself or ArGetAvailableResolvers.

Warning
This functions should typically not be used by consumers except in very specific cases. Consumers who want to retrieve an ArResolver to perform asset resolution should use ArGetResolver.

◆ ArGetAvailableResolvers()

AR_API std::vector< TfType > ArGetAvailableResolvers ( )

Returns list of TfTypes for available ArResolver subclasses.

This function returns the list of ArResolver subclasses used to determine the resolver implementation returned by ArGetResolver. See documentation on that function for more details.

If this function is called from within a call (or calls) to ArCreateResolver, the ArResolver subclass(es) being created will be removed from the returned list.

This function is not safe to call concurrently with itself or ArCreateResolver.

Warning
This functions should typically not be used by consumers except in very specific cases. Consumers who want to retrieve an ArResolver to perform asset resolution should use ArGetResolver.

◆ ArGetResolver()

AR_API ArResolver & ArGetResolver ( )

Returns the configured asset resolver.

When first called, this function will determine the ArResolver subclass to use for asset resolution via the following process:

  • If a preferred resolver has been set via ArSetPreferredResolver, it will be selected.
  • Otherwise, a list of available ArResolver subclasses in plugins will be generated. If multiple ArResolver subclasses are found, the list will be sorted by typename. ArDefaultResolver will be added as the last element of this list, and the first resolver in the list will be selected.
  • The plugin for the selected subclass will be loaded and an instance of the subclass will be constructed.
  • If an error occurs, an ArDefaultResolver will be constructed.

The constructed ArResolver subclass will be cached and used to service function calls made on the returned resolver.

Note that this function may not return the constructed subclass itself, meaning that dynamic casts to the subclass type may fail. See ArGetUnderlyingResolver if access to this object is needed.

◆ ArGetUnderlyingResolver()

AR_API ArResolver & ArGetUnderlyingResolver ( )

Returns the underlying ArResolver instance used by ArGetResolver.

This function returns the instance of the ArResolver subclass used by ArGetResolver and can be dynamic_cast to that type.

Warning
This functions should typically not be used by consumers except in very specific cases. Consumers who want to retrieve an ArResolver to perform asset resolution should use ArGetResolver.

◆ ArSetPreferredResolver()

AR_API void ArSetPreferredResolver ( const std::string &  resolverTypeName)

Set the preferred ArResolver subclass used by ArGetResolver.

Consumers may override ArGetResolver's plugin resolver discovery and force the use of a specific resolver subclass by calling this function with the typename of the implementation to use.

If the subclass specified by resolverTypeName cannot be found, ArGetResolver will issue a warning and fall back to using ArDefaultResolver.

This must be called before the first call to ArGetResolver.