HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
error.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_ERROR_H
8 #define PXR_EXEC_VDF_ERROR_H
9 
10 #include "pxr/pxr.h"
11 
12 #include "pxr/exec/vdf/api.h"
13 #include "pxr/base/tf/diagnostic.h"
14 
16 
17 class VdfNode;
18 
19 struct Vdf_ErrorHelper : public Tf_DiagnosticHelper {
22  Tf_DiagnosticHelper(context, type) {}
23  VDF_API
24  void FatalError(const VdfNode &node, std::string const &msg) const;
25  VDF_API
26  void FatalError(const VdfNode &node, char const *fmt, ...) const
27  ARCH_PRINTF_FUNCTION(3,4);
28 };
29 
30 /// Issues a fatal error to end the program in the spirit of TF_FATAL_ERROR.
31 ///
32 /// In addition to the functionality provided by Tf, VDF_FATAL_ERROR also
33 /// produces a graph of the network around \p node.
34 ///
35 #define VDF_FATAL_ERROR \
36  Vdf_ErrorHelper(TF_CALL_CONTEXT).FatalError
37 
38 /// Axioms that the condition \p cond is true in the spirit of TF_AXIOM.
39 ///
40 /// In addition to the functionality provided by Tf, VDF_AXIOM also
41 /// produces a graph of the network around \p node.
42 ///
43 #define VDF_AXIOM(node, cond) \
44  do { \
45  if (ARCH_UNLIKELY(!(cond))) \
46  Vdf_ErrorHelper(TF_CALL_CONTEXT). \
47  FatalError(node, "Failed axiom: ' %s '", #cond); \
48  } while (0)
49 
51 
52 #endif
VDF_API void FatalError(const VdfNode &node, std::string const &msg) const
#define PXR_NAMESPACE_OPEN_SCOPE
Definition: pxr.h:73
Definition: node.h:52
#define VDF_API
Definition: api.h:25
GLint GLint GLsizei GLint GLenum GLenum type
Definition: glcorearb.h:108
TfDiagnosticType
Vdf_ErrorHelper(TfCallContext const &context, TfDiagnosticType type=TF_DIAGNOSTIC_INVALID_TYPE)
Definition: error.h:20
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74