moab
|
Public Member Functions | |
TreeLayoutPrinter (std::ostream &stream, Interface *instance) | |
virtual ErrorCode | visit (EntityHandle node, int depth, bool &descend) |
Visit a node in the tree during a traversal. | |
virtual ErrorCode | leaf (EntityHandle node) |
Process a leaf node during tree traversal. | |
Private Attributes | |
Interface * | instance |
std::ostream & | outputStream |
std::vector< bool > | path |
Definition at line 1715 of file OrientedBoxTreeTool.cpp.
moab::TreeLayoutPrinter::TreeLayoutPrinter | ( | std::ostream & | stream, |
Interface * | instance | ||
) |
Definition at line 1732 of file OrientedBoxTreeTool.cpp.
: instance(interface), outputStream(stream) {}
ErrorCode moab::TreeLayoutPrinter::leaf | ( | EntityHandle | node | ) | [virtual] |
Process a leaf node during tree traversal.
Implements moab::OrientedBoxTreeTool::Op.
Definition at line 1770 of file OrientedBoxTreeTool.cpp.
{ return MB_SUCCESS; }
ErrorCode moab::TreeLayoutPrinter::visit | ( | EntityHandle | node, |
int | depth, | ||
bool & | descend | ||
) | [virtual] |
Visit a node in the tree during a traversal.
This method is called for each node in the tree visited during a pre-order traversal.
node | The EntityHandle for the entity set for the tree node. |
depth | The current depth in the tree. |
descend | Output: if false, traversal will skip children of the current node, or if the current node is a leaf, the 'leaf' method will not be called. |
Implements moab::OrientedBoxTreeTool::Op.
Definition at line 1738 of file OrientedBoxTreeTool.cpp.
{ descend = true; if ((unsigned)depth > path.size()) { //assert(depth+1 == path.size); // preorder traversal path.push_back(true); } else { path.resize( depth ); if (depth) path.back() = false; } for (unsigned i = 0; i+1 < path.size(); ++i) { if (path[i]) outputStream << "| "; else outputStream << " "; } if (depth) { if (path.back()) outputStream << "+---"; else outputStream << "\\---"; } outputStream << instance->id_from_handle( node ) << std::endl; return MB_SUCCESS; }
Interface* moab::TreeLayoutPrinter::instance [private] |
Definition at line 1727 of file OrientedBoxTreeTool.cpp.
std::ostream& moab::TreeLayoutPrinter::outputStream [private] |
Definition at line 1728 of file OrientedBoxTreeTool.cpp.
std::vector<bool> moab::TreeLayoutPrinter::path [private] |
Definition at line 1729 of file OrientedBoxTreeTool.cpp.