7#ifndef PXR_BASE_TF_DIAGNOSTIC_BASE_H
8#define PXR_BASE_TF_DIAGNOSTIC_BASE_H
13#include "pxr/base/tf/api.h"
28PXR_NAMESPACE_OPEN_SCOPE
30typedef std::any TfDiagnosticInfo;
58 return _context.GetFile();
64 return _context.GetLine();
75 _context.GetPrettyFunction());
89 if (_commentary.empty())
144 template <
typename T>
146 return std::any_cast<T>(&_info);
177 TfCallContext
const &context,
178 const std::string& commentary,
179 TfDiagnosticInfo info,
bool quiet);
182 TfCallContext _context;
184 std::string _commentary;
186 std::string _codeString;
187 TfDiagnosticInfo _info;
196PXR_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.