HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
openvdb::OPENVDB_VERSION_NAME::tree::ValueAccessorRW< TreeType, IsSafe > Class Template Reference

This accessor is thread-safe (at the cost of speed) for both reading and writing to a tree. That is, multiple threads may safely access a single, shared ValueAccessorRW. More...

#include <ValueAccessor.h>

+ Inheritance diagram for openvdb::OPENVDB_VERSION_NAME::tree::ValueAccessorRW< TreeType, IsSafe >:

Public Member Functions

 ValueAccessorRW (TreeType &tree)
 
- Public Member Functions inherited from openvdb::OPENVDB_VERSION_NAME::tree::ValueAccessor< TreeType, IsSafe, TreeType::DEPTH-1, tbb::spin_mutex >
 HBOOST_STATIC_ASSERT (CacheLevels< TreeType::DEPTH)
 
 ValueAccessor (TreeType &tree)
 
 ValueAccessor (const ValueAccessor &other)
 
ValueAccessoroperator= (const ValueAccessor &other)
 
virtual ~ValueAccessor ()
 
bool isCached (const Coord &xyz) const
 Return true if nodes along the path to the given voxel have been cached. More...
 
const ValueTypegetValue (const Coord &xyz) const
 Return the value of the voxel at the given coordinates. More...
 
bool isValueOn (const Coord &xyz) const
 Return the active state of the voxel at the given coordinates. More...
 
bool probeValue (const Coord &xyz, ValueType &value) const
 Return the active state of the voxel as well as its value. More...
 
int getValueDepth (const Coord &xyz) const
 
bool isVoxel (const Coord &xyz) const
 
void setValueOn (const Coord &xyz)
 Mark the voxel at the given coordinates as active but don't change its value. More...
 
void setValueOnly (const Coord &xyz, const ValueType &value)
 Set the value of the voxel at the given coordinate but don't change its active state. More...
 
void newSetValue (const Coord &xyz, const ValueType &value)
 
void setValueOff (const Coord &xyz, const ValueType &value)
 Set the value of the voxel at the given coordinates and mark the voxel as inactive. More...
 
void setValueOff (const Coord &xyz)
 Mark the voxel at the given coordinates as inactive but don't change its value. More...
 
void modifyValue (const Coord &xyz, const ModifyOp &op)
 Apply a functor to the value of the voxel at the given coordinates and mark the voxel as active. More...
 
void modifyValueAndActiveState (const Coord &xyz, const ModifyOp &op)
 Apply a functor to the voxel at the given coordinates. More...
 
void setActiveState (const Coord &xyz, bool on=true)
 Set the active state of the voxel at the given coordinates but don't change its value. More...
 
NodeType * getNode ()
 Return the cached node of type NodeType. [Mainly for internal use]. More...
 
void insertNode (const Coord &xyz, NodeType &node)
 
void eraseNode ()
 
void addLeaf (LeafNodeT *leaf)
 Add the specified leaf to this tree, possibly creating a child branch in the process. If the leaf node already exists, replace it. More...
 
void addTile (Index level, const Coord &xyz, const ValueType &value, bool state)
 Add a tile at the specified tree level that contains voxel (x, y, z), possibly deleting existing nodes or creating new nodes in the process. More...
 
LeafNodeTtouchLeaf (const Coord &xyz)
 Return a pointer to the leaf node that contains voxel (x, y, z). If no such node exists, create one, but preserve the values and active states of all voxels. More...
 
virtual void clear ()
 Remove all nodes from this cache, then reinsert the root node. More...
 
void setValue (const Coord &xyz, const ValueType &value)
 Set the value of the voxel at the given coordinates and mark the voxel as active. More...
 
void setValueOn (const Coord &xyz, const ValueType &value)
 Set the value of the voxel at the given coordinates and mark the voxel as active. More...
 
NodeT * probeNode (const Coord &xyz)
 Return a pointer to the node of the specified type that contains voxel (x, y, z), or nullptr if no such node exists. More...
 
