24 #ifndef PXR_USD_USD_COLLECTION_MEMBERSHIP_QUERY_H
25 #define PXR_USD_USD_COLLECTION_MEMBERSHIP_QUERY_H
42 #include <unordered_map>
46 #define USD_COLLECTION_MEMBERSHIP_QUERY_TOKENS \
47 (IncludedByMembershipExpression) \
48 (ExcludedByMembershipExpression)
90 const TfToken &topExpansionRule);
97 TfToken const &topExpansionRule);
143 return _Hash()(*this);
148 TfToken *expansionRule=
nullptr)
const;
152 const TfToken &parentExpansionRule,
153 TfToken *expansionRule=
nullptr)
const;
182 template <
class ExprEval>
219 TfToken *expansionRule=
nullptr)
const {
228 *expansionRule = res ?
229 UsdCollectionMembershipQueryTokens->
230 IncludedByMembershipExpression :
231 UsdCollectionMembershipQueryTokens->
232 ExcludedByMembershipExpression;
257 const TfToken &parentExpansionRule,
258 TfToken *expansionRule=
nullptr)
const {
263 path, parentExpansionRule, expansionRule));
268 *expansionRule = res ?
269 UsdCollectionMembershipQueryTokens->
270 IncludedByMembershipExpression :
271 UsdCollectionMembershipQueryTokens->
272 ExcludedByMembershipExpression;
286 _exprEval = std::move(exprEval);
304 return !_exprEval.IsEmpty();
316 _exprEval.IsEmpty() == rhs._exprEval.IsEmpty();
322 return !(*
this == rhs);
334 return Hash()(*this);
354 return stage->GetObjectAtPath(path);
362 typename PathExprEval::IncrementalSearcher<ObjToPath, PathToObj>;
384 return !_stage || _evaluator.
IsEmpty();
bool HasExpression() const
#define USD_COLLECTION_MEMBERSHIP_QUERY_TOKENS
const SdfPathSet & GetIncludedCollections() const
SdfPredicateFunctionResult IsPathIncluded(const SdfPath &path, TfToken *expansionRule=nullptr) const
USD_API std::set< UsdObject > UsdComputeIncludedObjectsFromCollection(const UsdCollectionMembershipQuery &query, const UsdStageWeakPtr &stage, const Usd_PrimFlagsPredicate &pred=UsdPrimDefaultPredicate)
STATIC_INLINE size_t Hash(const char *s, size_t len)
const PathExpansionRuleMap & GetAsPathExpansionRuleMap() const
UsdObjectCollectionExpressionEvaluator()=default
Construct an empty evaluator.
bool UsesPathExpansionRuleMap() const
size_t operator()(Usd_CollectionMembershipQuery const &query) const
SdfPathSet _includedCollections
ExprEval ExpressionEvaluator
GLsizei const GLchar *const * path
TfToken GetTopExpansionRule() const
USD_API bool _IsPathIncludedByRuleMap(const SdfPath &path, TfToken *expansionRule=nullptr) const
std::unordered_map< SdfPath, TfToken, SdfPath::Hash > PathExpansionRuleMap
Represents a flattened view of a collection. For more information about collections, please see UsdCollectionAPI as a way to encode and retrieve a collection from scene description. A UsdCollectionMembershipQuery object can be used to answer queries about membership of paths in the collection efficiently.
PathExpansionRuleMap _pathExpansionRuleMap
UsdStagePtr UsdStageWeakPtr
size_t GetHash() const
Hash function.
TF_DECLARE_PUBLIC_TOKENS(UsdCollectionMembershipQueryTokens, USD_API, USD_COLLECTION_MEMBERSHIP_QUERY_TOKENS)
void SetExpressionEvaluator(ExpressionEvaluator &&exprEval)
SdfPredicateFunctionResult IsPathIncluded(const SdfPath &path, const TfToken &parentExpansionRule, TfToken *expansionRule=nullptr) const
static SdfPredicateFunctionResult MakeVarying(bool value)
Create with value and 'MayVaryOverDescendants'.
bool operator!=(Usd_CollectionMembershipQuery const &rhs) const
Inequality operator.
std::set< class SdfPath > SdfPathSet
A set of SdfPaths.
UsdStageWeakPtr const & GetStage() const
USD_API IncrementalSearcher MakeIncrementalSearcher() const
static size_t Combine(Args &&...args)
Produce a hash code by combining the hash codes of several objects.
typename PathExprEval::IncrementalSearcher< ObjToPath, PathToObj > IncrementalSearcher
USD_API const Usd_PrimFlagsConjunction UsdPrimDefaultPredicate
Evaluates SdfPathExpressions with objects from a given UsdStage.
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
TfToken _topExpansionRule
#define PXR_NAMESPACE_CLOSE_SCOPE
ExpressionEvaluator const & GetExpressionEvaluator() const
size_t _GetHash() const
Hash function.
USD_API SdfPredicateFunctionResult Match(SdfPath const &path) const
Return the result of evaluating the expression against path.
USD_API SdfPathSet UsdComputeIncludedPathsFromCollection(const UsdCollectionMembershipQuery &query, const UsdStageWeakPtr &stage, const Usd_PrimFlagsPredicate &pred=UsdPrimDefaultPredicate)
bool operator==(Usd_CollectionMembershipQuery const &rhs) const
Equality operator.
USD_API size_t operator()(Usd_CollectionMembershipQueryBase const &query) const
void SetExpressionEvaluator(ExpressionEvaluator const &exprEval)
Usd_CollectionMembershipQueryBase()=default
SdfPathExpressionEval< UsdObject > PathExprEval
USD_API bool _HasEmptyRuleMap() const