HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GT_Types.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: GT_Types.h ( GT Library, C++)
7  *
8  * COMMENTS:
9  */
10 
11 #ifndef __GT_Types__
12 #define __GT_Types__
13 
14 #include "GT_API.h"
15 #include <SYS/SYS_Types.h>
16 
18 {
29 
31 };
32 
33 enum GT_Type
34 {
35  GT_TYPE_NONE = -1, // Implicit type based on data
36  GT_TYPE_POINT, // Position
37  GT_TYPE_HPOINT, // Homogeneous position
38  GT_TYPE_VECTOR, // Direction vector
39  GT_TYPE_NORMAL, // Normal
40  GT_TYPE_COLOR, // Color
41  GT_TYPE_QUATERNION, // Quaternion
42  GT_TYPE_MATRIX3, // 3x3 Matrix
43  GT_TYPE_MATRIX, // Matrix
44  GT_TYPE_ST, // Parametric interval
45  GT_TYPE_HIDDEN, // "Private" (hidden)
46  GT_TYPE_BOX2, // 2x2 Bounding box
47  GT_TYPE_BOX, // 3x3 Bounding box
48  GT_TYPE_TEXTURE, // Texture coordinate
49  GT_TYPE_INDEXPAIR, // Capture index/weight pair
50 };
51 
53 {
55 
63 
65 };
66 
67 /// Subdivision schemes
69 {
73 };
74 
76 {
78 
83 
87 
89 };
90 
92 {
93  GT_INDEXING_SMALL, // Use small data types for indexing (i.e. int32)
94  GT_INDEXING_LARGE, // Use large data types for indexing (i.e. int64)
95  GT_INDEXING_QUICK, // Perform a quick check to see which indexing to use
96  GT_INDEXING_CHECK, // Check, perhaps using a more expensive test
97 };
98 
100 {
101  GT_CACHE_DETAIL_DELETE, // Delete all references to detail
102  GT_CACHE_ATTRIBUTE_CHANGE, // Attribute value change
103  GT_CACHE_ATTRIBUTE_CREATE, // Attribute created
104  GT_CACHE_ATTRIBUTE_DELETE, // Attribute deleted
105  GT_CACHE_INDEXMAP_CHANGE, // Index map change (grow/shrink)
106  GT_CACHE_GROUP_CHANGE, // Group was changed
107  GT_CACHE_GROUP_CREATE, // New group added
108  GT_CACHE_GROUP_DELETE, // Group deleted
109 };
110 
111 typedef const char *GT_String;
112 typedef int64 GT_Size;
113 typedef int64 GT_Offset;
114 
115 template <typename T> constexpr GT_Storage
117 
118 template <> constexpr GT_Storage GTstorage<uint8>() { return GT_STORE_UINT8; }
119 template <> constexpr GT_Storage GTstorage<int8>() { return GT_STORE_INT8; }
120 template <> constexpr GT_Storage GTstorage<int16>() { return GT_STORE_INT16; }
121 template <> constexpr GT_Storage GTstorage<int32>() { return GT_STORE_INT32; }
122 template <> constexpr GT_Storage GTstorage<int64>() { return GT_STORE_INT64; }
123 template <> constexpr GT_Storage GTstorage<fpreal16>() { return GT_STORE_REAL16; }
124 template <> constexpr GT_Storage GTstorage<fpreal32>() { return GT_STORE_REAL32; }
125 template <> constexpr GT_Storage GTstorage<fpreal64>() { return GT_STORE_REAL64; }
126 template <> constexpr GT_Storage GTstorage<GT_String>() { return GT_STORE_STRING; }
127 
128 /// @{
129 /// Perform mapping between enum and string name
130 GT_API extern int GTsizeof(GT_Storage storage);
131 GT_API extern const char *GTstorage(GT_Storage storage);
132 GT_API extern GT_Storage GTstorage(const char *storage);
133 GT_API extern const char *GTtype(GT_Type type);
134 GT_API extern GT_Type GTtype(const char *type);
135 GT_API extern const char *GTbasis(GT_Basis basis);
136 GT_API extern GT_Basis GTbasis(const char *basis);
137 GT_API extern const char *GTscheme(GT_Scheme scheme);
138 GT_API extern GT_Scheme GTscheme(const char *scheme,
140 GT_API extern const char *GTowner(GT_Owner owner);
141 GT_API extern GT_Owner GTowner(const char *owner);
142 /// @}
143 
144 /// Compute the number of spans for a given basis and cv count. For basis
145 /// types other than linear, the order is assumed to be 4.
146 GT_API extern GT_Size GTbasisSpans(GT_Basis basis,
147  GT_Size count, bool wrapped,
148  int order = 4);
149 GT_API extern GT_Size GTbasisStep(GT_Basis basis, int order = 4);
150 
151 static inline constexpr bool GTisInteger(GT_Storage s)
152  {
153  return s == GT_STORE_INT32 ||
154  s == GT_STORE_INT64 ||
155  s == GT_STORE_INT16 ||
156  s == GT_STORE_INT8 ||
157  s == GT_STORE_UINT8;
158  }
159 static inline constexpr bool GTisFloat(GT_Storage s)
160  {
161  return s == GT_STORE_REAL16 ||
162  s == GT_STORE_REAL32 ||
163  s == GT_STORE_REAL64;
164  }
165 static inline constexpr bool GTisString(GT_Storage s)
166  { return s == GT_STORE_STRING; }
167 
168 template <typename T> static inline int64
169 GThandleMemoryUsage(const T &handle)
170 {
171  return handle ? handle->getMemoryUsage() : 0;
172 }
173 
174 #endif
GT_Storage
Definition: GT_Types.h:17
GT_API const char * GTscheme(GT_Scheme scheme)
GT_API const char * GTbasis(GT_Basis basis)
GT_API const char * GTtype(GT_Type type)
constexpr GT_Storage GTstorage< uint8 >()
Definition: GT_Types.h:118
const char * GT_String
Definition: GT_Types.h:111
constexpr GT_Storage GTstorage< fpreal64 >()
Definition: GT_Types.h:125
GT_IndexingMode
Definition: GT_Types.h:91
constexpr GT_Storage GTstorage< fpreal32 >()
Definition: GT_Types.h:124
#define GT_API
Definition: GT_API.h:11
GT_Type
Definition: GT_Types.h:33
constexpr GT_Storage GTstorage< int8 >()
Definition: GT_Types.h:119
GT_CacheEventType
Definition: GT_Types.h:99
GT_API GT_Size GTbasisStep(GT_Basis basis, int order=4)
long long int64
Definition: SYS_Types.h:107
constexpr GT_Storage GTstorage< GT_String >()
Definition: GT_Types.h:126
GT_Scheme
Subdivision schemes.
Definition: GT_Types.h:68
constexpr GT_Storage GTstorage< fpreal16 >()
Definition: GT_Types.h:123
GLint GLsizei count
Definition: glcorearb.h:404
GT_Owner
Definition: GT_Types.h:75
constexpr GT_Storage GTstorage< int32 >()
Definition: GT_Types.h:121
GLint GLint GLsizei GLint GLenum GLenum type
Definition: glcorearb.h:107
constexpr GT_Storage GTstorage< int64 >()
Definition: GT_Types.h:122
getOption("OpenEXR.storage") storage
Definition: HDK_Image.dox:276
GT_API GT_Size GTbasisSpans(GT_Basis basis, GT_Size count, bool wrapped, int order=4)
GT_Basis
Definition: GT_Types.h:52
int64 GT_Offset
Definition: GT_Types.h:113
int64 GT_Size
Definition: GT_Types.h:112
GT_API int GTsizeof(GT_Storage storage)
constexpr GT_Storage GTstorage< int16 >()
Definition: GT_Types.h:120
GT_API const char * GTowner(GT_Owner owner)
constexpr GT_Storage GTstorage()
Definition: GT_Types.h:116