MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ for_each_descendant()

template<FieldArray Array>
template<typename Fn>
bool MayaFlux::Kakshya::DataForestTraversal< Array >::for_each_descendant ( size_t row,
Fn && fn ) const
inline

Visit every descendant of row in document order, excluding row.

Note
Preorder rows take a sequential pass; other forests walk the child links depth first.

Definition at line 148 of file DataForestTraversal.hpp.

149 {
150 if (const auto range = m_index->subtree_range(row)) {
151 for (size_t next = range->first + 1; next < range->first + range->count; ++next) {
152 if (!visit(next, fn))
153 return false;
154 }
155 return true;
156 }
157
160 while (!pending.empty()) {
161 const uint64_t next = pending.back();
162 pending.pop_back();
163 if (!visit(next, fn))
164 return false;
166 }
167 return true;
168 }
void push_children(std::vector< uint64_t > &pending, size_t row) const
On-demand walks over the parent links of an indexed array.

References m_index, push_children(), and visit().

Referenced by reduce_subtree().

Here is the call graph for this function:
Here is the caller graph for this function: