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 5590 of file GeometryCore.h.
|
protected |
Definition at line 5607 of file GeometryCore.h.
|
inline |
Constructor: start from this node.
Definition at line 5593 of file GeometryCore.h.
std::vector< TGeoNode const * > geo::ROOTGeoNodeForwardIterator::get_path | ( | ) | const |
Returns the full path of the current node.
Definition at line 1957 of file GeometryCore.cxx.
|
protected |
Definition at line 1978 of file GeometryCore.cxx.
|
inline |
Returns the pointer to the current node, or nullptr if none.
Definition at line 5597 of file GeometryCore.h.
ROOTGeoNodeForwardIterator & geo::ROOTGeoNodeForwardIterator::operator++ | ( | ) |
Points to the next node, or to nullptr if there are no more.
Definition at line 1938 of file GeometryCore.cxx.
|
protected |
Definition at line 1969 of file GeometryCore.cxx.
|
protected |
which node, which sibling?
Definition at line 5615 of file GeometryCore.h.