OpenVDB 12.0.0
 
Loading...
Searching...
No Matches
TreeToMerge< TreeT >::MaskPtr Struct Reference

Wrapper around unique_ptr that deep-copies mask on copy construction. More...

#include <openvdb/tools/Merge.h>

Public Types

using TreeType
 
using RootNodeType
 
using ValueType
 
using MaskTreeType
 

Public Member Functions

 MaskPtr ()=default
 
 ~MaskPtr ()=default
 
 MaskPtr (MaskPtr &&other)=default
 
MaskPtroperator= (MaskPtr &&other)=default
 
 MaskPtr (const MaskPtr &other)
 
MaskPtroperator= (const MaskPtr &other)
 
 TreeToMerge ()=delete
 
 TreeToMerge (TreeType &tree, Steal)
 Non-const pointer tree constructor for stealing data.
 
 TreeToMerge (typename TreeType::Ptr treePtr, Steal)
 Non-const shared pointer tree constructor for stealing data.
 
 TreeToMerge (const TreeType &tree, DeepCopy, bool initialize=true)
 Const tree pointer constructor for deep-copying data. As the tree is not mutable and thus cannot be pruned, a lightweight mask tree with the same topology is created that can be pruned to use as a reference. Initialization of this mask tree can optionally be disabled for delayed construction.
 
 TreeToMerge (TreeType &tree, DeepCopy tag, bool initialize=true)
 Non-const tree pointer constructor for deep-copying data. The tree is not intended to be modified so is not pruned, instead a lightweight mask tree with the same topology is created that can be pruned to use as a reference. Initialization of this mask tree can optionally be disabled for delayed construction.
 
void reset (typename TreeType::Ptr treePtr, Steal)
 Reset the non-const tree shared pointer. This is primarily used to preserve the order of trees to merge in a container but have the data in the tree be lazily loaded or resampled.
 
TreeTypetreeToSteal ()
 Return a pointer to the tree to be stolen.
 
const TreeTypetreeToDeepCopy ()
 Return a pointer to the tree to be deep-copied.
 
const RootNodeTyperootPtr () const
 Retrieve a const pointer to the root node.
 
const NodeT * probeConstNode (const Coord &ijk) const
 Return a pointer to the node of type NodeT that contains voxel (x, y, z). If no such node exists, return nullptr.
 
void pruneMask (Index level, const Coord &ijk)
 Prune the mask and remove the node associated with this coord.
 
std::unique_ptr< NodeT > stealOrDeepCopyNode (const Coord &ijk, const ValueType &value)
 Return a pointer to the node of type NodeT that contains voxel (x, y, z). If the tree is non-const, steal the node and replace it with the value provided. If the tree is const, deep-copy the node and modify the mask tree to prune the node.
 
std::unique_ptr< NodeT > stealOrDeepCopyNode (const Coord &ijk)
 Return a pointer to the node of type NodeT that contains voxel (x, y, z). If the tree is non-const, steal the node and replace it with an inactive background-value tile. If the tree is const, deep-copy the node and modify the mask tree to prune the node.
 
void addTile (const Coord &ijk, const ValueType &value, bool active)
 Add a tile containing voxel (x, y, z) at the level of NodeT, deleting the existing branch if necessary.
 
void initializeMask ()
 
bool hasMask () const
 
MaskTreeTypemask ()
 
const MaskTreeTypemask () const
 

Public Attributes

std::unique_ptr< MaskTreeTypeptr
 

Detailed Description

template<typename TreeT>
struct openvdb::v12_0::tools::TreeToMerge< TreeT >::MaskPtr

Wrapper around unique_ptr that deep-copies mask on copy construction.

Member Typedef Documentation

◆ MaskTreeType

using MaskTreeType

◆ RootNodeType

using RootNodeType

◆ TreeType

using TreeType

◆ ValueType

using ValueType

Constructor & Destructor Documentation

◆ MaskPtr() [1/3]

template<typename TreeT>
MaskPtr ( )
default

◆ ~MaskPtr()

