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 terms set forth in the LICENSE.txt file available at
5 // https://openusd.org/license.
6 //
7 #ifndef PXR_USD_PCP_DEPENDENCY_H
8 #define PXR_USD_PCP_DEPENDENCY_H
9 
10 #include "pxr/pxr.h"
11 #include "pxr/usd/pcp/api.h"
13 #include "pxr/usd/pcp/types.h"
14 #include "pxr/usd/sdf/path.h"
15 
17 
18 #include <vector>
19 
21 
23 
24 class PcpNodeRef;
25 
26 /// \enum PcpDependencyType
27 ///
28 /// A classification of PcpPrimIndex->PcpSite dependencies
29 /// by composition structure.
30 ///
32  /// No type of dependency.
34 
35  /// The root dependency of a cache on its root site.
36  /// This may be useful to either include, as when invalidating
37  /// caches in response to scene edits, or to exclude, as when
38  /// scanning dependency arcs to compensate for a namespace edit.
40 
41  /// Purely direct dependencies involve only arcs introduced
42  /// directly at this level of namespace.
44 
45  /// Partly direct dependencies involve at least one arc introduced
46  /// directly at this level of namespace; they may also involve
47  /// ancestral arcs along the chain as well.
49 
50  /// Ancestral dependencies involve only arcs from ancestral
51  /// levels of namespace, and no direct arcs.
53 
54  /// Virtual dependencies do not contribute scene description,
55  /// yet represent sites whose scene description (or ancestral
56  /// scene description) informed the structure of the cache.
57  ///
58  /// One case of this is when a reference or payload arc
59  /// does not specify a prim, and the target layerStack does
60  /// not provide defaultPrim metadata either. In that case
61  /// a virtual dependency to the root of that layer stack will
62  /// represent the latent dependency on that site's metadata.
63  ///
64  /// Another case of this is "spooky ancestral" dependencies from
65  /// relocates. These are referred to as "spooky" dependencies
66  /// because they can be seen as a form of action-at-a-distance. They
67  /// only occur as a result of relocation arcs.
70 
71  /// Combined mask value representing both pure and partly direct
72  /// deps.
76 
77  /// Combined mask value representing any kind of dependency,
78  /// except virtual ones.
84 
85  /// Combined mask value representing any kind of dependency.
89 };
90 
91 /// A typedef for a bitmask of flags from PcpDependencyType.
92 typedef unsigned int PcpDependencyFlags;
93 
94 /// Description of a dependency.
95 struct PcpDependency {
96  /// The path in this PcpCache's root layer stack that depends
97  /// on the site.
99  /// The site path. When using recurseDownNamespace, this may
100  /// be a path beneath the initial sitePath.
102  /// The map function that applies to values from the site.
104 
105  bool operator==(const PcpDependency &rhs) const {
106  return indexPath == rhs.indexPath &&
107  sitePath == rhs.sitePath &&
108  mapFunc == rhs.mapFunc;
109  }
110  bool operator!=(const PcpDependency &rhs) const {
111  return !(*this == rhs);
112  }
113 };
114 
115 using PcpDependencyVector = std::vector<PcpDependency>;
116 
117 /// Description of a dependency that has been culled from the corresponding
118 /// prim index. Since this dependency does not have a node in the prim index,
119 /// this struct stores additional information needed to represent the
120 /// dependency.
122 {
123  /// Flag representing the type of dependency.
124  PcpDependencyFlags flags = PcpDependencyTypeNone;
125  /// Arc type for this dependency.
127  /// Layer stack containing the specs the prim index depends on.
128  PcpLayerStackRefPtr layerStack;
129  /// Path of the dependency specs in the layer stack.
131  /// If relocations applied to the dependency node, this is the
132  /// unrelocated site path. Otherwise, this is empty.
134  /// The map function that applies to values from the site.
136 };
137 
138 using PcpCulledDependencyVector = std::vector<PcpCulledDependency>;
139 
140 /// Returns true if this node introduces a dependency in its
141 /// PcpPrimIndex, false otherwise. This is equivalent to
142 /// PcpClassifyNodeDependency(n) != PcpDependencyTypeNone, but
143 /// is faster.
144 PCP_API
146 
147 /// Classify the dependency represented by a node, by analyzing
148 /// its structural role in its PcpPrimIndex. Returns a
149 /// bitmask of flags from PcpDependencyType.
150 PCP_API
151 PcpDependencyFlags PcpClassifyNodeDependency(const PcpNodeRef &n);
152 
153 PCP_API
154 std::string PcpDependencyFlagsToString(const PcpDependencyFlags flags);
155 
157 
158 #endif // PXR_USD_PCP_DEPENDENCY_H
SdfPath unrelocatedSitePath
Definition: dependency.h:133
GLbitfield flags
Definition: glcorearb.h:1596
std::vector< PcpDependency > PcpDependencyVector
Definition: dependency.h:115
Combined mask value representing any kind of dependency.
Definition: dependency.h:86
bool operator!=(const PcpDependency &rhs) const
Definition: dependency.h:110
PcpArcType arcType
Arc type for this dependency.
Definition: dependency.h:126
PcpDependencyType
Definition: dependency.h:31
SdfPath sitePath
Definition: dependency.h:101
SdfPath sitePath
Path of the dependency specs in the layer stack.
Definition: dependency.h:130
SdfPath indexPath
Definition: dependency.h:98
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:103
PCP_API PcpDependencyFlags PcpClassifyNodeDependency(const PcpNodeRef &n)
No type of dependency.
Definition: dependency.h:33
std::vector< PcpCulledDependency > PcpCulledDependencyVector
Definition: dependency.h:138
Definition: path.h:273
PCP_API bool PcpNodeIntroducesDependency(const PcpNodeRef &n)
PcpMapFunction mapToRoot
The map function that applies to values from the site.
Definition: dependency.h:135
bool operator==(const PcpDependency &rhs) const
Definition: dependency.h:105
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1425
PcpLayerStackRefPtr layerStack
Layer stack containing the specs the prim index depends on.
Definition: dependency.h:128
Description of a dependency.
Definition: dependency.h:95
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
unsigned int PcpDependencyFlags
A typedef for a bitmask of flags from PcpDependencyType.
Definition: dependency.h:92
#define PCP_API
Definition: api.h:23
PcpArcType
Definition: types.h:27