All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ArResolverContext Class Reference

An asset resolver context allows clients to provide additional data to the resolver for use during resolution. More...

Public Member Functions

 ArResolverContext ()
 Construct an empty asset resolver context. More...
 
template<class Context >
 ArResolverContext (const Context &context, typename boost::enable_if< ArIsContextObject< Context > >::type *=0)
 Construct a resolver context using the context object context. More...
 
bool IsEmpty () const
 Returns whether this context object is empty. More...
 
template<class Context >
const Context * Get () const
 Return pointer to the context object held in this asset resolver context if the context is holding an object of the requested type, NULL otherwise. More...
 
std::string GetDebugString () const
 Returns a debug string representing the contained context. More...
 
Operators
bool operator== (const ArResolverContext &rhs) const
 
bool operator!= (const ArResolverContext &rhs) const
 
bool operator< (const ArResolverContext &rhs) const
 

Friends

size_t hash_value (const ArResolverContext &context)
 Returns hash value for this asset resolver context. More...
 

Detailed Description

An asset resolver context allows clients to provide additional data to the resolver for use during resolution.

Clients may provide this data via a context object of their own (subject to restrictions below). An ArResolverContext is simply a wrapper around this object that allows it to be treated as a single type.

A client-defined context object must provide the following:

  • Default and copy constructors
  • operator<
  • operator==
  • An overload for size_t hash_value(const T&)

Note that the user may define a free function:

std::string ArGetDebugString(const Context& ctx); (Where Context is the type of the user's path resolver context.)

This is optional; a default generic implementation has been predefined. This function should return a string representation of the context to be utilized for debugging purposes(such as in TF_DEBUG statements).

The ArIsContextObject template must also be specialized for this object to declare that it can be used as a context object. This is to avoid accidental use of an unexpected object as a context object. The AR_DECLARE_RESOLVER_CONTEXT macro can be used to do this as a convenience.

See Also
AR_DECLARE_RESOLVER_CONTEXT
ArResolver::BindContext
ArResolver::UnbindContext
ArResolverContextBinder

Definition at line 89 of file resolverContext.h.

Constructor & Destructor Documentation

ArResolverContext ( )
inline

Construct an empty asset resolver context.

Definition at line 93 of file resolverContext.h.

ArResolverContext ( const Context &  context,
typename boost::enable_if< ArIsContextObject< Context > >::type *  = 0 
)
inline

Construct a resolver context using the context object context.

See class documentation for requirements.

Definition at line 100 of file resolverContext.h.

Member Function Documentation

const Context* Get ( ) const
inline

Return pointer to the context object held in this asset resolver context if the context is holding an object of the requested type, NULL otherwise.

Definition at line 117 of file resolverContext.h.

std::string GetDebugString ( ) const
inline

Returns a debug string representing the contained context.

Definition at line 124 of file resolverContext.h.

bool IsEmpty ( ) const
inline

Returns whether this context object is empty.

Definition at line 108 of file resolverContext.h.

Friends And Related Function Documentation

size_t hash_value ( const ArResolverContext context)
friend

Returns hash value for this asset resolver context.

Definition at line 166 of file resolverContext.h.


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