scopeDescription.h
1
//
2
// Copyright 2016 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_BASE_TF_SCOPE_DESCRIPTION_H
25
#define PXR_BASE_TF_SCOPE_DESCRIPTION_H
26
27
#include "
pxr/pxr.h
"
28
29
#include "
pxr/base/tf/callContext.h
"
30
#include "
pxr/base/tf/preprocessorUtils.h
"
31
#include "
pxr/base/tf/stringUtils.h
"
32
#include "pxr/base/tf/api.h"
33
34
#include <boost/optional.hpp>
35
#include <boost/preprocessor/if.hpp>
36
37
#include <vector>
38
#include <string>
39
40
PXR_NAMESPACE_OPEN_SCOPE
41
52
class
TfScopeDescription
53
{
54
TfScopeDescription
() =
delete
;
55
TfScopeDescription
(
TfScopeDescription
const
&) =
delete
;
56
TfScopeDescription
&operator=(
TfScopeDescription
const
&) =
delete
;
57
public
:
61
TF_API
explicit
62
TfScopeDescription
(std::string
const
&description,
63
TfCallContext
const
&context = TfCallContext());
64
68
TF_API
explicit
69
TfScopeDescription
(std::string &&description,
70
TfCallContext
const
&context = TfCallContext());
71
75
TF_API
explicit
76
TfScopeDescription
(
char
const
*description,
77
TfCallContext
const
&context = TfCallContext());
78
81
TF_API
~TfScopeDescription
();
82
86
TF_API
void
SetDescription
(std::string
const
&description);
87
90
TF_API
void
SetDescription
(std::string &&description);
91
95
TF_API
void
SetDescription
(
char
const
*description);
96
97
private
:
98
friend
inline
TfScopeDescription
*
99
Tf_GetPreviousScopeDescription(
TfScopeDescription
*d) {
100
return
d->_prev;
101
}
102
friend
inline
char
const
*
103
Tf_GetScopeDescriptionText(
TfScopeDescription
*d) {
104
return
d->_description;
105
}
106
friend
inline
TfCallContext
const
&
107
Tf_GetScopeDescriptionContext(
TfScopeDescription
*d) {
108
return
d->_context;
109
}
110
111
inline
void
_Push();
112
inline
void
_Pop()
const
;
113
114
boost::optional<std::string> _ownedString;
115
char
const
*_description;
116
TfCallContext _context;
117
void
*_localStack;
118
TfScopeDescription
*_prev;
// link to parent scope.
119
};
120
125
TF_API std::vector<std::string>
126
TfGetCurrentScopeDescriptionStack();
127
131
TF_API std::vector<std::string>
132
TfGetThisThreadScopeDescriptionStack();
133
136
#define TF_DESCRIBE_SCOPE(fmt, ...) \
137
TfScopeDescription __scope_description__ \
138
(BOOST_PP_IF(TF_NUM_ARGS(__VA_ARGS__), \
139
TfStringPrintf(fmt, __VA_ARGS__), fmt), TF_CALL_CONTEXT)
140
141
PXR_NAMESPACE_CLOSE_SCOPE
142
143
#endif // PXR_BASE_TF_SCOPE_DESCRIPTION_H
callContext.h
Functions for recording call locations.
TfScopeDescription::~TfScopeDescription
TF_API ~TfScopeDescription()
Destructor.
stringUtils.h
Definitions of basic string utilities in tf.
preprocessorUtils.h
pxr.h
TfScopeDescription::SetDescription
TF_API void SetDescription(std::string const &description)
Replace the description stack entry for this scope description.
TfScopeDescription
This class is used to provide high-level descriptions about scopes of execution that could possibly b...
Definition:
scopeDescription.h:52
pxr
base
tf
scopeDescription.h
Generated on Wed Jan 25 2023 23:08:43 for Universal Scene Description by
1.8.15