OpenVDB 12.1.0

Loading...
Searching...
No Matches
PrintTree.h
Go to the documentation of this file.
1// Copyright Contributors to the OpenVDB Project
2// SPDX-License-Identifier: Apache-2.0
3
4/// @file ast/PrintTree.h
5///
6/// @authors Nick Avramoussis, Richard Jones
7///
8/// @brief Various tools which traverse an AX AST and report information
9/// back to a std::ostream.
10///
11
12#ifndef OPENVDB_AX_AST_PRINT_TREE_HAS_BEEN_INCLUDED
13#define OPENVDB_AX_AST_PRINT_TREE_HAS_BEEN_INCLUDED
14
15#include <openvdb/version.h>
16
17#include <iostream>
18
19 namespace openvdb {
20 OPENVDB_USE_VERSION_NAMESPACE
21 namespace OPENVDB_VERSION_NAME {
22
23 namespace ax {
24 namespace ast {
25
26 struct Node;
27
28/// @brief Writes a descriptive printout of a Node hierarchy into a target
29/// stream
30/// @param node Node to print
31/// @param numberStatements Whether to number the line statements
32/// @param os Stream to write into
33/// @param indent The indent to print on each child traversal
34 OPENVDB_AX_API void print(const ast::Node& node,
35 const bool numberStatements = true,
36 std::ostream& os = std::cout,
37 const char* indent = " ");
38
39/// @brief Using the provided AST, print corresponding AX code which
40/// may have been used to create it.
41/// @note The result is not guaranteed to be exactly equal to the
42/// code that was original parsed. A few potential key differences worth
43/// mentioning include whitespace matching, component indexing and inferred
44/// attribute types.
45/// @param node Node to print
46/// @param os Stream to write into
47/// @param indent The indent to print on each child traversal
48 OPENVDB_AX_API void reprint(const ast::Node& node,
49 std::ostream& os = std::cout,
50 const char* indent = " ");
51
52} // namespace ast
53} // namespace ax
54
55} // namespace OPENVDB_VERSION_NAME
56} // namespace openvdb
57
58#endif // OPENVDB_AX_AST_PRINT_TREE_HAS_BEEN_INCLUDED
59
OPENVDB_AX_API
#define OPENVDB_AX_API
Definition Platform.h:312
openvdb::v12_1::ax::ast::print
OPENVDB_AX_API void print(const ast::Node &node, const bool numberStatements=true, std::ostream &os=std::cout, const char *indent=" ")
Writes a descriptive printout of a Node hierarchy into a target stream.
openvdb::v12_1::ax::ast::reprint
OPENVDB_AX_API void reprint(const ast::Node &node, std::ostream &os=std::cout, const char *indent=" ")
Using the provided AST, print corresponding AX code which may have been used to create it.
openvdb
Definition Exceptions.h:13
openvdb::v12_1::ax::ast::Node
The base abstract node which determines the interface and required methods for all derived concrete n...
Definition AST.h:103
OPENVDB_VERSION_NAME
#define OPENVDB_VERSION_NAME
The version namespace name for this library version.
Definition version.h.in:121
OPENVDB_USE_VERSION_NAMESPACE
#define OPENVDB_USE_VERSION_NAMESPACE
Definition version.h.in:218