Loading...
Searching...
No Matches
expressionVariablesSource.h
1//
2// Copyright 2023 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_EXPRESSION_VARIABLES_SOURCE_H
25#define PXR_USD_PCP_EXPRESSION_VARIABLES_SOURCE_H
26
27#include "pxr/pxr.h"
28#include "pxr/usd/pcp/api.h"
29
30#include <memory>
31
32PXR_NAMESPACE_OPEN_SCOPE
33
34class PcpCache;
36
42{
43public:
46 PCP_API
48
53 PCP_API
55 const PcpLayerStackIdentifier& layerStackIdentifier,
56 const PcpLayerStackIdentifier& rootLayerStackIdentifier);
57
58 PCP_API
60
63 PCP_API
64 bool operator==(const PcpExpressionVariablesSource& rhs) const;
65
66 PCP_API
67 bool operator!=(const PcpExpressionVariablesSource& rhs) const;
68
69 PCP_API
70 bool operator<(const PcpExpressionVariablesSource& rhs) const;
72
74 PCP_API
75 size_t GetHash() const;
76
80 bool IsRootLayerStack() const
81 {
82 return !static_cast<bool>(_identifier);
83 }
84
90 {
91 return _identifier ? _identifier.get() : nullptr;
92 }
93
98 PCP_API
100 const PcpLayerStackIdentifier& rootLayerStackIdentifier) const;
101
104 PCP_API
106 const PcpCache& cache) const;
107
108 // Avoid possibly returning a const-reference to a temporary.
110 PcpLayerStackIdentifier&&) const = delete;
112 PcpCache&&) const = delete;
113
114private:
115 // The identifier of the layer stack providing the associated
116 // expression variables. A null value indicates the root layer stack.
117 std::shared_ptr<PcpLayerStackIdentifier> _identifier;
118};
119
120template <typename HashState>
121void
122TfHashAppend(HashState& h, const PcpExpressionVariablesSource& x)
123{
124 h.Append(x.GetHash());
125}
126
127PXR_NAMESPACE_CLOSE_SCOPE
128
129#endif
PcpCache is the context required to make requests of the Pcp composition algorithm and cache the resu...
Definition: cache.h:94
Represents the layer stack associated with a set of expression variables.
const PcpLayerStackIdentifier * GetLayerStackIdentifier() const
Return the identifier of the layer stack represented by this object if it is not the root layer stack...
PCP_API size_t GetHash() const
Return hash value for this object.
PCP_API const PcpLayerStackIdentifier & ResolveLayerStackIdentifier(const PcpCache &cache) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
PCP_API PcpExpressionVariablesSource(const PcpLayerStackIdentifier &layerStackIdentifier, const PcpLayerStackIdentifier &rootLayerStackIdentifier)
Create a PcpExpressionVariableSource representing the layer stack identified by layerStackIdentifier.
PCP_API const PcpLayerStackIdentifier & ResolveLayerStackIdentifier(const PcpLayerStackIdentifier &rootLayerStackIdentifier) const
Convenience function to return the identifier of the layer stack represented by this object.
PCP_API PcpExpressionVariablesSource()
Create a PcpExpressionVariableSource representing the root layer stack of a prim index.
bool IsRootLayerStack() const
Return true if this object represents a prim index's root layer stack, false otherwise.
Arguments used to identify a layer stack.