VTK
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
dox
Common
vtkCollection.h
Go to the documentation of this file.
1
/*=========================================================================
2
3
Program: Visualization Toolkit
4
Module: vtkCollection.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
=========================================================================*/
33
#ifndef __vtkCollection_h
34
#define __vtkCollection_h
35
36
#include "
vtkObject.h
"
37
38
//BTX - begin tcl exclude
39
class
vtkCollectionElement
//;prevents pick-up by man page generator
40
{
41
public
:
42
vtkCollectionElement
():
Item
(NULL),
Next
(NULL) {};
43
vtkObject
*
Item
;
44
vtkCollectionElement
*
Next
;
45
};
46
typedef
void
*
vtkCollectionSimpleIterator
;
47
//ETX end tcl exclude
48
49
class
vtkCollectionIterator
;
50
51
class
VTK_COMMON_EXPORT
vtkCollection
:
public
vtkObject
52
{
53
public
:
54
vtkTypeMacro(
vtkCollection
,
vtkObject
);
55
void
PrintSelf
(ostream& os,
vtkIndent
indent);
56
58
static
vtkCollection
*
New
();
59
61
void
AddItem(
vtkObject
*);
62
66
void
InsertItem(
int
i,
vtkObject
*);
67
69
void
ReplaceItem(
int
i,
vtkObject
*);
70
76
void
RemoveItem(
int
i);
77
81
void
RemoveItem(
vtkObject
*);
82
84
void
RemoveAllItems();
85
89
int
IsItemPresent(
vtkObject
*a);
90
92
int
GetNumberOfItems();
93
96
void
InitTraversal
() { this->Current = this->Top;};
97
98
//BTX
100
102
void
InitTraversal
(
vtkCollectionSimpleIterator
&cookie) {
103
cookie =
static_cast<
vtkCollectionSimpleIterator
>
(this->Top);};
104
//ETX
106
109
vtkObject
*GetNextItemAsObject();
110
113
vtkObject
*GetItemAsObject(
int
i);
114
115
//BTX
117
119
vtkObject
*GetNextItemAsObject(
vtkCollectionSimpleIterator
&cookie);
120
//ETX
122
124
vtkCollectionIterator
* NewIterator();
125
127
128
virtual
void
Register
(
vtkObjectBase
* o);
129
virtual
void
UnRegister
(
vtkObjectBase
* o);
130
protected
:
131
vtkCollection
();
132
~
vtkCollection
();
134
135
virtual
void
DeleteElement(
vtkCollectionElement
*);
136
int
NumberOfItems
;
137
vtkCollectionElement
*
Top
;
138
vtkCollectionElement
*
Bottom
;
139
vtkCollectionElement
*
Current
;
140
141
//BTX
142
friend
class
vtkCollectionIterator
;
143
//ETX
144
145
// See vtkGarbageCollector.h:
146
virtual
void
ReportReferences
(
vtkGarbageCollector
* collector);
147
private
:
148
vtkCollection
(
const
vtkCollection
&);
// Not implemented
149
void
operator=(
const
vtkCollection
&);
// Not implemented
150
};
151
152
153
inline
vtkObject
*
vtkCollection::GetNextItemAsObject
()
154
{
155
vtkCollectionElement
*elem=this->
Current
;
156
157
if
( elem != NULL )
158
{
159
this->
Current
= elem->
Next
;
160
return
elem->
Item
;
161
}
162
else
163
{
164
return
NULL;
165
}
166
}
167
168
inline
vtkObject
*
vtkCollection::GetNextItemAsObject
(
void
*&cookie)
169
{
170
vtkCollectionElement
*elem=
static_cast<
vtkCollectionElement
*
>
(cookie);
171
172
if
( elem != NULL )
173
{
174
cookie =
static_cast<
void
*
>
(elem->
Next
);
175
return
elem->
Item
;
176
}
177
else
178
{
179
return
NULL;
180
}
181
}
182
183
#endif
184
185
186
187
188
Generated on Sun Sep 15 2013 03:44:18 for VTK by
1.8.4