HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
grapher.h
Go to the documentation of this file.
1 //
2 // Copyright 2025 Pixar
3 //
4 // Licensed under the terms set forth in the LICENSE.txt file available at
5 // https://openusd.org/license.
6 //
7 #ifndef PXR_EXEC_VDF_GRAPHER_H
8 #define PXR_EXEC_VDF_GRAPHER_H
9 
10 /// \file
11 
12 #include "pxr/pxr.h"
13 
14 #include "pxr/exec/vdf/api.h"
15 #include "pxr/exec/vdf/types.h"
16 
17 #include <string>
18 #include <vector>
19 
21 
22 class VdfGrapherOptions;
23 class VdfNetwork;
24 class VdfNode;
25 
26 ////////////////////////////////////////////////////////////////////////////////
27 ///
28 /// \class VdfGrapher
29 ///
30 /// This class is used to produce printable graphs of Vdf networks.
31 ///
32 /// The simplest way to use this class is to use the convenient static methods:
33 ///
34 /// \section cppcode_VdfGrapher C++ Code Sample
35 /// \code
36 /// VdfGrapher::GraphToFile(network, "filename.dot");
37 /// \endcode
38 ///
39 ///
40 /// Note: The command to be used for generating graphs should be:
41 ///
42 /// \code
43 /// dot -Gsize=80,80 -Gpage=95,95 -Tps <in.dot> | epstopdf --filter -o <out.pdf>
44 /// \endcode
45 ///
46 /// For viewing use:
47 ///
48 /// \code
49 /// acroread <out.pdf>
50 /// \endcode
51 ///
52 class VdfGrapher
53 {
54 public:
55 
56  /// \name Static API
57  /// @{
58 
59  /// Produces a graph of the given \p network and writes it to \p filename.
60  ///
61  /// Uses the default grapher options.
62  ///
63  VDF_API
64  static void GraphToFile(const VdfNetwork &network,
65  const std::string &filename);
66 
67  /// Produces a graph of the given \p network and writes it to \p filename.
68  ///
69  /// The given \p options are used to configure the output.
70  ///
71  VDF_API
72  static void GraphToFile(const VdfNetwork &network,
73  const std::string &filename,
74  const VdfGrapherOptions &options);
75 
76  /// Produces a graph of the given \p network and writes it to a temporary
77  /// file.
78  ///
79  /// The given \p options are used to configure the output.
80  ///
81  VDF_API
82  static void GraphToTemporaryFile(const VdfNetwork &network,
83  const VdfGrapherOptions &options);
84 
85  /// Produces a graph in the neighborhood of \p node.
86  ///
87  VDF_API
88  static void GraphNodeNeighborhood(
89  const VdfNode &node,
90  int maxInDepth, int maxOutDepth,
91  const std::vector<std::string> &exclude = std::vector<std::string>());
92 
93  /// Returns the list of all registered nodes in the given \p network with
94  /// the given \p name.
95  ///
96  VDF_API
97  static std::vector<const VdfNode *> GetNodesNamed(
98  const VdfNetwork &network,
99  const std::string &name);
100 
101 
102  /// Returns a string that represents a shell command that will view
103  /// the file \p dotFileName.
104  ///
105  VDF_API
106  static std::string GetDotCommand(const std::string &dotFileName);
107 
108 
109  /// @}
110 
111 };
112 
113 ////////////////////////////////////////////////////////////////////////////////
114 
116 
117 #endif
GT_API const UT_StringHolder filename
#define PXR_NAMESPACE_OPEN_SCOPE
Definition: pxr.h:73
static VDF_API void GraphNodeNeighborhood(const VdfNode &node, int maxInDepth, int maxOutDepth, const std::vector< std::string > &exclude=std::vector< std::string >())
Definition: node.h:52
#define VDF_API
Definition: api.h:25
static VDF_API std::vector< const VdfNode * > GetNodesNamed(const VdfNetwork &network, const std::string &name)
static VDF_API void GraphToFile(const VdfNetwork &network, const std::string &filename)
GLuint const GLchar * name
Definition: glcorearb.h:786
static VDF_API void GraphToTemporaryFile(const VdfNetwork &network, const VdfGrapherOptions &options)
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
static VDF_API std::string GetDotCommand(const std::string &dotFileName)