All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
conditionalAbortDiagnosticDelegate.h
1//
2// Copyright 2020 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_CONDITIONAL_ABORT_DIAGNOSTIC_DELEGATE_H
8#define PXR_USD_USD_UTILS_CONDITIONAL_ABORT_DIAGNOSTIC_DELEGATE_H
9
10#include "pxr/pxr.h"
11#include "pxr/usd/usdUtils/api.h"
13
14#include <string>
15#include <vector>
16
17PXR_NAMESPACE_OPEN_SCOPE
18
20
28{
29public:
31 USDUTILS_API
33 const std::vector<std::string>& stringFilters,
34 const std::vector<std::string>& codePathFilters);
35
36 const std::vector<std::string>& GetStringFilters() const {
37 return _stringFilters;
38 };
39
40 const std::vector<std::string>& GetCodePathFilters() const {
41 return _codePathFilters;
42 }
43
44 USDUTILS_API
45 void SetStringFilters(const std::vector<std::string>& stringFilters);
46 USDUTILS_API
47 void SetCodePathFilters(const std::vector<std::string>& codePathFilters);
48private:
49 std::vector<std::string> _stringFilters;
50 std::vector<std::string> _codePathFilters;
51};
52
81{
82public:
83
88 USDUTILS_API
91 includeFilters,
93 excludeFilters);
94
96 USDUTILS_API
98
101 const UsdUtilsConditionalAbortDiagnosticDelegate& delegate) = delete;
103 const UsdUtilsConditionalAbortDiagnosticDelegate& delegate) = delete;
104
105 // Interface overrides
106 void IssueError(const TfError& err) override;
107 void IssueWarning(const TfWarning& warning) override;
108 void IssueFatalError(const TfCallContext &ctx,
109 const std::string &msg) override;
110 // Following will be no-ops for our purposes - prints same message as
111 // DiagnosticMgr
112 void IssueStatus(const TfStatus& status) override;
113
114private:
115
116 const std::vector<TfPatternMatcher> _includePatternStringFilters;
117 const std::vector<TfPatternMatcher> _includePatternCodePathFilters;
118 const std::vector<TfPatternMatcher> _excludePatternStringFilters;
119 const std::vector<TfPatternMatcher> _excludePatternCodePathFilters;
120
121protected:
124 virtual bool _RuleMatcher(const TfDiagnosticBase& err,
125 const std::vector<TfPatternMatcher>& stringPatternFilters,
126 const std::vector<TfPatternMatcher>& codePathPatternFilters);
127};
128
129
130PXR_NAMESPACE_CLOSE_SCOPE
131
132#endif
Represents the base class of an object representing a diagnostic message.
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
Class for matching regular expressions.
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 represents the inclusion exclusion filters on which errors will be matched stringFilter...
A class that allows client application to instantiate a diagnostic delegate that can be used to abort...
virtual USDUTILS_API ~UsdUtilsConditionalAbortDiagnosticDelegate()
Handles the removal of this delegate from TfDiagnosticMgr.
virtual bool _RuleMatcher(const TfDiagnosticBase &err, const std::vector< TfPatternMatcher > &stringPatternFilters, const std::vector< TfPatternMatcher > &codePathPatternFilters)
Helper to match err against a given set of errorFilters A client can override this to affect the beha...
USDUTILS_API UsdUtilsConditionalAbortDiagnosticDelegate(const UsdUtilsConditionalAbortDiagnosticDelegateErrorFilters &includeFilters, const UsdUtilsConditionalAbortDiagnosticDelegateErrorFilters &excludeFilters)
Constructor to initialize conditionalAbortDiagnosticDelegate.
void IssueStatus(const TfStatus &status) override
Called when a TF_STATUS() is issued.
void IssueFatalError(const TfCallContext &ctx, const std::string &msg) override
Called when a TF_FATAL_ERROR is issued (or a failed TF_AXIOM).
void IssueError(const TfError &err) override
Called when a TfError is posted.
void IssueWarning(const TfWarning &warning) override
Called when a TF_WARNING() is issued.