executorErrorLogger.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_EXECUTOR_ERROR_LOGGER_H
8 #define PXR_EXEC_VDF_EXECUTOR_ERROR_LOGGER_H
9 
10 #include "pxr/pxr.h"
11 
12 #include "pxr/exec/vdf/api.h"
13 #include <tbb/concurrent_unordered_map.h>
14 #include <atomic>
15 
16 PXR_NAMESPACE_OPEN_SCOPE
17 
19 
20 class VdfNode;
21 
34 {
35 public:
36 
39  VDF_API
41 
44  VDF_API
46 
49  using NodeToStringMap =
50  tbb::concurrent_unordered_map<const VdfNode *, std::string>;
51 
54 
58  VDF_API
59  const NodeToStringMap &GetWarnings() const;
60 
62 
63 
66 
70  VDF_API
71  void ReportWarnings() const;
72 
75  VDF_API
76  static void IssueDefaultWarning(
77  const VdfNode &node,
78  const std::string &warning);
79 
81 
82 
85 
89  VDF_API
90  void LogWarning(const VdfNode &node, const std::string &warning) const;
91 
93 
94 private:
95 
96  // Holds warnings emitted by nodes during execution.
97  mutable std::atomic<NodeToStringMap *> _warnings;
98 };
99 
101 
102 PXR_NAMESPACE_CLOSE_SCOPE
103 
104 #endif
VDF_API void ReportWarnings() const
Reports warnings using node debug names.
A client may instantiate an object of this class and set it in an executor, to collect errors that ma...
VDF_API ~VdfExecutorErrorLogger()
Dtor.
VDF_API void LogWarning(const VdfNode &node, const std::string &warning) const
Logs a warning against node.
This is the base class for all nodes in a VdfNetwork.
Definition: node.h:52
VDF_API VdfExecutorErrorLogger()
Ctor.
tbb::concurrent_unordered_map< const VdfNode *, std::string > NodeToStringMap
A thread safe map from node pointer to string for logging warnings.
static VDF_API void IssueDefaultWarning(const VdfNode &node, const std::string &warning)
Prints out default warning message based on node's debug name.
VDF_API const NodeToStringMap & GetWarnings() const
Returns a map that maps nodes to warning strings that were encountered during a call to Run().