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
GA_SharedDataHandle.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: GU_SharedDataHandle.h
7
*
8
* COMMENTS:
9
*/
10
11
#ifndef GU_SHAREDDATAHANDLE_H_
12
#define GU_SHAREDDATAHANDLE_H_
13
14
#include "
GA_API.h
"
15
#include "
GA_PrimitiveDefinition.h
"
16
17
#include <
UT/UT_StringHolder.h
>
18
#include <
UT/UT_SharedPtr.h
>
19
#include <
UT/UT_Lock.h
>
20
#include <
UT/UT_DoubleLock.h
>
21
#include <
SYS/SYS_Types.h
>
22
23
class
GA_Primitive
;
24
class
GA_SharedDataContext
;
25
class
GA_SharedLoadData
;
26
class
GA_SharedLoadDataStat
;
27
28
class
UT_JSONParser
;
29
30
31
///
32
///
33
///
34
class
GA_API
GA_SharedDataHandle
35
{
36
public
:
37
/// @param filename Filename to retrieve shared data from
38
/// @param offset Offset into file given (usually given from index, -1 if no index)
39
/// @param loader The loader to use to retrieve the shared data
40
/// Setting the offset to -1 means that there was no index in the file.
41
GA_SharedDataHandle
(
const
UT_StringHolder
&
filename
,
42
exint
offset
,
43
exint
length
,
44
const
GA_PrimitiveDefinition::SharedDataLoader
* loader);
45
~
GA_SharedDataHandle
();
46
47
/// Forces the loading of the shared data immediately from the
48
/// parser given. Used for backwards compatibility with files that
49
/// do not have an index.
50
void
forceLoadSharedData(
GA_SharedLoadData
* loaded_data);
51
52
/// Called by shared data users when they want to retrieve the
53
/// loaded data. After calling this function they should clear
54
/// Their shared pointer to this object so the loaded data
55
/// can be freed.
56
const
GA_SharedLoadData
* resolveSharedData(
GA_Primitive
* caller);
57
const
GA_SharedLoadData
* resolveSharedData(
GA_Primitive
* caller,
GA_SharedDataContext
&context);
58
59
/// Called by shared data users to get metadata on the shared data
60
/// that can be resolved though this handle.
61
/// Note: This function will return NULL if we have already
62
/// resolved our shared data (and hence stating it would not save time)
63
const
GA_SharedLoadDataStat
* statSharedData();
64
65
/// Returns true if we have already resolved our shared data
66
bool
hasResolvedSharedData()
const
;
67
68
private
:
69
/// Caller can be null if load is false.
70
/// If load is true geometry will be loaded. If not it will be stated
71
void
parseSharedData(
UT_DoubleLock<GA_SharedLoadData*>
& lock,
GA_Primitive
* caller,
bool
load,
GA_SharedDataContext
&context);
72
void
loadOrStatWithParser(
UT_DoubleLock<GA_SharedLoadData*>
& lock,
UT_JSONParser
& parser,
73
GA_Primitive
* caller,
bool
load);
74
75
/// Filename of file where shared data is kept
76
UT_StringHolder
myFileName;
77
78
/// Offset of the shared data into file
79
/// If -1 then we have no index
80
exint
myOffset;
81
82
/// Length of shared data in file
83
exint
myLength;
84
85
/// Loader to load shared data from file
86
const
GA_PrimitiveDefinition::SharedDataLoader
* myLoader;
87
88
/// Storage of loaded shared data
89
/// Will be deleted when shared data handle is destroyed
90
GA_SharedLoadData
* myLoadedData;
91
92
/// Storage of stated shared data
93
/// Will be deleted when shared data handle is destroyed or
94
/// shared data is loaded.
95
GA_SharedLoadDataStat
* myStatedData;
96
97
/// Used to allow resolveSharedData/statSharedData to be safely called from
98
/// multiple threads.
99
UT_Lock
myLock;
100
};
101
102
typedef
UT_SharedPtr<GA_SharedDataHandle>
GA_SharedDataHandlePtr
;
103
104
#endif // GU_SHAREDDATAHANDLE_H_
UT_SharedPtr.h
GT_Names::filename
GT_API const UT_StringHolder filename
GA_SharedLoadDataStat
Definition:
GA_SharedLoadDataStat.h:22
UT_DoubleLock
Definition:
UT_DoubleLock.h:50
exint
int64 exint
Definition:
SYS_Types.h:125
length
GLuint GLsizei GLsizei * length
Definition:
glcorearb.h:795
UT_JSONParser
JSON reader class which handles parsing of JSON or bJSON files.
Definition:
UT_JSONParser.h:87
GA_API
#define GA_API
Definition:
GA_API.h:14
GA_SharedDataHandlePtr
UT_SharedPtr< GA_SharedDataHandle > GA_SharedDataHandlePtr
Definition:
GA_SharedDataHandle.h:102
UT_SpinLockT< true, false >
UT_StringHolder
Definition:
UT_StringHolder.h:999
SYS_Types.h
GA_PrimitiveDefinition::SharedDataLoader
Class to load shared data.
Definition:
GA_PrimitiveDefinition.h:112
offset
GLintptr offset
Definition:
glcorearb.h:665
GA_API.h
UT_SharedPtr
std::shared_ptr< T > UT_SharedPtr
Wrapper around std::shared_ptr.
Definition:
UT_SharedPtr.h:36
GA_SharedLoadData
Definition:
GA_SharedLoadData.h:41
GA_PrimitiveDefinition.h
UT_DoubleLock.h
UT_StringHolder.h
GA_Primitive
Definition:
GA_Primitive.h:110
GA_SharedDataHandle
Definition:
GA_SharedDataHandle.h:34
UT_Lock.h
GA_SharedDataContext
Definition:
GA_SharedDataContext.h:25
GA
GA_SharedDataHandle.h
Generated on Thu Nov 21 2024 02:43:32 for HDK by
1.8.6