All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
diagnosticHelper.h
1//
2// Copyright 2016 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_BASE_TF_DIAGNOSTIC_HELPER_H
8#define PXR_BASE_TF_DIAGNOSTIC_HELPER_H
9
10#include "pxr/pxr.h"
11#include "pxr/base/tf/api.h"
13#include "pxr/base/arch/defines.h"
14
15// XXX: This include is a hack to avoid build errors due to
16// incompatible macro definitions in pyport.h on macOS.
17#include <locale>
18
19#include <any>
20#include <string>
21
22// Follow up changes should more tightly scope these to just where it's needed
23// in pxr.
24#if defined(ARCH_OS_LINUX) || defined(ARCH_OS_DARWIN)
25// Include <unistd.h> to provide _exit for tf/debugger.cpp and dependencies
26// that were previously transitively getting this from boost
27#include <unistd.h>
28// Include <cstring> to provide memset, memcmp, and memcpy for dependencies
29// that were previously transitively getting them from boost
30#include <cstring>
31#endif
32
33PXR_NAMESPACE_OPEN_SCOPE
34
35typedef std::any TfDiagnosticInfo;
36class TfCallContext;
37enum TfDiagnosticType : int;
38class TfEnum;
39class TfError;
40
41TF_API void
42Tf_PostErrorHelper(
43 const TfCallContext &context,
44 const TfEnum &code,
45 const std::string &msg);
46
47TF_API void
48Tf_PostErrorHelper(
49 const TfCallContext &context,
51 const std::string &msg);
52
53TF_API void
54Tf_PostErrorHelper(
55 const TfCallContext &context,
56 const TfEnum &code,
57 const char *fmt, ...) ARCH_PRINTF_FUNCTION(3, 4);
58
59TF_API void
60Tf_PostErrorHelper(
61 const TfCallContext &context,
63 const char *fmt, ...) ARCH_PRINTF_FUNCTION(3, 4);
64
65TF_API void
66Tf_PostErrorHelper(
67 const TfCallContext &context,
68 const TfDiagnosticInfo &info,
69 const TfEnum &code,
70 const std::string &msg);
71
72TF_API void
73Tf_PostErrorHelper(
74 const TfCallContext &context,
75 const TfDiagnosticInfo &info,
76 const TfEnum &code,
77 const char *fmt, ...) ARCH_PRINTF_FUNCTION(4, 5);
78
79TF_API void
80Tf_PostQuietlyErrorHelper(
81 const TfCallContext &context,
82 const TfEnum &code,
83 const TfDiagnosticInfo &info,
84 const std::string &msg);
85
86TF_API void
87Tf_PostQuietlyErrorHelper(
88 const TfCallContext &context,
89 const TfEnum &code,
90 const TfDiagnosticInfo &info,
91 const char *fmt, ...) ARCH_PRINTF_FUNCTION(4, 5);
92
93TF_API void
94Tf_PostQuietlyErrorHelper(
95 const TfCallContext &context,
96 const TfEnum &code,
97 const std::string &msg);
98
99TF_API void
100Tf_PostQuietlyErrorHelper(
101 const TfCallContext &context,
102 const TfEnum &code,
103 const char *fmt, ...) ARCH_PRINTF_FUNCTION(3, 4);
104
105
106// Helper functions for posting a warning with TF_WARN.
107TF_API void
108Tf_PostWarningHelper(const TfCallContext &context,
109 const std::string &msg);
110
111TF_API void
112Tf_PostWarningHelper(const TfCallContext &context,
113 const char *fmt, ...) ARCH_PRINTF_FUNCTION(2, 3);
114
115TF_API void
116Tf_PostWarningHelper(
117 const TfCallContext &context,
118 const TfEnum &code,
119 const std::string &msg);
120
121TF_API void
122Tf_PostWarningHelper(
123 const TfCallContext &context,
124 TfDiagnosticType code,
125 const std::string &msg);
126
127TF_API void
128Tf_PostWarningHelper(
129 const TfCallContext &context,
130 const TfEnum &code,
131 const char *fmt, ...) ARCH_PRINTF_FUNCTION(3, 4);
132
133TF_API void
134Tf_PostWarningHelper(
135 const TfCallContext &context,
136 TfDiagnosticType code,
137 const char *fmt, ...) ARCH_PRINTF_FUNCTION(3, 4);
138
139TF_API void
140Tf_PostWarningHelper(
141 const TfCallContext &context,
142 const TfDiagnosticInfo &info,
143 const TfEnum &code,
144 const std::string &msg);
145
146TF_API void
147Tf_PostWarningHelper(
148 const TfCallContext &context,
149 const TfDiagnosticInfo &info,
150 const TfEnum &code,
151 const char *fmt, ...) ARCH_PRINTF_FUNCTION(4, 5);
152
153TF_API void
154Tf_PostStatusHelper(
155 const TfCallContext &context,
156 const char *fmt, ...) ARCH_PRINTF_FUNCTION(2, 3);
157
158TF_API void
159Tf_PostStatusHelper(
160 const TfCallContext &context,
161 const std::string &msg);
162
163
164TF_API void
165Tf_PostStatusHelper(
166 const TfCallContext &context,
167 const TfEnum &code,
168 const std::string &msg);
169
170TF_API void
171Tf_PostStatusHelper(
172 const TfCallContext &context,
173 const TfEnum &code,
174 const char *fmt, ...) ARCH_PRINTF_FUNCTION(3, 4);
175
176TF_API void
177Tf_PostStatusHelper(
178 const TfCallContext &context,
179 const TfDiagnosticInfo &info,
180 const TfEnum &code,
181 const std::string &msg);
182
183TF_API void
184Tf_PostStatusHelper(
185 const TfCallContext &context,
186 const TfDiagnosticInfo &info,
187 const TfEnum &code,
188 const char *fmt, ...) ARCH_PRINTF_FUNCTION(4, 5);
189
190PXR_NAMESPACE_CLOSE_SCOPE
191
192#endif // PXR_BASE_TF_DIAGNOSTIC_HELPER_H
Define function attributes.
#define ARCH_PRINTF_FUNCTION(_fmt, _firstArg)
Macro used to indicate a function takes a printf-like specification.
Definition: attributes.h:34
An enum class that records both enum type and enum value.
Definition: enum.h:120
Represents an object that contains error information.
Definition: error.h:32
TfDiagnosticType
Enum describing various diagnostic conditions.
STL namespace.