template<typename IteratorType, typename OwnerType>
class vtk::CompositeDataSetNodeReference< IteratorType, OwnerType >
A reference proxy into a vtkCompositeDataSet, obtained by dereferencing an iterator from the vtk::Range(vtkCompositeDataSet*) overloads.
This proxy may be used as a pointer, in which case it will forward the currently pointed-to vtkDataObject*. This means that the following code is legal:
```cpp for (auto node : vtk::Range(cds)) { // decltype(node) == CompositeDataSetNodeReference if (node) // same as: if (node.GetDataObject() != nullptr) { assert(node->IsA("vtkDataObject")); // node.GetDataObject()->IsA(...) node = nullptr; // node.SetDataObject(nullptr) } }
for (vtkDataObject dObj : vtk::Range(cds)) { // Work with dObj }
```
This allows for simple access to the objects in the composite dataset. If more advanced operations are required, the CompositeDataSetNodeReference can:
- Access the current vtkDataObject*:
vtkDataObject* NodeReference::GetDataObject() const
- `NodeReference::operator vtkDataObject</em> () const
(implicit conversion) -
vtkDataObject* NodeReference::operator->() const` (arrow operator)
- Replace the current vtkDataObject* in the composite dataset:
void NodeReference::SetDataObject(vtkDataObject*)
NodeReference& NodeReference::operator=(vtkDataObject*)
(assignment)
- SetGet the vtkDataObject at the same position in another composite dataset
void NodeReference::SetDataObject(vtkCompositeDataSet*, vtkDataObject*)
vtkDataObject* NodeReference::GetDataObject(vtkCompositeDataSet*) const
- Check and access node metadata (if any):
bool NodeReference::HasMetaData() const
vtkInformation* NodeReference::GetMetaData() const
- Get the current flat index within the parent range:
unsigned int NodeReference::GetFlatIndex() const
Assigning one reference to another assigns the vtkDataObject* pointer to the target reference. Assigning to non-leaf nodes invalidates all iterators / references.
Equality testing compares each reference's DataObject and FlatIndex.
- Warning
- The NodeReference shares state with the OwnerType iterator that generates it. Incrementing or destroying the parent iterator will invalidate the reference. In debugging builds, these misuses will be caught via runtime assertions.
Definition at line 146 of file vtkCompositeDataSetNodeReference.h.