Loading...
Searching...
No Matches
TfDiagnosticTransport Class Reference

A facility for transporting diagnostics from thread to thread. More...

#include <diagnosticTransport.h>

Public Member Functions

 TfDiagnosticTransport ()=default
 Construct an empty TfDiagnosticTransport.
 
 TfDiagnosticTransport (TfDiagnosticTransport &&)=default
 
TfDiagnosticTransportoperator= (TfDiagnosticTransport &&)=default
 
 TfDiagnosticTransport (const TfDiagnosticTransport &)=delete
 
TfDiagnosticTransportoperator= (const TfDiagnosticTransport &)=delete
 
bool IsEmpty () const
 Return true if this transport contains no diagnostics.
 
void Post ()
 Post all contained diagnostics to the current thread in the order they were originally issued, leaving this transport empty.
 

Friends

class TfDiagnosticTrap
 

Detailed Description

A facility for transporting diagnostics from thread to thread.

Typical use is to install a TfDiagnosticTrap in a child thread to intercept diagnostics, then call TfDiagnosticTrap::Transport() to move the accumulated diagnostics into a TfDiagnosticTransport. The parent thread then calls Post() after joining to re-post the transported diagnostics to its own thread, where they will be caught by any active TfDiagnosticTrap or forwarded to diagnostic delegates.

Example usage:

tbb::concurrent_vector<TfDiagnosticTransport> transports;
// In each child task:
DoWork();
if (!trap.IsClean()) {
transports.push_back(trap.Transport());
}
// After joining, on the parent thread:
for (auto &transport : transports) {
transport.Post();
}
A scoped, stack-based mechanism for intercepting and examining diagnostics issued on the current thre...
TF_API TfDiagnosticTransport Transport()
Move all accumulated diagnostics into a TfDiagnosticTransport, leaving this trap active but empty.
TF_API bool IsClean() const
Return true if no diagnostics have been captured.
Note
TfDiagnosticTransport has no thread affinity of its own. Post() should be called on the thread that should receive the diagnostics.

Definition at line 61 of file diagnosticTransport.h.

Constructor & Destructor Documentation

◆ TfDiagnosticTransport()

TfDiagnosticTransport ( )
default

Construct an empty TfDiagnosticTransport.

Member Function Documentation

◆ IsEmpty()

bool IsEmpty ( ) const
inline

Return true if this transport contains no diagnostics.

Definition at line 74 of file diagnosticTransport.h.

◆ Post()

void Post ( )
inline

Post all contained diagnostics to the current thread in the order they were originally issued, leaving this transport empty.

Definition at line 80 of file diagnosticTransport.h.

Friends And Related Function Documentation

◆ TfDiagnosticTrap

friend class TfDiagnosticTrap
friend

Definition at line 85 of file diagnosticTransport.h.


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