ucx
UAP Common Extensions
Loading...
Searching...
No Matches
Data Fields
cx_tree_visitor_s Struct Reference

A breadth-first tree iterator. More...

#include <tree.h>

Data Fields

struct cx_iterator_base_s base
 Base members.
 
bool skip
 Indicates whether the subtree below the current node shall be skipped.
 
ptrdiff_t loc_children
 Offset in the node struct for the children linked list.
 
ptrdiff_t loc_next
 Offset in the node struct for the next pointer.
 
size_t counter
 The total number of distinct nodes that have been passed so far.
 
void * node
 The currently observed node.
 
size_t depth
 The current depth in the tree.
 
struct cx_tree_visitor_queue_squeue_next
 The next element in the visitor queue.
 
struct cx_tree_visitor_queue_squeue_last
 The last element in the visitor queue.
 

Detailed Description

A breadth-first tree iterator.

This iterator needs to maintain a visitor queue that will be automatically freed once the iterator becomes invalid. If you want to discard the iterator before, you MUST manually call cxTreeVisitorDispose().

This iterator is not position-aware in a strict sense, as it does not assume a particular order of elements in the tree. However, the iterator keeps track of the number of nodes it has passed in a counter variable. Each node, regardless of the number of passes, is counted only once.

Note
Objects that are pointed to by an iterator are mutable through that iterator. However, if the underlying data structure is mutated by other means than this iterator (e.g. elements added or removed), the iterator becomes invalid (regardless of what cxIteratorValid() returns).
See also
CxIterator

Field Documentation

◆ node

void* cx_tree_visitor_s::node

The currently observed node.

This is the same what cxIteratorCurrent() would return.


The documentation for this struct was generated from the following file: