HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
dependency.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 PXR_USD_PCP_DEPENDENCY_H
25 #define PXR_USD_PCP_DEPENDENCY_H
26 
27 #include "pxr/pxr.h"
28 #include "pxr/usd/pcp/api.h"
30 #include "pxr/usd/sdf/path.h"
31 
33 
34 #include <vector>
35 
37 
39 
40 class PcpNodeRef;
41 
42 /// \enum PcpDependencyType
43 ///
44 /// A classification of PcpPrimIndex->PcpSite dependencies
45 /// by composition structure.
46 ///
48  /// No type of dependency.
50 
51  /// The root dependency of a cache on its root site.
52  /// This may be useful to either include, as when invalidating
53  /// caches in response to scene edits, or to exclude, as when
54  /// scanning dependency arcs to compensate for a namespace edit.
56 
57  /// Purely direct dependencies involve only arcs introduced
58  /// directly at this level of namespace.
60 
61  /// Partly direct dependencies involve at least one arc introduced
62  /// directly at this level of namespace; they may also involve
63  /// ancestral arcs along the chain as well.
65 
66  /// Ancestral dependencies involve only arcs from ancestral
67  /// levels of namespace, and no direct arcs.
69 
70  /// Virtual dependencies do not contribute scene description,
71  /// yet represent sites whose scene description (or ancestral
72  /// scene description) informed the structure of the cache.
73  ///
74  /// One case of this is when a reference or payload arc
75  /// does not specify a prim, and the target layerStack does
76  /// not provide defaultPrim metadata either. In that case
77  /// a virtual dependency to the root of that layer stack will
78  /// represent the latent dependency on that site's metadata.
79  ///
80  /// Another case of this is "spooky ancestral" dependencies from
81  /// relocates. These are referred to as "spooky" dependencies
82  /// because they can be seen as a form of action-at-a-distance. They
83  /// only occur as a result of relocation arcs.
86 
87  /// Combined mask value representing both pure and partly direct
88  /// deps.
92 
93  /// Combined mask value representing any kind of dependency,
94  /// except virtual ones.
100 
101  /// Combined mask value representing any kind of dependency.
105 };
106 
107 /// A typedef for a bitmask of flags from PcpDependencyType.
108 typedef unsigned int PcpDependencyFlags;
109 
110 /// Description of a dependency.
112  /// The path in this PcpCache's root layer stack that depends
113  /// on the site.
115  /// The site path. When using recurseDownNamespace, this may
116  /// be a path beneath the initial sitePath.
118  /// The map function that applies to values from the site.
120 
121  bool operator==(const PcpDependency &rhs) const {
122  return indexPath == rhs.indexPath &&
123  sitePath == rhs.sitePath &&
124  mapFunc == rhs.mapFunc;
125  }
126  bool operator!=(const PcpDependency &rhs) const {
127  return !(*this == rhs);
128  }
129 };
130 
131 using PcpDependencyVector = std::vector<PcpDependency>;
132 
133 /// Description of a dependency that has been culled from the corresponding
134 /// prim index. Since this dependency does not have a node in the prim index,
135 /// this struct stores additional information needed to represent the
136 /// dependency.
138 {
139  /// Flag representing the type of dependency.
140  PcpDependencyFlags flags = PcpDependencyTypeNone;
141  /// Layer stack containing the specs the prim index depends on.
142  PcpLayerStackRefPtr layerStack;
143  /// Path of the dependency specs in the layer stack.
145  /// If relocations applied to the dependency node, this is the
146  /// unrelocated site path. Otherwise, this is empty.
148  /// The map function that applies to values from the site.
150 };
151 
152 using PcpCulledDependencyVector = std::vector<PcpCulledDependency>;
153 
154 /// Returns true if this node introduces a dependency in its
155 /// PcpPrimIndex, false otherwise. This is equivalent to
156 /// PcpClassifyNodeDependency(n) != PcpDependencyTypeNone, but
157 /// is faster.
158 PCP_API
160 
161 /// Classify the dependency represented by a node, by analyzing
162 /// its structural role in its PcpPrimIndex. Returns a
163 /// bitmask of flags from PcpDependencyType.
164 PCP_API
165 PcpDependencyFlags PcpClassifyNodeDependency(const PcpNodeRef &n);
166 
167 PCP_API
168 std::string PcpDependencyFlagsToString(const PcpDependencyFlags flags);
169 
171 
172 #endif // PXR_USD_PCP_DEPENDENCY_H
SdfPath unrelocatedSitePath
Definition: dependency.h:147
GLbitfield flags
Definition: glcorearb.h:1596
std::vector< PcpDependency > PcpDependencyVector
Definition: dependency.h:131
Combined mask value representing any kind of dependency.
Definition: dependency.h:102
GLsizei const GLchar *const * string
Definition: glcorearb.h:814
bool operator!=(const PcpDependency &rhs) const
Definition: dependency.h:126
PcpDependencyType
Definition: dependency.h:47
SdfPath sitePath
Definition: dependency.h:117
SdfPath sitePath
Path of the dependency specs in the layer stack.
Definition: dependency.h:144
SdfPath indexPath
Definition: dependency.h:114
PCP_API std::string PcpDependencyFlagsToString(const PcpDependencyFlags flags)
GLdouble n
Definition: glcorearb.h:2008
PXR_NAMESPACE_OPEN_SCOPE TF_DECLARE_WEAK_AND_REF_PTRS(PcpLayerStack)
PcpMapFunction mapFunc
The map function that applies to values from the site.
Definition: dependency.h:119
PCP_API PcpDependencyFlags PcpClassifyNodeDependency(const PcpNodeRef &n)
No type of dependency.
Definition: dependency.h:49
std::vector< PcpCulledDependency > PcpCulledDependencyVector
Definition: dependency.h:152
Definition: path.h:290
PCP_API bool PcpNodeIntroducesDependency(const PcpNodeRef &n)
PcpMapFunction mapToRoot
The map function that applies to values from the site.
Definition: dependency.h:149
bool operator==(const PcpDependency &rhs) const
Definition: dependency.h:121
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1432
PcpLayerStackRefPtr layerStack
Layer stack containing the specs the prim index depends on.
Definition: dependency.h:142
Description of a dependency.
Definition: dependency.h:111
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:91
unsigned int PcpDependencyFlags
A typedef for a bitmask of flags from PcpDependencyType.
Definition: dependency.h:108
#define PCP_API
Definition: api.h:40