HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TfDiagnosticMgr Class Reference

#include <diagnosticMgr.h>

+ Inheritance diagram for TfDiagnosticMgr:

Classes

class  Delegate
 
struct  FatalHelper
 
struct  StatusHelper
 
struct  WarningHelper
 

Public Types

typedef TfDiagnosticMgr This
 
typedef std::list< TfErrorErrorList
 
typedef ErrorList::iterator ErrorIterator
 

Public Member Functions

TF_API void AddDelegate (Delegate *delegate)
 
TF_API void RemoveDelegate (Delegate *delegate)
 
TF_API void SetQuiet (bool quiet)
 
ErrorIterator GetErrorBegin ()
 Return an iterator to the beginning of this thread's error list. More...
 
ErrorIterator GetErrorEnd ()
 Return an iterator to the end of this thread's error list. More...
 
TF_API ErrorIterator EraseError (ErrorIterator i)
 
TF_API ErrorIterator EraseRange (ErrorIterator first, ErrorIterator last)
 
TF_API void AppendError (TfError const &e)
 
TF_API void PostError (TfEnum errorCode, const char *errorCodeString, TfCallContext const &context, const std::string &commentary, TfDiagnosticInfo info, bool quiet)
 
TF_API void PostError (const TfDiagnosticBase &diagnostic)
 
TF_API void PostWarning (TfEnum warningCode, const char *warningCodeString, TfCallContext const &context, std::string const &commentary, TfDiagnosticInfo info, bool quiet) const
 
TF_API void PostWarning (const TfDiagnosticBase &diagnostic) const
 
TF_API void PostStatus (TfEnum statusCode, const char *statusCodeString, TfCallContext const &context, std::string const &commentary, TfDiagnosticInfo info, bool quiet) const
 
TF_API void PostStatus (const TfDiagnosticBase &diagnostic) const
 
TF_API void PostFatal (TfCallContext const &context, TfEnum statusCode, std::string const &msg) const
 
bool HasActiveErrorMark ()
 
- Public Member Functions inherited from TfWeakBase
 TfWeakBase ()
 
 TfWeakBase (const TfWeakBase &)
 
const TfWeakBase__GetTfWeakBase__ () const
 
const TfWeakBaseoperator= (const TfWeakBase &)
 
void EnableNotification2 () const
 
TF_API void constGetUniqueIdentifier () const
 

Static Public Member Functions

static TF_API std::string GetCodeName (const TfEnum &code)
 Returns the name of the given diagnostic code. More...
 
static TF_API std::string FormatDiagnostic (const TfEnum &code, const TfCallContext &context, const std::string &msg, const TfDiagnosticInfo &info)
 
static TF_API ThisGetInstance ()
 Return the singleton instance. More...
 

Friends

class TfSingleton< This >
 
class TfError
 
class TfErrorTransport
 
class TfErrorMark
 

Additional Inherited Members

- Protected Member Functions inherited from TfWeakBase
 ~TfWeakBase ()
 
TfRefPtr< Tf_Remnant_Register () const
 
template<class T >
TfRefPtr< Tf_Remnant_Register (T *tempRmnt) const
 
bool _HasRemnant () const
 

Detailed Description

Singleton class through which all errors and diagnostics pass.

Definition at line 71 of file diagnosticMgr.h.

Member Typedef Documentation

typedef ErrorList::iterator TfDiagnosticMgr::ErrorIterator

Synonym for standard STL iterator to traverse the error list.

The error list for a thread is an STL list. The ErrorIterator type is an STL iterator and can be used without restriction in any way that it is legal to use an STL iterator.

Given an iterator, one accesses the error in the standard STL fashion:

... ;
if (!m.IsClean()) {
for (i = m.GetBegin(); i != m.GetEnd(); ++i) {
cout << "file = " << i->GetSourceFileName()
<< "line = " << i->GetSourceLineNumber() << "\n";
}

Definition at line 96 of file diagnosticMgr.h.

typedef std::list<TfError> TfDiagnosticMgr::ErrorList

Definition at line 76 of file diagnosticMgr.h.

Definition at line 74 of file diagnosticMgr.h.

Member Function Documentation

TF_API void TfDiagnosticMgr::AddDelegate ( Delegate delegate)

Add the delegate delegate to the list of current delegates.

This will add the delegate even if it already exists in the list.

Each delegate will be called when diagnostics and errors are invoked

This function is thread safe.

TF_API void TfDiagnosticMgr::AppendError ( TfError const e)

Append an error to the list of active errors. This is generally not meant to be called by user code. It is public so that the system which translates tf errors to and from python exceptions can manage errors.

TF_API ErrorIterator TfDiagnosticMgr::EraseError ( ErrorIterator  i)

Remove error specified by iterator i.

Deprecated:
Use TfErrorMark instead.
TF_API ErrorIterator TfDiagnosticMgr::EraseRange ( ErrorIterator  first,
ErrorIterator  last 
)

Remove all the errors in [first, last) from this thread's error stream. This should generally not be invoked directly. Use TfErrorMark instead.

static TF_API std::string TfDiagnosticMgr::FormatDiagnostic ( const TfEnum code,
const TfCallContext context,
const std::string msg,
const TfDiagnosticInfo info 
)
static

Return a human-readable diagnostic message. The TfDiagnosticMgr uses this function to print diagnostics when no diagnostic delegates are installed. Diagnostic delegate implementations can call this to produce messages in the same format, if desired.

static TF_API std::string TfDiagnosticMgr::GetCodeName ( const TfEnum code)
static

Returns the name of the given diagnostic code.

ErrorIterator TfDiagnosticMgr::GetErrorBegin ( )
inline

Return an iterator to the beginning of this thread's error list.

Definition at line 182 of file diagnosticMgr.h.

ErrorIterator TfDiagnosticMgr::GetErrorEnd ( )
inline

Return an iterator to the end of this thread's error list.

Definition at line 185 of file diagnosticMgr.h.

static TF_API This& TfDiagnosticMgr::GetInstance ( )
inlinestatic

Return the singleton instance.

Definition at line 156 of file diagnosticMgr.h.

bool TfDiagnosticMgr::HasActiveErrorMark ( )
inline

Return true if an instance of TfErrorMark exists in the current thread of execution, false otherwise.

Definition at line 267 of file diagnosticMgr.h.

TF_API void TfDiagnosticMgr::PostError ( TfEnum  errorCode,
const char *  errorCodeString,
TfCallContext const context,
const std::string commentary,
TfDiagnosticInfo  info,
bool  quiet 
)

This method will create a TfError, append it to the error list, and pass it to all delegates.

If no delegates have been registered and no error mark is active, this method will print the error to stderr.

TF_API void TfDiagnosticMgr::PostError ( const TfDiagnosticBase diagnostic)

This method will create a TfError, append it to the error list, and pass it to all delegates.

If no delegates have been registered and no error mark is active, this method will print the error to stderr.

TF_API void TfDiagnosticMgr::PostFatal ( TfCallContext const context,
TfEnum  statusCode,
std::string const msg 
) const

This method will issue a fatal error to all delegates.

If no delegates have been registered, or if none of the delegates abort the process, this method will print the error msg and abort the process.

TF_API void TfDiagnosticMgr::PostStatus ( TfEnum  statusCode,
const char *  statusCodeString,
TfCallContext const context,
std::string const commentary,
TfDiagnosticInfo  info,
bool  quiet 
) const

This method will create a TfStatus and pass it to all delegates.

If no delegates have been registered, this method will print the status msg to stderr.

TF_API void TfDiagnosticMgr::PostStatus ( const TfDiagnosticBase diagnostic) const

This method will create a TfStatus and pass it to all delegates.

If no delegates have been registered, this method will print the status msg to stderr.

TF_API void TfDiagnosticMgr::PostWarning ( TfEnum  warningCode,
const char *  warningCodeString,
TfCallContext const context,
std::string const commentary,
TfDiagnosticInfo  info,
bool  quiet 
) const

This method will create a TfWarning and pass it to all delegates.

If no delegates have been registered, this method will print the warning msg to stderr.

TF_API void TfDiagnosticMgr::PostWarning ( const TfDiagnosticBase diagnostic) const

This method will create a TfWarning and pass it to all delegates.

If no delegates have been registered, this method will print the warning msg to stderr.

TF_API void TfDiagnosticMgr::RemoveDelegate ( Delegate delegate)

Removes all delegates equal to delegate from the current delegates.

This function is thread safe.

TF_API void TfDiagnosticMgr::SetQuiet ( bool  quiet)
inline

Set whether errors, warnings and status messages should be printed out to the terminal.

Definition at line 179 of file diagnosticMgr.h.

Friends And Related Function Documentation

friend class TfError
friend

Definition at line 465 of file diagnosticMgr.h.

friend class TfErrorMark
friend

Definition at line 467 of file diagnosticMgr.h.

friend class TfErrorTransport
friend

Definition at line 466 of file diagnosticMgr.h.

friend class TfSingleton< This >
friend

Definition at line 396 of file diagnosticMgr.h.


The documentation for this class was generated from the following file: