All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
propertyIndex.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_USD_PCP_PROPERTY_INDEX_H
25 #define PXR_USD_PCP_PROPERTY_INDEX_H
26 
27 #include "pxr/pxr.h"
28 #include "pxr/usd/pcp/api.h"
29 #include "pxr/usd/pcp/errors.h"
30 #include "pxr/usd/pcp/iterator.h"
31 #include "pxr/usd/pcp/node.h"
32 
33 #include "pxr/usd/sdf/path.h"
35 
36 #include <memory>
37 #include <vector>
38 
39 PXR_NAMESPACE_OPEN_SCOPE
40 
41 // Forward declarations:
42 class PcpCache;
43 
49 struct Pcp_PropertyInfo
50 {
51  Pcp_PropertyInfo() { }
52  Pcp_PropertyInfo(const SdfPropertySpecHandle& prop, const PcpNodeRef& node)
53  : propertySpec(prop), originatingNode(node) { }
54 
55  SdfPropertySpecHandle propertySpec;
56  PcpNodeRef originatingNode;
57 };
58 
66 {
67 public:
69  PCP_API
71 
73  PCP_API
74  PcpPropertyIndex(const PcpPropertyIndex &rhs);
75 
77  PCP_API
78  void Swap(PcpPropertyIndex& index);
79 
82  PCP_API
83  bool IsEmpty() const;
84 
91  PCP_API
92  PcpPropertyRange GetPropertyRange(bool localOnly = false) const;
93 
95  PcpErrorVector GetLocalErrors() const {
96  return _localErrors ? *_localErrors.get() : PcpErrorVector();
97  }
98 
100  PCP_API
101  size_t GetNumLocalSpecs() const;
102 
103 private:
104  friend class PcpPropertyIterator;
105  friend class Pcp_PropertyIndexer;
106 
107  // The property stack is a list of Pcp_PropertyInfo objects in
108  // strong-to-weak order.
109  std::vector<Pcp_PropertyInfo> _propertyStack;
110 
113  std::unique_ptr<PcpErrorVector> _localErrors;
114 };
115 
119 PCP_API
120 void
121 PcpBuildPropertyIndex( const SdfPath& propertyPath,
122  PcpCache *cache,
123  PcpPropertyIndex *propertyIndex,
124  PcpErrorVector *allErrors );
125 
128 PCP_API
129 void
130 PcpBuildPrimPropertyIndex( const SdfPath& propertyPath,
131  const PcpCache& cache,
132  const PcpPrimIndex& owningPrimIndex,
133  PcpPropertyIndex *propertyIndex,
134  PcpErrorVector *allErrors );
135 
136 PXR_NAMESPACE_CLOSE_SCOPE
137 
138 #endif // PXR_USD_PCP_PROPERTY_INDEX_H
PcpErrorVector GetLocalErrors() const
Return the list of errors local to this property.
Definition: propertyIndex.h:95
PcpPrimIndex is an index of the all sites of scene description that contribute opinions to a specific...
Definition: primIndex.h:75
PcpNode represents a node in an expression tree for compositing scene description.
Definition: node.h:67
PcpCache is the context required to make requests of the Pcp composition algorithm and cache the resu...
Definition: cache.h:93
PCP_API void Swap(PcpPropertyIndex &index)
Swap the contents of this property index with index.
PCP_API PcpPropertyRange GetPropertyRange(bool localOnly=false) const
Returns range of iterators that encompasses properties in this index&#39;s property stack.
PCP_API bool IsEmpty() const
Returns true if this property index contains no opinions, false otherwise.
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:288
Object used to iterate over property specs in a property index in strong-to-weak order.
Definition: iterator.h:191
PCP_API PcpPropertyIndex()
Construct an empty property index.
PcpPropertyIndex is an index of all sites in scene description that contribute opinions to a specific...
Definition: propertyIndex.h:65
PCP_API size_t GetNumLocalSpecs() const
Returns the number of local properties in this prim index.