------------------------------------------------------------------------------ Description: Replace attribute at index `i' by `a'.
| 228 | // Description: |
| 229 | // Replace attribute at index `i' by `a'. |
| 230 | void vtkGenericAttributeCollection::InsertAttribute(int i, vtkGenericAttribute* a) |
| 231 | { |
| 232 | assert("pre: not_empty" && !this->IsEmpty()); |
| 233 | assert("pre: a_exists" && a != nullptr); |
| 234 | assert("pre: valid_i" && (i >= 0) && (i < this->GetNumberOfAttributes())); |
| 235 | |
| 236 | #ifndef NDEBUG |
| 237 | int oldnumber = this->GetNumberOfAttributes(); |
| 238 | #endif |
| 239 | |
| 240 | if (this->AttributeInternalVector->Vector[i] != nullptr) |
| 241 | { |
| 242 | this->AttributeInternalVector->Vector[i]->Delete(); |
| 243 | } |
| 244 | this->AttributeInternalVector->Vector[i] = a; |
| 245 | a->Register(this); |
| 246 | this->Modified(); |
| 247 | |
| 248 | assert("post: more_items" && this->GetNumberOfAttributes() == oldnumber); |
| 249 | assert("post: a_is_set" && this->GetAttribute(i) == a); |
| 250 | } |
| 251 | |
| 252 | //------------------------------------------------------------------------------ |
| 253 | // Description: |
nothing calls this directly
no test coverage detected