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 terms set forth in the LICENSE.txt file available at
5 // https://openusd.org/license.
6 //
7 #ifndef PXR_USD_SDF_SITE_H
8 #define PXR_USD_SDF_SITE_H
9 
10 #include "pxr/pxr.h"
11 #include "pxr/usd/sdf/layer.h"
12 #include "pxr/usd/sdf/path.h"
13 
14 #include <set>
15 #include <vector>
16 
18 
19 /// \class SdfSite
20 ///
21 /// An SdfSite is a simple representation of a location in a layer where
22 /// opinions may possibly be found. It is simply a pair of layer and path
23 /// within that layer.
24 ///
25 class SdfSite
26 {
27 public:
28  SdfSite() { }
29  SdfSite(const SdfLayerHandle& layer_, const SdfPath& path_)
30  : layer(layer_)
31  , path(path_)
32  { }
33 
34  bool operator==(const SdfSite& other) const
35  {
36  return layer == other.layer && path == other.path;
37  }
38 
39  bool operator!=(const SdfSite& other) const
40  {
41  return !(*this == other);
42  }
43 
44  bool operator<(const SdfSite& other) const
45  {
46  return layer < other.layer ||
47  (!(other.layer < layer) && path < other.path);
48  }
49 
50  bool operator>(const SdfSite& other) const
51  {
52  return other < *this;
53  }
54 
55  bool operator<=(const SdfSite& other) const
56  {
57  return !(other < *this);
58  }
59 
60  bool operator>=(const SdfSite& other) const
61  {
62  return !(*this < other);
63  }
64 
65  /// Explicit bool conversion operator. A site object converts to \c true iff
66  /// both the layer and path fields are filled with valid values, \c false
67  /// otherwise.
68  /// This does NOT imply that there are opinions in the layer at that path.
69  explicit operator bool() const
70  {
71  return layer && !path.IsEmpty();
72  }
73 
74 public:
75  SdfLayerHandle layer;
77 };
78 
79 typedef std::set<SdfSite> SdfSiteSet;
80 typedef std::vector<SdfSite> SdfSiteVector;
81 
83 
84 #endif // PXR_USD_SDF_SITE_H
SdfPath path
Definition: site.h:76
GLsizei const GLchar *const * path
Definition: glcorearb.h:3341
std::vector< SdfSite > SdfSiteVector
Definition: site.h:80
bool operator==(const SdfSite &other) const
Definition: site.h:34
bool operator<(const SdfSite &other) const
Definition: site.h:44
OutGridT const XformOp bool bool
GLenum GLuint GLint GLint layer
Definition: glcorearb.h:1299
Definition: site.h:25
bool operator!=(const SdfSite &other) const
Definition: site.h:39
bool operator>=(const SdfSite &other) const
Definition: site.h:60
bool operator>(const SdfSite &other) const
Definition: site.h:50
SdfSite()
Definition: site.h:28
Definition: path.h:273
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1425
SdfLayerHandle layer
Definition: site.h:75
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
bool operator<=(const SdfSite &other) const
Definition: site.h:55
std::set< SdfSite > SdfSiteSet
Definition: site.h:79
SdfSite(const SdfLayerHandle &layer_, const SdfPath &path_)
Definition: site.h:29