MCPcopy Create free account
hub / github.com/Kitware/VTK / FindAttribute

Method FindAttribute

Common/DataModel/vtkGenericAttributeCollection.cxx:166–193  ·  view source on GitHub ↗

------------------------------------------------------------------------------ Description: Return the index of attribute `name', if found. Return -1 otherwise.

Source from the content-addressed store, hash-verified

164// Description:
165// Return the index of attribute `name', if found. Return -1 otherwise.
166int vtkGenericAttributeCollection::FindAttribute(const char* name)
167{
168 assert("pre: name_exists:" && name != nullptr);
169
170 int result = -1;
171
172 const char* attributeName;
173 int numAtt = this->GetNumberOfAttributes();
174 int i = 0;
175
176 while ((i < numAtt) && (result == -1))
177 {
178 attributeName = this->GetAttribute(i)->GetName();
179 if (attributeName != nullptr)
180 {
181 if (strcmp(attributeName, name) == 0)
182 {
183 result = i;
184 }
185 }
186 ++i;
187 }
188
189 assert("post: valid_result" &&
190 ((result == -1) || ((result >= 0) && (result <= this->GetNumberOfAttributes()))));
191
192 return result;
193}
194//------------------------------------------------------------------------------
195// Description:
196// Return the index of the first component of attribute `i' in an array of

Callers 1

FunctionValuesMethod · 0.45

Calls 4

GetNumberOfAttributesMethod · 0.95
GetAttributeMethod · 0.95
assertFunction · 0.50
GetNameMethod · 0.45

Tested by

no test coverage detected