All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
coalescingDiagnosticDelegate.h
Go to the documentation of this file.
1 //
2 // Copyright 2017 Pixar
3 //
4 // Licensed under the Apache License, Version 2.0 (the "Apache License")
5 // with the following modification; you may not use this file except in
6 // compliance with the Apache License and the following modification to it:
7 // Section 6. Trademarks. is deleted and replaced with:
8 //
9 // 6. Trademarks. This License does not grant permission to use the trade
10 // names, trademarks, service marks, or product names of the Licensor
11 // and its affiliates, except as required to comply with Section 4(c) of
12 // the License and to reproduce the content of the NOTICE file.
13 //
14 // You may obtain a copy of the Apache License at
15 //
16 // http://www.apache.org/licenses/LICENSE-2.0
17 //
18 // Unless required by applicable law or agreed to in writing, software
19 // distributed under the Apache License with the above modification is
20 // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21 // KIND, either express or implied. See the Apache License for the specific
22 // language governing permissions and limitations under the Apache License.
23 //
24 #ifndef PXR_USD_USD_UTILS_COALESCING_DIAGNOSTIC_DELEGATE_H
25 #define PXR_USD_USD_UTILS_COALESCING_DIAGNOSTIC_DELEGATE_H
26 
34 
35 #include "pxr/pxr.h"
36 #include "pxr/usd/usdUtils/api.h"
38 
39 #include <ostream>
40 #include <memory>
41 #include <string>
42 #include <vector>
43 
44 #include <tbb/concurrent_queue.h>
45 
46 PXR_NAMESPACE_OPEN_SCOPE
47 
52  size_t sourceLineNumber;
53  std::string sourceFunction;
54  std::string sourceFileName;
55 };
56 
59  TfCallContext context;
60  std::string commentary;
61 };
62 
68  std::vector<UsdUtilsCoalescingDiagnosticDelegateUnsharedItem> unsharedItems;
69 };
70 
74 typedef std::vector<UsdUtilsCoalescingDiagnosticDelegateItem>
76 
85 public:
86  USDUTILS_API
88 
89  USDUTILS_API
90  virtual ~UsdUtilsCoalescingDiagnosticDelegate();
91 
93 
94  USDUTILS_API
95  virtual void IssueError(const TfError&) override;
96 
97  USDUTILS_API
98  virtual void IssueStatus(const TfStatus&) override;
99 
100  USDUTILS_API
101  virtual void IssueWarning(const TfWarning&) override;
102 
103  USDUTILS_API
104  virtual void IssueFatalError(const TfCallContext&, const std::string &) override;
105 
106  // Methods that provide collection of diagnostics as well as sending
107  // them to a stream(stderr, stdout, a file, etc).
108 
111  USDUTILS_API
112  void DumpCoalescedDiagnostics(std::ostream& ostr);
113 
116  USDUTILS_API
117  void DumpUncoalescedDiagnostics(std::ostream& ostr);
118 
121  USDUTILS_API
123 
126  USDUTILS_API
127  std::vector<std::unique_ptr<TfDiagnosticBase>> TakeUncoalescedDiagnostics();
128 
129 private:
130  tbb::concurrent_queue<TfDiagnosticBase*> _diagnostics;
131 };
132 
133 PXR_NAMESPACE_CLOSE_SCOPE
134 
135 #endif // PXR_USD_USD_UTILS_COALESCING_DIAGNOSTIC_DELEGATE_H
USDUTILS_API void DumpCoalescedDiagnostics(std::ostream &ostr)
Print all pending diagnostics in a coalesced form to ostr.
USDUTILS_API std::vector< std::unique_ptr< TfDiagnosticBase > > TakeUncoalescedDiagnostics()
Get all pending diagnostics without any coalescing.
An item used in coalesced results, containing a shared component: the file/function/line number...
virtual USDUTILS_API void IssueWarning(const TfWarning &) override
Called when a TF_WARNING() is issued.
virtual USDUTILS_API void IssueError(const TfError &) override
Methods that implement the interface provided in TfDiagnosticMgr::Delegate.
virtual USDUTILS_API void IssueFatalError(const TfCallContext &, const std::string &) override
Called when a TF_FATAL_ERROR is issued (or a failed TF_AXIOM).
The unshared component in a coalesced result.
The shared component in a coalesced result This type can be thought of as the key by which we coalesc...
A class which collects warnings and statuses from the Tf diagnostic manager system in a thread safe m...
Represents an object that contains information about a status message.
Definition: status.h:44
Represents an object that contains error information.
Definition: error.h:49
USDUTILS_API void DumpUncoalescedDiagnostics(std::ostream &ostr)
Print all pending diagnostics without any coalescing to ostr.
std::vector< UsdUtilsCoalescingDiagnosticDelegateItem > UsdUtilsCoalescingDiagnosticDelegateVector
A vector of coalesced results, each containing a shared component, the file/function/line number...
USDUTILS_API UsdUtilsCoalescingDiagnosticDelegateVector TakeCoalescedDiagnostics()
Get all pending diagnostics in a coalesced form.
virtual USDUTILS_API void IssueStatus(const TfStatus &) override
Called when a TF_STATUS() is issued.
Represents an object that contains information about a warning.
Definition: warning.h:44
One may set a delegate with the TfDiagnosticMgr which will be called to respond to errors and diagnos...