LArSoft
v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
|
Iterator to navigate through all the nodes. More...
#include "GeometryCore.h"
Classes | |
struct | NodeInfo_t |
Public Member Functions | |
ROOTGeoNodeForwardIterator (TGeoNode const *start_node) | |
Constructor: start from this node. More... | |
TGeoNode const * | operator* () const |
Returns the pointer to the current node, or nullptr if none. More... | |
ROOTGeoNodeForwardIterator & | operator++ () |
Points to the next node, or to nullptr if there are no more. More... | |
std::vector< TGeoNode const * > | get_path () const |
Returns the full path of the current node. More... | |
Protected Types | |
using | Node_t = TGeoNode const * |
Protected Member Functions | |
void | reach_deepest_descendant () |
void | init (TGeoNode const *start_node) |
Protected Attributes | |
std::vector< NodeInfo_t > | current_path |
which node, which sibling? More... | |
Iterator to navigate through all the nodes.
Note that this is not a fully standard forward iterator in that it lacks of the postfix operator. The reason is that it's too expensive and it should be avoided. Also I did not bother declaring the standard type definitions (that's just laziness).
An example of iteration:
TGeoNode const* pCurrentNode; ROOTGeoNodeForwardIterator iNode(geom->ROOTGeoManager()->GetTopNode()); while ((pCurrentNode = *iNode)) { // do something with pCurrentNode ++iNode; } // while
These iterators are one use only, and they can't be reset after a loop is completed.
Definition at line 5432 of file GeometryCore.h.
|
protected |
Definition at line 5449 of file GeometryCore.h.
|
inline |
Constructor: start from this node.
Definition at line 5435 of file GeometryCore.h.
std::vector< TGeoNode const * > geo::ROOTGeoNodeForwardIterator::get_path | ( | ) | const |
Returns the full path of the current node.
Definition at line 2049 of file GeometryCore.cxx.
Referenced by geo::CollectPathsByName::operator()().
|
protected |
Definition at line 2070 of file GeometryCore.cxx.
|
inline |
Returns the pointer to the current node, or nullptr if none.
Definition at line 5439 of file GeometryCore.h.
ROOTGeoNodeForwardIterator & geo::ROOTGeoNodeForwardIterator::operator++ | ( | ) |
Points to the next node, or to nullptr if there are no more.
Definition at line 2030 of file GeometryCore.cxx.
References geo::ROOTGeoNodeForwardIterator::NodeInfo_t::self, and geo::ROOTGeoNodeForwardIterator::NodeInfo_t::sibling.
|
protected |
Definition at line 2061 of file GeometryCore.cxx.
|
protected |
which node, which sibling?
Definition at line 5457 of file GeometryCore.h.