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_SDF_SITE_H
25 #define PXR_USD_SDF_SITE_H
26 
27 #include "pxr/pxr.h"
28 #include "pxr/usd/sdf/layer.h"
29 #include "pxr/usd/sdf/path.h"
30 
31 #include <set>
32 #include <vector>
33 
35 
36 /// \class SdfSite
37 ///
38 /// An SdfSite is a simple representation of a location in a layer where
39 /// opinions may possibly be found. It is simply a pair of layer and path
40 /// within that layer.
41 ///
42 class SdfSite
43 {
44 public:
45  SdfSite() { }
46  SdfSite(const SdfLayerHandle& layer_, const SdfPath& path_)
47  : layer(layer_)
48  , path(path_)
49  { }
50 
51  bool operator==(const SdfSite& other) const
52  {
53  return layer == other.layer && path == other.path;
54  }
55 
56  bool operator!=(const SdfSite& other) const
57  {
58  return !(*this == other);
59  }
60 
61  bool operator<(const SdfSite& other) const
62  {
63  return layer < other.layer ||
64  (!(other.layer < layer) && path < other.path);
65  }
66 
67  bool operator>(const SdfSite& other) const
68  {
69  return other < *this;
70  }
71 
72  bool operator<=(const SdfSite& other) const
73  {
74  return !(other < *this);
75  }
76 
77  bool operator>=(const SdfSite& other) const
78  {
79  return !(*this < other);
80  }
81 
82  /// Explicit bool conversion operator. A site object converts to \c true iff
83  /// both the layer and path fields are filled with valid values, \c false
84  /// otherwise.
85  /// This does NOT imply that there are opinions in the layer at that path.
86  explicit operator bool() const
87  {
88  return layer && !path.IsEmpty();
89  }
90 
91 public:
92  SdfLayerHandle layer;
94 };
95 
96 typedef std::set<SdfSite> SdfSiteSet;
97 typedef std::vector<SdfSite> SdfSiteVector;
98 
100 
101 #endif // PXR_USD_SDF_SITE_H
SdfPath path
Definition: site.h:93
GLsizei const GLchar *const * path
Definition: glcorearb.h:3341
std::vector< SdfSite > SdfSiteVector
Definition: site.h:97
bool operator==(const SdfSite &other) const
Definition: site.h:51
bool operator<(const SdfSite &other) const
Definition: site.h:61
GLenum GLuint GLint GLint layer
Definition: glcorearb.h:1299
Definition: site.h:42
bool operator!=(const SdfSite &other) const
Definition: site.h:56
bool operator>=(const SdfSite &other) const
Definition: site.h:77
bool operator>(const SdfSite &other) const
Definition: site.h:67
SdfSite()
Definition: site.h:45
Definition: path.h:290
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1432
SdfLayerHandle layer
Definition: site.h:92
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:91
bool operator<=(const SdfSite &other) const
Definition: site.h:72
std::set< SdfSite > SdfSiteSet
Definition: site.h:96
SdfSite(const SdfLayerHandle &layer_, const SdfPath &path_)
Definition: site.h:46