const NodeT * probeNode (const Coord &xyz) const
 Return a pointer to the node of the specified type that contains voxel (x, y, z), or nullptr if no such node exists. More...
 
const NodeT * probeConstNode (const Coord &xyz) const
 Return a pointer to the node of the specified type that contains voxel (x, y, z), or nullptr if no such node exists. More...
 
LeafNodeTprobeLeaf (const Coord &xyz)
 Return a pointer to the leaf node that contains voxel (x, y, z), or nullptr if no such node exists. More...
 
const LeafNodeTprobeLeaf (const Coord &xyz) const
 Return a pointer to the leaf node that contains voxel (x, y, z), or nullptr if no such node exists. More...
 
const LeafNodeTprobeConstLeaf (const Coord &xyz) const
 Return a pointer to the leaf node that contains voxel (x, y, z), or nullptr if no such node exists. More...
 
- Public Member Functions inherited from openvdb::OPENVDB_VERSION_NAME::tree::ValueAccessorBase< TreeType, IsSafe >
 ValueAccessorBase (TreeType &tree)
 
virtual ~ValueAccessorBase ()
 
TreeType * getTree () const
 Return a pointer to the tree associated with this accessor. More...
 
TreeType & tree () const
 Return a reference to the tree associated with this accessor. More...
 
 ValueAccessorBase (const ValueAccessorBase &other)
 
ValueAccessorBaseoperator= (const ValueAccessorBase &other)
 

Additional Inherited Members

- Public Types inherited from openvdb::OPENVDB_VERSION_NAME::tree::ValueAccessor< TreeType, IsSafe, TreeType::DEPTH-1, tbb::spin_mutex >
typedef TreeType TreeType
 
typedef TreeType::RootNodeType RootNodeT
 
typedef TreeType::LeafNodeType LeafNodeT
 
typedef RootNodeT::ValueType ValueType
 
typedef ValueAccessorBase
< TreeType, IsSafe > 
BaseT
 
typedef
tbb::spin_mutex::scoped_lock 
LockT
 
- Static Public Member Functions inherited from openvdb::OPENVDB_VERSION_NAME::tree::ValueAccessor< TreeType, IsSafe, TreeType::DEPTH-1, tbb::spin_mutex >
static Index numCacheLevels ()
 Return the number of cache levels employed by this accessor. More...
 
- Static Public Member Functions inherited from openvdb::OPENVDB_VERSION_NAME::tree::ValueAccessorBase< TreeType, IsSafe >
static bool isSafe ()
 Return true if this accessor is safe, i.e. registered by the tree from which it is constructed. Un-registered accessors can in rare cases be faster because it avoids the (small) overhead of registration, but they are unsafe if the tree is modified. So unless you're an expert it is highly recommended to set IsSafe = true (which is the default). More...
 
- Static Public Attributes inherited from openvdb::OPENVDB_VERSION_NAME::tree::ValueAccessorBase< TreeType, IsSafe >
static const bool IsConstTree = hboost::is_const<TreeType>::value
 
- Protected Attributes inherited from openvdb::OPENVDB_VERSION_NAME::tree::ValueAccessorBase< TreeType, IsSafe >
TreeType * mTree
 

Detailed Description

template<typename TreeType, bool IsSafe = true>
class openvdb::OPENVDB_VERSION_NAME::tree::ValueAccessorRW< TreeType, IsSafe >

This accessor is thread-safe (at the cost of speed) for both reading and writing to a tree. That is, multiple threads may safely access a single, shared ValueAccessorRW.

Warning
Since the mutex-locking employed by the ValueAccessorRW can seriously impair performance of multithreaded applications, it is recommended that, instead, each thread be assigned its own (non-mutex protected) accessor.

Definition at line 547 of file ValueAccessor.h.

Constructor & Destructor Documentation

template<typename TreeType , bool IsSafe = true>
openvdb::OPENVDB_VERSION_NAME::tree::ValueAccessorRW< TreeType, IsSafe >::ValueAccessorRW ( TreeType tree)
inline

Definition at line 550 of file ValueAccessor.h.


The documentation for this class was generated from the following file: