VTK  9.3.20240329
vtkDataSetCollection.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
40 #ifndef vtkDataSetCollection_h
41 #define vtkDataSetCollection_h
42 
43 #include "vtkCollection.h"
44 #include "vtkCommonDataModelModule.h" // For export macro
45 
46 #include "vtkDataSet.h" // Needed for inline methods.
47 
48 VTK_ABI_NAMESPACE_BEGIN
49 class VTKCOMMONDATAMODEL_EXPORT vtkDataSetCollection : public vtkCollection
50 {
51 public:
54  void PrintSelf(ostream& os, vtkIndent indent) override;
55 
59  void AddItem(vtkDataSet* ds) { this->vtkCollection::AddItem(ds); }
60 
62 
65  vtkDataSet* GetNextItem() { return static_cast<vtkDataSet*>(this->GetNextItemAsObject()); }
66  vtkDataSet* GetNextDataSet() { return static_cast<vtkDataSet*>(this->GetNextItemAsObject()); }
68 
70 
73  vtkDataSet* GetItem(int i) { return static_cast<vtkDataSet*>(this->GetItemAsObject(i)); }
74  vtkDataSet* GetDataSet(int i) { return static_cast<vtkDataSet*>(this->GetItemAsObject(i)); }
76 
82  {
83  return static_cast<vtkDataSet*>(this->GetNextItemAsObject(cookie));
84  }
85 
86 protected:
87  vtkDataSetCollection() = default;
88  ~vtkDataSetCollection() override = default;
89 
90 private:
91  // hide the standard AddItem from the user and the compiler.
92  void AddItem(vtkObject* o) { this->vtkCollection::AddItem(o); }
93 
95  void operator=(const vtkDataSetCollection&) = delete;
96 };
97 
98 VTK_ABI_NAMESPACE_END
99 #endif
create and manipulate ordered lists of objects
Definition: vtkCollection.h:46
vtkObject * GetItemAsObject(int i)
Get the i'th item in the collection.
void AddItem(vtkObject *)
Add an object to the bottom of the list.
vtkObject * GetNextItemAsObject()
Get the next item in the collection.
maintain an unordered list of dataset objects
vtkDataSet * GetNextItem()
Get the next dataset in the list.
vtkDataSet * GetItem(int i)
Get the ith dataset in the list.
void AddItem(vtkDataSet *ds)
Add a dataset to the bottom of the list.
vtkDataSet * GetDataSet(int i)
Get the ith dataset in the list.
vtkDataSet * GetNextDataSet()
Get the next dataset in the list.
vtkDataSetCollection()=default
vtkDataSet * GetNextDataSet(vtkCollectionSimpleIterator &cookie)
Reentrant safe way to get an object in a collection.
~vtkDataSetCollection() override=default
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
static vtkDataSetCollection * New()
abstract class to specify dataset behavior
Definition: vtkDataSet.h:166
a simple class to control print indentation
Definition: vtkIndent.h:108
abstract base class for most VTK objects
Definition: vtkObject.h:162
void * vtkCollectionSimpleIterator
Definition: vtkCollection.h:41