4 #ifndef OPENVDB_TYPES_HAS_BEEN_INCLUDED
5 #define OPENVDB_TYPES_HAS_BEEN_INCLUDED
24 #include <type_traits>
39 using Byte =
unsigned char;
95 template<
typename T>
using SharedPtr = std::shared_ptr<T>;
96 template<
typename T>
using WeakPtr = std::weak_ptr<T>;
116 template<
typename T,
typename U>
inline SharedPtr<T>
126 template<
typename T,
typename U>
inline SharedPtr<T>
136 template<
typename IntType_, Index Kind>
206 #define OPENVDB_INIT_INVOKABLE_MEMBER_FUNCTION(F) \
207 template <typename ClassT, typename... Args> \
208 struct HasInvokableMemberFunction_##F { \
210 template <typename T> \
211 static auto check(T*) -> \
212 decltype(std::declval<T>(). \
213 F(std::declval<Args>()...), std::true_type()); \
214 template <typename T> \
215 static auto check(...) -> std::false_type; \
217 static constexpr bool value = \
218 decltype(check<ClassT>(nullptr))::value; \
220 #define OPENVDB_HAS_INVOKABLE_MEMBER_FUNCTION(T, F, ...) \
221 HasInvokableMemberFunction_##F<T, __VA_ARGS__>::value
223 #define OPENVDB_INIT_MEMBER_FUNCTION(F) \
224 template<typename ClassT, typename Signature> \
225 struct HasMemberFunction_##F { \
226 template <typename U, U> struct sigmatch; \
227 template <typename U> static std::true_type \
228 check(sigmatch<Signature, &U::F>*); \
229 template <typename> static std::false_type check(...); \
230 static const bool value = std::is_same<std::true_type, \
231 decltype(check<ClassT>(nullptr))>::value; \
233 #define OPENVDB_HAS_MEMBER_FUNCTION(T, F, S) \
234 HasMemberFunction_##F<T, S>::value
243 template <
typename T,
template <
typename...>
class Template>
246 template <
typename... Args,
template <
typename...>
class Template>
274 template <std::size_t... Ns>
277 template <std::size_t
N, std::size_t... Is>
284 template <std::
size_t N>
286 std::decay_t<decltype(make_index_sequence_impl<N>())>;
343 template<typename T, bool = VecTraits<T>::IsVec ||
381 namespace types_internal
383 template <
size_t Bits,
bool Signed>
struct int_t;
384 template <>
struct int_t<8ul, true> {
using type = int8_t; };
385 template <>
struct int_t<16ul, true> {
using type = int16_t; };
386 template <>
struct int_t<32ul, true> {
using type = int32_t; };
387 template <>
struct int_t<64ul, true> {
using type = int64_t; };
388 template <>
struct int_t<8ul, false> {
using type = uint8_t; };
389 template <>
struct int_t<16ul, false> {
using type = uint16_t; };
390 template <>
struct int_t<32ul, false> {
using type = uint32_t; };
391 template <>
struct int_t<64ul, false> {
using type = uint64_t; };
393 template <
size_t Bits>
struct flt_t;
396 template <>
struct flt_t<64ul> {
using type = double; };
408 template <
size_t bits>
413 static_assert(
sizeof(
T) <= 8ul,
"Unsupported source type for promotion");
415 #define OPENVDB_TARGET_BITS(SHIFT, PROMOTE) \
416 std::max(size_t(8), \
417 std::min(size_t(64), (PROMOTE ? size_t(8)*(sizeof(T)<<SHIFT) : \
418 size_t(8)*(sizeof(T)>>SHIFT))))
419 template <
size_t Shift = ~0UL>
using Promote =
typename TypeT<OPENVDB_TARGET_BITS(Shift, true)>::type;
420 template <
size_t Shift = ~0UL>
using Demote =
typename TypeT<OPENVDB_TARGET_BITS(Shift, false)>::type;
421 #undef OPENVDB_TARGET_BITS
424 using Lowest =
typename TypeT<8ul>::type;
429 template <
typename T,
template <
typename>
class ContainerT>
433 template <
size_t Shift = ~0UL>
using Demote = ContainerT<typename PromoteType<T>::template
Demote<Shift>>;
434 using Highest = ContainerT<typename PromoteType<T>::Highest>;
435 using Lowest = ContainerT<typename PromoteType<T>::Lowest>;
436 using Next = ContainerT<typename PromoteType<T>::Next>;
437 using Previous = ContainerT<typename PromoteType<T>::Previous>;
454 template<
typename FromType,
typename ToType>
466 template<
typename T0,
typename T1>
468 template<
typename T0,
typename T1>
470 template<
typename T0,
typename T1>
495 template<
typename FromType,
typename ToType>
struct CopyConstness<const FromType, ToType> {
496 using Type =
const ToType;
528 static const Real LEVEL_SET_HALF_WIDTH = 3;
586 template<>
inline const char* typeNameAsString<math::half>() {
return "half"; }
607 template<>
inline const char* typeNameAsString<std::string>() {
return "string"; }
612 template<>
inline const char* typeNameAsString<math::Quats>() {
return "quats"; }
613 template<>
inline const char* typeNameAsString<math::Quatd>() {
return "quatd"; }
634 template<
typename AValueType,
typename BValueType = AValueType>
653 bool aOn =
false,
bool bOn =
false)
664 CombineArgs(
const AValueType&
a,
const BValueType&
b,
bool aOn =
false,
bool bOn =
false)
725 template<
typename ValueType,
typename CombineOp>
766 for (
unsigned i = 0; i < 3; ++i, ++
op, ++ip) {
779 #endif // OPENVDB_TYPES_HAS_BEEN_INCLUDED
const AValueType & result() const
Get the output value.
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...
PointIndex operator+(T x)
Needed to support the (zeroVal<PointIndex>() + val) idiom.
const char * typeNameAsString< ValueMask >()
const BValueType * mBValPtr
This struct collects both input and output arguments to "grid combiner" functors used with the tree::...
typename T::ValueType ElementType
Tag dispatch class that distinguishes shallow copy constructors from deep copy constructors.
const char * typeNameAsString< PointIndex32 >()
typename T::ValueType ElementType
const char * typeNameAsString< int32_t >()
const char * typeNameAsString< Vec3i >()
const char * typeNameAsString< uint16_t >()
GLsizei const GLfloat * value
Mat3< Type1 > cwiseAdd(const Mat3< Type1 > &m, const Type2 s)
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.
CombineArgs & setBIsActive(bool b)
Set the active state of the B value.
const char * typeNameAsString< int8_t >()
const char * typeNameAsString< int16_t >()
GLboolean GLboolean GLboolean GLboolean a
#define OPENVDB_USE_VERSION_NAMESPACE
const char * typeNameAsString< Mat3s >()
bool_constant< std::is_floating_point< T >::value||is_float128< T >::value > is_floating_point
void updateResultActive()
Signed (x, y, z) 32-bit integer coordinates.
Tag dispatch class that distinguishes constructors during file input.
const char * typeNameAsString< PointIndex64 >()
const char * typeNameAsString< Vec3d >()
std::decay_t< decltype(make_index_sequence_impl< N >())> make_index_sequence
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...
const char * typeNameAsString< Mat4s >()
std::shared_ptr< T > SharedPtr
const AValueType & a() const
Get the A input value.
SwappedCombineOp(CombineOp &_op)
const char * typeNameAsString< Vec3U16 >()
Helper metafunction used to determine if the first template parameter is a specialization of the clas...
const char * typeNameAsString< Vec3f >()
const char * typeNameAsString< PointDataIndex32 >()
Re-implementation of C++17's index_sequence and the helper alias make_index_sequence. This was introduced to fix an issue with clang's builtin implementation which treats template specializations of builtin templates differently when a subsequent parameter is dependent. The result is a resolution failure during partial specialization selection. For example, the following will fail to specialize:
const char * typeNameAsString< uint32_t >()
A TypeList provides a compile time sequence of heterogeneous types which can be accessed, transformed and executed over in various ways. It incorporates a subset of functionality similar to hboost::mpl::vector however provides most of its content through using declarations rather than additional typed classes.
std::weak_ptr< T > WeakPtr
PointIndex(T i)
Explicit type conversion constructor.
const char * typeNameAsString< uint8_t >()
bool resultIsActive() const
const char * typeNameAsString< float >()
const char * typeNameAsString< Vec2i >()
General-purpose arithmetic and comparison routines, most of which accept arbitrary value types (or at...
CombineArgs & setAIsActive(bool b)
Set the active state of the A value.
typename std::remove_const< ToType >::type Type
const char * typeNameAsString()
const char * typeNameAsString< int64_t >()
Tag dispatch class that distinguishes constructors that steal.
static const bool IsScalar
CopyConstness<T1, T2>::Type is either const T2 or T2 with no const qualifier, depending on whether T1...
GLuint const GLchar * name
GLboolean GLboolean GLboolean b
const char * typeNameAsString< Vec4d >()
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.
CombineArgs & setResultIsActive(bool b)
Set the active state of the output value.
const char * typeNameAsString< double >()
const AValueType * mAValPtr
AValueType * mResultValPtr
CanConvertType<FromType, ToType>::value is true if a value of type ToType can be constructed from a v...
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...
typename T::ValueType ElementType
std::integral_constant< bool, std::numeric_limits< T >::is_signed||std::is_same< T, int128_opt >::value > is_signed
IMATH_NAMESPACE::V2f IMATH_NAMESPACE::Box2i std::string this attribute is obsolete as of OpenEXR v3 float
Library and file format version numbers.
const char * typeNameAsString< bool >()
static const int Elements
AValueType & result()
Get the output value.
CombineArgs & setBRef(const BValueType &b)
Redirect the B value to a new external source.
const char * typeNameAsString< Mat4d >()
CombineArgs & setResultRef(AValueType &val)
Redirect the result value to a new external destination.
const char * typeNameAsString< Vec3U8 >()
const char * typeNameAsString< Vec2d >()
void operator()(CombineArgs< ValueType > &args)
GA_API const UT_StringHolder N
**If you just want to fire and args
CombineArgs & setARef(const AValueType &a)
Redirect the A value to a new external source.
Integer wrapper, required to distinguish PointIndexGrid and PointDataGrid from Int32Grid and Int64Gri...
const char * typeNameAsString< Vec4f >()
Tag dispatch class that distinguishes topology copy constructors from deep copy constructors.
const BValueType & b() const
Get the B input value.
Tag dispatch class that distinguishes constructors that deep copy.
const char * typeNameAsString< Vec4i >()
auto make_index_sequence_impl()
typename T::ValueType ElementType
#define OPENVDB_VERSION_NAME
The version namespace name for this library version.
Conversion classes for changing the underlying type of VDB types.
const char * typeNameAsString< PointDataIndex64 >()
CombineArgs & setResult(const AValueType &val)
Set the output value.
const char * typeNameAsString< Vec2s >()
PointIndex(IntType i=IntType(0))
const char * typeNameAsString< Mat3d >()