HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
raii.h
Go to the documentation of this file.
1 //
2 // Copyright 2024 Pixar
3 //
4 // Licensed under the terms set forth in the LICENSE.txt file available at
5 // https://openusd.org/license.
6 //
7 
8 #ifndef PXR_BASE_TS_RAII_H
9 #define PXR_BASE_TS_RAII_H
10 
11 #include "pxr/pxr.h"
12 #include "pxr/base/ts/api.h"
13 #include "pxr/base/ts/types.h"
14 #include "pxr/base/tf/stacked.h"
15 
17 
18 
19 #ifdef doxygen
20 
21 /// RAII helper class that locally sets the anti-regression authoring mode.
22 /// The effect lasts as long as the object exists. The effect is limited to
23 /// the calling thread. Multiple instances on the same thread will stack.
24 class TsAntiRegressionAuthoringSelector
25 {
26 public:
27  TsAntiRegressionAuthoringSelector(TsAntiRegressionMode mode);
28 };
29 
30 #else
31 
33  TsAntiRegressionAuthoringSelector, /* perThread = */ true, TS_API)
34 {
35 public:
36  TsAntiRegressionAuthoringSelector(TsAntiRegressionMode mode) : mode(mode) {}
38 };
39 
40 #endif // doxygen
41 
42 
43 #ifdef doxygen
44 
45 /// RAII helper class that temporarily prevents automatic behaviors when editing
46 /// splines. Currently this includes anti-regression.
47 class TsEditBehaviorBlock
48 {
49 public:
50  TsEditBehaviorBlock();
51 };
52 
53 #else
54 
56  TsEditBehaviorBlock, /* perThread = */ true, TS_API)
57 {
58 };
59 
60 #endif // doxygen
61 
62 
64 
65 #endif
TsAntiRegressionMode
Definition: types.h:272
PXR_NAMESPACE_OPEN_SCOPE TF_DEFINE_STACKED(TsAntiRegressionAuthoringSelector, true, TS_API)
Definition: raii.h:32
#define TS_API
Definition: api.h:24
GLenum mode
Definition: glcorearb.h:99
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1425
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74