VTK  9.7.1
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:
56  ~vtkDataAssemblyVisitor() override;
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<std::string> GetCurrentNodePath() const;
99  std::vector<unsigned int> GetCurrentDataSetIndices() const;
101 
102 private:
104  void operator=(const vtkDataAssemblyVisitor&) = delete;
105 
106  class vtkInternals;
107  std::unique_ptr<vtkInternals> Internals;
108 
109  const vtkDataAssembly* Assembly;
110  int TraversalOrder;
111  friend class vtkDataAssembly;
112 };
113 
114 VTK_ABI_NAMESPACE_END
115 #endif
abstract base class for most VTK objects
Definition: vtkObject.h:52
virtual void EndSubTree(int nodeid)
Methods called at the start and end of a subtree traversal.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual bool GetTraverseSubtree(int nodeid)
Called to check if the subtree anchored at nodeid is to be traversed.
visitor API for vtkDataAssembly
virtual void BeginSubTree(int nodeid)
Methods called at the start and end of a subtree traversal.
a simple class to control print indentation
Definition: vtkIndent.h:28
int GetTraversalOrder() const
Returns the current traversal order.
hierarchical representation to use with vtkPartitionedDataSetCollection
const vtkDataAssembly * GetAssembly() const
Provides access to the assembly during traversal, otherwise returns nullptr.