All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
stagePopulationMask.h
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 USD_STAGEPOPULATIONMASK_H
25 #define USD_STAGEPOPULATIONMASK_H
26 
27 #include "pxr/pxr.h"
28 #include "pxr/usd/usd/api.h"
29 #include "pxr/usd/sdf/path.h"
30 
31 #include <iosfwd>
32 #include <vector>
33 
34 PXR_NAMESPACE_OPEN_SCOPE
35 
36 
61 {
62 public:
66  All() {
68  }
69 
71  UsdStagePopulationMask() = default;
72 
75  UsdStagePopulationMask &operator=(UsdStagePopulationMask const &) = default;
76  UsdStagePopulationMask &operator=(UsdStagePopulationMask &&) = default;
77 
81  template <class Iter>
82  explicit UsdStagePopulationMask(Iter f, Iter l) : _paths(f, l) {
83  _ValidateAndNormalize();
84  }
85 
89  explicit UsdStagePopulationMask(std::vector<SdfPath> const &paths) :
90  UsdStagePopulationMask(std::vector<SdfPath>(paths)) {};
91 
95  USD_API
96  explicit UsdStagePopulationMask(std::vector<SdfPath> &&paths);
97 
99  USD_API
102 
104  USD_API
106 
109  USD_API
110  UsdStagePopulationMask GetUnion(SdfPath const &path) const;
111 
113  USD_API
116  UsdStagePopulationMask const &r);
117 
119  USD_API
121  GetIntersection(UsdStagePopulationMask const &other) const;
122 
125  USD_API
126  bool Includes(UsdStagePopulationMask const &other) const;
127 
131  USD_API
132  bool Includes(SdfPath const &path) const;
133 
144  USD_API
145  bool IncludesSubtree(SdfPath const &path) const;
146 
149  bool IsEmpty() const {
150  return _paths.empty();
151  }
152 
158  USD_API
159  bool GetIncludedChildNames(SdfPath const &path,
160  std::vector<TfToken> *childNames) const;
161 
163  USD_API
164  std::vector<SdfPath> GetPaths() const;
165 
169  *this = GetUnion(other);
170  return *this;
171  }
172 
176  *this = GetUnion(path);
177  return *this;
178  }
179 
181  bool operator==(UsdStagePopulationMask const &other) const {
182  return _paths == other._paths;
183  }
184 
186  bool operator!=(UsdStagePopulationMask const &other) const {
187  return !(*this == other);
188  }
189 
192  _paths.swap(other._paths);
193  }
194 
195 private:
196  friend USD_API size_t hash_value(UsdStagePopulationMask const &);
197 
198  USD_API void _ValidateAndNormalize();
199 
200  std::vector<SdfPath> _paths;
201 };
202 
204 USD_API
205 std::ostream &operator<<(std::ostream &, UsdStagePopulationMask const &);
206 
209 {
210  l.swap(r);
211 }
212 
213 USD_API
214 size_t hash_value(UsdStagePopulationMask const &);
215 
216 PXR_NAMESPACE_CLOSE_SCOPE
217 
218 #endif // USD_STAGEPOPULATIONMASK_H
USD_API UsdStagePopulationMask GetUnion(UsdStagePopulationMask const &other) const
Return a mask that is the union of this and other.
void swap(ArAssetInfo &lhs, ArAssetInfo &rhs)
Definition: assetInfo.h:60
bool operator!=(UsdStagePopulationMask const &other) const
Return true if this mask is not equivalent to other.
UsdStagePopulationMask(Iter f, Iter l)
Construct a mask from the range of paths [f, l).
static USD_API UsdStagePopulationMask Intersection(UsdStagePopulationMask const &l, UsdStagePopulationMask const &r)
Return a mask that is the intersection of l and r.
UsdStagePopulationMask(std::vector< SdfPath > const &paths)
Construct a mask from paths.
bool operator==(UsdStagePopulationMask const &other) const
Return true if this mask is equivalent to other.
USD_API bool GetIncludedChildNames(SdfPath const &path, std::vector< TfToken > *childNames) const
Return true if this mask includes any child prims beneath path, false otherwise.
USD_API UsdStagePopulationMask GetIntersection(UsdStagePopulationMask const &other) const
Return a mask that is the intersection of this and other.
USD_API std::vector< SdfPath > GetPaths() const
Return the set of paths that define this mask.
USD_API bool IncludesSubtree(SdfPath const &path) const
Return true if this mask includes path and all paths descendant to path.
void swap(UsdStagePopulationMask &other)
Swap the content of this mask with other.
static USD_API UsdStagePopulationMask Union(UsdStagePopulationMask const &l, UsdStagePopulationMask const &r)
Return a mask that is the union of l and r.
static UsdStagePopulationMask All()
Return a mask that includes all paths.
UsdStagePopulationMask & Add(SdfPath const &path)
Assign this mask to be its union with path and return a reference to this mask.
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:287
USD_API bool Includes(UsdStagePopulationMask const &other) const
Return true if this mask is a superset of other.
UsdStagePopulationMask & Add(UsdStagePopulationMask const &other)
Assign this mask to be its union with other and return a reference to this mask.
GF_API std::ostream & operator<<(std::ostream &, const GfBBox3d &)
Output a GfBBox3d using the format [(range) matrix zeroArea].
static SDF_API const SdfPath & AbsoluteRootPath()
The absolute path representing the top of the namespace hierarchy.
UsdStagePopulationMask()=default
Construct an empty mask that includes no paths.
bool IsEmpty() const
Return true if this mask contains no paths.
This class represents a mask that may be applied to a UsdStage to limit the set of UsdPrim s it popul...