VTK  9.1.0
vtkDataObjectCollection.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkDataObjectCollection.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
23 #ifndef vtkDataObjectCollection_h
24 #define vtkDataObjectCollection_h
25 
26 #include "vtkCollection.h"
27 #include "vtkCommonDataModelModule.h" // For export macro
28 
29 #include "vtkDataObject.h" // Needed for inline methods
30 
31 class VTKCOMMONDATAMODEL_EXPORT vtkDataObjectCollection : public vtkCollection
32 {
33 public:
36  void PrintSelf(ostream& os, vtkIndent indent) override;
37 
41  void AddItem(vtkDataObject* ds) { this->vtkCollection::AddItem(ds); }
42 
46  vtkDataObject* GetNextItem() { return static_cast<vtkDataObject*>(this->GetNextItemAsObject()); }
47 
51  vtkDataObject* GetItem(int i) { return static_cast<vtkDataObject*>(this->GetItemAsObject(i)); }
52 
58  {
59  return static_cast<vtkDataObject*>(this->GetNextItemAsObject(cookie));
60  }
61 
62 protected:
64  ~vtkDataObjectCollection() override = default;
65 
66 private:
67  // hide the standard AddItem from the user and the compiler.
68  void AddItem(vtkObject* o) { this->vtkCollection::AddItem(o); }
69 
70 private:
72  void operator=(const vtkDataObjectCollection&) = delete;
73 };
74 
75 #endif
create and manipulate ordered lists of objects
Definition: vtkCollection.h:53
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
Definition: vtkDataObject.h:60
a simple class to control print indentation
Definition: vtkIndent.h:34
abstract base class for most VTK objects
Definition: vtkObject.h:63
void * vtkCollectionSimpleIterator
Definition: vtkCollection.h:48