/usr/include/vtk-7.1/vtkCollection.h is in libvtk7-dev 7.1.1+dfsg1-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 | /*=========================================================================
Program: Visualization Toolkit
Module: vtkCollection.h
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
/**
* @class vtkCollection
* @brief create and manipulate unsorted lists of objects
*
* vtkCollection is a general object for creating and manipulating lists
* of objects. The lists are unsorted and allow duplicate entries.
* vtkCollection also serves as a base class for lists of specific types
* of objects.
*
* @sa
* vtkActorCollection vtkAssemblyPaths vtkDataSetCollection
* vtkImplicitFunctionCollection vtkLightCollection vtkPolyDataCollection
* vtkRenderWindowCollection vtkRendererCollection
* vtkStructuredPointsCollection vtkTransformCollection vtkVolumeCollection
*/
#ifndef vtkCollection_h
#define vtkCollection_h
#include "vtkCommonCoreModule.h" // For export macro
#include "vtkObject.h"
class vtkCollectionElement //;prevents pick-up by man page generator
{
public:
vtkCollectionElement():Item(NULL),Next(NULL) {}
vtkObject *Item;
vtkCollectionElement *Next;
};
typedef void * vtkCollectionSimpleIterator;
class vtkCollectionIterator;
class VTKCOMMONCORE_EXPORT vtkCollection : public vtkObject
{
public:
vtkTypeMacro(vtkCollection,vtkObject);
void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
/**
* Construct with empty list.
*/
static vtkCollection *New();
/**
* Add an object to the list. Does not prevent duplicate entries.
*/
void AddItem(vtkObject *);
/**
* Insert item into the list after the i'th item. Does not prevent duplicate entries.
* If i < 0 the item is placed at the top of the list.
*/
void InsertItem(int i, vtkObject *);
/**
* Replace the i'th item in the collection with a
*/
void ReplaceItem(int i, vtkObject *);
/**
* Remove the i'th item in the list.
* Be careful if using this function during traversal of the list using
* GetNextItemAsObject (or GetNextItem in derived class). The list WILL
* be shortened if a valid index is given! If this->Current is equal to the
* element being removed, have it point to then next element in the list.
*/
void RemoveItem(int i);
/**
* Remove an object from the list. Removes the first object found, not
* all occurrences. If no object found, list is unaffected. See warning
* in description of RemoveItem(int).
*/
void RemoveItem(vtkObject *);
/**
* Remove all objects from the list.
*/
void RemoveAllItems();
/**
* Search for an object and return location in list. If the return value is
* 0, the object was not found. If the object was found, the location is
* the return value-1.
*/
int IsItemPresent(vtkObject *a);
/**
* Return the number of objects in the list.
*/
int GetNumberOfItems() { return this->NumberOfItems; }
/**
* Initialize the traversal of the collection. This means the data pointer
* is set at the beginning of the list.
*/
void InitTraversal() { this->Current = this->Top;};
/**
* A reentrant safe way to iterate through a collection.
* Just pass the same cookie value around each time
*/
void InitTraversal(vtkCollectionSimpleIterator &cookie) {
cookie = static_cast<vtkCollectionSimpleIterator>(this->Top);};
/**
* Get the next item in the collection. NULL is returned if the collection
* is exhausted.
*/
vtkObject *GetNextItemAsObject();
/**
* Get the i'th item in the collection. NULL is returned if i is out
* of range
*/
vtkObject *GetItemAsObject(int i);
/**
* A reentrant safe way to get the next object as a collection. Just pass the
* same cookie back and forth.
*/
vtkObject *GetNextItemAsObject(vtkCollectionSimpleIterator &cookie);
/**
* Get an iterator to traverse the objects in this collection.
*/
VTK_NEWINSTANCE vtkCollectionIterator* NewIterator();
//@{
/**
* Participate in garbage collection.
*/
void Register(vtkObjectBase* o) VTK_OVERRIDE;
void UnRegister(vtkObjectBase* o) VTK_OVERRIDE;
//@}
protected:
vtkCollection();
~vtkCollection() VTK_OVERRIDE;
virtual void RemoveElement(vtkCollectionElement *element,
vtkCollectionElement *previous);
virtual void DeleteElement(vtkCollectionElement *);
int NumberOfItems;
vtkCollectionElement *Top;
vtkCollectionElement *Bottom;
vtkCollectionElement *Current;
friend class vtkCollectionIterator;
// See vtkGarbageCollector.h:
void ReportReferences(vtkGarbageCollector* collector) VTK_OVERRIDE;
private:
vtkCollection(const vtkCollection&) VTK_DELETE_FUNCTION;
void operator=(const vtkCollection&) VTK_DELETE_FUNCTION;
};
inline vtkObject *vtkCollection::GetNextItemAsObject()
{
vtkCollectionElement *elem=this->Current;
if ( elem != NULL )
{
this->Current = elem->Next;
return elem->Item;
}
else
{
return NULL;
}
}
inline vtkObject *vtkCollection::GetNextItemAsObject(void *&cookie)
{
vtkCollectionElement *elem=static_cast<vtkCollectionElement *>(cookie);
if ( elem != NULL )
{
cookie = static_cast<void *>(elem->Next);
return elem->Item;
}
else
{
return NULL;
}
}
#endif
|