MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / findObjectByCallback

Method findObjectByCallback

Engine/source/console/simSet.h:353–384  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

351
352template< class T >
353void SimSet::findObjectByCallback( bool ( *fn )( T* ), Vector<T*> &foundObjects )
354{
355 T *curObj;
356 SimSet *curSet;
357
358 lock();
359
360 // Loop through our child objects.
361
362 SimObjectList::iterator itr = mObjectList.begin();
363
364 for ( ; itr != mObjectList.end(); itr++ )
365 {
366 curObj = dynamic_cast<T*>( *itr );
367 curSet = dynamic_cast<SimSet*>( *itr );
368
369 // If child object is a set, call recursively into it.
370 if ( curSet )
371 curSet->findObjectByCallback( fn, foundObjects );
372
373 // Add this child object if appropriate.
374 if ( curObj && ( fn == NULL || fn( curObj ) ) )
375 foundObjects.push_back( curObj );
376 }
377
378 // Add this object if appropriate.
379 curObj = dynamic_cast<T*>(this);
380 if ( curObj && ( fn == NULL || fn( curObj ) ) )
381 foundObjects.push_back( curObj );
382
383 unlock();
384}
385
386/// An iterator that recursively and exhaustively traverses the contents
387/// of a SimSet.

Callers 3

deleteMeshSafeMethod · 0.80
_collectElementsMethod · 0.80
findByObjectMethod · 0.80

Calls 3

beginMethod · 0.45
endMethod · 0.45
push_backMethod · 0.45

Tested by 1

findByObjectMethod · 0.64