HDK
|
#include <diagnosticBase.h>
Public Member Functions | |
const TfCallContext & | GetContext () const |
Return the call context where the message was issued. More... | |
std::string | GetSourceFileName () const |
Return the source file name that the diagnostic message was posted from. More... | |
size_t | GetSourceLineNumber () const |
std::string const & | GetCommentary () const |
Return the commentary string describing this diagnostic message. More... | |
std::string | GetSourceFunction () const |
Return the source function that the diagnostic message was posted from. More... | |
void | AugmentCommentary (const std::string &s) |
TfEnum | GetDiagnosticCode () const |
Return the diagnostic code posted. More... | |
const std::string & | GetDiagnosticCodeAsString () const |
template<typename T > | |
const T * | GetInfo () const |
void | SetInfo (TfDiagnosticInfo any) |
bool | GetQuiet () const |
TF_API bool | IsFatal () const |
Return true if this diagnostic's code is a fatal code. More... | |
TF_API bool | IsCodingError () const |
TF_API | TfDiagnosticBase (TfEnum code, char const *codeString, TfCallContext const &context, const std::string &commentary, TfDiagnosticInfo info, bool quiet) |
Construct an instance. More... | |
Protected Attributes | |
TfCallContext | _context |
std::string | _commentary |
TfEnum | _code |
std::string | _codeString |
TfDiagnosticInfo | _info |
size_t | _serial = 0 |
bool | _quiet = false |
Friends | |
class | TfDiagnosticMgr |
class | TfErrorTransport |
class | TfErrorMark |
Represents the base class of an object representing a diagnostic message.
This forms the base class for specific types associated with errors, warnings and status messages. It associates a diagnostic code (which is an enum value) with the message. It can also hold on to arbitrary information associated with the message in a TfDiagnosticInfo.
See page_tf_TfError in the C++ API reference for a detailed example. For a description of how to post an error, warning or a status message see TF_ERROR()
, TF_WARN
and TF_STATUS
also in the C++ API reference.
Definition at line 65 of file diagnosticBase.h.
TF_API TfDiagnosticBase::TfDiagnosticBase | ( | TfEnum | code, |
char const * | codeString, | ||
TfCallContext const & | context, | ||
const std::string & | commentary, | ||
TfDiagnosticInfo | info, | ||
bool | quiet | ||
) |
Construct an instance.
|
inline |
Add to the commentary string describing this diagnostic message.
Note: each string added to the commentary is separated from the previous one with a newline. This means that you the string s
should not end with a newline. Thus,
always prints the entire commentary string as a newline separated sequence of messages.
Definition at line 105 of file diagnosticBase.h.
|
inline |
Return the commentary string describing this diagnostic message.
Definition at line 85 of file diagnosticBase.h.
|
inline |
Return the call context where the message was issued.
Definition at line 69 of file diagnosticBase.h.
|
inline |
Return the diagnostic code posted.
Definition at line 115 of file diagnosticBase.h.
|
inline |
Return the diagnostic code posted as a string.
If the enum value posted with the message has been registered with TF_ADD_ENUM_NAME()
, then GetDiagnosticCodeAsString()
will return the symbolic name of the enum.
If the enum has not been registered, then code of the form
will still result in GetDiagnosticCodeAsString()
returning the string "PUCE"; however, code of the form
will result in GetDiagnosticCodeAsString()
returning the (uninformative) string "c".
Definition at line 138 of file diagnosticBase.h.
|
inline |
Return a (possibly NULL) const pointer to the info object associated with this message.
If this message was posted without supplying an info
argument to Post(), e.g.
then GetInfo()
returns NULL. Otherwise, when info is supplied, e.g.
then a const pointer to a copy of myInfo in the above example is returned by GetInfo<T>(). If the type T doesn't match the held type then GetInfo() returns NULL.
Definition at line 162 of file diagnosticBase.h.
|
inline |
Return true if the message was posted via PostQuietly()
.
Notices sent from PostQuietly()
are indicating that an immediate printout of the error is not desirable, because someone higher up on the stack may actually handle this error. This is rare, but it does happen on occasion.
Definition at line 178 of file diagnosticBase.h.
|
inline |
Return the source file name that the diagnostic message was posted from.
Definition at line 74 of file diagnosticBase.h.
|
inline |
Return the source function that the diagnostic message was posted from.
Definition at line 90 of file diagnosticBase.h.
|
inline |
Return the source line number that the diagnostic message was posted from.
Definition at line 80 of file diagnosticBase.h.
TF_API bool TfDiagnosticBase::IsCodingError | ( | ) | const |
Return true if this diagnostic's code is either a fatal or nonfatal coding error.
TF_API bool TfDiagnosticBase::IsFatal | ( | ) | const |
Return true if this diagnostic's code is a fatal code.
|
inline |
Set the info object associated with this diagnostic message.
Definition at line 168 of file diagnosticBase.h.
|
friend |
Definition at line 208 of file diagnosticBase.h.
|
friend |
Definition at line 210 of file diagnosticBase.h.
|
friend |
Definition at line 209 of file diagnosticBase.h.
|
protected |
Definition at line 202 of file diagnosticBase.h.
|
protected |
Definition at line 203 of file diagnosticBase.h.
|
protected |
Definition at line 201 of file diagnosticBase.h.
|
protected |
Definition at line 199 of file diagnosticBase.h.
|
protected |
Definition at line 204 of file diagnosticBase.h.
|
protected |
Definition at line 206 of file diagnosticBase.h.
|
protected |
Definition at line 205 of file diagnosticBase.h.