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 5589 of file GeometryCore.h.
|
protected |
Definition at line 5606 of file GeometryCore.h.
|
inline |
Constructor: start from this node.
Definition at line 5592 of file GeometryCore.h.
std::vector< TGeoNode const * > geo::ROOTGeoNodeForwardIterator::get_path | ( | ) | const |
Returns the full path of the current node.
Definition at line 2046 of file GeometryCore.cxx.
|
protected |
Definition at line 2067 of file GeometryCore.cxx.
|
inline |
Returns the pointer to the current node, or nullptr if none.
Definition at line 5596 of file GeometryCore.h.
ROOTGeoNodeForwardIterator & geo::ROOTGeoNodeForwardIterator::operator++ | ( | ) |
Points to the next node, or to nullptr if there are no more.
Definition at line 2027 of file GeometryCore.cxx.
|
protected |
Definition at line 2058 of file GeometryCore.cxx.
|
protected |
which node, which sibling?
Definition at line 5614 of file GeometryCore.h.