.TH G_DISPLAYASTREE 2 "27 February 1992" "Demeter" "Demeter Software" .SH NAME g_displayAsTree \- displays a tree object in object graph notation. .SH SYNOPSIS void .I g_displayAsTree ( ostream& strm = cout ) .SH DESCRIPTION .I g_displayAsTree displays a detailed description of an object using the object graph notation. If the .I strm argument is provided, then the output is sent to the ostream in the given .I strm, otherwise the output is sent to the standard output. The object must be a tree object. That is, it cannot have any cycles or shared subobjects. The class of the object is displayed preceded by a colon, and followed by an open delimiter, the description of the composition of the object, and a close delimiter. If the class of the object is a construction class the open and close delimiters are "(" and ")", respectively, and the composition of the object is a number of part objects. If the class of the object is a repetition class the open and close delimiters are "{" and "}", respectively, and the composition of the object is a sequence of repeated element objects. Each part object or repeated element object is in turn displayed in object graph format in a similar fashion. Each part object is preceded by a label indicating the name of the part in the class dictionary that defines the object that contains the part. If the class of the object is a terminal class (i.e., Ident, Number, Real, String, or Text), then no delimiters are displayed and the composition of the object is simply a quoted value. .SH EXAMPLE Here is an example of how to use .I g_displayAsTree. Assume the following class dictionary. Example = List(Prefix). .br Prefix : Simple | Compound. .br Simple = Number. .br Compound = "(" Op List(Prefix) ")". .br Op : AddSym | MulSym. .br AddSym = "+". .br MulSym = "*". .br List(S) ~ S { S }. The following program parses in a Compound object and displays it as a tree object. Compound* iCompound = new Compound(); .br iCompound = (Compound*)iCompound->g_parse("demeter-input"); ostream outFile( "compound-object-graph" ); .br iCompound->g_displayAsTree( outFile ); If the contents of demeter\-input is (* (+ 3 4) 3), then the following text is written to the file compound\-object\-graph. An example of an object graph is as follows: : Compound ( .br < op > : MulSym ( ) .br < args > : Prefix_List { .br : Compound ( .br < op > : AddSym ( ) .br < args > : Prefix_List { .br : Simple ( .br < val > : Number "3" ) , .br : Simple ( .br < val > : Number "4" ) } ) , .br : Simple ( .br < val > : Number "3" ) } ) If no argument had been given, then the description is sent to the standard output. .SH SEE ALSO g_parse(2) .SH REFERENCES .I User Manual for The C++ Demeter System .br Walter L. Hursch .br Northeastern University, 1993 .I The Annotated C++ Reference Manual .br Margaret A. Ellis and Bjarne Stroustrup .br Addison-Wesley, 1990 .I C++ Primer .br Stanley B. Lippman .br Addison-Wesley, 1989