VTK
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
dox
Common
vtkIdList.h
Go to the documentation of this file.
1
/*=========================================================================
2
3
Program: Visualization Toolkit
4
Module: vtkIdList.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
=========================================================================*/
29
#ifndef __vtkIdList_h
30
#define __vtkIdList_h
31
32
#include "
vtkObject.h
"
33
34
class
VTK_COMMON_EXPORT
vtkIdList
:
public
vtkObject
35
{
36
public
:
37
static
vtkIdList
*
New
();
38
39
void
Initialize();
40
int
Allocate(
const
vtkIdType
sz,
const
int
strategy=0);
41
vtkTypeMacro(
vtkIdList
,
vtkObject
);
42
void
PrintSelf
(ostream& os,
vtkIndent
indent);
43
45
vtkIdType
GetNumberOfIds
() {
return
this->NumberOfIds;};
46
48
vtkIdType
GetId
(
const
vtkIdType
i) {
return
this->Ids[i];};
49
52
void
SetNumberOfIds(
const
vtkIdType
number);
53
57
void
SetId
(
const
vtkIdType
i,
const
vtkIdType
vtkid) {this->Ids[i] = vtkid;};
58
61
void
InsertId(
const
vtkIdType
i,
const
vtkIdType
vtkid);
62
65
vtkIdType
InsertNextId(
const
vtkIdType
vtkid);
66
69
vtkIdType
InsertUniqueId(
const
vtkIdType
vtkid);
70
72
vtkIdType
*
GetPointer
(
const
vtkIdType
i) {
return
this->Ids + i;};
73
77
vtkIdType
*WritePointer(
const
vtkIdType
i,
const
vtkIdType
number);
78
80
void
Reset
() {this->NumberOfIds = 0;};
81
83
void
Squeeze
() {this->Resize(this->NumberOfIds);};
84
86
void
DeepCopy(
vtkIdList
*ids);
87
90
void
DeleteId(
vtkIdType
vtkid);
91
94
vtkIdType
IsId(
vtkIdType
vtkid);
95
98
void
IntersectWith(
vtkIdList
* otherIds);
99
100
//BTX
101
// This method should become legacy
102
void
IntersectWith
(
vtkIdList
& otherIds) {
103
return
this->IntersectWith(&otherIds); };
104
//ETX
105
106
protected
:
107
vtkIdList
();
108
~
vtkIdList
();
109
110
vtkIdType
NumberOfIds
;
111
vtkIdType
Size
;
112
vtkIdType
*
Ids
;
113
114
vtkIdType
*Resize(
const
vtkIdType
sz);
115
private
:
116
vtkIdList
(
const
vtkIdList
&);
// Not implemented.
117
void
operator=(
const
vtkIdList
&);
// Not implemented.
118
};
119
120
// In-lined for performance
121
inline
vtkIdType
vtkIdList::InsertNextId
(
const
vtkIdType
vtkid)
122
{
123
if
( this->
NumberOfIds
>= this->
Size
)
124
{
125
this->
Resize
(this->
NumberOfIds
+1);
126
}
127
this->
Ids
[this->
NumberOfIds
++] = vtkid;
128
return
this->
NumberOfIds
-1;
129
}
130
131
inline
vtkIdType
vtkIdList::IsId
(
vtkIdType
vtkid)
132
{
133
vtkIdType
*ptr, i;
134
for
(ptr=this->
Ids
, i=0; i<this->
NumberOfIds
; i++, ptr++)
135
{
136
if
( vtkid == *ptr )
137
{
138
return
i;
139
}
140
}
141
return
(-1);
142
}
143
144
#endif
Generated on Sun Sep 9 2012 13:03:26 for VTK by
1.8.1.2