[#BloombergLP-bslalg-RbTreeUtil-printTreeStructure]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslalg.adoc[bslalg]::xref:BloombergLP/bslalg/RbTreeUtil.adoc[RbTreeUtil]::printTreeStructure
:relfileprefix: ../../../
:mrdocs:

Write a human&hyphen;readable description of `subtree` to `file`&period;

== Synopsis

Declared in `&lt;bslalg&lowbar;rbtreeutil&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
static
void
printTreeStructure(
    FILE* file,
    xref:BloombergLP/bslalg/RbTreeNode.adoc[RbTreeNode] const* subtree,
    void(* printNodeValueCallback)(FILE*, xref:BloombergLP/bslalg/RbTreeNode.adoc[RbTreeNode] const*),
    int level = 0,
    int spacesPerLevel = 4);
----

== Description

Write a description of the structure of the specified `subtree` to the specified output `file` in a human&hyphen;readable format, using the specified `printValueCallback` to render the value of each node&period; Optionally specify an initial indentation `level`, whose absolute value is incremented recursively for nested objects&period; If `level` is specified, optionally specify `spacesPerLevel`, whose absolute value indicates the number of spaces per indentation level for this and all of its nested objects&period; If `level` is negative, suppress indentation of the first line&period; If `spacesPerLevel` is negative, format the entire output on one line, suppressing all but the initial indentation (as governed by `level`)&period; The behavior is undefined unless `node` is 0, or the root of a valid binary tree&period; Note that the implementation of this function is recursive and expensive to perform, it is intended for debugging purposes only&period; Also note that the format is not fully specified, and can change without notice&period;

== Parameters

[cols="1,4"]
|===
| Name| Description
| *file*
| output stream that receives the description
| *subtree*
| root of the subtree to print, or 0
| *printNodeValueCallback*
| callback that prints each node&apos;s value
| *level*
| initial indentation level
| *spacesPerLevel*
| spaces used for each indentation level
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
