31 #ifndef OPENVDB_TYPES_HAS_BEEN_INCLUDED 32 #define OPENVDB_TYPES_HAS_BEEN_INCLUDED 36 #include <OpenEXR/half.h> 47 #include <type_traits> 48 #if OPENVDB_ABI_VERSION_NUMBER <= 3 49 #include <boost/shared_ptr.hpp> 50 #include <boost/weak_ptr.hpp> 66 using Byte =
unsigned char;
121 #if OPENVDB_ABI_VERSION_NUMBER <= 3 124 template<
typename T>
using SharedPtr = boost::shared_ptr<T>;
125 template<
typename T>
using WeakPtr = boost::weak_ptr<T>;
133 template<
typename T,
typename U>
inline SharedPtr<T>
134 StaticPtrCast(
const SharedPtr<U>& ptr) {
return boost::static_pointer_cast<T, U>(ptr); }
136 #else // if OPENVDB_ABI_VERSION_NUMBER > 3 139 template<
typename T>
using SharedPtr = std::shared_ptr<T>;
140 template<
typename T>
using WeakPtr = std::weak_ptr<T>;
182 template<
typename IntType_, Index Kind>
185 static_assert(std::is_integral<IntType_>::value,
"PointIndex requires an integer value type");
216 static const bool IsVec =
false;
217 static const int Size = 1;
222 static const bool IsVec =
true;
223 static const int Size = 2;
228 static const bool IsVec =
true;
229 static const int Size = 3;
234 static const bool IsVec =
true;
235 static const int Size = 4;
245 template<
typename FromType,
typename ToType>
246 struct CanConvertType {
enum { value = std::is_constructible<ToType, FromType>::value }; };
257 template<
typename T0,
typename T1>
259 template<
typename T0,
typename T1>
261 template<
typename T0,
typename T1>
358 template<>
inline const char* typeNameAsString<std::string>() {
return "string"; }
363 template<>
inline const char* typeNameAsString<math::Quats>() {
return "quats"; }
364 template<>
inline const char* typeNameAsString<math::Quatd>() {
return "quatd"; }
385 template<
typename AValueType,
typename BValueType = AValueType>
395 , mResultValPtr(&mResultVal)
398 , mResultIsActive(false)
403 CombineArgs(
const AValueType& a,
const BValueType& b, AValueType& result,
404 bool aOn =
false,
bool bOn =
false)
407 , mResultValPtr(&result)
411 this->updateResultActive();
415 CombineArgs(
const AValueType& a,
const BValueType& b,
bool aOn =
false,
bool bOn =
false)
418 , mResultValPtr(&mResultVal)
422 this->updateResultActive();
426 const AValueType&
a()
const {
return *mAValPtr; }
428 const BValueType&
b()
const {
return *mBValPtr; }
430 const AValueType& result()
const {
return *mResultValPtr; }
432 AValueType&
result() {
return *mResultValPtr; }
476 template<
typename ValueType,
typename CombineOp>
495 #if OPENVDB_ABI_VERSION_NUMBER <= 3 496 enum CopyPolicy { CP_NEW, CP_SHARE, CP_COPY };
530 #define OPENVDB_START_THREADSAFE_STATIC_REFERENCE __pragma(warning(disable:1710)) 531 #define OPENVDB_FINISH_THREADSAFE_STATIC_REFERENCE __pragma(warning(default:1710)) 532 #define OPENVDB_START_THREADSAFE_STATIC_WRITE __pragma(warning(disable:1711)) 533 #define OPENVDB_FINISH_THREADSAFE_STATIC_WRITE __pragma(warning(default:1711)) 534 #define OPENVDB_START_THREADSAFE_STATIC_ADDRESS __pragma(warning(disable:1712)) 535 #define OPENVDB_FINISH_THREADSAFE_STATIC_ADDRESS __pragma(warning(default:1712)) 539 #define OPENVDB_START_NON_THREADSAFE_STATIC_REFERENCE __pragma(warning(disable:1710)) 540 #define OPENVDB_FINISH_NON_THREADSAFE_STATIC_REFERENCE __pragma(warning(default:1710)) 541 #define OPENVDB_START_NON_THREADSAFE_STATIC_WRITE __pragma(warning(disable:1711)) 542 #define OPENVDB_FINISH_NON_THREADSAFE_STATIC_WRITE __pragma(warning(default:1711)) 543 #define OPENVDB_START_NON_THREADSAFE_STATIC_ADDRESS __pragma(warning(disable:1712)) 544 #define OPENVDB_FINISH_NON_THREADSAFE_STATIC_ADDRESS __pragma(warning(default:1712)) 547 #define OPENVDB_THREADSAFE_STATIC_REFERENCE(CODE) \ 548 __pragma(warning(disable:1710)); CODE; __pragma(warning(default:1710)) 549 #define OPENVDB_THREADSAFE_STATIC_WRITE(CODE) \ 550 __pragma(warning(disable:1711)); CODE; __pragma(warning(default:1711)) 551 #define OPENVDB_THREADSAFE_STATIC_ADDRESS(CODE) \ 552 __pragma(warning(disable:1712)); CODE; __pragma(warning(default:1712)) 554 #else // GCC does not support these compiler warnings 556 #define OPENVDB_START_THREADSAFE_STATIC_REFERENCE 557 #define OPENVDB_FINISH_THREADSAFE_STATIC_REFERENCE 558 #define OPENVDB_START_THREADSAFE_STATIC_WRITE 559 #define OPENVDB_FINISH_THREADSAFE_STATIC_WRITE 560 #define OPENVDB_START_THREADSAFE_STATIC_ADDRESS 561 #define OPENVDB_FINISH_THREADSAFE_STATIC_ADDRESS 563 #define OPENVDB_START_NON_THREADSAFE_STATIC_REFERENCE 564 #define OPENVDB_FINISH_NON_THREADSAFE_STATIC_REFERENCE 565 #define OPENVDB_START_NON_THREADSAFE_STATIC_WRITE 566 #define OPENVDB_FINISH_NON_THREADSAFE_STATIC_WRITE 567 #define OPENVDB_START_NON_THREADSAFE_STATIC_ADDRESS 568 #define OPENVDB_FINISH_NON_THREADSAFE_STATIC_ADDRESS 570 #define OPENVDB_THREADSAFE_STATIC_REFERENCE(CODE) CODE 571 #define OPENVDB_THREADSAFE_STATIC_WRITE(CODE) CODE 572 #define OPENVDB_THREADSAFE_STATIC_ADDRESS(CODE) CODE 574 #endif // defined(__ICC) 576 #endif // OPENVDB_TYPES_HAS_BEEN_INCLUDED const char * typeNameAsString< int64_t >()
Definition: Types.h:349
const char * typeNameAsString< Vec3i >()
Definition: Types.h:355
AValueType AValueT
Definition: Types.h:389
Vec3< int32_t > Vec3i
Definition: Vec3.h:676
Vec2< float > Vec2s
Definition: Vec2.h:558
const char * typeNameAsString< Vec3U16 >()
Definition: Types.h:354
CombineArgs & setResultIsActive(bool b)
Set the active state of the output value.
Definition: Types.h:457
int16_t Int16
Definition: Types.h:62
Index32 Index
Definition: Types.h:61
uint64_t Index64
Definition: Types.h:60
General-purpose arithmetic and comparison routines, most of which accept arbitrary value types (or at...
void updateResultActive()
Definition: Types.h:462
T ElementType
Definition: Types.h:224
T ElementType
Definition: Types.h:230
T ElementType
Definition: Types.h:236
const char * typeNameAsString< double >()
Definition: Types.h:343
void operator()(CombineArgs< ValueType > &args)
Definition: Types.h:481
const char * typeNameAsString< uint32_t >()
Definition: Types.h:348
VecType
Definition: Types.h:305
Mat4< double > Mat4d
Definition: Mat4.h:1361
const char * typeNameAsString< Mat4s >()
Definition: Types.h:361
AValueType mResultVal
Definition: Types.h:466
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:151
Vec3< double > Vec3d
Definition: Vec3.h:679
Tag dispatch class that distinguishes topology copy constructors from deep copy constructors.
Definition: Types.h:518
Integer wrapper, required to distinguish PointIndexGrid and PointDataGrid from Int32Grid and Int64Gri...
Definition: Types.h:183
const char * typeNameAsString< ValueMask >()
Definition: Types.h:340
const char * typeNameAsString< Mat3d >()
Definition: Types.h:360
const char * typeNameAsString< Vec2d >()
Definition: Types.h:352
std::weak_ptr< T > WeakPtr
Definition: Types.h:140
CombineArgs & setAIsActive(bool b)
Set the active state of the A value.
Definition: Types.h:453
Vec4< double > Vec4d
Definition: Vec4.h:587
CombineArgs()
Definition: Types.h:392
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:171
3x3 matrix class.
Definition: Mat3.h:55
Mat3< double > Mat3d
Definition: Mat3.h:843
const AValueType & result() const
Get the output value.
Definition: Types.h:431
Signed (x, y, z) 32-bit integer coordinates.
Definition: Coord.h:51
const char * typeNameAsString< uint16_t >()
Definition: Types.h:346
int32_t Int32
Definition: Types.h:63
PointIndex(T i)
Explicit type conversion constructor.
Definition: Types.h:192
const BValueType * mBValPtr
Definition: Types.h:465
const char * typeNameAsString< Vec2i >()
Definition: Types.h:350
bool resultIsActive() const
Definition: Types.h:450
Tag dispatch class that distinguishes shallow copy constructors from deep copy constructors.
Definition: Types.h:515
Int32 Int
Definition: Types.h:65
PointIndex(IntType i=IntType(0))
Definition: Types.h:189
const char * typeNameAsString< int32_t >()
Definition: Types.h:347
const char * typeNameAsString< PointIndex64 >()
Definition: Types.h:366
CombineArgs & setBIsActive(bool b)
Set the active state of the B value.
Definition: Types.h:455
GridClass
Definition: Types.h:275
uint32_t Index32
Definition: Types.h:59
static const Real LEVEL_SET_HALF_WIDTH
Definition: Types.h:283
Vec2< int32_t > Vec2i
Definition: Vec2.h:556
BValueType BValueT
Definition: Types.h:390
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:403
bool mBIsActive
Definition: Types.h:468
Vec4< float > Vec4s
Definition: Vec4.h:586
#define OPENVDB_VERSION_NAME
The version namespace name for this library version.
Definition: version.h:136
SwappedCombineOp(CombineOp &_op)
Definition: Types.h:479
const char * typeNameAsString< PointDataIndex32 >()
Definition: Types.h:367
unsigned char Byte
Definition: Types.h:66
const char * typeNameAsString< Mat4d >()
Definition: Types.h:362
Vec4< int32_t > Vec4i
Definition: Vec4.h:584
AValueType & result()
Get the output value.
Definition: Types.h:432
const char * typeNameAsString< Mat3s >()
Definition: Types.h:359
const char * typeNameAsString< bool >()
Definition: Types.h:339
bool mResultIsActive
Definition: Types.h:469
Definition: Exceptions.h:40
Axis-aligned bounding box of signed integer coordinates.
Definition: Coord.h:264
Quat< double > Quatd
Definition: Quat.h:643
const AValueType & a() const
Get the A input value.
Definition: Types.h:426
const char * typeNameAsString< PointIndex32 >()
Definition: Types.h:365
CanConvertType<FromType, ToType>::value is true if a value of type ToType can be constructed from a v...
Definition: Types.h:246
const BValueType & b() const
Get the B input value.
Definition: Types.h:428
const char * typeNameAsString< half >()
Definition: Types.h:341
const char * typeNameAsString< Vec2s >()
Definition: Types.h:351
Vec2< double > Vec2d
Definition: Vec2.h:559
This struct collects both input and output arguments to "grid combiner" functors used with the tree::...
Definition: Types.h:386
Library and file format version numbers.
const char * typeNameAsString< Vec3d >()
Definition: Types.h:357
AValueType * mResultValPtr
Definition: Types.h:467
const char * typeNameAsString()
Definition: Types.h:338
const char * typeNameAsString< Vec3U8 >()
Definition: Types.h:353
std::shared_ptr< T > SharedPtr
Definition: Types.h:139
Mat4< float > Mat4s
Definition: Mat4.h:1360
const char * typeNameAsString< PointDataIndex64 >()
Definition: Types.h:368
int64_t Int64
Definition: Types.h:64
Tag dispatch class that distinguishes constructors during file input.
Definition: Types.h:520
CombineOp & op
Definition: Types.h:488
const AValueType * mAValPtr
Definition: Types.h:464
Mat3< float > Mat3s
Definition: Mat3.h:842
CombineArgs & setARef(const AValueType &a)
Redirect the A value to a new external source.
Definition: Types.h:439
const char * typeNameAsString< float >()
Definition: Types.h:342
CombineArgs & setResultRef(AValueType &val)
Redirect the result value to a new external destination.
Definition: Types.h:443
MergePolicy
Definition: Types.h:328
#define OPENVDB_USE_VERSION_NAMESPACE
Definition: version.h:188
Vec3< float > Vec3s
Definition: Vec3.h:678
const char * typeNameAsString< int16_t >()
Definition: Types.h:345
const char * typeNameAsString< uint8_t >()
Definition: Types.h:344
IntType_ IntType
Definition: Types.h:187
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:415
CombineArgs & setResult(const AValueType &val)
Set the output value.
Definition: Types.h:436
PointIndex operator+(T x)
Needed to support the (zeroVal<PointIndex>() + val) idiom.
Definition: Types.h:198
double Real
Definition: Types.h:67
bool aIsActive() const
Definition: Types.h:446
Quat< float > Quats
Definition: Quat.h:642
bool bIsActive() const
Definition: Types.h:448
const char * typeNameAsString< Vec3f >()
Definition: Types.h:356
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:161
CombineArgs & setBRef(const BValueType &b)
Redirect the B value to a new external source.
Definition: Types.h:441
T ElementType
Definition: Types.h:218