All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
changeManager.h
Go to the documentation of this file.
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 SDF_CHANGEMANAGER_H
25 #define SDF_CHANGEMANAGER_H
26 
28 
29 #include "pxr/pxr.h"
30 #include "pxr/usd/sdf/changeList.h"
31 #include "pxr/usd/sdf/declareHandles.h"
32 #include "pxr/usd/sdf/spec.h"
33 #include "pxr/base/tf/singleton.h"
34 
35 #include <boost/noncopyable.hpp>
36 #include <tbb/enumerable_thread_specific.h>
37 #include <string>
38 #include <vector>
39 
40 PXR_NAMESPACE_OPEN_SCOPE
41 
42 SDF_DECLARE_HANDLES(SdfLayer);
43 
44 class SdfSpec;
45 
56 class Sdf_ChangeManager : boost::noncopyable {
57 public:
58  SDF_API
59  static Sdf_ChangeManager& Get() {
61  }
62 
63  // Queue notifications.
64  void DidReplaceLayerContent(const SdfLayerHandle &layer);
65  void DidReloadLayerContent(const SdfLayerHandle &layer);
66  void DidChangeLayerIdentifier(const SdfLayerHandle &layer,
67  const std::string &oldIdentifier);
68  void DidChangeLayerResolvedPath(const SdfLayerHandle &layer);
69  void DidChangeField(const SdfLayerHandle &layer,
70  const SdfPath & path, const TfToken &field,
71  const VtValue & oldValue, const VtValue & newValue );
72  void DidChangeAttributeTimeSamples(const SdfLayerHandle &layer,
73  const SdfPath &attrPath);
74 
75  // Spec changes.
76  void DidMoveSpec(const SdfLayerHandle &layer,
77  const SdfPath & oldPath, const SdfPath & newPath);
78  void DidAddSpec(const SdfLayerHandle &layer, const SdfPath &path,
79  bool inert);
80  void DidRemoveSpec(const SdfLayerHandle &layer, const SdfPath &path,
81  bool inert);
82  void RemoveSpecIfInert(const SdfSpec&);
83 
84  // Open/close change blocks. SdfChangeBlock provides stack-based management
85  // of change blocks and should be preferred over this API.
86  SDF_API
87  void OpenChangeBlock();
88  SDF_API
89  void CloseChangeBlock();
90 
91 private:
92  Sdf_ChangeManager();
93  ~Sdf_ChangeManager();
94 
95  void _SendNoticesForChangeList( const SdfLayerHandle & layer,
96  const SdfChangeList & changeList );
97  void _SendNotices();
98 
99  void _ProcessRemoveIfInert();
100 
101 private:
102  struct _Data {
103  _Data();
104  SdfLayerChangeListMap changes;
105  int changeBlockDepth;
106  std::vector<SdfSpec> removeIfInert;
107  };
108 
109  tbb::enumerable_thread_specific<_Data> _data;
110 
111  friend class TfSingleton<Sdf_ChangeManager>;
112 };
113 
114 SDF_API_TEMPLATE_CLASS(TfSingleton<Sdf_ChangeManager>);
115 
116 PXR_NAMESPACE_CLOSE_SCOPE
117 
118 #endif // SDF_CHANGEMANAGER_H
A unit of scene description that you combine with other units of scene description to form a shot...
Definition: layer.h:93
Manage a single instance of an object (see.
Definition: singleton.h:122
Base class for all Sdf spec classes.
Definition: spec.h:51
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:89
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:287
static T & GetInstance()
Return a reference to an object of type T, creating it if necessary.
Definition: singleton.h:137
A list of scene description modifications, organized by the namespace paths where the changes occur...
Definition: changeList.h:49
Provides a container which may hold any type, and provides introspection and iteration over array typ...
Definition: value.h:182