VTK  9.7.1
vtkCullerCollection.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
15 #ifndef vtkCullerCollection_h
16 #define vtkCullerCollection_h
17 
18 #include "vtkCollection.h"
19 #include "vtkCuller.h" // for inline functions
20 #include "vtkRenderingCoreModule.h" // For export macro
21 #include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
22 
23 VTK_ABI_NAMESPACE_BEGIN
24 class VTKRENDERINGCORE_EXPORT VTK_MARSHALAUTO vtkCullerCollection : public vtkCollection
25 {
26 public:
27  static vtkCullerCollection* New();
29  void PrintSelf(ostream& os, vtkIndent indent) override;
30 
34  void AddItem(vtkCuller* a) { this->vtkCollection::AddItem(a); }
35 
39  vtkCuller* GetNextItem() { return static_cast<vtkCuller*>(this->GetNextItemAsObject()); }
40 
44  vtkCuller* GetLastItem();
45 
51  {
52  return static_cast<vtkCuller*>(this->GetNextItemAsObject(cookie));
53  }
54 
55 protected:
56  vtkCullerCollection() = default;
57  ~vtkCullerCollection() override = default;
58 
59 private:
60  // hide the standard AddItem from the user and the compiler.
61  void AddItem(vtkObject* o) { this->vtkCollection::AddItem(o); }
62 
64  void operator=(const vtkCullerCollection&) = delete;
65 };
66 
68 {
69  int numItems = this->GetNumberOfItems();
70  if (numItems == 0)
71  {
72  return nullptr;
73  }
74  else
75  {
76  return static_cast<vtkCuller*>(this->GetItemAsObject(numItems - 1));
77  }
78 }
79 
80 VTK_ABI_NAMESPACE_END
81 #endif
void * vtkCollectionSimpleIterator
Definition: vtkCollection.h:35
vtkCuller * GetNextItem()
Get the next Culler in the list.
abstract base class for most VTK objects
Definition: vtkObject.h:52
int GetNumberOfItems() VTK_FUTURE_CONST
Return the number of items in the collection.
vtkCuller * GetLastItem()
Get the last Culler in the list.
a superclass for prop cullers
Definition: vtkCuller.h:30
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.
void AddItem(vtkObject *)
Add given item to the bottom (end) of the collection.
an ordered list of Cullers
create and manipulate ordered lists of objects
Definition: vtkCollection.h:39
vtkCuller * GetNextCuller(vtkCollectionSimpleIterator &cookie)
Reentrant safe way to get an object in a collection.
#define VTK_MARSHALAUTO
void AddItem(vtkCuller *a)
Add an Culler to the bottom of the list.
vtkObject * GetNextItemAsObject()
Get the next item in the collection.