VTK  9.3.20240419
vtkDataAssemblyVisitor.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
37 #ifndef vtkDataAssemblyVisitor_h
38 #define vtkDataAssemblyVisitor_h
39 
40 #include "vtkCommonDataModelModule.h" // for export macros
41 #include "vtkObject.h"
42 #include <memory> // for std::unique_ptr
43 #include <vector> // for std::vector
44 
45 VTK_ABI_NAMESPACE_BEGIN
46 class vtkDataAssembly;
47 
48 class VTKCOMMONDATAMODEL_EXPORT vtkDataAssemblyVisitor : public vtkObject
49 {
50 public:
52  void PrintSelf(ostream& os, vtkIndent indent) override;
53 
54 protected:
57 
62  const vtkDataAssembly* GetAssembly() const { return this->Assembly; }
63 
67  int GetTraversalOrder() const { return this->TraversalOrder; }
68 
74  virtual void Visit(int nodeid) = 0;
75 
81  virtual bool GetTraverseSubtree(int vtkNotUsed(nodeid)) { return true; }
82 
84 
87  virtual void BeginSubTree(int vtkNotUsed(nodeid)) {}
88  virtual void EndSubTree(int vtkNotUsed(nodeid)) {}
90 
92 
97  const char* GetCurrentNodeName() const;
98  std::vector<unsigned int> GetCurrentDataSetIndices() const;
100 
101 private:
103  void operator=(const vtkDataAssemblyVisitor&) = delete;
104 
105  class vtkInternals;
106  std::unique_ptr<vtkInternals> Internals;
107 
108  const vtkDataAssembly* Assembly;
109  int TraversalOrder;
110  friend class vtkDataAssembly;
111 };
112 
113 VTK_ABI_NAMESPACE_END
114 #endif
visitor API for vtkDataAssembly
~vtkDataAssemblyVisitor() override
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
int GetTraversalOrder() const
Returns the current traversal order.
virtual void EndSubTree(int vtkNotUsed(nodeid))
Methods called at the start and end of a subtree traversal.
const vtkDataAssembly * GetAssembly() const
Provides access to the assembly during traversal, otherwise returns nullptr.
virtual void Visit(int nodeid)=0
Called on every node being visited.
virtual void BeginSubTree(int vtkNotUsed(nodeid))
Methods called at the start and end of a subtree traversal.
std::vector< unsigned int > GetCurrentDataSetIndices() const
API to access information from the current node being processed.
virtual bool GetTraverseSubtree(int vtkNotUsed(nodeid))
Called to check if the subtree anchored at nodeid is to be traversed.
const char * GetCurrentNodeName() const
API to access information from the current node being processed.
hierarchical representation to use with vtkPartitionedDataSetCollection
a simple class to control print indentation
Definition: vtkIndent.h:108
abstract base class for most VTK objects
Definition: vtkObject.h:162