template<typename TreeT>
~MaskPtr ( )
default

◆ MaskPtr() [2/3]

template<typename TreeT>
MaskPtr ( MaskPtr && other)
default

◆ MaskPtr() [3/3]

template<typename TreeT>
MaskPtr ( const MaskPtr & other)
inline

Member Function Documentation

◆ addTile()

void addTile ( const Coord & ijk,
const ValueType & value,
bool active )

Add a tile containing voxel (x, y, z) at the level of NodeT, deleting the existing branch if necessary.

◆ hasMask()

bool hasMask ( ) const

◆ initializeMask()

void initializeMask ( )

◆ mask() [1/2]

MaskTreeType * mask ( )
inline

◆ mask() [2/2]

const MaskTreeType * mask ( ) const
inline

◆ operator=() [1/2]

template<typename TreeT>
MaskPtr & operator= ( const MaskPtr & other)
inline

◆ operator=() [2/2]

template<typename TreeT>
MaskPtr & operator= ( MaskPtr && other)
default

◆ probeConstNode()

const NodeT * probeConstNode ( const Coord & ijk) const

Return a pointer to the node of type NodeT that contains voxel (x, y, z). If no such node exists, return nullptr.

◆ pruneMask()

void pruneMask ( Index level,
const Coord & ijk )

Prune the mask and remove the node associated with this coord.

◆ reset()

void reset ( typename TreeType::Ptr treePtr,
Steal  )

Reset the non-const tree shared pointer. This is primarily used to preserve the order of trees to merge in a container but have the data in the tree be lazily loaded or resampled.

◆ rootPtr()

const TreeToMerge< TreeT >::RootNodeType * rootPtr ( ) const

Retrieve a const pointer to the root node.

◆ stealOrDeepCopyNode() [1/2]

std::unique_ptr< NodeT > stealOrDeepCopyNode ( const Coord & ijk)

Return a pointer to the node of type NodeT that contains voxel (x, y, z). If the tree is non-const, steal the node and replace it with an inactive background-value tile. If the tree is const, deep-copy the node and modify the mask tree to prune the node.

◆ stealOrDeepCopyNode() [2/2]

std::unique_ptr< NodeT > stealOrDeepCopyNode ( const Coord & ijk,
const ValueType & value )

Return a pointer to the node of type NodeT that contains voxel (x, y, z). If the tree is non-const, steal the node and replace it with the value provided. If the tree is const, deep-copy the node and modify the mask tree to prune the node.

◆ treeToDeepCopy()

const TreeType * treeToDeepCopy ( )
inline

Return a pointer to the tree to be deep-copied.

◆ TreeToMerge() [1/5]

TreeToMerge ( )
delete

◆ TreeToMerge() [2/5]

TreeToMerge ( const TreeType & tree,
DeepCopy ,
bool initialize = true )
inline

Const tree pointer constructor for deep-copying data. As the tree is not mutable and thus cannot be pruned, a lightweight mask tree with the same topology is created that can be pruned to use as a reference. Initialization of this mask tree can optionally be disabled for delayed construction.

◆ TreeToMerge() [3/5]

TreeToMerge ( TreeType & tree,
DeepCopy tag,
bool initialize = true )
inline

Non-const tree pointer constructor for deep-copying data. The tree is not intended to be modified so is not pruned, instead a lightweight mask tree with the same topology is created that can be pruned to use as a reference. Initialization of this mask tree can optionally be disabled for delayed construction.

◆ TreeToMerge() [4/5]

TreeToMerge ( TreeType & tree,
Steal  )
inline

Non-const pointer tree constructor for stealing data.

◆ TreeToMerge() [5/5]

TreeToMerge ( typename TreeType::Ptr treePtr,
Steal  )
inline

Non-const shared pointer tree constructor for stealing data.

◆ treeToSteal()

TreeType * treeToSteal ( )
inline

Return a pointer to the tree to be stolen.

Member Data Documentation

◆ ptr

template<typename TreeT>
std::unique_ptr<MaskTreeType> ptr