HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Types.h
Go to the documentation of this file.
1 // Copyright Contributors to the OpenVDB Project
2 // SPDX-License-Identifier: MPL-2.0
3 
4 #ifndef OPENVDB_TYPES_HAS_BEEN_INCLUDED
5 #define OPENVDB_TYPES_HAS_BEEN_INCLUDED
6 
7 #include "version.h"
8 #include "Platform.h"
9 #include <OpenEXR/half.h>
10 #include <openvdb/math/Math.h>
11 #include <openvdb/math/BBox.h>
12 #include <openvdb/math/Quat.h>
13 #include <openvdb/math/Vec2.h>
14 #include <openvdb/math/Vec3.h>
15 #include <openvdb/math/Vec4.h>
16 #include <openvdb/math/Mat3.h>
17 #include <openvdb/math/Mat4.h>
18 #include <openvdb/math/Coord.h>
19 #include <cstdint>
20 #include <memory>
21 #include <type_traits>
22 
23 
24 namespace openvdb {
26 namespace OPENVDB_VERSION_NAME {
27 
28 // One-dimensional scalar types
29 using Index32 = uint32_t;
30 using Index64 = uint64_t;
31 using Index = Index32;
32 using Int16 = int16_t;
33 using Int32 = int32_t;
34 using Int64 = int64_t;
35 using Int = Int32;
36 using Byte = unsigned char;
37 using Real = double;
38 
39 // Two-dimensional vector types
44 using math::Vec2i;
45 using math::Vec2s;
46 using math::Vec2d;
47 
48 // Three-dimensional vector types
55 using math::Vec3i;
56 using math::Vec3s;
57 using math::Vec3d;
58 
59 using math::Coord;
60 using math::CoordBBox;
62 
63 // Four-dimensional vector types
68 using math::Vec4i;
69 using math::Vec4s;
70 using math::Vec4d;
71 
72 // Three-dimensional matrix types
74 using math::Mat3s;
75 using math::Mat3d;
76 
77 // Four-dimensional matrix types
79 using math::Mat4s;
80 using math::Mat4d;
81 
82 // Quaternions
84 using math::Quats;
85 using math::Quatd;
86 
87 // Dummy type for a voxel with a binary mask value, e.g. the active state
88 class ValueMask {};
89 
90 // Use STL shared pointers from OpenVDB 4 on.
91 template<typename T> using SharedPtr = std::shared_ptr<T>;
92 template<typename T> using WeakPtr = std::weak_ptr<T>;
93 
94 /// @brief Return a new shared pointer that points to the same object
95 /// as the given pointer but with possibly different <TT>const</TT>-ness.
96 /// @par Example:
97 /// @code
98 /// FloatGrid::ConstPtr grid = ...;
99 /// FloatGrid::Ptr nonConstGrid = ConstPtrCast<FloatGrid>(grid);
100 /// FloatGrid::ConstPtr constGrid = ConstPtrCast<const FloatGrid>(nonConstGrid);
101 /// @endcode
102 template<typename T, typename U> inline SharedPtr<T>
103 ConstPtrCast(const SharedPtr<U>& ptr) { return std::const_pointer_cast<T, U>(ptr); }
104 
105 /// @brief Return a new shared pointer that is either null or points to
106 /// the same object as the given pointer after a @c dynamic_cast.
107 /// @par Example:
108 /// @code
109 /// GridBase::ConstPtr grid = ...;
110 /// FloatGrid::ConstPtr floatGrid = DynamicPtrCast<const FloatGrid>(grid);
111 /// @endcode
112 template<typename T, typename U> inline SharedPtr<T>
113 DynamicPtrCast(const SharedPtr<U>& ptr) { return std::dynamic_pointer_cast<T, U>(ptr); }
114 
115 /// @brief Return a new shared pointer that points to the same object
116 /// as the given pointer after a @c static_cast.
117 /// @par Example:
118 /// @code
119 /// FloatGrid::Ptr floatGrid = ...;
120 /// GridBase::Ptr grid = StaticPtrCast<GridBase>(floatGrid);
121 /// @endcode
122 template<typename T, typename U> inline SharedPtr<T>
123 StaticPtrCast(const SharedPtr<U>& ptr) { return std::static_pointer_cast<T, U>(ptr); }
124 
125 
126 ////////////////////////////////////////
127 
128 
129 /// @brief Integer wrapper, required to distinguish PointIndexGrid and
130 /// PointDataGrid from Int32Grid and Int64Grid
131 /// @note @c Kind is a dummy parameter used to create distinct types.
132 template<typename IntType_, Index Kind>
134 {
135  static_assert(std::is_integral<IntType_>::value, "PointIndex requires an integer value type");
136 
137  using IntType = IntType_;
138 
139  PointIndex(IntType i = IntType(0)): mIndex(i) {}
140 
141  /// Explicit type conversion constructor
142  template<typename T> explicit PointIndex(T i): mIndex(static_cast<IntType>(i)) {}
143 
144  operator IntType() const { return mIndex; }
145 
146  /// Needed to support the <tt>(zeroVal<PointIndex>() + val)</tt> idiom.
147  template<typename T>
148  PointIndex operator+(T x) { return PointIndex(mIndex + IntType(x)); }
149 
150 private:
151  IntType mIndex;
152 };
153 
154 
157 
160 
161 
162 ////////////////////////////////////////
163 
164 
165 /// @brief Helper metafunction used to determine if the first template
166 /// parameter is a specialization of the class template given in the second
167 /// template parameter
168 template <typename T, template <typename...> class Template>
169 struct IsSpecializationOf: public std::false_type {};
170 
171 template <typename... Args, template <typename...> class Template>
172 struct IsSpecializationOf<Template<Args...>, Template>: public std::true_type {};
173 
174 
175 ////////////////////////////////////////
176 
177 
181 struct VecTraits
182 {
183  static const bool IsVec = true;
184  static const int Size = T::size;
185  using ElementType = typename T::ValueType;
186 };
187 
188 template<typename T>
189 struct VecTraits<T, false>
190 {
191  static const bool IsVec = false;
192  static const int Size = 1;
193  using ElementType = T;
194 };
195 
198 {
199  static const bool IsQuat = true;
200  static const int Size = T::size;
201  using ElementType = typename T::ValueType;
202 };
203 
204 template<typename T>
205 struct QuatTraits<T, false>
206 {
207  static const bool IsQuat = false;
208  static const int Size = 1;
209  using ElementType = T;
210 };
211 
214 struct MatTraits
215 {
216  static const bool IsMat = true;
217  static const int Size = T::size;
218  using ElementType = typename T::ValueType;
219 };
220 
221 template<typename T>
222 struct MatTraits<T, false>
223 {
224  static const bool IsMat = false;
225  static const int Size = 1;
226  using ElementType = T;
227 };
228 
229 template<typename T, bool = VecTraits<T>::IsVec ||
233 {
234  static const bool IsVec = VecTraits<T>::IsVec;
235  static const bool IsQuat = QuatTraits<T>::IsQuat;
236  static const bool IsMat = MatTraits<T>::IsMat;
237  static const bool IsScalar = false;
238  static const int Size = T::size;
239  static const int Elements = IsMat ? Size*Size : Size;
240  using ElementType = typename T::ValueType;
241 };
242 
243 template<typename T>
244 struct ValueTraits<T, false>
245 {
246  static const bool IsVec = false;
247  static const bool IsQuat = false;
248  static const bool IsMat = false;
249  static const bool IsScalar = true;
250  static const int Size = 1;
251  static const int Elements = 1;
252  using ElementType = T;
253 };
254 
255 
256 ////////////////////////////////////////
257 
258 
259 /// @brief CanConvertType<FromType, ToType>::value is @c true if a value
260 /// of type @a ToType can be constructed from a value of type @a FromType.
261 template<typename FromType, typename ToType>
263 
264 // Specializations for vector types, which can be constructed from values
265 // of their own ValueTypes (or values that can be converted to their ValueTypes),
266 // but only explicitly
267 template<typename T> struct CanConvertType<T, math::Vec2<T> > { enum { value = true }; };
268 template<typename T> struct CanConvertType<T, math::Vec3<T> > { enum { value = true }; };
269 template<typename T> struct CanConvertType<T, math::Vec4<T> > { enum { value = true }; };
270 template<typename T> struct CanConvertType<math::Vec2<T>, math::Vec2<T> > { enum {value = true}; };
271 template<typename T> struct CanConvertType<math::Vec3<T>, math::Vec3<T> > { enum {value = true}; };
272 template<typename T> struct CanConvertType<math::Vec4<T>, math::Vec4<T> > { enum {value = true}; };
273 template<typename T0, typename T1>
274 struct CanConvertType<T0, math::Vec2<T1> > { enum { value = CanConvertType<T0, T1>::value }; };
275 template<typename T0, typename T1>
276 struct CanConvertType<T0, math::Vec3<T1> > { enum { value = CanConvertType<T0, T1>::value }; };
277 template<typename T0, typename T1>
278 struct CanConvertType<T0, math::Vec4<T1> > { enum { value = CanConvertType<T0, T1>::value }; };
279 template<> struct CanConvertType<PointIndex32, PointDataIndex32> { enum {value = true}; };
280 template<> struct CanConvertType<PointDataIndex32, PointIndex32> { enum {value = true}; };
281 template<typename T>
283 template<typename T>
285 
286 
287 ////////////////////////////////////////
288 
289 
290 /// @brief CopyConstness<T1, T2>::Type is either <tt>const T2</tt>
291 /// or @c T2 with no @c const qualifier, depending on whether @c T1 is @c const.
292 /// @details For example,
293 /// - CopyConstness<int, int>::Type is @c int
294 /// - CopyConstness<int, const int>::Type is @c int
295 /// - CopyConstness<const int, int>::Type is <tt>const int</tt>
296 /// - CopyConstness<const int, const int>::Type is <tt>const int</tt>
297 template<typename FromType, typename ToType> struct CopyConstness {
299 };
300 
301 /// @cond OPENVDB_TYPES_INTERNAL
302 template<typename FromType, typename ToType> struct CopyConstness<const FromType, ToType> {
303  using Type = const ToType;
304 };
305 /// @endcond
306 
307 
308 ////////////////////////////////////////
309 
310 
311 /// @cond OPENVDB_TYPES_INTERNAL
312 
313 template<typename... Ts> struct TypeList; // forward declaration
314 
315 namespace internal {
316 
317 // Implementation details of @c TypeList
318 
319 /// @brief Dummy struct, used as the return type from invalid or out-of-range
320 /// @c TypeList queries.
321 struct NullType {};
322 
323 
324 /// @brief Type resolver for index queries
325 /// @details Defines a type at a given location within a @c TypeList or the
326 /// @c NullType if the index is out-of-range. The last template
327 /// parameter is used to determine if the index is in range.
328 /// @tparam ListT The @c TypeList
329 /// @tparam Idx The index of the type to get
330 template<typename ListT, size_t Idx, typename = void> struct TSGetElementImpl;
331 
332 /// @brief Partial specialization for valid (in range) index queries.
333 /// @tparam Ts Unpacked types from a @c TypeList
334 /// @tparam Idx The index of the type to get
335 template<typename... Ts, size_t Idx>
336 struct TSGetElementImpl<TypeList<Ts...>, Idx,
337  typename std::enable_if<(Idx < sizeof...(Ts) && sizeof...(Ts))>::type> {
338  using type = typename std::tuple_element<Idx, std::tuple<Ts...>>::type;
339 };
340 
341 /// @brief Partial specialization for invalid index queries (i.e. out-of-range
342 /// indices such as @c TypeList<Int32>::Get<1>). Defines the NullType.
343 /// @tparam Ts Unpacked types from a @c TypeList
344 /// @tparam Idx The index of the type to get
345 template<typename... Ts, size_t Idx>
346 struct TSGetElementImpl<TypeList<Ts...>, Idx,
347  typename std::enable_if<!(Idx < sizeof...(Ts) && sizeof...(Ts))>::type> {
348  using type = NullType;
349 };
350 
351 
352 /// @brief Search for a given type within a @c TypeList.
353 /// @details If the type is found, a @c bool constant @c Value is set to true
354 /// and an @c int64_t @c Index points to the location of the type. If
355 /// multiple versions of the types exist, the value of @c Index is
356 /// always the location of the first matching type. If the type is not
357 /// found, @c Value is set to false and @c Index is set to -1.
358 /// @note This implementation is recursively defined until the type is found
359 /// or until the end of the list is reached. The last template argument
360 /// is used as an internal counter to track the current index being
361 /// evaluated.
362 /// @tparam ListT The @c TypeList
363 /// @tparam T The type to find
364 template <typename ListT, typename T, size_t=0>
365 struct TSHasTypeImpl;
366 
367 /// @brief Partial specialization on an empty @c TypeList, instantiated when
368 /// @c TSHasTypeImpl has been invoked with an empty @c TypeList or when
369 /// a recursive search reaches the end of a @c TypeList.
370 /// @tparam T The type to find
371 /// @tparam Idx Current index
372 template <typename T, size_t Idx>
373 struct TSHasTypeImpl<TypeList<>, T, Idx> {
374  static constexpr bool Value = false;
375  static constexpr int64_t Index = -1;
376 };
377 
378 /// @brief Partial specialization on a @c TypeList which still contains types,
379 /// but the current type being evaluated @c U does not match the given
380 /// type @C T.
381 /// @tparam U The current type being evaluated within the @c TypeList
382 /// @tparam T The type to find
383 /// @tparam Ts Remaining types
384 /// @tparam Idx Current index
385 template <typename U, typename T, typename... Ts, size_t Idx>
386 struct TSHasTypeImpl<TypeList<U, Ts...>, T, Idx> :
387  TSHasTypeImpl<TypeList<Ts...>, T, Idx+1> {};
388 
389 /// @brief Partial specialization on a @c TypeList where @c T matches the
390 /// current type (i.e. the type has been found).
391 /// @tparam T The type to find
392 /// @tparam Ts Remaining types
393 /// @tparam Idx Current index
394 template <typename T, typename... Ts, size_t Idx>
395 struct TSHasTypeImpl<TypeList<T, Ts...>, T, Idx>
396 {
397  static constexpr bool Value = true;
398  static constexpr int64_t Index = static_cast<int64_t>(Idx);
399 };
400 
401 
402 /// @brief Remove any duplicate types from a @c TypeList.
403 /// @details This implementation effectively rebuilds a @c TypeList by starting
404 /// with an empty @c TypeList and recursively defining an expanded
405 /// @c TypeList for every type (first to last), only if the type does
406 /// not already exist in the new @c TypeList. This has the effect of
407 /// dropping all but the first of duplicate types.
408 /// @note Each type must define a new instantiation of this object.
409 /// @tparam ListT The starting @c TypeList, usually (but not limited to) an
410 /// empty @c TypeList
411 /// @tparam Ts The list of types to make unique
412 template <typename ListT, typename... Ts>
413 struct TSMakeUniqueImpl {
414  using type = ListT;
415 };
416 
417 /// @brief Partial specialization for type packs, where by the next type @c U
418 /// is checked in the existing type set @c Ts for duplication. If the
419 /// type does not exist, it is added to the new @c TypeList definition,
420 /// otherwise it is dropped. In either case, this class is recursively
421 /// defined with the remaining types @c Us.
422 /// @tparam Ts Current types in the @c TypeList
423 /// @tparam U Type to check for duplication in @c Ts
424 /// @tparam Us Remaining types
425 template <typename... Ts, typename U, typename... Us>
426 struct TSMakeUniqueImpl<TypeList<Ts...>, U, Us...>
427 {
428  using type = typename std::conditional<
429  TSHasTypeImpl<TypeList<Ts...>, U>::Value,
430  typename TSMakeUniqueImpl<TypeList<Ts...>, Us...>::type,
431  typename TSMakeUniqueImpl<TypeList<Ts..., U>, Us...>::type >::type;
432 };
433 
434 
435 /// @brief Append any number of types to a @c TypeList
436 /// @details Defines a new @c TypeList with the provided types appended
437 /// @tparam ListT The @c TypeList to append to
438 /// @tparam Ts Types to append
439 template<typename ListT, typename... Ts> struct TSAppendImpl;
440 
441 /// @brief Partial specialization for a @c TypeList with a list of zero or more
442 /// types to append
443 /// @tparam Ts Current types within the @c TypeList
444 /// @tparam OtherTs Other types to append
445 template<typename... Ts, typename... OtherTs>
446 struct TSAppendImpl<TypeList<Ts...>, OtherTs...> {
447  using type = TypeList<Ts..., OtherTs...>;
448 };
449 
450 /// @brief Partial specialization for a @c TypeList with another @c TypeList.
451 /// Appends the other TypeList's members.
452 /// @tparam Ts Types within the first @c TypeList
453 /// @tparam OtherTs Types within the second @c TypeList
454 template<typename... Ts, typename... OtherTs>
455 struct TSAppendImpl<TypeList<Ts...>, TypeList<OtherTs...>> {
456  using type = TypeList<Ts..., OtherTs...>;
457 };
458 
459 
460 /// @brief Remove all occurrences of type T from a @c TypeList
461 /// @details Defines a new @c TypeList with the provided types removed
462 /// @tparam ListT The @c TypeList
463 /// @tparam T Type to remove
464 template<typename ListT, typename T> struct TSEraseImpl;
465 
466 /// @brief Partial specialization for an empty @c TypeList
467 /// @tparam T Type to remove, has no effect
468 template<typename T>
469 struct TSEraseImpl<TypeList<>, T> { using type = TypeList<>; };
470 
471 /// @brief Partial specialization where the currently evaluating type in a
472 /// @c TypeList matches the type to remove. Recursively defines this
473 /// implementation with the remaining types.
474 /// @tparam Ts Unpacked types within the @c TypeList
475 /// @tparam T Type to remove
476 template<typename... Ts, typename T>
477 struct TSEraseImpl<TypeList<T, Ts...>, T> {
478  using type = typename TSEraseImpl<TypeList<Ts...>, T>::type;
479 };
480 
481 /// @brief Partial specialization where the currently evaluating type @c T2 in
482 /// a @c TypeList does not match the type to remove @c T. Recursively
483 /// defines this implementation with the remaining types.
484 /// @tparam T2 Current type within the @c TypeList, which does not match @c T
485 /// @tparam Ts Other types within the @c TypeList
486 /// @tparam T Type to remove
487 template<typename T2, typename... Ts, typename T>
488 struct TSEraseImpl<TypeList<T2, Ts...>, T> {
489  using type = typename TSAppendImpl<TypeList<T2>,
490  typename TSEraseImpl<TypeList<Ts...>, T>::type>::type;
491 };
492 
493 /// @brief Front end implementation to call TSEraseImpl which removes all
494 /// occurrences of a type from a @c TypeList. This struct handles the
495 /// case where the type to remove is another @c TypeList, in which case
496 /// all types in the second @c TypeList are removed from the first.
497 /// @tparam ListT The @c TypeList
498 /// @tparam Ts Types in the @c TypeList
499 template<typename ListT, typename... Ts> struct TSRemoveImpl;
500 
501 /// @brief Partial specialization when there are no types in the @c TypeList.
502 /// @tparam ListT The @c TypeList
503 template<typename ListT>
504 struct TSRemoveImpl<ListT> { using type = ListT; };
505 
506 /// @brief Partial specialization when the type to remove @c T is not another
507 /// @c TypeList. @c T is removed from the @c TypeList.
508 /// @tparam ListT The @c TypeList
509 /// @tparam T Type to remove
510 /// @tparam Ts Types in the @c TypeList
511 template<typename ListT, typename T, typename... Ts>
512 struct TSRemoveImpl<ListT, T, Ts...> {
514 };
515 
516 /// @brief Partial specialization when the type to remove is another
517 /// @c TypeList. All types within the other type list are removed from
518 /// the first list.
519 /// @tparam ListT The @c TypeList
520 /// @tparam Ts Types from the second @c TypeList to remove from the first
521 template<typename ListT, typename... Ts>
522 struct TSRemoveImpl<ListT, TypeList<Ts...>> {
523  using type = typename TSRemoveImpl<ListT, Ts...>::type;
524 };
525 
526 /// @brief Remove the first element of a type list. If the list is empty,
527 /// nothing is done. This base configuration handles the empty list.
528 /// @note Much cheaper to instantiate than TSRemoveIndicesImpl
529 /// @tparam T The @c TypeList
530 template<typename T>
531 struct TSRemoveFirstImpl {
532  using type = TypeList<>;
533 };
534 
535 /// @brief Partial specialization for removing the first type of a @c TypeList
536 /// when the list is not empty i.e. does that actual work.
537 /// @tparam T The first type in the @c TypeList.
538 /// @tparam Ts Remaining types in the @c TypeList
539 template<typename T, typename... Ts>
540 struct TSRemoveFirstImpl<TypeList<T, Ts...>> {
541  using type = TypeList<Ts...>;
542 };
543 
544 
545 /// @brief Remove the last element of a type list. If the list is empty,
546 /// nothing is done. This base configuration handles the empty list.
547 /// @note Cheaper to instantiate than TSRemoveIndicesImpl
548 /// @tparam T The @c TypeList
549 template<typename T>
550 struct TSRemoveLastImpl { using type = TypeList<>; };
551 
552 /// @brief Partial specialization for removing the last type of a @c TypeList.
553 /// This instance is instantiated when the @c TypeList contains a
554 /// single type, or the primary struct which recursively removes types
555 /// (see below) hits the last type. Evaluates the last type to the empty
556 /// list (see above).
557 /// @tparam T The last type in the @c TypeList
558 template<typename T>
559 struct TSRemoveLastImpl<TypeList<T>> : TSRemoveLastImpl<T> {};
560 
561 /// @brief Partial specialization for removing the last type of a @c TypeList
562 /// with a type list size of two or more. Recursively defines this
563 /// implementation with the remaining types, effectively rebuilding the
564 /// @c TypeList until the last type is hit, which is dropped.
565 /// @tparam T The current type in the @c TypeList
566 /// @tparam Ts Remaining types in the @c TypeList
567 template<typename T, typename... Ts>
568 struct TSRemoveLastImpl<TypeList<T, Ts...>>
569 {
570  using type =
571  typename TypeList<T>::template
572  Append<typename TSRemoveLastImpl<TypeList<Ts...>>::type>;
573 };
574 
575 
576 /// @brief Remove a number of types from a @c TypeList based on a @c First and
577 /// @c Last index.
578 /// @details Both indices are inclusive, such that when <tt>First == Last</tt>
579 /// a single type is removed (assuming the index exists). If
580 /// <tt>Last < First</tt>, nothing is done. Any indices which do not
581 /// exist are ignored. If @c Last is greater than the number of types
582 /// in the @c TypeList, all types from @c First to the end of the list
583 /// are dropped.
584 /// @tparam ListT The @c TypeList
585 /// @tparam First The first index
586 /// @tparam Last The last index
587 /// @tparam Idx Internal counter for the current index
588 template<typename ListT, size_t First, size_t Last, size_t Idx=0>
589 struct TSRemoveIndicesImpl;
590 
591 /// @brief Partial specialization for an empty @c TypeList
592 /// @tparam First The first index
593 /// @tparam Last The last index
594 /// @tparam Idx Internal counter for the current index
595 template<size_t First, size_t Last, size_t Idx>
596 struct TSRemoveIndicesImpl<TypeList<>, First, Last, Idx> {
597  using type = TypeList<>;
598 };
599 
600 /// @brief Partial specialization for a @c TypeList containing a single element.
601 /// @tparam T The last or only type in a @c TypeList
602 /// @tparam First The first index
603 /// @tparam Last The last index
604 /// @tparam Idx Internal counter for the current index
605 template<typename T, size_t First, size_t Last, size_t Idx>
606 struct TSRemoveIndicesImpl<TypeList<T>, First, Last, Idx>
607 {
608 private:
609  static constexpr bool Remove = Idx >= First && Idx <= Last;
610 public:
611  using type = typename std::conditional<Remove, TypeList<>, TypeList<T>>::type;
612 };
613 
614 /// @brief Partial specialization for a @c TypeList containing two or more types.
615 /// @details This implementation effectively rebuilds a @c TypeList by starting
616 /// with an empty @c TypeList and recursively defining an expanded
617 /// @c TypeList for every type (first to last), only if the type's
618 /// index does not fall within the range of indices defines by
619 /// @c First and @c Last. Recursively defines this implementation with
620 /// all but the last type.
621 /// @tparam T The currently evaluating type within a @c TypeList
622 /// @tparam Ts Remaining types in the @c TypeList
623 /// @tparam First The first index
624 /// @tparam Last The last index
625 /// @tparam Idx Internal counter for the current index
626 template<typename T, typename... Ts, size_t First, size_t Last, size_t Idx>
627 struct TSRemoveIndicesImpl<TypeList<T, Ts...>, First, Last, Idx>
628 {
629 private:
630  using ThisList = typename TSRemoveIndicesImpl<TypeList<T>, First, Last, Idx>::type;
631  using NextList = typename TSRemoveIndicesImpl<TypeList<Ts...>, First, Last, Idx+1>::type;
632 public:
633  using type = typename ThisList::template Append<NextList>;
634 };
635 
636 
637 template<typename OpT> inline void TSForEachImpl(OpT) {}
638 template<typename OpT, typename T, typename... Ts>
639 inline void TSForEachImpl(OpT op) { op(T()); TSForEachImpl<OpT, Ts...>(op); }
640 
641 } // namespace internal
642 
643 /// @endcond
644 
645 
646 /// @brief A list of types (not necessarily unique)
647 /// @details Example:
648 /// @code
649 /// using MyTypes = openvdb::TypeList<int, float, int, double, float>;
650 /// @endcode
651 template<typename... Ts>
652 struct TypeList
653 {
654  /// The type of this list
655  using Self = TypeList;
656 
657  /// @brief The number of types in the type list
658  static constexpr size_t Size = sizeof...(Ts);
659 
660  /// @brief Access a particular element of this type list. If the index
661  /// is out of range, internal::NullType is returned.
662  template<size_t N>
664  using Front = Get<0>;
665  using Back = Get<Size-1>;
666 
667  /// @brief True if this list contains the given type, false otherwise
668  /// @details Example:
669  /// @code
670  /// {
671  /// using IntTypes = openvdb::TypeList<Int16, Int32, Int64>;
672  /// using RealTypes = openvdb::TypeList<float, double>;
673  /// }
674  /// {
675  /// openvdb::TypeList<IntTypes>::Contains<Int32>; // true
676  /// openvdb::TypeList<RealTypes>::Contains<Int32>; // false
677  /// }
678  /// @endcode
679  template<typename T>
680  static constexpr bool Contains = internal::TSHasTypeImpl<Self, T>::Value;
681 
682  /// @brief Returns the index of the first found element of the given type, -1 if
683  /// no matching element exists.
684  /// @details Example:
685  /// @code
686  /// {
687  /// using IntTypes = openvdb::TypeList<Int16, Int32, Int64>;
688  /// using RealTypes = openvdb::TypeList<float, double>;
689  /// }
690  /// {
691  /// const int64_t L1 = openvdb::TypeList<IntTypes>::Index<Int32>; // 1
692  /// const int64_t L2 = openvdb::TypeList<RealTypes>::Index<Int32>; // -1
693  /// }
694  /// @endcode
695  template<typename T>
696  static constexpr int64_t Index = internal::TSHasTypeImpl<Self, T>::Index;
697 
698  /// @brief Remove any duplicate types from this TypeList by rotating the
699  /// next valid type left (maintains the order of other types).
700  /// @details Example:
701  /// @code
702  /// {
703  /// using Types = openvdb::TypeList<Int16, Int32, Int16, float, float, Int64>;
704  /// }
705  /// {
706  /// using UniqueTypes = Types::Unique; // <Int16, Int32, float, Int64>
707  /// }
708  /// @endcode
709  using Unique = typename internal::TSMakeUniqueImpl<TypeList<>, Ts...>::type;
710 
711  /// @brief Append types, or the members of another TypeList, to this list.
712  /// @details Example:
713  /// @code
714  /// {
715  /// using IntTypes = openvdb::TypeList<Int16, Int32, Int64>;
716  /// using RealTypes = openvdb::TypeList<float, double>;
717  /// using NumericTypes = IntTypes::Append<RealTypes>;
718  /// }
719  /// {
720  /// using IntTypes = openvdb::TypeList<Int16>::Append<Int32, Int64>;
721  /// using NumericTypes = IntTypes::Append<float>::Append<double>;
722  /// }
723  /// @endcode
724  template<typename... TypesToAppend>
725  using Append = typename internal::TSAppendImpl<Self, TypesToAppend...>::type;
726 
727  /// @brief Remove all occurrences of one or more types, or the members of
728  /// another TypeList, from this list.
729  /// @details Example:
730  /// @code
731  /// {
732  /// using NumericTypes = openvdb::TypeList<float, double, Int16, Int32, Int64>;
733  /// using LongTypes = openvdb::TypeList<Int64, double>;
734  /// using ShortTypes = NumericTypes::Remove<LongTypes>; // float, Int16, Int32
735  /// }
736  /// @endcode
737  template<typename... TypesToRemove>
738  using Remove = typename internal::TSRemoveImpl<Self, TypesToRemove...>::type;
739 
740  /// @brief Remove the first element of this type list. Has no effect if the
741  /// type list is already empty.
742  /// @details Example:
743  /// @code
744  /// {
745  /// using IntTypes = openvdb::TypeList<Int16, Int32, Int64>;
746  /// using EmptyTypes = openvdb::TypeList<>;
747  /// }
748  /// {
749  /// IntTypes::PopFront; // openvdb::TypeList<Int32, Int64>;
750  /// EmptyTypes::PopFront; // openvdb::TypeList<>;
751  /// }
752  /// @endcode
754 
755  /// @brief Remove the last element of this type list. Has no effect if the
756  /// type list is already empty.
757  /// @details Example:
758  /// @code
759  /// {
760  /// using IntTypes = openvdb::TypeList<Int16, Int32, Int64>;
761  /// using EmptyTypes = openvdb::TypeList<>;
762  /// }
763  /// {
764  /// IntTypes::PopBack; // openvdb::TypeList<Int16, Int32>;
765  /// EmptyTypes::PopBack; // openvdb::TypeList<>;
766  /// }
767  /// @endcode
769 
770  /// @brief Return a new list with types removed by their location within the list.
771  /// If First is equal to Last, a single element is removed (if it exists).
772  /// If First is greater than Last, the list remains unmodified.
773  /// @details Example:
774  /// @code
775  /// {
776  /// using NumericTypes = openvdb::TypeList<float, double, Int16, Int32, Int64>;
777  /// }
778  /// {
779  /// using IntTypes = NumericTypes::RemoveByIndex<0,1>; // openvdb::TypeList<Int16, Int32, Int64>;
780  /// using RealTypes = NumericTypes::RemoveByIndex<2,4>; // openvdb::TypeList<float, double>;
781  /// using RemoveFloat = NumericTypes::RemoveByIndex<0,0>; // openvdb::TypeList<double, Int16, Int32, Int64>;
782  /// }
783  /// @endcode
784  template <size_t First, size_t Last>
786 
787  /// @brief Invoke a templated, unary functor on a value of each type in this list.
788  /// @details Example:
789  /// @code
790  /// #include <typeinfo>
791  ///
792  /// template<typename ListT>
793  /// void printTypeList()
794  /// {
795  /// std::string sep;
796  /// auto op = [&](auto x) { // C++14
797  /// std::cout << sep << typeid(decltype(x)).name(); sep = ", "; };
798  /// ListT::foreach(op);
799  /// }
800  ///
801  /// using MyTypes = openvdb::TypeList<int, float, double>;
802  /// printTypeList<MyTypes>(); // "i, f, d" (exact output is compiler-dependent)
803  /// @endcode
804  ///
805  /// @note The functor object is passed by value. Wrap it with @c std::ref
806  /// to use the same object for each type.
807  template<typename OpT>
808  static void foreach(OpT op) { internal::TSForEachImpl<OpT, Ts...>(op); }
809 };
810 
811 
812 ////////////////////////////////////////
813 
814 
815 // Add new items to the *end* of this list, and update NUM_GRID_CLASSES.
816 enum GridClass {
821 };
823 
824 static const Real LEVEL_SET_HALF_WIDTH = 3;
825 
826 /// The type of a vector determines how transforms are applied to it:
827 /// <dl>
828 /// <dt><b>Invariant</b>
829 /// <dd>Does not transform (e.g., tuple, uvw, color)
830 ///
831 /// <dt><b>Covariant</b>
832 /// <dd>Apply inverse-transpose transformation: @e w = 0, ignores translation
833 /// (e.g., gradient/normal)
834 ///
835 /// <dt><b>Covariant Normalize</b>
836 /// <dd>Apply inverse-transpose transformation: @e w = 0, ignores translation,
837 /// vectors are renormalized (e.g., unit normal)
838 ///
839 /// <dt><b>Contravariant Relative</b>
840 /// <dd>Apply "regular" transformation: @e w = 0, ignores translation
841 /// (e.g., displacement, velocity, acceleration)
842 ///
843 /// <dt><b>Contravariant Absolute</b>
844 /// <dd>Apply "regular" transformation: @e w = 1, vector translates (e.g., position)
845 /// </dl>
846 enum VecType {
852 };
854 
855 
856 /// Specify how grids should be merged during certain (typically multithreaded) operations.
857 /// <dl>
858 /// <dt><b>MERGE_ACTIVE_STATES</b>
859 /// <dd>The output grid is active wherever any of the input grids is active.
860 ///
861 /// <dt><b>MERGE_NODES</b>
862 /// <dd>The output grid's tree has a node wherever any of the input grids' trees
863 /// has a node, regardless of any active states.
864 ///
865 /// <dt><b>MERGE_ACTIVE_STATES_AND_NODES</b>
866 /// <dd>The output grid is active wherever any of the input grids is active,
867 /// and its tree has a node wherever any of the input grids' trees has a node.
868 /// </dl>
873 };
874 
875 
876 ////////////////////////////////////////
877 
878 
879 template<typename T> const char* typeNameAsString() { return typeid(T).name(); }
880 template<> inline const char* typeNameAsString<bool>() { return "bool"; }
881 template<> inline const char* typeNameAsString<ValueMask>() { return "mask"; }
882 template<> inline const char* typeNameAsString<half>() { return "half"; }
883 template<> inline const char* typeNameAsString<float>() { return "float"; }
884 template<> inline const char* typeNameAsString<double>() { return "double"; }
885 template<> inline const char* typeNameAsString<int8_t>() { return "int8"; }
886 template<> inline const char* typeNameAsString<uint8_t>() { return "uint8"; }
887 template<> inline const char* typeNameAsString<int16_t>() { return "int16"; }
888 template<> inline const char* typeNameAsString<uint16_t>() { return "uint16"; }
889 template<> inline const char* typeNameAsString<int32_t>() { return "int32"; }
890 template<> inline const char* typeNameAsString<uint32_t>() { return "uint32"; }
891 template<> inline const char* typeNameAsString<int64_t>() { return "int64"; }
892 template<> inline const char* typeNameAsString<Vec2i>() { return "vec2i"; }
893 template<> inline const char* typeNameAsString<Vec2s>() { return "vec2s"; }
894 template<> inline const char* typeNameAsString<Vec2d>() { return "vec2d"; }
895 template<> inline const char* typeNameAsString<Vec3U8>() { return "vec3u8"; }
896 template<> inline const char* typeNameAsString<Vec3U16>() { return "vec3u16"; }
897 template<> inline const char* typeNameAsString<Vec3i>() { return "vec3i"; }
898 template<> inline const char* typeNameAsString<Vec3f>() { return "vec3s"; }
899 template<> inline const char* typeNameAsString<Vec3d>() { return "vec3d"; }
900 template<> inline const char* typeNameAsString<Vec4i>() { return "vec4i"; }
901 template<> inline const char* typeNameAsString<Vec4f>() { return "vec4s"; }
902 template<> inline const char* typeNameAsString<Vec4d>() { return "vec4d"; }
903 template<> inline const char* typeNameAsString<std::string>() { return "string"; }
904 template<> inline const char* typeNameAsString<Mat3s>() { return "mat3s"; }
905 template<> inline const char* typeNameAsString<Mat3d>() { return "mat3d"; }
906 template<> inline const char* typeNameAsString<Mat4s>() { return "mat4s"; }
907 template<> inline const char* typeNameAsString<Mat4d>() { return "mat4d"; }
908 template<> inline const char* typeNameAsString<math::Quats>() { return "quats"; }
909 template<> inline const char* typeNameAsString<math::Quatd>() { return "quatd"; }
910 template<> inline const char* typeNameAsString<PointIndex32>() { return "ptidx32"; }
911 template<> inline const char* typeNameAsString<PointIndex64>() { return "ptidx64"; }
912 template<> inline const char* typeNameAsString<PointDataIndex32>() { return "ptdataidx32"; }
913 template<> inline const char* typeNameAsString<PointDataIndex64>() { return "ptdataidx64"; }
914 
915 
916 ////////////////////////////////////////
917 
918 
919 /// @brief This struct collects both input and output arguments to "grid combiner" functors
920 /// used with the tree::TypedGrid::combineExtended() and combine2Extended() methods.
921 /// AValueType and BValueType are the value types of the two grids being combined.
922 ///
923 /// @see openvdb/tree/Tree.h for usage information.
924 ///
925 /// Setter methods return references to this object, to facilitate the following usage:
926 /// @code
927 /// CombineArgs<float> args;
928 /// myCombineOp(args.setARef(aVal).setBRef(bVal).setAIsActive(true).setBIsActive(false));
929 /// @endcode
930 template<typename AValueType, typename BValueType = AValueType>
932 {
933 public:
934  using AValueT = AValueType;
935  using BValueT = BValueType;
936 
938  : mAValPtr(nullptr)
939  , mBValPtr(nullptr)
941  , mAIsActive(false)
942  , mBIsActive(false)
943  , mResultIsActive(false)
944  {
945  }
946 
947  /// Use this constructor when the result value is stored externally.
948  CombineArgs(const AValueType& a, const BValueType& b, AValueType& result,
949  bool aOn = false, bool bOn = false)
950  : mAValPtr(&a)
951  , mBValPtr(&b)
952  , mResultValPtr(&result)
953  , mAIsActive(aOn)
954  , mBIsActive(bOn)
955  {
956  this->updateResultActive();
957  }
958 
959  /// Use this constructor when the result value should be stored in this struct.
960  CombineArgs(const AValueType& a, const BValueType& b, bool aOn = false, bool bOn = false)
961  : mAValPtr(&a)
962  , mBValPtr(&b)
964  , mAIsActive(aOn)
965  , mBIsActive(bOn)
966  {
967  this->updateResultActive();
968  }
969 
970  /// Get the A input value.
971  const AValueType& a() const { return *mAValPtr; }
972  /// Get the B input value.
973  const BValueType& b() const { return *mBValPtr; }
974  //@{
975  /// Get the output value.
976  const AValueType& result() const { return *mResultValPtr; }
977  AValueType& result() { return *mResultValPtr; }
978  //@}
979 
980  /// Set the output value.
981  CombineArgs& setResult(const AValueType& val) { *mResultValPtr = val; return *this; }
982 
983  /// Redirect the A value to a new external source.
984  CombineArgs& setARef(const AValueType& a) { mAValPtr = &a; return *this; }
985  /// Redirect the B value to a new external source.
986  CombineArgs& setBRef(const BValueType& b) { mBValPtr = &b; return *this; }
987  /// Redirect the result value to a new external destination.
988  CombineArgs& setResultRef(AValueType& val) { mResultValPtr = &val; return *this; }
989 
990  /// @return true if the A value is active
991  bool aIsActive() const { return mAIsActive; }
992  /// @return true if the B value is active
993  bool bIsActive() const { return mBIsActive; }
994  /// @return true if the output value is active
995  bool resultIsActive() const { return mResultIsActive; }
996 
997  /// Set the active state of the A value.
998  CombineArgs& setAIsActive(bool b) { mAIsActive = b; updateResultActive(); return *this; }
999  /// Set the active state of the B value.
1000  CombineArgs& setBIsActive(bool b) { mBIsActive = b; updateResultActive(); return *this; }
1001  /// Set the active state of the output value.
1002  CombineArgs& setResultIsActive(bool b) { mResultIsActive = b; return *this; }
1003 
1004 protected:
1005  /// By default, the result value is active if either of the input values is active,
1006  /// but this behavior can be overridden by calling setResultIsActive().
1008 
1009  const AValueType* mAValPtr; // pointer to input value from A grid
1010  const BValueType* mBValPtr; // pointer to input value from B grid
1011  AValueType mResultVal; // computed output value (unused if stored externally)
1012  AValueType* mResultValPtr; // pointer to either mResultVal or an external value
1013  bool mAIsActive, mBIsActive; // active states of A and B values
1014  bool mResultIsActive; // computed active state (default: A active || B active)
1015 };
1016 
1017 
1018 /// This struct adapts a "grid combiner" functor to swap the A and B grid values
1019 /// (e.g., so that if the original functor computes a + 2 * b, the adapted functor
1020 /// will compute b + 2 * a).
1021 template<typename ValueType, typename CombineOp>
1023 {
1024  SwappedCombineOp(CombineOp& _op): op(_op) {}
1025 
1027  {
1028  CombineArgs<ValueType> swappedArgs(args.b(), args.a(), args.result(),
1029  args.bIsActive(), args.aIsActive());
1030  op(swappedArgs);
1031  }
1032 
1033  CombineOp& op;
1034 };
1035 
1036 
1037 ////////////////////////////////////////
1038 
1039 
1040 /// @brief Tag dispatch class that distinguishes shallow copy constructors
1041 /// from deep copy constructors
1042 class ShallowCopy {};
1043 /// @brief Tag dispatch class that distinguishes topology copy constructors
1044 /// from deep copy constructors
1045 class TopologyCopy {};
1046 /// @brief Tag dispatch class that distinguishes constructors during file input
1047 class PartialCreate {};
1048 
1049 } // namespace OPENVDB_VERSION_NAME
1050 } // namespace openvdb
1051 
1052 
1053 #if defined(__ICC)
1054 
1055 // Use these defines to bracket a region of code that has safe static accesses.
1056 // Keep the region as small as possible.
1057 #define OPENVDB_START_THREADSAFE_STATIC_REFERENCE __pragma(warning(disable:1710))
1058 #define OPENVDB_FINISH_THREADSAFE_STATIC_REFERENCE __pragma(warning(default:1710))
1059 #define OPENVDB_START_THREADSAFE_STATIC_WRITE __pragma(warning(disable:1711))
1060 #define OPENVDB_FINISH_THREADSAFE_STATIC_WRITE __pragma(warning(default:1711))
1061 #define OPENVDB_START_THREADSAFE_STATIC_ADDRESS __pragma(warning(disable:1712))
1062 #define OPENVDB_FINISH_THREADSAFE_STATIC_ADDRESS __pragma(warning(default:1712))
1063 
1064 // Use these defines to bracket a region of code that has unsafe static accesses.
1065 // Keep the region as small as possible.
1066 #define OPENVDB_START_NON_THREADSAFE_STATIC_REFERENCE __pragma(warning(disable:1710))
1067 #define OPENVDB_FINISH_NON_THREADSAFE_STATIC_REFERENCE __pragma(warning(default:1710))
1068 #define OPENVDB_START_NON_THREADSAFE_STATIC_WRITE __pragma(warning(disable:1711))
1069 #define OPENVDB_FINISH_NON_THREADSAFE_STATIC_WRITE __pragma(warning(default:1711))
1070 #define OPENVDB_START_NON_THREADSAFE_STATIC_ADDRESS __pragma(warning(disable:1712))
1071 #define OPENVDB_FINISH_NON_THREADSAFE_STATIC_ADDRESS __pragma(warning(default:1712))
1072 
1073 // Simpler version for one-line cases
1074 #define OPENVDB_THREADSAFE_STATIC_REFERENCE(CODE) \
1075  __pragma(warning(disable:1710)); CODE; __pragma(warning(default:1710))
1076 #define OPENVDB_THREADSAFE_STATIC_WRITE(CODE) \
1077  __pragma(warning(disable:1711)); CODE; __pragma(warning(default:1711))
1078 #define OPENVDB_THREADSAFE_STATIC_ADDRESS(CODE) \
1079  __pragma(warning(disable:1712)); CODE; __pragma(warning(default:1712))
1080 
1081 #else // GCC does not support these compiler warnings
1082 
1083 #define OPENVDB_START_THREADSAFE_STATIC_REFERENCE
1084 #define OPENVDB_FINISH_THREADSAFE_STATIC_REFERENCE
1085 #define OPENVDB_START_THREADSAFE_STATIC_WRITE
1086 #define OPENVDB_FINISH_THREADSAFE_STATIC_WRITE
1087 #define OPENVDB_START_THREADSAFE_STATIC_ADDRESS
1088 #define OPENVDB_FINISH_THREADSAFE_STATIC_ADDRESS
1089 
1090 #define OPENVDB_START_NON_THREADSAFE_STATIC_REFERENCE
1091 #define OPENVDB_FINISH_NON_THREADSAFE_STATIC_REFERENCE
1092 #define OPENVDB_START_NON_THREADSAFE_STATIC_WRITE
1093 #define OPENVDB_FINISH_NON_THREADSAFE_STATIC_WRITE
1094 #define OPENVDB_START_NON_THREADSAFE_STATIC_ADDRESS
1095 #define OPENVDB_FINISH_NON_THREADSAFE_STATIC_ADDRESS
1096 
1097 #define OPENVDB_THREADSAFE_STATIC_REFERENCE(CODE) CODE
1098 #define OPENVDB_THREADSAFE_STATIC_WRITE(CODE) CODE
1099 #define OPENVDB_THREADSAFE_STATIC_ADDRESS(CODE) CODE
1100 
1101 #endif // defined(__ICC)
1102 
1103 #endif // OPENVDB_TYPES_HAS_BEEN_INCLUDED
static constexpr bool Contains
True if this list contains the given type, false otherwise.
Definition: Types.h:680
const AValueType & result() const
Get the output value.
Definition: Types.h:976
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:123
PointIndex operator+(T x)
Needed to support the (zeroVal<PointIndex>() + val) idiom.
Definition: Types.h:148
const char * typeNameAsString< ValueMask >()
Definition: Types.h:881
This struct collects both input and output arguments to "grid combiner" functors used with the tree::...
Definition: Types.h:931
typename T::ValueType ElementType
Definition: Types.h:240
GLsizeiptr size
Definition: glew.h:1681
GLuint const GLchar * name
Definition: glew.h:1814
Tag dispatch class that distinguishes shallow copy constructors from deep copy constructors.
Definition: Types.h:1042
const char * typeNameAsString< PointIndex32 >()
Definition: Types.h:910
const Args & args
Definition: printf.h:628
typename T::ValueType ElementType
Definition: Types.h:185
const char * typeNameAsString< int32_t >()
Definition: Types.h:889
GLuint const GLfloat * val
Definition: glew.h:2794
const char * typeNameAsString< Vec3i >()
Definition: Types.h:897
const char * typeNameAsString< uint16_t >()
Definition: Types.h:888
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:960
typename internal::TSRemoveLastImpl< Self >::type PopBack
Remove the last element of this type list. Has no effect if the type list is already empty...
Definition: Types.h:768
GLboolean GLboolean GLboolean GLboolean a
Definition: glew.h:9477
CombineArgs & setBIsActive(bool b)
Set the active state of the B value.
Definition: Types.h:1000
const char * typeNameAsString< int8_t >()
Definition: Types.h:885
const char * typeNameAsString< int16_t >()
Definition: Types.h:887
#define OPENVDB_USE_VERSION_NAMESPACE
Definition: version.h:166
const char * typeNameAsString< Mat3s >()
Definition: Types.h:904
const char * typeNameAsString< half >()
Definition: Types.h:882
Signed (x, y, z) 32-bit integer coordinates.
Definition: Coord.h:25
typename internal::TSRemoveIndicesImpl< Self, First, Last >::type RemoveByIndex
Return a new list with types removed by their location within the list. If First is equal to Last...
Definition: Types.h:785
Tag dispatch class that distinguishes constructors during file input.
Definition: Types.h:1047
const char * typeNameAsString< PointIndex64 >()
Definition: Types.h:911
const char * typeNameAsString< Vec3d >()
Definition: Types.h:899
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:103
const char * typeNameAsString< Mat4s >()
Definition: Types.h:906
std::shared_ptr< T > SharedPtr
Definition: Types.h:91
const AValueType & a() const
Get the A input value.
Definition: Types.h:971
const char * typeNameAsString< Vec3U16 >()
Definition: Types.h:896
Helper metafunction used to determine if the first template parameter is a specialization of the clas...
Definition: Types.h:169
const char * typeNameAsString< Vec3f >()
Definition: Types.h:898
const char * typeNameAsString< PointDataIndex32 >()
Definition: Types.h:912
const char * typeNameAsString< uint32_t >()
Definition: Types.h:890
typename internal::TSMakeUniqueImpl< TypeList<>, Ts...>::type Unique
Remove any duplicate types from this TypeList by rotating the next valid type left (maintains the ord...
Definition: Types.h:709
std::weak_ptr< T > WeakPtr
Definition: Types.h:92
typename internal::TSAppendImpl< Self, TypesToAppend...>::type Append
Append types, or the members of another TypeList, to this list.
Definition: Types.h:725
GLint GLint GLint GLint GLint x
Definition: glew.h:1252
PointIndex(T i)
Explicit type conversion constructor.
Definition: Types.h:142
typename internal::TSGetElementImpl< Self, N >::type Get
Access a particular element of this type list. If the index is out of range, internal::NullType is re...
Definition: Types.h:663
const char * typeNameAsString< uint8_t >()
Definition: Types.h:886
const char * typeNameAsString< float >()
Definition: Types.h:883
const char * typeNameAsString< Vec2i >()
Definition: Types.h:892
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.
Definition: Types.h:998
typename std::remove_const< ToType >::type Type
Definition: Types.h:298
const char * typeNameAsString()
Definition: Types.h:879
const char * typeNameAsString< int64_t >()
Definition: Types.h:891
Axis-aligned bounding box of signed integer coordinates.
Definition: Coord.h:248
Mark the end – don't use this!
CopyConstness<T1, T2>::Type is either const T2 or T2 with no const qualifier, depending on whether T1...
Definition: Types.h:297
typename internal::TSRemoveFirstImpl< Self >::type PopFront
Remove the first element of this type list. Has no effect if the type list is already empty...
Definition: Types.h:753
GLuint GLuint GLsizei GLenum type
Definition: glew.h:1253
const char * typeNameAsString< Vec4d >()
Definition: Types.h:902
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:948
CombineArgs & setResultIsActive(bool b)
Set the active state of the output value.
Definition: Types.h:1002
const char * typeNameAsString< double >()
Definition: Types.h:884
TypeList Self
The type of this list.
Definition: Types.h:655
CanConvertType<FromType, ToType>::value is true if a value of type ToType can be constructed from a v...
Definition: Types.h:262
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:113
typename T::ValueType ElementType
Definition: Types.h:218
GLdouble GLdouble GLdouble b
Definition: glew.h:9122
const char * typeNameAsString< bool >()
Definition: Types.h:880
AValueType & result()
Get the output value.
Definition: Types.h:977
CombineArgs & setBRef(const BValueType &b)
Redirect the B value to a new external source.
Definition: Types.h:986
const void * ptr(const T *p)
Definition: format.h:3292
const char * typeNameAsString< Mat4d >()
Definition: Types.h:907
CombineArgs & setResultRef(AValueType &val)
Redirect the result value to a new external destination.
Definition: Types.h:988
const char * typeNameAsString< Vec3U8 >()
Definition: Types.h:895
const char * typeNameAsString< Vec2d >()
Definition: Types.h:894
typename internal::TSRemoveImpl< Self, TypesToRemove...>::type Remove
Remove all occurrences of one or more types, or the members of another TypeList, from this list...
Definition: Types.h:738
void operator()(CombineArgs< ValueType > &args)
Definition: Types.h:1026
unsigned char Byte
Definition: Types.h:36
CombineArgs & setARef(const AValueType &a)
Redirect the A value to a new external source.
Definition: Types.h:984
Integer wrapper, required to distinguish PointIndexGrid and PointDataGrid from Int32Grid and Int64Gri...
Definition: Types.h:133
GLuint64EXT * result
Definition: glew.h:14007
const char * typeNameAsString< Vec4f >()
Definition: Types.h:901
Tag dispatch class that distinguishes topology copy constructors from deep copy constructors.
Definition: Types.h:1045
const BValueType & b() const
Get the B input value.
Definition: Types.h:973
#define const
Definition: zconf.h:214
const char * typeNameAsString< Vec4i >()
Definition: Types.h:900
typename T::ValueType ElementType
Definition: Types.h:201
#define OPENVDB_VERSION_NAME
The version namespace name for this library version.
Definition: version.h:112
GLsizei const GLfloat * value
Definition: glew.h:1849
A list of types (not necessarily unique)
Definition: Types.h:652
const char * typeNameAsString< PointDataIndex64 >()
Definition: Types.h:913
CombineArgs & setResult(const AValueType &val)
Set the output value.
Definition: Types.h:981
const char * typeNameAsString< Vec2s >()
Definition: Types.h:893
static constexpr size_t Size
The number of types in the type list.
Definition: Types.h:658
type
Definition: core.h:528
PointIndex(IntType i=IntType(0))
Definition: Types.h:139
const char * typeNameAsString< Mat3d >()
Definition: Types.h:905