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

Singleton class through which all errors and diagnostics pass. More...

+ Inheritance diagram for TfDiagnosticMgr:

Classes

class  Delegate
 One may set a delegate with the TfDiagnosticMgr which will be called to respond to errors and diagnostics. More...
 

Public Types

typedef TfDiagnosticMgr This
 
typedef std::list< TfErrorErrorList
 
typedef ErrorList::iterator ErrorIterator
 Synonym for standard STL iterator to traverse the error list. More...
 

Public Member Functions

TF_API void AddDelegate (Delegate *delegate)
 Add the delegate delegate to the list of current delegates. More...
 
TF_API void RemoveDelegate (Delegate *delegate)
 Removes all delegates equal to delegate from the current delegates. More...
 
TF_API void SetQuiet (bool quiet)
 Set whether errors, warnings and status messages should be printed out to the terminal. More...
 
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)
 Remove error specified by iterator i. More...
 
TF_API ErrorIterator EraseRange (ErrorIterator first, ErrorIterator last)
 Remove all the errors in [first, last) from this thread's error stream. More...
 
TF_API void AppendError (TfError const &e)
 Append an error to the list of active errors. More...
 
TF_API void PostError (TfEnum errorCode, const char *errorCodeString, TfCallContext const &context, const std::string &commentary, TfDiagnosticInfo info, bool quiet)
 If called in a main thread, this method will create a TfError, append it to the error list, and pass it to the delegate. More...
 
TF_API void PostError (const TfDiagnosticBase &diagnostic)
 If called in a main thread, this method will create a TfError, append it to the error list, and pass it to the delegate. More...
 
TF_API void PostWarning (TfEnum warningCode, const char *warningCodeString, TfCallContext const &context, std::string const &commentary, TfDiagnosticInfo info, bool quiet) const
 If called in a non-main thread, this method will print the warning msg rather than passing it to the delegate. More...
 
TF_API void PostWarning (const TfDiagnosticBase &diagnostic) const
 If called in a non-main thread, this method will print the warning msg rather than passing it to the delegate. More...
 
TF_API void PostStatus (TfEnum statusCode, const char *statusCodeString, TfCallContext const &context, std::string const &commentary, TfDiagnosticInfo info, bool quiet) const
 If called in a non-main thread, this method will print the status msg rather than passing it to the delegate. More...
 
TF_API void PostStatus (const TfDiagnosticBase &diagnostic) const
 If called in a non-main thread, this method will print the status msg rather than passing it to the delegate. More...
 
TF_API void PostFatal (TfCallContext const &context, TfEnum statusCode, std::string const &msg) const
 If called in a non-main thread, this method will print the error msg and handle the fatal error itself rather than passing it to the delegate. More...
 
bool HasActiveErrorMark ()
 Return true if an instance of TfErrorMark exists in the current thread of execution, false otherwise. More...
 
- Public Member Functions inherited from TfWeakBase
 TfWeakBase (const TfWeakBase &)
 
const TfWeakBase__GetTfWeakBase__ () const
 
const TfWeakBaseoperator= (const TfWeakBase &)
 
void EnableNotification2 () const
 
TF_API void const * GetUniqueIdentifier () 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 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
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 70 of file diagnosticMgr.h.

Member Typedef Documentation

typedef ErrorList::iterator 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()) {
* TfErrorMark::Iterator i;
* for (i = m.GetBegin(); i != m.GetEnd(); ++i) {
* cout << "file = " << i->GetSourceFileName()
* << "line = " << i->GetSourceLineNumber() << "\n";
* }
*

Definition at line 95 of file diagnosticMgr.h.

Member Function Documentation

TF_API void 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 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 EraseError ( ErrorIterator  i)

Remove error specified by iterator i.

Deprecated:
Use TfErrorMark instead.
TF_API ErrorIterator 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 GetCodeName ( const TfEnum code)
static

Returns the name of the given diagnostic code.

ErrorIterator GetErrorBegin ( )
inline

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

Definition at line 172 of file diagnosticMgr.h.

ErrorIterator GetErrorEnd ( )
inline

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

Definition at line 175 of file diagnosticMgr.h.

static TF_API This& GetInstance ( )
inlinestatic

Return the singleton instance.

Definition at line 146 of file diagnosticMgr.h.

bool HasActiveErrorMark ( )
inline

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

Definition at line 249 of file diagnosticMgr.h.

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

If called in a main thread, this method will create a TfError, append it to the error list, and pass it to the delegate.

If called in a non-main thread, this method will print the error to stderr and will not add it to the error list or pass it to the delegate.

TF_API void PostError ( const TfDiagnosticBase diagnostic)

If called in a main thread, this method will create a TfError, append it to the error list, and pass it to the delegate.

If called in a non-main thread, this method will print the error to stderr and will not add it to the error list or pass it to the delegate.

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

If called in a non-main thread, this method will print the error msg and handle the fatal error itself rather than passing it to the delegate.

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

If called in a non-main thread, this method will print the status msg rather than passing it to the delegate.

TF_API void PostStatus ( const TfDiagnosticBase diagnostic) const

If called in a non-main thread, this method will print the status msg rather than passing it to the delegate.

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

If called in a non-main thread, this method will print the warning msg rather than passing it to the delegate.

TF_API void PostWarning ( const TfDiagnosticBase diagnostic) const

If called in a non-main thread, this method will print the warning msg rather than passing it to the delegate.

TF_API void RemoveDelegate ( Delegate delegate)

Removes all delegates equal to delegate from the current delegates.

This function is thread safe.

TF_API void SetQuiet ( bool  quiet)
inline

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

Definition at line 169 of file diagnosticMgr.h.


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