HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
site.h
Go to the documentation of this file.
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_SITE_H
25 #define PXR_USD_PCP_SITE_H
26 
27 #include "pxr/pxr.h"
28 #include "pxr/usd/pcp/api.h"
30 #include "pxr/usd/sdf/path.h"
31 #include "pxr/usd/sdf/types.h"
33 
34 #include <hboost/operators.hpp>
35 #include <iosfwd>
36 
38 
40 class PcpLayerStackSite;
41 
42 /// \class PcpSite
43 ///
44 /// A site specifies a path in a layer stack of scene description.
45 ///
46 class PcpSite : hboost::totally_ordered<PcpSite>
47 {
48 public:
51 
52  PCP_API
53  PcpSite();
54 
55  PCP_API
56  PcpSite( const PcpLayerStackIdentifier &, const SdfPath & path );
57  PCP_API
58  PcpSite( const PcpLayerStackPtr &, const SdfPath & path );
59  PCP_API
60  PcpSite( const SdfLayerHandle &, const SdfPath & path );
61  PCP_API
62  explicit PcpSite( const PcpLayerStackSite & );
63 
64  PCP_API
65  bool operator==(const PcpSite &rhs) const;
66 
67  PCP_API
68  bool operator<(const PcpSite &rhs) const;
69 
70  struct Hash {
71  PCP_API
72  size_t operator()(const PcpSite &) const;
73  };
74 };
75 
76 /// \class PcpSiteStr
77 ///
78 /// A "string-based" version of PcpSite. This stores layer identifiers as
79 /// strings rather than SdfLayerHandles, making it stable wrt layer lifetimes.
80 ///
81 class PcpSiteStr : hboost::totally_ordered<PcpSiteStr>
82 {
83 public:
86 
87  PCP_API
88  PcpSiteStr();
89 
90  PCP_API
92  PCP_API
93  PcpSiteStr( const PcpLayerStackIdentifier &, const SdfPath & path );
94  PCP_API
95  PcpSiteStr( const SdfLayerHandle &, const SdfPath & path );
96  PCP_API
98  PCP_API
99  PcpSiteStr(PcpSite const &);
100 
101  PCP_API
102  bool operator==(const PcpSiteStr &rhs) const;
103 
104  PCP_API
105  bool operator<(const PcpSiteStr &rhs) const;
106 
107  struct Hash {
108  PCP_API
109  size_t operator()(const PcpSiteStr &) const;
110  };
111 };
112 
113 /// \class PcpLayerStackSite
114 ///
115 /// A site specifies a path in a layer stack of scene description.
116 ///
117 class PcpLayerStackSite : hboost::totally_ordered<PcpLayerStackSite>
118 {
119 public:
120  PcpLayerStackRefPtr layerStack;
122 
123  PCP_API
125 
126  PCP_API
127  PcpLayerStackSite( const PcpLayerStackRefPtr &, const SdfPath & path );
128 
129  PCP_API
130  bool operator==(const PcpLayerStackSite &rhs) const;
131 
132  PCP_API
133  bool operator<(const PcpLayerStackSite &rhs) const;
134 
135  struct Hash {
136  PCP_API
137  size_t operator()(const PcpLayerStackSite &) const;
138  };
139 };
140 
141 PCP_API
142 std::ostream& operator<<(std::ostream&, const PcpSite&);
143 PCP_API
144 std::ostream& operator<<(std::ostream&, const PcpSiteStr&);
145 PCP_API
146 std::ostream& operator<<(std::ostream&, const PcpLayerStackSite&);
147 
148 static inline
149 size_t
150 hash_value(const PcpSite& site)
151 {
152  return PcpSite::Hash()(site);
153 }
154 
155 static inline
156 size_t
157 hash_value(const PcpSiteStr& site)
158 {
159  return PcpSiteStr::Hash()(site);
160 }
161 
162 static inline
163 size_t
164 hash_value(const PcpLayerStackSite& site)
165 {
166  return PcpLayerStackSite::Hash()(site);
167 }
168 
170 
171 #endif // PXR_USD_PCP_SITE_H
PCP_API bool operator<(const PcpSiteStr &rhs) const
PcpLayerStackIdentifier layerStackIdentifier
Definition: site.h:49
PCP_API size_t operator()(const PcpSiteStr &) const
PCP_API size_t operator()(const PcpLayerStackSite &) const
Definition: site.h:46
PCP_API bool operator==(const PcpSiteStr &rhs) const
PCP_API std::ostream & operator<<(std::ostream &, const PcpSite &)
PcpLayerStackRefPtr layerStack
Definition: site.h:120
size_t OIIO_API Hash(const char *s, size_t len)
SdfPath path
Definition: site.h:85
PCP_API bool operator<(const PcpSite &rhs) const
PCP_API bool operator==(const PcpLayerStackSite &rhs) const
PcpLayerStackIdentifierStr layerStackIdentifierStr
Definition: site.h:84
PCP_API PcpSite()
PXR_NAMESPACE_OPEN_SCOPE TF_DECLARE_WEAK_AND_REF_PTRS(PcpLayerStack)
PCP_API PcpLayerStackSite()
PCP_API bool operator<(const PcpLayerStackSite &rhs) const
Definition: path.h:288
SdfPath path
Definition: site.h:121
PCP_API bool operator==(const PcpSite &rhs) const
GLsizei const GLchar *const * path
Definition: glew.h:6461
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1346
PCP_API size_t operator()(const PcpSite &) const
PCP_API PcpSiteStr()
SdfPath path
Definition: site.h:50
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:91
size_t hash_value(const CH_ChannelRef &ref)
#define PCP_API
Definition: api.h:40