1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124
|
// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
// SPDX-License-Identifier: BSD-3-Clause
/**
* @class vtkCompositeDataIterator
* @brief superclass for composite data iterators
*
* vtkCompositeDataIterator provides an interface for accessing datasets
* in a collection (vtkCompositeDataIterator).
*/
#ifndef vtkCompositeDataIterator_h
#define vtkCompositeDataIterator_h
#include "vtkCommonDataModelModule.h" // For export macro
#include "vtkObject.h"
VTK_ABI_NAMESPACE_BEGIN
class vtkCompositeDataSet;
class vtkCompositeDataSetInternals;
class vtkCompositeDataSetIndex;
class vtkDataObject;
class vtkInformation;
class VTKCOMMONDATAMODEL_EXPORT vtkCompositeDataIterator : public vtkObject
{
public:
vtkTypeMacro(vtkCompositeDataIterator, vtkObject);
void PrintSelf(ostream& os, vtkIndent indent) override;
///@{
/**
* Set the composite dataset this iterator is iterating over.
* Must be set before traversal begins.
*/
virtual void SetDataSet(vtkCompositeDataSet* ds);
vtkGetObjectMacro(DataSet, vtkCompositeDataSet);
///@}
/**
* Begin iterating over the composite dataset structure.
*/
virtual void InitTraversal();
/**
* Begin iterating over the composite dataset structure in reverse order.
*/
virtual void InitReverseTraversal();
/**
* Move the iterator to the beginning of the collection.
*/
virtual void GoToFirstItem() = 0;
/**
* Move the iterator to the next item in the collection.
*/
virtual void GoToNextItem() = 0;
/**
* Test whether the iterator is finished with the traversal.
* Returns 1 for yes, and 0 for no.
* It is safe to call any of the GetCurrent...() methods only when
* IsDoneWithTraversal() returns 0.
*/
virtual int IsDoneWithTraversal() = 0;
/**
* Returns the current item. Valid only when IsDoneWithTraversal() returns 0.
*/
virtual vtkDataObject* GetCurrentDataObject() = 0;
/**
* Returns the meta-data associated with the current item. This will allocate
* a new vtkInformation object is none is already present. Use
* HasCurrentMetaData to avoid unnecessary creation of vtkInformation objects.
*/
virtual vtkInformation* GetCurrentMetaData() = 0;
/**
* Returns if the a meta-data information object is present for the current
* item. Return 1 on success, 0 otherwise.
*/
virtual vtkTypeBool HasCurrentMetaData() = 0;
///@{
/**
* If SkipEmptyNodes is true, then nullptr datasets will be skipped. Default is
* true.
*/
vtkSetMacro(SkipEmptyNodes, vtkTypeBool);
vtkGetMacro(SkipEmptyNodes, vtkTypeBool);
vtkBooleanMacro(SkipEmptyNodes, vtkTypeBool);
///@}
/**
* Flat index is an index to identify the data in a composite data structure
*/
virtual unsigned int GetCurrentFlatIndex() = 0;
///@{
/**
* Returns if the iteration is in reverse order.
*/
vtkGetMacro(Reverse, int);
///@}
protected:
vtkCompositeDataIterator();
~vtkCompositeDataIterator() override;
// Use macro to ensure MTime is updated:
vtkSetMacro(Reverse, int);
vtkTypeBool SkipEmptyNodes;
int Reverse;
vtkCompositeDataSet* DataSet;
private:
vtkCompositeDataIterator(const vtkCompositeDataIterator&) = delete;
void operator=(const vtkCompositeDataIterator&) = delete;
};
VTK_ABI_NAMESPACE_END
#endif
|