VTK  9.3.20240329
vtkDataObjectCollection.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
11 #ifndef vtkDataObjectCollection_h
12 #define vtkDataObjectCollection_h
13 
14 #include "vtkCollection.h"
15 #include "vtkCommonDataModelModule.h" // For export macro
16 
17 #include "vtkDataObject.h" // Needed for inline methods
18 
19 VTK_ABI_NAMESPACE_BEGIN
20 class VTKCOMMONDATAMODEL_EXPORT vtkDataObjectCollection : public vtkCollection
21 {
22 public:
25  void PrintSelf(ostream& os, vtkIndent indent) override;
26 
30  void AddItem(vtkDataObject* ds) { this->vtkCollection::AddItem(ds); }
31 
35  vtkDataObject* GetNextItem() { return static_cast<vtkDataObject*>(this->GetNextItemAsObject()); }
36 
40  vtkDataObject* GetItem(int i) { return static_cast<vtkDataObject*>(this->GetItemAsObject(i)); }
41 
47  {
48  return static_cast<vtkDataObject*>(this->GetNextItemAsObject(cookie));
49  }
50 
51 protected:
53  ~vtkDataObjectCollection() override = default;
54 
55 private:
56  // hide the standard AddItem from the user and the compiler.
57  void AddItem(vtkObject* o) { this->vtkCollection::AddItem(o); }
58 
60  void operator=(const vtkDataObjectCollection&) = delete;
61 };
62 
63 VTK_ABI_NAMESPACE_END
64 #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 data objects
vtkDataObject * GetItem(int i)
Get the ith data object in the list.
void AddItem(vtkDataObject *ds)
Add a data object to the bottom of the list.
~vtkDataObjectCollection() override=default
vtkDataObject * GetNextItem()
Get the next data object in the list.
static vtkDataObjectCollection * New()
vtkDataObject * GetNextDataObject(vtkCollectionSimpleIterator &cookie)
Reentrant safe way to get an object in a collection.
vtkDataObjectCollection()=default
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
general representation of visualization data
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