Loading...
Searching...
No Matches
expressionVariablesSource.h
1//
2// Copyright 2023 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_EXPRESSION_VARIABLES_SOURCE_H
8#define PXR_USD_PCP_EXPRESSION_VARIABLES_SOURCE_H
9
10#include "pxr/pxr.h"
11#include "pxr/usd/pcp/api.h"
12
13#include <memory>
14
15PXR_NAMESPACE_OPEN_SCOPE
16
17class PcpCache;
19
25{
26public:
29 PCP_API
31
36 PCP_API
38 const PcpLayerStackIdentifier& layerStackIdentifier,
39 const PcpLayerStackIdentifier& rootLayerStackIdentifier);
40
41 PCP_API
43
46 PCP_API
47 bool operator==(const PcpExpressionVariablesSource& rhs) const;
48
49 PCP_API
50 bool operator!=(const PcpExpressionVariablesSource& rhs) const;
51
52 PCP_API
53 bool operator<(const PcpExpressionVariablesSource& rhs) const;
55
57 PCP_API
58 size_t GetHash() const;
59
63 bool IsRootLayerStack() const
64 {
65 return !static_cast<bool>(_identifier);
66 }
67
73 {
74 return _identifier ? _identifier.get() : nullptr;
75 }
76
81 PCP_API
83 const PcpLayerStackIdentifier& rootLayerStackIdentifier) const;
84
87 PCP_API
89 const PcpCache& cache) const;
90
91 // Avoid possibly returning a const-reference to a temporary.
93 PcpLayerStackIdentifier&&) const = delete;
95 PcpCache&&) const = delete;
96
97private:
98 // The identifier of the layer stack providing the associated
99 // expression variables. A null value indicates the root layer stack.
100 std::shared_ptr<PcpLayerStackIdentifier> _identifier;
101};
102
103template <typename HashState>
104void
105TfHashAppend(HashState& h, const PcpExpressionVariablesSource& x)
106{
107 h.Append(x.GetHash());
108}
109
110PXR_NAMESPACE_CLOSE_SCOPE
111
112#endif
PcpCache is the context required to make requests of the Pcp composition algorithm and cache the resu...
Definition: cache.h:77
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.