Go to the documentation of this file.
11 #ifndef OPENVDB_TREE_NODEUNION_HAS_BEEN_INCLUDED
12 #define OPENVDB_TREE_NODEUNION_HAS_BEEN_INCLUDED
17 #include <type_traits>
26 template<
typename T>
struct CopyTraits;
31 template<
typename ValueT,
typename ChildT,
typename Enable =
void>
42 void setChild(ChildT* child) { mChild = child; }
44 const ValueT&
getValue()
const {
return mValue; }
46 void setValue(
const ValueT& val) { mValue = val; }
51 template<
typename ValueT,
typename ChildT>
52 class NodeUnion<ValueT, ChildT, typename
std::enable_if<std::is_pod<ValueT>::value>::type>
55 union { ChildT* mChild; ValueT
mValue; };
61 void setChild(ChildT* child) { mChild = child; }
63 const ValueT&
getValue()
const {
return mValue; }
65 void setValue(
const ValueT& val) { mValue = val; }
71 template<
typename ValueT,
typename ChildT>
72 class NodeUnion<ValueT, ChildT, typename
std::enable_if<CopyTraits<ValueT>::IsCopyable>::type>
75 union { ChildT* mChild; ValueT
mValue; };
80 { std::memcpy(
static_cast<void*
>(
this), &other,
sizeof(*
this)); }
82 { std::memcpy(
static_cast<void*
>(
this), &rhs,
sizeof(*
this));
return *
this; }
85 void setChild(ChildT* child) { mChild = child; }
87 const ValueT&
getValue()
const {
return mValue; }
89 void setValue(
const ValueT& val) { mValue = val; }
99 template<
typename T>
struct CopyTraits {
static const bool IsCopyable =
false; };
100 template<
typename T>
struct CopyTraits<math::
Vec2<T>> {
static const bool IsCopyable =
true; };
101 template<
typename T>
struct CopyTraits<math::
Vec3<T>> {
static const bool IsCopyable =
true; };
102 template<
typename T>
struct CopyTraits<math::
Vec4<T>> {
static const bool IsCopyable =
true; };
113 #endif // OPENVDB_TREE_NODEUNION_HAS_BEEN_INCLUDED
Signed (x, y, z) 32-bit integer coordinates.
Definition: Coord.h:26
Definition: NodeUnion.h:33
Definition: NodeUnion.h:99
const ValueT & getValue() const
Definition: NodeUnion.h:87
ValueT & getValue()
Definition: NodeUnion.h:45
ValueT mValue
Definition: NodeUnion.h:75
void setValue(const ValueT &val)
Definition: NodeUnion.h:65
void setValue(const ValueT &val)
Definition: NodeUnion.h:46
ValueT mValue
Definition: NodeUnion.h:55
ChildT * getChild() const
Definition: NodeUnion.h:41
Library and file format version numbers.
void setChild(ChildT *child)
Definition: NodeUnion.h:61
ValueT & getValue()
Definition: NodeUnion.h:64
NodeUnion()
Definition: NodeUnion.h:39
ChildT * getChild() const
Definition: NodeUnion.h:84
void setChild(ChildT *child)
Definition: NodeUnion.h:42
#define OPENVDB_USE_VERSION_NAMESPACE
Definition: version.h:147
const ValueT & getValue() const
Definition: NodeUnion.h:63
NodeUnion()
Definition: NodeUnion.h:58
ValueT & getValue()
Definition: NodeUnion.h:88
NodeUnion()
Definition: NodeUnion.h:78
const ValueT & getValue() const
Definition: NodeUnion.h:44
ChildT * getChild() const
Definition: NodeUnion.h:60
void setValue(const ValueT &val)
Definition: NodeUnion.h:89
NodeUnion(const NodeUnion &other)
Definition: NodeUnion.h:79
#define OPENVDB_VERSION_NAME
The version namespace name for this library version.
Definition: version.h:95
Definition: openvdb/Exceptions.h:13
void setChild(ChildT *child)
Definition: NodeUnion.h:85
NodeUnion & operator=(const NodeUnion &rhs)
Definition: NodeUnion.h:81