Loading...
Searching...
No Matches
layerStackIdentifier.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_LAYER_STACK_IDENTIFIER_H
8#define PXR_USD_PCP_LAYER_STACK_IDENTIFIER_H
9
11
12#include "pxr/pxr.h"
13#include "pxr/usd/pcp/api.h"
14#include "pxr/usd/pcp/expressionVariablesSource.h"
15
18
19#include <iosfwd>
20
21PXR_NAMESPACE_OPEN_SCOPE
22
23SDF_DECLARE_HANDLES(SdfLayer);
24
32public:
34
36 PCP_API
38
41 PCP_API
43 const SdfLayerHandle& rootLayer,
44 const SdfLayerHandle& sessionLayer = TfNullPtr,
48
49 // XXX: Allow assignment because there are clients using this
50 // as a member that themselves want to be assignable.
51 PCP_API
53
54 // Validity.
55 PCP_API
56 explicit operator bool() const;
57
58 // Comparison.
59 PCP_API
60 bool operator==(const This &rhs) const;
61 bool operator!=(const This &rhs) const
62 {
63 return !(rhs == *this);
64 }
65
66 PCP_API
67 bool operator<(const This &rhs) const;
68 bool operator<=(const This& rhs) const
69 {
70 return !(rhs < *this);
71 }
72 bool operator>(const This& rhs) const
73 {
74 return rhs < *this;
75 }
76 bool operator>=(const This& rhs) const
77 {
78 return !(*this < rhs);
79 }
80
81 // Hashing.
82 struct Hash {
83 size_t operator()(const This & x) const
84 {
85 return x.GetHash();
86 }
87 };
88 size_t GetHash() const
89 {
90 return _hash;
91 }
92
93public:
95 const SdfLayerHandle rootLayer;
96
98 const SdfLayerHandle sessionLayer;
99
102
106
107private:
108 size_t _ComputeHash() const;
109
110private:
111 const size_t _hash;
112};
113
114template <typename HashState>
115inline void
116TfHashAppend(HashState& h, const PcpLayerStackIdentifier& x)
117{
118 h.Append(x.GetHash());
119}
120
121inline
122size_t
124{
125 return TfHash{}(x);
126}
127
128PCP_API
129std::ostream& operator<<(std::ostream&, const PcpLayerStackIdentifier&);
130
134PCP_API
135std::ostream& PcpIdentifierFormatBaseName(std::ostream&);
136
140PCP_API
141std::ostream& PcpIdentifierFormatRealPath(std::ostream&);
142
147PCP_API
148std::ostream& PcpIdentifierFormatIdentifier(std::ostream&);
149
150PXR_NAMESPACE_CLOSE_SCOPE
151
152#endif // PXR_USD_PCP_LAYER_STACK_IDENTIFIER_H
An asset resolver context allows clients to provide additional data to the resolver for use during re...
Represents the layer stack associated with a set of expression variables.
Arguments used to identify a layer stack.
PCP_API PcpLayerStackIdentifier(const SdfLayerHandle &rootLayer, const SdfLayerHandle &sessionLayer=TfNullPtr, const ArResolverContext &pathResolverContext=ArResolverContext(), const PcpExpressionVariablesSource &expressionVariablesOverrideSource=PcpExpressionVariablesSource())
Construct with given pointers.
const ArResolverContext pathResolverContext
The path resolver context used for resolving asset paths. (optional)
const PcpExpressionVariablesSource expressionVariablesOverrideSource
The source for expression variables that compose over the expression variables in this layer stack.
PCP_API PcpLayerStackIdentifier()
Construct with all empty pointers.
const SdfLayerHandle rootLayer
The root layer.
const SdfLayerHandle sessionLayer
The session layer (optional).
A scene description container that can combine with other such containers to form simple component as...
Definition: layer.h:84
A user-extensible hashing mechanism for use with runtime hash tables.
Definition: hash.h:472
GF_API std::ostream & operator<<(std::ostream &, const GfBBox3d &)
Output a GfBBox3d using the format [(range) matrix zeroArea].
std::size_t hash_value(const half h)
Overload hash_value for half.
Definition: half.h:30
PCP_API std::ostream & PcpIdentifierFormatBaseName(std::ostream &)
Manipulator to cause the next PcpLayerStackIdentifier written to the ostream to write the base name o...
PCP_API std::ostream & PcpIdentifierFormatRealPath(std::ostream &)
Manipulator to cause the next PcpLayerStackIdentifier written to the ostream to write the real path o...
PCP_API std::ostream & PcpIdentifierFormatIdentifier(std::ostream &)
Manipulator to cause the next PcpLayerStackIdentifier written to the ostream to write the identifier ...