31 #ifndef OPENVDB_TYPES_HAS_BEEN_INCLUDED 32 #define OPENVDB_TYPES_HAS_BEEN_INCLUDED 36 #include <OpenEXR/half.h> 47 #include <type_traits> 62 using Byte =
unsigned char;
113 #ifdef OPENVDB_3_ABI_COMPATIBLE 116 template<
typename T>
using SharedPtr = boost::shared_ptr<T>;
127 #else // if !defined(OPENVDB_3_ABI_COMPATIBLE) 130 template<
typename T>
using SharedPtr = std::shared_ptr<T>;
163 #endif // OPENVDB_3_ABI_COMPATIBLE 172 template<
typename IntType_, Index Kind>
175 static_assert(std::is_integral<IntType_>::value,
"PointIndex requires an integer value type");
203 static const bool IsVec =
false;
204 static const int Size = 1;
209 static const bool IsVec =
true;
210 static const int Size = 2;
215 static const bool IsVec =
true;
216 static const int Size = 3;
221 static const bool IsVec =
true;
222 static const int Size = 4;
232 template<
typename FromType,
typename ToType>
233 struct CanConvertType {
enum { value = std::is_constructible<ToType, FromType>::value }; };
244 template<
typename T0,
typename T1>
246 template<
typename T0,
typename T1>
248 template<
typename T0,
typename T1>
345 template<>
inline const char* typeNameAsString<std::string>() {
return "string"; }
348 template<>
inline const char* typeNameAsString<math::Quats>() {
return "quats"; }
349 template<>
inline const char* typeNameAsString<math::Quatd>() {
return "quatd"; }
370 template<
typename AValueType,
typename BValueType = AValueType>
380 , mResultValPtr(&mResultVal)
383 , mResultIsActive(false)
388 CombineArgs(
const AValueType& a,
const BValueType& b, AValueType& result,
389 bool aOn =
false,
bool bOn =
false)
392 , mResultValPtr(&result)
396 this->updateResultActive();
400 CombineArgs(
const AValueType& a,
const BValueType& b,
bool aOn =
false,
bool bOn =
false)
403 , mResultValPtr(&mResultVal)
407 this->updateResultActive();
411 const AValueType&
a()
const {
return *mAValPtr; }
413 const BValueType&
b()
const {
return *mBValPtr; }
415 const AValueType& result()
const {
return *mResultValPtr; }
417 AValueType&
result() {
return *mResultValPtr; }
461 template<
typename ValueType,
typename CombineOp>
480 #ifdef OPENVDB_3_ABI_COMPATIBLE 481 enum CopyPolicy { CP_NEW, CP_SHARE, CP_COPY };
515 #define OPENVDB_START_THREADSAFE_STATIC_REFERENCE __pragma(warning(disable:1710)) 516 #define OPENVDB_FINISH_THREADSAFE_STATIC_REFERENCE __pragma(warning(default:1710)) 517 #define OPENVDB_START_THREADSAFE_STATIC_WRITE __pragma(warning(disable:1711)) 518 #define OPENVDB_FINISH_THREADSAFE_STATIC_WRITE __pragma(warning(default:1711)) 519 #define OPENVDB_START_THREADSAFE_STATIC_ADDRESS __pragma(warning(disable:1712)) 520 #define OPENVDB_FINISH_THREADSAFE_STATIC_ADDRESS __pragma(warning(default:1712)) 524 #define OPENVDB_START_NON_THREADSAFE_STATIC_REFERENCE __pragma(warning(disable:1710)) 525 #define OPENVDB_FINISH_NON_THREADSAFE_STATIC_REFERENCE __pragma(warning(default:1710)) 526 #define OPENVDB_START_NON_THREADSAFE_STATIC_WRITE __pragma(warning(disable:1711)) 527 #define OPENVDB_FINISH_NON_THREADSAFE_STATIC_WRITE __pragma(warning(default:1711)) 528 #define OPENVDB_START_NON_THREADSAFE_STATIC_ADDRESS __pragma(warning(disable:1712)) 529 #define OPENVDB_FINISH_NON_THREADSAFE_STATIC_ADDRESS __pragma(warning(default:1712)) 532 #define OPENVDB_THREADSAFE_STATIC_REFERENCE(CODE) \ 533 __pragma(warning(disable:1710)); CODE; __pragma(warning(default:1710)) 534 #define OPENVDB_THREADSAFE_STATIC_WRITE(CODE) \ 535 __pragma(warning(disable:1711)); CODE; __pragma(warning(default:1711)) 536 #define OPENVDB_THREADSAFE_STATIC_ADDRESS(CODE) \ 537 __pragma(warning(disable:1712)); CODE; __pragma(warning(default:1712)) 539 #else // GCC does not support these compiler warnings 541 #define OPENVDB_START_THREADSAFE_STATIC_REFERENCE 542 #define OPENVDB_FINISH_THREADSAFE_STATIC_REFERENCE 543 #define OPENVDB_START_THREADSAFE_STATIC_WRITE 544 #define OPENVDB_FINISH_THREADSAFE_STATIC_WRITE 545 #define OPENVDB_START_THREADSAFE_STATIC_ADDRESS 546 #define OPENVDB_FINISH_THREADSAFE_STATIC_ADDRESS 548 #define OPENVDB_START_NON_THREADSAFE_STATIC_REFERENCE 549 #define OPENVDB_FINISH_NON_THREADSAFE_STATIC_REFERENCE 550 #define OPENVDB_START_NON_THREADSAFE_STATIC_WRITE 551 #define OPENVDB_FINISH_NON_THREADSAFE_STATIC_WRITE 552 #define OPENVDB_START_NON_THREADSAFE_STATIC_ADDRESS 553 #define OPENVDB_FINISH_NON_THREADSAFE_STATIC_ADDRESS 555 #define OPENVDB_THREADSAFE_STATIC_REFERENCE(CODE) CODE 556 #define OPENVDB_THREADSAFE_STATIC_WRITE(CODE) CODE 557 #define OPENVDB_THREADSAFE_STATIC_ADDRESS(CODE) CODE 559 #endif // defined(__ICC) 561 #endif // OPENVDB_TYPES_HAS_BEEN_INCLUDED CombineArgs & setBRef(const BValueType &b)
Redirect the B value to a new external source.
Definition: Types.h:426
Vec3< float > Vec3s
Definition: Vec3.h:707
Tag dispatch class that distinguishes topology copy constructors from deep copy constructors.
Definition: Types.h:503
uint32_t Index32
Definition: Types.h:55
bool resultIsActive() const
Definition: Types.h:435
const char * typeNameAsString< Vec3f >()
Definition: Types.h:343
const char * typeNameAsString< bool >()
Definition: Types.h:326
T ElementType
Definition: Types.h:211
Vec2< double > Vec2d
Definition: Vec2.h:582
const char * typeNameAsString< PointDataIndex64 >()
Definition: Types.h:353
PointIndex(IntType i=IntType(0))
Definition: Types.h:179
AValueType mResultVal
Definition: Types.h:451
General-purpose arithmetic and comparison routines, most of which accept arbitrary value types (or at...
bool aIsActive() const
Definition: Types.h:431
const char * typeNameAsString< PointIndex64 >()
Definition: Types.h:351
double Real
Definition: Types.h:63
const char * typeNameAsString()
Definition: Types.h:325
T ElementType
Definition: Types.h:223
T ElementType
Definition: Types.h:217
Vec3< int32_t > Vec3i
Definition: Vec3.h:705
Vec4< float > Vec4s
Definition: Vec4.h:623
PointIndex operator+(T x)
Needed to support the (zeroVal<PointIndex>() + val) idiom.
Definition: Types.h:185
Axis-aligned bounding box of signed integer coordinates.
Definition: Coord.h:266
SharedPtr< T > StaticPtrCast(const SharedPtr< U > &ptr)
Return a new shared pointer that points to the same object as the given pointer after a static_cast...
Definition: Types.h:161
const AValueType & a() const
Get the A input value.
Definition: Types.h:411
Vec2< float > Vec2s
Definition: Vec2.h:581
const char * typeNameAsString< Vec3U8 >()
Definition: Types.h:340
CombineArgs()
Definition: Types.h:377
int64_t Int64
Definition: Types.h:60
const char * typeNameAsString< int32_t >()
Definition: Types.h:334
AValueType & result()
Get the output value.
Definition: Types.h:417
Signed (x, y, z) 32-bit integer coordinates.
Definition: Coord.h:48
CombineArgs & setARef(const AValueType &a)
Redirect the A value to a new external source.
Definition: Types.h:424
const char * typeNameAsString< int64_t >()
Definition: Types.h:336
AValueType AValueT
Definition: Types.h:374
GridClass
Definition: Types.h:262
const char * typeNameAsString< Mat4s >()
Definition: Types.h:346
BValueType BValueT
Definition: Types.h:375
static const Real LEVEL_SET_HALF_WIDTH
Definition: Types.h:270
T ElementType
Definition: Types.h:205
void operator()(CombineArgs< ValueType > &args)
Definition: Types.h:466
const char * typeNameAsString< int16_t >()
Definition: Types.h:332
Int32 Int
Definition: Types.h:61
Tag dispatch class that distinguishes shallow copy constructors from deep copy constructors.
Definition: Types.h:500
#define OPENVDB_VERSION_NAME
Definition: version.h:43
const char * typeNameAsString< Vec2i >()
Definition: Types.h:337
Vec3< double > Vec3d
Definition: Vec3.h:708
3x3 matrix class.
Definition: Mat3.h:54
AValueType * mResultValPtr
Definition: Types.h:452
const char * typeNameAsString< PointDataIndex32 >()
Definition: Types.h:352
const char * typeNameAsString< double >()
Definition: Types.h:330
const char * typeNameAsString< Vec2s >()
Definition: Types.h:338
This struct collects both input and output arguments to "grid combiner" functors used with the tree::...
Definition: Types.h:371
SwappedCombineOp(CombineOp &_op)
Definition: Types.h:464
CombineArgs & setResultRef(AValueType &val)
Redirect the result value to a new external destination.
Definition: Types.h:428
const AValueType * mAValPtr
Definition: Types.h:449
CombineArgs & setResult(const AValueType &val)
Set the output value.
Definition: Types.h:421
Definition: Exceptions.h:39
const BValueType * mBValPtr
Definition: Types.h:450
Vec4< int32_t > Vec4i
Definition: Vec4.h:621
const char * typeNameAsString< PointIndex32 >()
Definition: Types.h:350
unsigned char Byte
Definition: Types.h:62
const char * typeNameAsString< Vec3d >()
Definition: Types.h:344
CombineArgs(const AValueType &a, const BValueType &b, AValueType &result, bool aOn=false, bool bOn=false)
Use this constructor when the result value is stored externally.
Definition: Types.h:388
const char * typeNameAsString< float >()
Definition: Types.h:329
SharedPtr< T > DynamicPtrCast(const SharedPtr< U > &ptr)
Return a new shared pointer that is either null or points to the same object as the given pointer aft...
Definition: Types.h:151
bool bIsActive() const
Definition: Types.h:433
uint64_t Index64
Definition: Types.h:56
MergePolicy
Definition: Types.h:315
int16_t Int16
Definition: Types.h:58
Vec4< double > Vec4d
Definition: Vec4.h:624
IntType_ IntType
Definition: Types.h:177
const char * typeNameAsString< half >()
Definition: Types.h:328
const char * typeNameAsString< ValueMask >()
Definition: Types.h:327
bool mBIsActive
Definition: Types.h:453
std::shared_ptr< T > SharedPtr
Definition: Types.h:130
const char * typeNameAsString< uint8_t >()
Definition: Types.h:331
bool mResultIsActive
Definition: Types.h:454
VecType
Definition: Types.h:292
CombineArgs & setAIsActive(bool b)
Set the active state of the A value.
Definition: Types.h:438
CanConvertType<FromType, ToType>::value is true if a value of type ToType can be constructed from a v...
Definition: Types.h:233
Vec2< int32_t > Vec2i
Definition: Vec2.h:579
const char * typeNameAsString< uint32_t >()
Definition: Types.h:335
const char * typeNameAsString< Vec3i >()
Definition: Types.h:342
CombineArgs & setResultIsActive(bool b)
Set the active state of the output value.
Definition: Types.h:442
const BValueType & b() const
Get the B input value.
Definition: Types.h:413
const char * typeNameAsString< Vec2d >()
Definition: Types.h:339
void updateResultActive()
Definition: Types.h:447
Tag dispatch class that distinguishes constructors during file input.
Definition: Types.h:505
CombineArgs & setBIsActive(bool b)
Set the active state of the B value.
Definition: Types.h:440
#define OPENVDB_USE_VERSION_NAMESPACE
Definition: version.h:71
const char * typeNameAsString< Vec3U16 >()
Definition: Types.h:341
int32_t Int32
Definition: Types.h:59
const char * typeNameAsString< Mat4d >()
Definition: Types.h:347
Index32 Index
Definition: Types.h:57
Integer wrapper, required to distinguish PointIndexGrid and PointDataGrid from Int32Grid and Int64Gri...
Definition: Types.h:173
CombineArgs(const AValueType &a, const BValueType &b, bool aOn=false, bool bOn=false)
Use this constructor when the result value should be stored in this struct.
Definition: Types.h:400
SharedPtr< T > ConstPtrCast(const SharedPtr< U > &ptr)
Return a new shared pointer that points to the same object as the given pointer but with possibly dif...
Definition: Types.h:141
const AValueType & result() const
Get the output value.
Definition: Types.h:416
const char * typeNameAsString< uint16_t >()
Definition: Types.h:333
CombineOp & op
Definition: Types.h:473