This document is for a version of USD that is under development. See this page for the current release.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
site.h
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
17PXR_NAMESPACE_OPEN_SCOPE
18
26{
27public:
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
69 explicit operator bool() const
70 {
71 return layer && !path.IsEmpty();
72 }
73
74public:
75 SdfLayerHandle layer;
76 SdfPath path;
77};
78
79typedef std::set<SdfSite> SdfSiteSet;
80typedef std::vector<SdfSite> SdfSiteVector;
81
82PXR_NAMESPACE_CLOSE_SCOPE
83
84#endif // PXR_USD_SDF_SITE_H
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:274
bool IsEmpty() const noexcept
Returns true if this is the empty path (SdfPath::EmptyPath()).
Definition: path.h:398
An SdfSite is a simple representation of a location in a layer where opinions may possibly be found.
Definition: site.h:26