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
errorTransport.h
Go to the documentation of this file.
1//
2// Copyright 2016 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_BASE_TF_ERROR_TRANSPORT_H
8#define PXR_BASE_TF_ERROR_TRANSPORT_H
9
11
12#include "pxr/pxr.h"
14#include "pxr/base/arch/hints.h"
15#include "pxr/base/tf/api.h"
16
17PXR_NAMESPACE_OPEN_SCOPE
18
30{
31public:
32 typedef TfDiagnosticMgr::ErrorList ErrorList;
33
36
39 void Post() {
40 if (ARCH_UNLIKELY(!IsEmpty()))
41 _PostImpl();
42 }
43
46 bool IsEmpty() const { return _errorList.empty(); }
47
51 void swap(TfErrorTransport &other) {
52 _errorList.swap(other._errorList);
53 }
54
55private:
56 friend class TfErrorMark;
57
58 TfErrorTransport(ErrorList &src,
59 ErrorList::iterator first,
60 ErrorList::iterator last) {
61 _errorList.splice(_errorList.begin(), src, first, last);
62 }
63
64 TF_API
65 void _PostImpl();
66
67 ErrorList _errorList;
68};
69
70inline void
72{
73 l.swap(r);
74}
75
76PXR_NAMESPACE_CLOSE_SCOPE
77
78#endif // PXR_BASE_TF_ERROR_TRANSPORT_H
Class used to record the end of the error-list.
Definition: errorMark.h:48
A facility for transporting errors from thread to thread.
void Post()
Post all contained errors to the current thread's error list, leaving this TfErrorTransport empty.
void swap(TfErrorTransport &other)
Swap this TfErrorTransport's content with other.
bool IsEmpty() const
Return true if this TfErrorTransport contains no errors, false otherwise.
TfErrorTransport()
Construct an empty TfErrorTransport.
Compiler hints.