A tree is read from infile into memory. If parentPtr is
non-null, the tree that is read in is made a child of parentPtr.
Usually users will invoke this subroutine with parentPtr equal
to NULL, but the routine invokes itself recursively with non-null parentPtr to build the tree. The routine returns a generic F_Nodestar; it may be necessary for the user to cast the return
value to the appropriate pointer type (see Section
).
Thus, the following is equivalent to the example in the F_inputTree() example above.
fstream infile;
infile.open("infile.dst",ios::in);
eventNode *ev;
ev = (eventNode*) F_inputSubtree(NULL,infile);
The following might be used if trees of different types (say event trees and beginning-of-run trees) coexist on the disk file.
fstream infile;
infile.open("infile.dst",ios::in);
F_Node *top;
eventNode *ev;
runNode *br;
top = F_inputSubtree(NULL,infile);
if (top->returnType() == runType)
{ br = (runNode*) top; ...}
else if (top->returnType() == eventType)
{ ev = (eventNode*) top; ...}