This document is for a version of USD that is under development. See this page for the current release.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
coalescingDiagnosticDelegate.h
Go to the documentation of this file.
1//
2// Copyright 2017 Pixar
3//
4// Licensed under the terms set forth in the LICENSE.txt file available at
5// https://openusd.org/license.
6//
7#ifndef PXR_USD_USD_UTILS_COALESCING_DIAGNOSTIC_DELEGATE_H
8#define PXR_USD_USD_UTILS_COALESCING_DIAGNOSTIC_DELEGATE_H
9
17
18#include "pxr/pxr.h"
19#include "pxr/usd/usdUtils/api.h"
21
22#include <ostream>
23#include <memory>
24#include <string>
25#include <vector>
26
27#include <tbb/concurrent_queue.h>
28
29PXR_NAMESPACE_OPEN_SCOPE
30
35 size_t sourceLineNumber;
36 std::string sourceFunction;
37 std::string sourceFileName;
38};
39
42 TfCallContext context;
43 std::string commentary;
44};
45
51 std::vector<UsdUtilsCoalescingDiagnosticDelegateUnsharedItem> unsharedItems;
52};
53
57typedef std::vector<UsdUtilsCoalescingDiagnosticDelegateItem>
59
68public:
69 USDUTILS_API
71
72 USDUTILS_API
74
76
77 USDUTILS_API
78 virtual void IssueError(const TfError&) override;
79
80 USDUTILS_API
81 virtual void IssueStatus(const TfStatus&) override;
82
83 USDUTILS_API
84 virtual void IssueWarning(const TfWarning&) override;
85
86 USDUTILS_API
87 virtual void IssueFatalError(const TfCallContext&, const std::string &) override;
88
89 // Methods that provide collection of diagnostics as well as sending
90 // them to a stream(stderr, stdout, a file, etc).
91
94 USDUTILS_API
95 void DumpCoalescedDiagnostics(std::ostream& ostr);
96
99 USDUTILS_API
100 void DumpUncoalescedDiagnostics(std::ostream& ostr);
101
104 USDUTILS_API
106
109 USDUTILS_API
110 std::vector<std::unique_ptr<TfDiagnosticBase>> TakeUncoalescedDiagnostics();
111
112private:
113 tbb::concurrent_queue<TfDiagnosticBase*> _diagnostics;
114};
115
116PXR_NAMESPACE_CLOSE_SCOPE
117
118#endif // PXR_USD_USD_UTILS_COALESCING_DIAGNOSTIC_DELEGATE_H
One may set a delegate with the TfDiagnosticMgr which will be called to respond to errors and diagnos...
Represents an object that contains error information.
Definition: error.h:32
Represents an object that contains information about a status message.
Definition: status.h:28
Represents an object that contains information about a warning.
Definition: warning.h:28
A class which collects warnings and statuses from the Tf diagnostic manager system in a thread safe m...
virtual USDUTILS_API void IssueStatus(const TfStatus &) override
Called when a TF_STATUS() is issued.
USDUTILS_API void DumpUncoalescedDiagnostics(std::ostream &ostr)
Print all pending diagnostics without any coalescing to ostr.
USDUTILS_API std::vector< std::unique_ptr< TfDiagnosticBase > > TakeUncoalescedDiagnostics()
Get all pending diagnostics without any coalescing.
virtual USDUTILS_API void IssueWarning(const TfWarning &) override
Called when a TF_WARNING() is issued.
virtual USDUTILS_API void IssueFatalError(const TfCallContext &, const std::string &) override
Called when a TF_FATAL_ERROR is issued (or a failed TF_AXIOM).
virtual USDUTILS_API void IssueError(const TfError &) override
Methods that implement the interface provided in TfDiagnosticMgr::Delegate.
USDUTILS_API UsdUtilsCoalescingDiagnosticDelegateVector TakeCoalescedDiagnostics()
Get all pending diagnostics in a coalesced form.
USDUTILS_API void DumpCoalescedDiagnostics(std::ostream &ostr)
Print all pending diagnostics in a coalesced form to ostr.
std::vector< UsdUtilsCoalescingDiagnosticDelegateItem > UsdUtilsCoalescingDiagnosticDelegateVector
A vector of coalesced results, each containing a shared component, the file/function/line number,...
An item used in coalesced results, containing a shared component: the file/function/line number,...
The shared component in a coalesced result This type can be thought of as the key by which we coalesc...
The unshared component in a coalesced result.