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

#include <errorMark.h>

Public Types


Public Member Functions

TF_API TfErrorMark ()
TF_API ~TfErrorMark ()
void SetMark ()
bool IsClean () const
bool Clear () const
TfErrorTransport Transport () const
void TransportTo (TfErrorTransport &dest) const
Iterator GetBegin (size_t *nErrors=0) const
Iterator GetEnd () const
Iterator begin () const
 Equivalent to GetBegin() More...
Iterator end () const
 Equivalent to GetEnd() More...


class TfDiagnosticMgr

Detailed Description

Class used to record the end of the error-list.

See page_tf_TfError for a detailed description.

A TfErrorMark is used as follows:

m.SetMark(); // (A)
... ;
... ;
// (B)
if (!m.IsClean()) {
// errors occurred between (A) and (B)

Another common pattern is

if (TF_HAS_ERRORS(m, expr)) {
// handle errors;

Definition at line 64 of file errorMark.h.

Member Typedef Documentation

Constructor & Destructor Documentation

TF_API TfErrorMark::TfErrorMark ( )

Default constructor.

The default constructor automatically calls SetMark() at the point of declaration.

TF_API TfErrorMark::~TfErrorMark ( )

Destroy this ErrorMark.

If this is the last ErrorMark on this thread of execution and there are pending errors, this will report them via the diagnostic delegate (if one is installed) otherwise by printing to stderr.

Member Function Documentation

Iterator TfErrorMark::begin ( void  ) const

Equivalent to GetBegin()

Definition at line 170 of file errorMark.h.

bool TfErrorMark::Clear ( ) const

Remove all errors in this mark from the error system. Return true if any errors were cleared, false if there were no errors in this mark.

Clear all errors contained in this mark from the error system. Subsequently, these errors will be considered handled.

Definition at line 109 of file errorMark.h.

Iterator TfErrorMark::end ( void  ) const

Equivalent to GetEnd()

Definition at line 173 of file errorMark.h.

Iterator TfErrorMark::GetBegin ( size_t *  nErrors = 0) const

Return an iterator to the first error added to the error list after SetMark().

If there are no errors on the error list that were not already present when SetMark() was called, the iterator returned is equal to the iterator returned by TfDiagnosticMgr::GetErrorEnd(). Otherwise, the iterator points to the earliest error added to the list since SetMark() was called.

This function takes O(n) time where n is the number of errors from the end of the list to the mark i.e. GetMark() walks the list from the end until it finds the mark and then returns an iterator to that spot.

If nErrors is non-NULL, then *nErrors is set to the number of errors between the returned iterator and the end of the list.

Definition at line 156 of file errorMark.h.

Iterator TfErrorMark::GetEnd ( ) const

Return an iterator past the last error in the error system.

This iterator is always equivalent to the iterator returned by TfDiagnosticMgr::GetErrorEnd().

Definition at line 165 of file errorMark.h.

bool TfErrorMark::IsClean ( ) const

Return true if no new errors were posted in this thread since the last call to SetMark(), false otherwise.

When no threads are issuing errors the cost of this function is an atomic integer read and comparison. Otherwise thread-specific data is accessed to make the determination. Thus, this function is fast when diagnostics are not being issued.

Definition at line 99 of file errorMark.h.

void TfErrorMark::SetMark ( )

Record future errors.

SetMark() arranges to record future errors in *this.

Definition at line 88 of file errorMark.h.

TfErrorTransport TfErrorMark::Transport ( ) const

Remove all errors in this mark fom the error system and return them in a TfErrorTransport.

This can be used to transfer errors from one thread to another. See TfErrorTransport for more information. As with Clear(), all the removed errors are considered handled for this thread. See also TransportTo().

Definition at line 126 of file errorMark.h.

void TfErrorMark::TransportTo ( TfErrorTransport dest) const

Remove all errors in this mark fom the error system and return them in a TfErrorTransport.

This is a variant of Transport(). Instead of returning a new TfErrorTransport object it fills an existing one.

Definition at line 137 of file errorMark.h.

Friends And Related Function Documentation

friend class TfDiagnosticMgr

Definition at line 176 of file errorMark.h.

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