23 template <
typename T>
class UT_Array;
187 #define GA_MAX_ORDER 11
224 #define GA_PAGE_BITS 10
225 #define GA_PAGE_SIZE (1 << GA_PAGE_BITS)
226 #define GA_PAGE_MASK (GA_PAGE_SIZE - 1)
227 #define GA_DEFRAGMENT_OCCUPANCY 1.00
239 #if !defined(GA_STRICT_TYPES) && UT_ASSERT_LEVEL > 2
240 #define GA_STRICT_TYPES 0
243 #if defined(GA_STRICT_TYPES)
245 #if (UT_ASSERT_LEVEL >= UT_ASSERT_LEVEL_NORMAL)
246 #define GA_MAGIC_BAD_VALUE 0x7BADF00D7F00DBAD
249 #if (UT_ASSERT_LEVEL < UT_ASSERT_LEVEL_NORMAL)
259 #define GA_DEFINE_ORDINAL_METHODS_EXTRA \
260 size_t operator*(size_t v) const { return myVal * v; } \
261 friend size_t operator*(size_t v, const ThisType &a) { return v * a.myVal; }
263 #define GA_DEFINE_ORDINAL_METHODS_EXTRA
267 #define GA_DEFINE_ORDINAL_METHODS \
268 GA_DEFINE_ORDINAL_METHODS_EXTRA \
269 bool operator==(const ThisType &that) const { return (myVal == that.myVal); } \
270 bool operator!=(const ThisType &that) const { return (myVal != that.myVal); } \
271 bool operator<(const ThisType &that) const { return (myVal < that.myVal); } \
272 bool operator<=(const ThisType &that) const { return (myVal <= that.myVal); } \
273 bool operator>(const ThisType &that) const { return (myVal > that.myVal); } \
274 bool operator>=(const ThisType &that) const { return (myVal >= that.myVal); } \
275 exint operator&(exint v) const { return myVal & v; } \
276 exint operator&(int v) const { return myVal & v; } \
277 exint operator&(uint v) const { return myVal & v; } \
278 exint operator>>(exint v) const { return myVal >> v; } \
279 exint operator>>(int v) const { return myVal >> v; } \
280 exint operator>>(uint v) const { return myVal >> v; } \
281 exint operator*(exint v) const { return myVal * v; } \
282 exint operator*(int v) const { return myVal * v; } \
283 exint operator*(uint v) const { return myVal * v; } \
284 exint operator*(uint64 v) const { return exint(myVal * v); } \
285 ThisType operator+(const ThisType &that) const { return ThisType(myVal + that.myVal); } \
286 ThisType operator+(exint v) const { return ThisType(myVal + v); } \
287 ThisType operator+(uint64 v) const { return ThisType(myVal + v); } \
288 ThisType operator+(int v) const { return ThisType(myVal + v); } \
289 ThisType operator+(uint v) const { return ThisType(myVal + v); } \
290 friend ThisType operator+(exint v, const ThisType &a) { return ThisType(a.myVal + v); } \
291 friend ThisType operator+(uint64 v, const ThisType &a) { return ThisType(a.myVal + v); } \
292 friend ThisType operator+(int v, const ThisType &a) { return ThisType(a.myVal + v); } \
293 friend ThisType operator+(uint v, const ThisType &a) { return ThisType(a.myVal + v); } \
294 friend exint operator*(exint v, const ThisType &a) { return ThisType(a.myVal * v); } \
295 friend exint operator*(uint64 v, const ThisType &a) { return ThisType(a.myVal * v); } \
296 friend exint operator*(int v, const ThisType &a) { return ThisType(a.myVal * v); } \
297 friend exint operator*(uint v, const ThisType &a) { return ThisType(a.myVal * v); } \
300 exint operator/(uint v) const { return myVal/v; } \
301 exint operator/(int v) const { return myVal/v; } \
302 exint operator/(uint64 v) const { return myVal/v; } \
303 exint operator/(int64 v) const { return myVal/v; } \
304 ThisType operator-(const ThisType &that) const { return ThisType(myVal - that.myVal); } \
305 ThisType operator-(exint v) const { return ThisType(myVal - v); } \
306 ThisType operator-(uint64 v) const { return ThisType(myVal - v); } \
307 ThisType operator-(int v) const { return ThisType(myVal - v); } \
308 ThisType operator-(uint v) const { return ThisType(myVal - v); } \
309 ThisType operator+=(const ThisType &that) { myVal += that.myVal; return *this; } \
310 ThisType operator+=(exint v) { myVal += v; return *this; } \
311 ThisType operator+=(uint64 v){ myVal += v; return *this; } \
312 ThisType operator+=(int v) { myVal += v; return *this; } \
313 ThisType operator+=(uint v) { myVal += v; return *this; } \
314 ThisType operator-=(const ThisType &that) { myVal -= that.myVal; return *this; } \
315 ThisType operator-=(exint v) { myVal -= v; return *this; } \
316 ThisType operator-=(uint64 v){ myVal -= v; return *this; } \
317 ThisType operator-=(int v) { myVal -= v; return *this; } \
318 ThisType operator-=(uint v) { myVal -= v; return *this; } \
319 ThisType & operator++() { ++myVal; return *this; } \
320 ThisType operator++(int) { return ThisType(myVal++); } \
321 ThisType & operator--() { --myVal; return *this; } \
322 ThisType operator--(int) { return ThisType(myVal--); } \
323 ThisType operator-() { return ThisType(-myVal); } \
324 friend std::ostream &operator<< (std::ostream &stream, const ThisType &a) { return stream << a.myVal; } \
325 friend ThisType SYSmax(const ThisType &a, const ThisType &b) \
326 { return ThisType(SYSmax(a.myVal, b.myVal)); } \
327 friend ThisType SYSmin(const ThisType &a, const ThisType &b) \
328 { return ThisType(SYSmin(a.myVal, b.myVal)); } \
329 friend ThisType SYSclamp(const ThisType &a, const ThisType &b, const ThisType &c) \
330 { return ThisType(SYSclamp(a.myVal, b.myVal, c.myVal)); } \
331 friend ThisType UTbumpAlloc(const ThisType &a) \
332 { return ThisType(UTbumpAlloc(a.myVal)); } \
336 template <
typename TAG,
typename BASE_TYPE>
340 typedef GA_OrdinalType<TAG, BASE_TYPE> ThisType;
344 #if (UT_ASSERT_LEVEL >= UT_ASSERT_LEVEL_NORMAL)
345 : myVal(BASE_TYPE(GA_MAGIC_BAD_VALUE))
348 explicit GA_OrdinalType(
const BASE_TYPE &
val) : myVal(val) { }
350 operator BASE_TYPE()
const {
return myVal; }
352 GA_DEFINE_ORDINAL_METHODS
370 #if (UT_ASSERT_LEVEL >= UT_ASSERT_LEVEL_NORMAL)
371 : myVal(GA_MAGIC_BAD_VALUE)
376 operator int64()
const {
return myVal; }
377 operator uint64()
const {
return myVal; }
382 operator int32()
const {
return myVal; }
383 operator uint32()
const {
return myVal; }
384 operator int16()
const {
return myVal; }
385 operator uint16()
const {
return myVal; }
386 operator int8()
const {
return myVal; }
387 operator uint8()
const {
return myVal; }
392 operator long()
const {
return myVal; }
393 operator unsigned long()
const {
return myVal; }
396 GA_DEFINE_ORDINAL_METHODS
438 #if (UT_ASSERT_LEVEL >= UT_ASSERT_LEVEL_NORMAL)
439 : myVal(GA_MAGIC_BAD_VALUE)
444 operator int64()
const {
return myVal; }
445 operator uint64()
const {
return myVal; }
450 operator int32()
const {
return myVal; }
451 operator uint32()
const {
return myVal; }
452 operator int16()
const {
return myVal; }
453 operator uint16()
const {
return myVal; }
454 operator int8()
const {
return myVal; }
455 operator uint8()
const {
return myVal; }
459 operator long()
const {
return myVal; }
460 operator unsigned long()
const {
return myVal; }
463 GA_DEFINE_ORDINAL_METHODS
482 bool operator< (
int v)
const {
return (myVal < v); }
483 bool operator<=(
int v)
const {
return (myVal <= v); }
484 bool operator> (
int v)
const {
return (myVal > v); }
485 bool operator>=(
int v)
const {
return (myVal >= v); }
486 bool operator==(
int v)
const {
return (myVal == v); }
487 bool operator!=(
int v)
const {
return (myVal != v); }
497 bool operator< (
unsigned long v)
const {
return (myVal < v); }
498 bool operator<=(
unsigned long v)
const {
return (myVal <= v); }
499 bool operator> (
unsigned long v)
const {
return (myVal > v); }
500 bool operator>=(
unsigned long v)
const {
return (myVal >= v); }
501 bool operator==(
unsigned long v)
const {
return (myVal == v); }
502 bool operator!=(
unsigned long v)
const {
return (myVal != v); }
532 friend bool operator<(
unsigned long v,
const GA_Index &a) {
return (v < a.myVal); }
534 friend bool operator>(
unsigned long v,
const GA_Index &a) {
return (v > a.myVal); }
557 #undef GA_DEFINE_ORDINAL_BINARY_OPS
558 #undef GA_DEFINE_ORDINAL_METHODS
561 class GA_PageNumTag {};
562 typedef GA_OrdinalType<GA_PageNumTag, GA_Size>
GA_PageNum;
566 class GA_PageOffTag {};
567 typedef GA_OrdinalType<GA_PageOffTag, GA_Size>
GA_PageOff;
585 struct DefaultClearer;
594 static void clearConstruct(
GA_Offset *p) { clear(*p); }
596 static const bool clearNeedsDestruction =
false;
606 static void clearConstruct(
GA_Index *p) { clear(*p); }
608 static const bool clearNeedsDestruction =
false;
617 {
return std::hash<exint>()((
exint)v); }
622 size_t operator()(GA_Index v)
623 {
return std::hash<exint>()((
exint)v); }
657 #if defined(GA_STRICT_TYPES)
681 const GA_Offset &
end)
686 #define GA_INVALID_INDEX GA_Index(-1)
687 #define GA_INVALID_OFFSET GA_Offset(-1)
690 #define GA_DETAIL_INDEX GA_Index(0)
691 #define GA_DETAIL_OFFSET GA_Offset(0)
697 #define GA_INVALID_DATAID GA_DataId(-1)
705 #define GA_INVALID_INTRINSIC_HANDLE -1
706 static inline bool GAisValidGlobalIntrinsic(GA_GlobalIntrinsic
h)
708 static inline bool GAisValidLocalIntrinsic(GA_LocalIntrinsic
h)
779 static inline bool GAisStorageType(
int s)
804 static inline bool GAisNumericStorage(
GA_Storage s)
806 return GAisFloatStorage(s) || GAisIntStorage(s);
GA_API const char * GAtypeinfoLabel(GA_TypeInfo type)
Lookup the type-info label (descriptive name) from the type-info type.
GA_API const char * GAstorageClass(GA_StorageClass store)
Lookup the storage name from the storage type.
bool GAisFullPage(GA_Offset start, GA_Offset end)
GLenum GLuint GLenum GLsizei const GLchar * buf
Data has no numeric representation.
GLenum GLuint GLsizei bufsize
*get result *(waiting if necessary)*A common idiom is to fire a bunch of sub tasks at the and then *wait for them to all complete We provide a helper class
UT_Array< GA_Index > GA_IndexArray
GA_API const char * GAowner(GA_AttributeOwner owner)
Lookup the owner name from the owner type.
GA_API const char * GAgroupType(GA_GroupType owner)
Lookup the owner name from the owner type.
Data represents a color. Token "color".
GA_API const char * GAtypeinfo(GA_TypeInfo type)
Lookup the type-info name from the type-info type.
GLboolean GLboolean GLboolean GLboolean a
std::size_t SYS_HashType
Define the type for hash values.
ImageBuf OIIO_API min(Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
Standard user attribute level.
unsigned long long uint64
SYS_FORCE_INLINE bool GAisValid(GA_Size v)
exint GA_Size
Defines the bit width for index and offset types in GA.
SYS_FORCE_INLINE GA_PageOff GAgetPageOff(GA_Offset v)
OIIO_FORCEINLINE vbool4 operator>=(const vint4 &a, const vint4 &b)
GA_API size_t format(char *buffer, size_t buffer_size, const GA_AttributeOwner &v)
GA_API GA_Precision GAprecision(GA_Storage a)
Return the precision associated with the storage.
UT_Array< GA_Offset > GA_OffsetArray
bool operator==(const BaseDimensions< T > &a, const BaseDimensions< Y > &b)
GA_API const char * GAstorage(GA_Storage store)
Lookup the storage name from the storage type.
OIIO_FORCEINLINE vbool4 operator>(const vint4 &a, const vint4 &b)
OIIO_FORCEINLINE vbool4 operator<=(const vint4 &a, const vint4 &b)
SYS_FORCE_INLINE GA_PageNum GAgetPageNum(GA_Offset v)
GLint GLint GLsizei GLint GLenum format
#define SYS_DECLARE_IS_POD(T)
Declare a type as POD.
GA_API int GAprecisionBits(GA_Precision precision)
Returns the nominal bits of provided precision, 0 for invalid.
bool operator<(const GU_TetrahedronFacet &a, const GU_TetrahedronFacet &b)
Data has no numeric representation.
GA_API const char * GAstorageLabel(GA_Storage store)
Lookup the storage label (descriptive name) from the storage type.
GLboolean GLboolean GLboolean b
GA_Size GA_Index
Define the strictness of GA_Offset/GA_Index.
GA_API int GAcomparePrecision(GA_Storage a, GA_Storage b)
GLenum GLint GLint * precision
Data represents a quaternion. Token "quaternion".
GLfloat GLfloat GLfloat GLfloat h
GA_API const char * GAscope(GA_AttributeScope scope)
Lookup the scope name from the scope type.
Data represents a normal vector. Token "normal".
GA_GroupType
An ordinal enum for the different types of groups in GA.
#define GA_PAGE_BITS
Attributes may paritition their data in pages of GA_PAGE_SIZE offsets.
Data represents a direction vector. Token "vector".
Data represents a position in space. Token "point".
#define UT_IFNOT_ASSERT(ZZ)
bool operator!=(const BaseDimensions< T > &a, const BaseDimensions< Y > &b)
Data represents an index-pair. Token "indexpair".
GA_API unsigned GAsizeof(GA_Storage store)
Lookup the size in bytes of a storage type (inaccurate for bool)
size_t hash_value(const CH_ChannelRef &ref)
Data represents a transform matrix. Token "matrix".
GA_Offset GAgetPageBoundary(const GA_Offset &start, const GA_Offset &end)