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