VTK  9.7.1
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
14 #ifndef vtkDataObjectCollection_h
15 #define vtkDataObjectCollection_h
16 
17 #include "vtkCollection.h"
18 #include "vtkCommonDataModelModule.h" // For export macro
19 
20 #include "vtkDataObject.h" // Needed for inline methods
21 
22 VTK_ABI_NAMESPACE_BEGIN
23 class VTKCOMMONDATAMODEL_EXPORT vtkDataObjectCollection : public vtkCollection
24 {
25 public:
26  static vtkDataObjectCollection* New();
28  void PrintSelf(ostream& os, vtkIndent indent) override;
29 
33  void AddItem(vtkDataObject* ds) { this->vtkCollection::AddItem(ds); }
34 
38  vtkDataObject* GetNextItem() { return static_cast<vtkDataObject*>(this->GetNextItemAsObject()); }
39 
43  vtkDataObject* GetItem(int i) { return static_cast<vtkDataObject*>(this->GetItemAsObject(i)); }
44 
50  {
51  return static_cast<vtkDataObject*>(this->GetNextItemAsObject(cookie));
52  }
53 
54 protected:
55  vtkDataObjectCollection() = default;
56  ~vtkDataObjectCollection() override = default;
57 
58 private:
59  // hide the standard AddItem from the user and the compiler.
60  void AddItem(vtkObject* o) { this->vtkCollection::AddItem(o); }
61 
63  void operator=(const vtkDataObjectCollection&) = delete;
64 };
65 
66 VTK_ABI_NAMESPACE_END
67 #endif
void * vtkCollectionSimpleIterator
Definition: vtkCollection.h:35
vtkDataObject * GetNextDataObject(vtkCollectionSimpleIterator &cookie)
Reentrant safe way to get an object in a collection.
abstract base class for most VTK objects
Definition: vtkObject.h:52
vtkDataObject * GetItem(int i)
Get the ith data object in the list.
maintain an unordered list of data objects
a simple class to control print indentation
Definition: vtkIndent.h:28
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
static vtkCollection * New()
Construct an empty collection.
vtkObject * GetItemAsObject(int i) VTK_FUTURE_CONST
Get the i'th item in the collection.
vtkDataObject * GetNextItem()
Get the next data object in the list.
void AddItem(vtkObject *)
Add given item to the bottom (end) of the collection.
create and manipulate ordered lists of objects
Definition: vtkCollection.h:39
vtkObject * GetNextItemAsObject()
Get the next item in the collection.
general representation of visualization data
Definition: vtkDataObject.h:55
void AddItem(vtkDataObject *ds)
Add a data object to the bottom of the list.