HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
FS_FileResolver Class Referenceabstract

#include <FS_FileResolver.h>

+ Inheritance diagram for FS_FileResolver:

Classes

class  FS_ResolverFileEntry
 Contains details about the data that the resolver can provide. More...
 

Public Member Functions

 FS_FileResolver ()
 Constructor. More...
 
virtual ~FS_FileResolver ()
 Destructor. More...
 
virtual bool getCanResolve (const char *name)=0
 Checks if the resolver can provide the file data for the given name. More...
 
virtual FS_ReadernewReader (const FS_FileResolverOptions &opts, const char *name)=0
 Creates a new reader object given the file (or data) name. More...
 
virtual void deleteReader (FS_Reader *reader)=0
 
virtual void acquireFilePath (const FS_FileResolverOptions &opts, const char *name, UT_String &file_path)=0
 
virtual void relinquishFilePath (const char *file_path)=0
 
virtual void registerFile (const FS_FileResolverOptions &opts, const UT_StringHolder &name, UT_IStream &data)
 
virtual int getRevisionID (const char *name)=0
 

Static Public Member Functions

static void setResolver (FS_FileResolver *resolver)
 Sets the instance that will resolve the operator paths to data files. More...
 
static FS_FileResolvergetResolver ()
 Returns the currently set resolver. More...
 

Protected Member Functions

void registerFile (const FS_FileResolverOptions &opts, const UT_StringHolder &name, const UT_StringHolder &file_path)
 
void unregisterFile (const UT_StringRef &name, bool delete_file)
 
FS_ResolverFileEntryfindFileInTable (const char *name)
 

Detailed Description

Maps the operator paths (eg, "op:/path"), and other data sources, to file readers that access their data.

Definition at line 90 of file FS_FileResolver.h.

Constructor & Destructor Documentation

FS_FileResolver::FS_FileResolver ( )

Constructor.

virtual FS_FileResolver::~FS_FileResolver ( )
virtual

Destructor.

Member Function Documentation

virtual void FS_FileResolver::acquireFilePath ( const FS_FileResolverOptions opts,
const char *  name,
UT_String file_path 
)
pure virtual

Obtains the file path to the data of a given name. On success, 'file_path' will contain a non-epnty file path. This file path should be then released using FS_FileResolver::relinquishFilePath().

Parameters
optsThe options that describe the data.
nameThe name of the data available in the file.
file_pathThe output parameter which will have the path of the file that contains the data. If the request fails, the path will be an empty string.

Implemented in OP_FileResolver.

virtual void FS_FileResolver::deleteReader ( FS_Reader reader)
pure virtual

Closes stream (if they are still open) and deletes the reader. After this call, the reader pointer will no longer be valid.

Parameters
readerThe reader to be freed.

Implemented in OP_FileResolver.

FS_ResolverFileEntry* FS_FileResolver::findFileInTable ( const char *  name)
protected

Looks up the table entry for the given name key and returns the entry. If not found, returns NULL.

virtual bool FS_FileResolver::getCanResolve ( const char *  name)
pure virtual

Checks if the resolver can provide the file data for the given name.

Implemented in OP_FileResolver.

static FS_FileResolver* FS_FileResolver::getResolver ( )
static

Returns the currently set resolver.

virtual int FS_FileResolver::getRevisionID ( const char *  name)
pure virtual

Returns an instance-unique identifier for a path that can be used to check if the underlying resource data has changed, and should be re-read by the clients of this class.

Parameters
nameThe name of the data to get the identifier for.
Returns
The revision id of the data. Returns 0 if the resource does not exist or revision IDs are not supported.

Implemented in OP_FileResolver.

virtual FS_Reader* FS_FileResolver::newReader ( const FS_FileResolverOptions opts,
const char *  name 
)
pure virtual

Creates a new reader object given the file (or data) name.

The returned reader can be used to read the data, and when finished, it should be freed by passing it to the FS_FileResolver::deleteReader() method.

Parameters
optsThe options that indicate how the data should be generated, if applicable. Eg, it contains the evaluation time for nodes or the file format in which the data should be available.
nameThe name of the data to be read. Can be a file specified with "file:/path" or an operator node data specified with "op:/path", or any other standard way of specifying data in Houdini.
Returns
The reader for the specified data.

Implemented in OP_FileResolver.

virtual void FS_FileResolver::registerFile ( const FS_FileResolverOptions opts,
const UT_StringHolder name,
UT_IStream data 
)
virtual

Adds the data to the resolver, so that the resolver can handle future requests for the data given this name.

Parameters
optsOptions describe how the data should be interpreted.
nameThe name of the resource. Future requests for this resource using FS_FileResolver::newReader() will returno a reader that provides this data.
dataThe stream containing the data. The resolver will read in and store this data for future use.
void FS_FileResolver::registerFile ( const FS_FileResolverOptions opts,
const UT_StringHolder name,
const UT_StringHolder file_path 
)
protected

Adds the file to the table. The resolver takes ownership of the file and will delete it in the destructor, unless it is unregistered from the table beforehand, with FS_FileResolver::unregisterFile().

virtual void FS_FileResolver::relinquishFilePath ( const char *  file_path)
pure virtual

Releases the file path and allows the resolver to (optionally) free the file resources.

Parameters
file_pathThe file path previously obtained with FS_FileResolver::acquireFilePath().

Implemented in OP_FileResolver.

static void FS_FileResolver::setResolver ( FS_FileResolver resolver)
static

Sets the instance that will resolve the operator paths to data files.

void FS_FileResolver::unregisterFile ( const UT_StringRef name,
bool  delete_file 
)
protected

Removes the file from table, and deletes the file if 'delete_file' is true.


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