Loading...
Searching...
No Matches
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 PXR_USD_USD_STAGE_POPULATION_MASK_H
25#define PXR_USD_USD_STAGE_POPULATION_MASK_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
34PXR_NAMESPACE_OPEN_SCOPE
35
36
61{
62public:
66 All() {
68 }
69
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
111
113 USD_API
116 UsdStagePopulationMask const &r);
117
119 USD_API
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
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
195private:
196 friend USD_API size_t hash_value(UsdStagePopulationMask const &);
197
198 USD_API void _ValidateAndNormalize();
199
200 std::vector<SdfPath> _paths;
201};
202
204USD_API
205std::ostream &operator<<(std::ostream &, UsdStagePopulationMask const &);
206
208inline void swap(UsdStagePopulationMask &l, UsdStagePopulationMask &r)
209{
210 l.swap(r);
211}
212
213USD_API
214size_t hash_value(UsdStagePopulationMask const &);
215
216PXR_NAMESPACE_CLOSE_SCOPE
217
218#endif // PXR_USD_USD_STAGE_POPULATION_MASK_H
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:291
static SDF_API const SdfPath & AbsoluteRootPath()
The absolute path representing the top of the namespace hierarchy.
This class represents a mask that may be applied to a UsdStage to limit the set of UsdPrim s it popul...
USD_API bool IncludesSubtree(SdfPath const &path) const
Return true if this mask includes path and all paths descendant to path.
UsdStagePopulationMask & Add(SdfPath const &path)
Assign this mask to be its union with path and return a reference to this mask.
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 bool Includes(UsdStagePopulationMask const &other) const
Return true if this mask is a superset of other.
UsdStagePopulationMask()=default
Construct an empty mask that includes no paths.
static UsdStagePopulationMask All()
Return a mask that includes all paths.
static USD_API UsdStagePopulationMask Union(UsdStagePopulationMask const &l, UsdStagePopulationMask const &r)
Return a mask that is the union of l and r.
USD_API UsdStagePopulationMask GetIntersection(UsdStagePopulationMask const &other) const
Return a mask that is the intersection of this and other.
UsdStagePopulationMask(Iter f, Iter l)
Construct a mask from the range of paths [f, l).
bool IsEmpty() const
Return true if this mask contains no paths.
UsdStagePopulationMask & Add(UsdStagePopulationMask const &other)
Assign this mask to be its union with other and return a reference to this mask.
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.
USD_API bool Includes(SdfPath const &path) const
Return true if this mask includes path.
USD_API UsdStagePopulationMask(std::vector< SdfPath > &&paths)
Construct a mask from paths.
bool operator==(UsdStagePopulationMask const &other) const
Return true if this mask is equivalent to other.
USD_API std::vector< SdfPath > GetPaths() const
Return the set of paths that define this mask.
void swap(UsdStagePopulationMask &other)
Swap the content of this mask with other.
USD_API UsdStagePopulationMask GetUnion(UsdStagePopulationMask const &other) const
Return a mask that is the union of this and other.
bool operator!=(UsdStagePopulationMask const &other) const
Return true if this mask is not equivalent to other.
USD_API UsdStagePopulationMask GetUnion(SdfPath const &path) const
Return a mask that is the union of this and a mask containing the single path.
GF_API std::ostream & operator<<(std::ostream &, const GfBBox3d &)
Output a GfBBox3d using the format [(range) matrix zeroArea].
size_t hash_value(const half h)
Overload hash_value for half.
Definition: half.h:45
STL namespace.