#include <TEveElementIter.h>
Public Member Functions | |
TEveElement * | current () |
TEveElement * | next () |
TEveElement * | reset () |
unsigned int | size () |
TEveElementIter (TEveElement *, const char *regular_expression=0) | |
Private Member Functions | |
void | addElement (TEveElement *) |
Private Attributes | |
std::vector< TEveElement * > | elements |
std::vector< TEveElement * > ::iterator | iter |
TPRegexp | regexp |
Definition at line 15 of file TEveElementIter.h.
TEveElementIter::TEveElementIter | ( | TEveElement * | element, |
const char * | regular_expression = 0 |
||
) |
Definition at line 7 of file TEveElementIter.cc.
References addElement(), elements, fwLog, getHLTprescales::index, iter, fwlog::kError, parents, and regexp.
{ if ( regular_expression ) regexp = TPRegexp( regular_expression ); std::stack<std::pair<TEveElement*,TEveElement::List_i> > parents; parents.push( std::pair<TEveElement*,TEveElement::List_i>( element, element->BeginChildren() ) ); unsigned int index = 0; // index number to prevent endless loops unsigned int indexLimit = 1000000; while ( !parents.empty() && ++index < indexLimit ) { // take care of finished loop if ( parents.top().second == parents.top().first->EndChildren() ) { addElement( parents.top().first ); parents.pop(); if ( !parents.empty() ) ++(parents.top().second); continue; } // find element without children if ( (*parents.top().second)->NumChildren() > 0 ) { parents.push( std::pair<TEveElement*,TEveElement::List_i>( *(parents.top().second), (*parents.top().second)->BeginChildren() ) ); continue; } // we have a leaf element (no children) to process addElement( *(parents.top().second) ); ++(parents.top().second); } if ( index >= indexLimit ) { fwLog(fwlog::kError) << " tree loop limit is reached!\n" << "You either have a tree with loops or navigation logic is broken." << std::endl; elements.clear(); } iter = elements.begin(); }
void TEveElementIter::addElement | ( | TEveElement * | element | ) | [private] |
Definition at line 65 of file TEveElementIter.cc.
References elements, and regexp.
Referenced by TEveElementIter().
TEveElement * TEveElementIter::current | ( | ) |
TEveElement * TEveElementIter::next | ( | void | ) |
TEveElement * TEveElementIter::reset | ( | void | ) |
unsigned int TEveElementIter::size | ( | void | ) | [inline] |
std::vector<TEveElement*> TEveElementIter::elements [private] |
Definition at line 18 of file TEveElementIter.h.
Referenced by addElement(), current(), next(), reset(), size(), and TEveElementIter().
std::vector<TEveElement*>::iterator TEveElementIter::iter [private] |
Definition at line 19 of file TEveElementIter.h.
Referenced by current(), next(), reset(), and TEveElementIter().
TPRegexp TEveElementIter::regexp [private] |
Definition at line 17 of file TEveElementIter.h.
Referenced by addElement(), and TEveElementIter().