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

Method Set

Common/ExecutionModel/vtkInformationExecutivePortVectorKey.cxx:119–163  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

117
118//------------------------------------------------------------------------------
119void 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//------------------------------------------------------------------------------
166vtkExecutive** vtkInformationExecutivePortVectorKey::GetExecutives(vtkInformation* info)

Callers 2

AppendMethod · 0.95
ShallowCopyMethod · 0.95

Calls 11

InitializeObjectBaseMethod · 0.80
DeleteMethod · 0.65
copyFunction · 0.50
RegisterMethod · 0.45
GetAsObjectBaseMethod · 0.45
sizeMethod · 0.45
beginMethod · 0.45
ModifiedMethod · 0.45
insertMethod · 0.45
SetAsObjectBaseMethod · 0.45

Tested by

no test coverage detected