LArSoft
v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
|
Iterator to navigate through all the nodes. More...
Classes | |
struct | NodeInfo_t |
Public Member Functions | |
ROOTGeoNodeForwardIterator (TGeoNode const *start_node) | |
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... | |
Private Member Functions | |
void | reach_deepest_descendant () |
Private 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 562 of file GeometryCore.cxx.
|
explicit |
Definition at line 1675 of file GeometryCore.cxx.
std::vector< TGeoNode const * > geo::ROOTGeoNodeForwardIterator::get_path | ( | ) | const |
Returns the full path of the current node.
Definition at line 1706 of file GeometryCore.cxx.
Referenced by geo::CollectPathsByName::operator()().
|
inline |
Returns the pointer to the current node, or nullptr if none.
Definition at line 567 of file GeometryCore.cxx.
ROOTGeoNodeForwardIterator & geo::ROOTGeoNodeForwardIterator::operator++ | ( | ) |
Points to the next node, or to nullptr if there are no more.
Definition at line 1683 of file GeometryCore.cxx.
References geo::ROOTGeoNodeForwardIterator::NodeInfo_t::self, and geo::ROOTGeoNodeForwardIterator::NodeInfo_t::sibling.
|
private |
Definition at line 1717 of file GeometryCore.cxx.
|
private |
which node, which sibling?
Definition at line 585 of file GeometryCore.cxx.