HDK
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
OP_FileResolver.h
Go to the documentation of this file.
1
/*
2
* PROPRIETARY INFORMATION. This software is proprietary to
3
* Side Effects Software Inc., and is not to be reproduced,
4
* transmitted, or disclosed in any way without written permission.
5
*
6
* NAME: OP_FileResolver.h ( OP Library, C++)
7
*
8
* COMMENTS:
9
*
10
*/
11
12
#ifndef __OP_FileResolver__
13
#define __OP_FileResolver__
14
15
#include "
OP_API.h
"
16
17
#include "
OP_Context.h
"
18
19
#include <
UT/UT_StringMap.h
>
20
#include <
FS/FS_FileResolver.h
>
21
22
class
FS_Writer
;
23
class
OP_Node
;
24
25
26
/// Cooks node data and makes it available through the reader.
27
class
OP_API
OP_FileResolver
:
public
FS_FileResolver
28
{
29
public
:
30
/// Constructor.
31
OP_FileResolver
();
32
33
/// Checks if the resolver can provide the file data for the given name.
34
bool
getCanResolve
(
const
char
*
name
)
override
;
35
36
/// @brief Creates a new reader object given the file (or data) name.
37
///
38
/// The returned reader can be used to read the data, and when finished,
39
/// it should be freed by passing it to the FS_FileResolver::deleteReader()
40
/// method.
41
///
42
/// @param opts The options that indicate how the data should be
43
/// generated, if applicable. Eg, it contains the evaluation
44
/// time for nodes or the file format in which the data
45
/// should be available.
46
///
47
/// @param name The name of the data to be read. Can be a file
48
/// specified with "file:/path" or an operator node
49
/// data specified with "op:/path", or any other standard
50
/// way of specifying data in Houdini.
51
//
52
/// @return The reader for the specified data.
53
///
54
FS_Reader
*
newReader
(
const
FS_FileResolverOptions
& opts,
55
const
char
* name )
override
;
56
57
/// Closes stream (if they are still open) and deletes the reader.
58
/// After this call, the reader pointer will no longer be valid.
59
///
60
/// @param reader The reader to be freed.
61
///
62
void
deleteReader
(
FS_Reader
* reader )
override
;
63
64
/// Obtains the file path to the data of a given name. On success,
65
/// 'file_path' will contain a non-epnty file path. This file path
66
/// should be then released using FS_FileResolver::relinquishFilePath().
67
///
68
/// @param opts The options that describe the data.
69
/// @param name The name of the data available in the file.
70
/// @param file_path The output parameter which will have the
71
/// path of the file that contains the data. If
72
/// the request fails, the path will be an empty string.
73
void
acquireFilePath
(
74
const
FS_FileResolverOptions
& opts,
75
const
char
* name,
76
UT_String
& file_path )
override
;
77
78
/// Releases the file path and allows the resolver to (optionally) free
79
/// the file resources.
80
///
81
/// @param file_path The file path previously obtained with
82
/// FS_FileResolver::acquireFilePath().
83
void
relinquishFilePath
(
const
char
* file_path )
override
;
84
85
86
/// Returns an instance-unique identifier for a path that can be used to
87
/// check if the underlying resource data has changed, and should be
88
/// re-read by the clients of this class.
89
90
/// @param name The name of the data to get the identifier for.
91
///
92
/// @return The revision id of the data. Returns 0 if the resource
93
/// does not exist or revision IDs are not supported.
94
int
getRevisionID
(
const
char
*name)
override
;
95
private
:
96
/// Saves the node data to a file according to the given specifications
97
/// in the options. This class stores an FS_Writer. If no FS_Reader is
98
/// created from the filename, then the temporary file may be deleted.
99
class
NodeSaver
100
{
101
public
:
102
NodeSaver() {}
103
~NodeSaver();
104
105
const
UT_StringHolder
&
filename
()
const
{
return
myFilename; }
106
bool
saveNode(
const
FS_FileResolverOptions
&opts,
107
const
char
*name);
108
private
:
109
UT_StringHolder
myFilename;
110
};
111
112
private
:
113
/// A map from issued reader pointers or from issued file paths to
114
/// the names used for registering the resource with the base class.
115
UT_Map<FS_Reader *, UT_StringHolder>
myRegisteredReaderFilenameMap;
116
UT_StringMap<UT_StringHolder>
myRegisteredPathFilenameMap;
117
};
118
119
120
121
/// Used to control how the node data is being saved when the file resolver
122
/// requests a cook.
123
class
OP_API
OP_FileResolverContextData
:
public
OP_ContextData
124
{
125
public
:
126
/// Constructor.
127
OP_FileResolverContextData
()
128
: myIsEnvMap( false )
129
{}
130
131
/// Indicates whether the COP should save an image as an environment map.
132
bool
getIsEnvMap
()
const
133
{
return
myIsEnvMap; }
134
void
setIsEnvMap
(
bool
env_map )
135
{ myIsEnvMap = env_map; }
136
137
private
:
138
/// Flag: save image as an environment map.
139
bool
myIsEnvMap;
140
};
141
142
#endif
143
FS_FileResolver::relinquishFilePath
virtual void relinquishFilePath(const char *file_path)=0
FS_Reader
Class for reading files.
Definition:
FS_Reader.h:33
GT_Names::filename
GT_API const UT_StringHolder filename
UT_StringMap< UT_StringHolder >
UT_Map< FS_Reader *, UT_StringHolder >
FS_FileResolver
Definition:
FS_FileResolver.h:90
FS_FileResolver.h
FS_FileResolver::getCanResolve
virtual bool getCanResolve(const char *name)=0
Checks if the resolver can provide the file data for the given name.
OP_API.h
FS_FileResolver::acquireFilePath
virtual void acquireFilePath(const FS_FileResolverOptions &opts, const char *name, UT_String &file_path)=0
OP_FileResolverContextData::getIsEnvMap
bool getIsEnvMap() const
Indicates whether the COP should save an image as an environment map.
Definition:
OP_FileResolver.h:132
FS_FileResolver::deleteReader
virtual void deleteReader(FS_Reader *reader)=0
UT_StringHolder
Definition:
UT_StringHolder.h:999
OP_FileResolverContextData::OP_FileResolverContextData
OP_FileResolverContextData()
Constructor.
Definition:
OP_FileResolver.h:127
OP_Node
Definition:
OP_Node.h:503
OP_FileResolverContextData
Definition:
OP_FileResolver.h:123
FS_Writer
Class for writing files.
Definition:
FS_Writer.h:32
OP_FileResolverContextData::setIsEnvMap
void setIsEnvMap(bool env_map)
Definition:
OP_FileResolver.h:134
OP_ContextData
Definition:
OP_Context.h:17
name
GLuint const GLchar * name
Definition:
glcorearb.h:786
OP_Context.h
FS_FileResolver::getRevisionID
virtual int getRevisionID(const char *name)=0
OP_API
#define OP_API
Definition:
OP_API.h:10
FS_FileResolverOptions
Provides various options for creating and obtaining the file data.
Definition:
FS_FileResolver.h:49
UT_String
Definition:
UT_String.h:73
FS_FileResolver::newReader
virtual FS_Reader * newReader(const FS_FileResolverOptions &opts, const char *name)=0
Creates a new reader object given the file (or data) name.
OP_FileResolver
Cooks node data and makes it available through the reader.
Definition:
OP_FileResolver.h:27
UT_StringMap.h
OP
OP_FileResolver.h
Generated on Sat Nov 23 2024 02:46:13 for HDK by
1.8.6