24#ifndef PXR_BASE_TF_DIAGNOSTIC_BASE_H
25#define PXR_BASE_TF_DIAGNOSTIC_BASE_H
30#include "pxr/base/tf/api.h"
45PXR_NAMESPACE_OPEN_SCOPE
47typedef std::any TfDiagnosticInfo;
75 return _context.GetFile();
81 return _context.GetLine();
92 _context.GetPrettyFunction());
106 if (_commentary.empty())
161 template <
typename T>
163 return std::any_cast<T>(&_info);
194 TfCallContext
const &context,
195 const std::string& commentary,
196 TfDiagnosticInfo info,
bool quiet);
199 TfCallContext _context;
201 std::string _commentary;
203 std::string _codeString;
204 TfDiagnosticInfo _info;
213PXR_NAMESPACE_CLOSE_SCOPE
Define function attributes.
Functions for recording call locations.
Represents the base class of an object representing a diagnostic message.
TF_API TfDiagnosticBase(TfEnum code, char const *codeString, TfCallContext const &context, const std::string &commentary, TfDiagnosticInfo info, bool quiet)
Construct an instance.
TF_API bool IsCodingError() const
Return true if this diagnostic's code is either a fatal or nonfatal coding error.
const std::string & GetDiagnosticCodeAsString() const
Return the diagnostic code posted as a string.
TF_API bool IsFatal() const
Return true if this diagnostic's code is a fatal code.
const TfCallContext & GetContext() const
Return the call context where the message was issued.
std::string GetSourceFunction() const
Return the source function that the diagnostic message was posted from.
void SetInfo(TfDiagnosticInfo any)
Set the info object associated with this diagnostic message.
TfEnum GetDiagnosticCode() const
Return the diagnostic code posted.
size_t GetSourceLineNumber() const
Return the source line number that the diagnostic message was posted from.
std::string GetSourceFileName() const
Return the source file name that the diagnostic message was posted from.
bool GetQuiet() const
Return true if the message was posted via PostQuietly().
const T * GetInfo() const
Return a (possibly NULL) const pointer to the info object associated with this message.
std::string const & GetCommentary() const
Return the commentary string describing this diagnostic message.
void AugmentCommentary(const std::string &s)
Add to the commentary string describing this diagnostic message.
Singleton class through which all errors and diagnostics pass.
An enum class that records both enum type and enum value.
Class used to record the end of the error-list.
A facility for transporting errors from thread to thread.
Define preprocessor function name macros.
ARCH_API std::string ArchGetPrettierFunctionName(const std::string &function, const std::string &prettyFunction)
Return well formatted function name.
Definitions of basic string utilities in tf.
Pointer storage with deletion detection.