Loading...
Searching...
No Matches
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 _pin = {};
43 }
44
47 bool IsEmpty() const { return _errorList.empty(); }
48
52 void swap(TfErrorTransport &other) {
53 _errorList.swap(other._errorList);
54 std::swap(_pin, other._pin);
55 }
56
57private:
58 friend class Tf_DiagnosticMgrTestAccess;
59 friend class TfErrorMark;
60
61 TfErrorTransport(ErrorList &src,
62 ErrorList::iterator first,
63 ErrorList::iterator last,
64 TfDiagnosticMgr::_LogTextPin &&pin)
65 : _pin(std::move(pin))
66 {
67 _errorList.splice(_errorList.begin(), src, first, last);
68 }
69
70 TF_API
71 void _PostImpl();
72
73 ErrorList _errorList;
74 TfDiagnosticMgr::_LogTextPin _pin;
75};
76
77inline void
79{
80 l.swap(r);
81}
82
83PXR_NAMESPACE_CLOSE_SCOPE
84
85#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.
STL namespace.