------------------------------------------------------------------------------
| 117 | |
| 118 | //------------------------------------------------------------------------------ |
| 119 | void vtkInformationExecutivePortVectorKey::Set( |
| 120 | vtkInformation* info, vtkExecutive** executives, int* ports, int length) |
| 121 | { |
| 122 | if (executives && ports && length > 0) |
| 123 | { |
| 124 | #ifndef VTK_USE_SINGLE_REF |
| 125 | // Register our references to all the given executives. |
| 126 | for (int i = 0; i < length; ++i) |
| 127 | { |
| 128 | if (executives[i]) |
| 129 | { |
| 130 | executives[i]->Register(0); |
| 131 | } |
| 132 | } |
| 133 | #endif |
| 134 | // Store the vector of pointers. |
| 135 | vtkInformationExecutivePortVectorValue* oldv = |
| 136 | static_cast<vtkInformationExecutivePortVectorValue*>(this->GetAsObjectBase(info)); |
| 137 | if (oldv && static_cast<int>(oldv->Executives.size()) == length) |
| 138 | { |
| 139 | // Replace the existing value. |
| 140 | oldv->UnRegisterAllExecutives(); |
| 141 | std::copy(executives, executives + length, oldv->Executives.begin()); |
| 142 | std::copy(ports, ports + length, oldv->Ports.begin()); |
| 143 | // Since this sets a value without call SetAsObjectBase(), |
| 144 | // the info has to be modified here (instead of |
| 145 | // vtkInformation::SetAsObjectBase() |
| 146 | info->Modified(); |
| 147 | } |
| 148 | else |
| 149 | { |
| 150 | // Allocate a new value. |
| 151 | vtkInformationExecutivePortVectorValue* v = new vtkInformationExecutivePortVectorValue; |
| 152 | v->InitializeObjectBase(); |
| 153 | v->Executives.insert(v->Executives.begin(), executives, executives + length); |
| 154 | v->Ports.insert(v->Ports.begin(), ports, ports + length); |
| 155 | this->SetAsObjectBase(info, v); |
| 156 | v->Delete(); |
| 157 | } |
| 158 | } |
| 159 | else |
| 160 | { |
| 161 | this->SetAsObjectBase(info, nullptr); |
| 162 | } |
| 163 | } |
| 164 | |
| 165 | //------------------------------------------------------------------------------ |
| 166 | vtkExecutive** vtkInformationExecutivePortVectorKey::GetExecutives(vtkInformation* info) |
no test coverage detected