All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
stagePopulationMask.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_USD_STAGE_POPULATION_MASK_H
8#define PXR_USD_USD_STAGE_POPULATION_MASK_H
9
10#include "pxr/pxr.h"
11#include "pxr/usd/usd/api.h"
12#include "pxr/usd/sdf/path.h"
13
14#include <iosfwd>
15#include <vector>
16
17PXR_NAMESPACE_OPEN_SCOPE
18
19
44{
45public:
49 All() {
51 }
52
55
58 UsdStagePopulationMask &operator=(UsdStagePopulationMask const &) = default;
59 UsdStagePopulationMask &operator=(UsdStagePopulationMask &&) = default;
60
64 template <class Iter>
65 explicit UsdStagePopulationMask(Iter f, Iter l) : _paths(f, l) {
66 _ValidateAndNormalize();
67 }
68
72 explicit UsdStagePopulationMask(std::vector<SdfPath> const &paths) :
73 UsdStagePopulationMask(std::vector<SdfPath>(paths)) {};
74
78 USD_API
79 explicit UsdStagePopulationMask(std::vector<SdfPath> &&paths);
80
82 USD_API
85
87 USD_API
89
92 USD_API
94
96 USD_API
99 UsdStagePopulationMask const &r);
100
102 USD_API
105
108 USD_API
109 bool Includes(UsdStagePopulationMask const &other) const;
110
114 USD_API
115 bool Includes(SdfPath const &path) const;
116
127 USD_API
128 bool IncludesSubtree(SdfPath const &path) const;
129
132 bool IsEmpty() const {
133 return _paths.empty();
134 }
135
141 USD_API
143 std::vector<TfToken> *childNames) const;
144
146 USD_API
147 std::vector<SdfPath> GetPaths() const;
148
152 *this = GetUnion(other);
153 return *this;
154 }
155
159 *this = GetUnion(path);
160 return *this;
161 }
162
164 bool operator==(UsdStagePopulationMask const &other) const {
165 return _paths == other._paths;
166 }
167
169 bool operator!=(UsdStagePopulationMask const &other) const {
170 return !(*this == other);
171 }
172
175 _paths.swap(other._paths);
176 }
177
178private:
179 friend USD_API size_t hash_value(UsdStagePopulationMask const &);
180
181 USD_API void _ValidateAndNormalize();
182
183 std::vector<SdfPath> _paths;
184};
185
187USD_API
188std::ostream &operator<<(std::ostream &, UsdStagePopulationMask const &);
189
191inline void swap(UsdStagePopulationMask &l, UsdStagePopulationMask &r)
192{
193 l.swap(r);
194}
195
196USD_API
197size_t hash_value(UsdStagePopulationMask const &);
198
199PXR_NAMESPACE_CLOSE_SCOPE
200
201#endif // PXR_USD_USD_STAGE_POPULATION_MASK_H
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:274
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:28
STL namespace.