next up previous
Next: A Sample Walker: recursionWalker Up: Walkers Previous: Walkers are Easy to

Walker subclass definitions

A walker should be defined in a .cc file that #includes "c_breeze.h" (which will itself #include "walker.h"). You must define a constructor for the walker that specifies the order (Postorder, Preorder or Both) and the depth (NodeOnly or Subtree) of the traversal. You also provide member functions that override the default actions for the nodes you're interested in. These void functions accept two parameters: a pointer to the appropriate subclass of Node, and a parameter of type Order that will tell you whether the node is being visited in preorder (i.e., the parameter == Preorder) or postorder (i.e., == Postorder). You can ignore (but must still declare) this parameter if your Walker subclass only goes in one order.



Calvin Lin
2002-01-31