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

Function PyVTKObject_Traverse

Wrapping/PythonCore/PyVTKObject.cxx:255–289  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

253
254//------------------------------------------------------------------------------
255int PyVTKObject_Traverse(PyObject* o, visitproc visit, void* arg)
256{
257 PyVTKObject* self = (PyVTKObject*)o;
258 int err = 0;
259
260 if (self->vtk_observers != nullptr)
261 {
262 unsigned long* olist = self->vtk_observers;
263 while (err == 0 && *olist != 0)
264 {
265 vtkObject* op = static_cast<vtkObject*>(self->vtk_ptr);
266 vtkCommand* c = op->GetCommand(*olist);
267 if (c == nullptr)
268 {
269 // observer is gone, remove from list
270 unsigned long* tmp = olist;
271 do
272 {
273 tmp++;
274 } while (*tmp != 0);
275 *olist = *--tmp;
276 *tmp = 0;
277 }
278 else
279 {
280 // visit the observer
281 vtkPythonCommand* cbc = static_cast<vtkPythonCommand*>(c);
282 err = visit(cbc->obj, arg);
283 olist++;
284 }
285 }
286 }
287
288 return err;
289}
290
291//------------------------------------------------------------------------------
292PyObject* PyVTKObject_New(PyTypeObject* tp, PyObject* args, PyObject* /*kwds*/)

Callers

nothing calls this directly

Calls 1

GetCommandMethod · 0.80

Tested by

no test coverage detected