7 #ifndef PXR_USD_USD_COLLECTION_MEMBERSHIP_QUERY_H
8 #define PXR_USD_USD_COLLECTION_MEMBERSHIP_QUERY_H
25 #include <unordered_map>
29 #define USD_COLLECTION_MEMBERSHIP_QUERY_TOKENS \
30 (IncludedByMembershipExpression) \
31 (ExcludedByMembershipExpression)
73 const TfToken &topExpansionRule);
80 TfToken const &topExpansionRule);
126 return _Hash()(*this);
131 TfToken *expansionRule=
nullptr)
const;
135 const TfToken &parentExpansionRule,
136 TfToken *expansionRule=
nullptr)
const;
172 template <
class ExprEval>
209 TfToken *expansionRule=
nullptr)
const {
218 *expansionRule = res ?
219 UsdCollectionMembershipQueryTokens->
220 IncludedByMembershipExpression :
221 UsdCollectionMembershipQueryTokens->
222 ExcludedByMembershipExpression;
247 const TfToken &parentExpansionRule,
248 TfToken *expansionRule=
nullptr)
const {
253 path, parentExpansionRule, expansionRule));
258 *expansionRule = res ?
259 UsdCollectionMembershipQueryTokens->
260 IncludedByMembershipExpression :
261 UsdCollectionMembershipQueryTokens->
262 ExcludedByMembershipExpression;
276 _exprEval = std::move(exprEval);
294 return !_exprEval.IsEmpty();
306 _exprEval.IsEmpty() == rhs._exprEval.IsEmpty();
312 return !(*
this == rhs);
324 return Hash()(*this);
338 return stage->GetObjectAtPath(path);
346 typename PathExprEval::IncrementalSearcher<PathToObj>;
368 return !_stage || _evaluator.
IsEmpty();
bool HasExpression() const
#define USD_COLLECTION_MEMBERSHIP_QUERY_TOKENS
const SdfPathSet & GetIncludedCollections() const
typename PathExprEval::IncrementalSearcher< PathToObj > IncrementalSearcher
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.
USD_API const Usd_PrimFlagsConjunction UsdPrimDefaultPredicate
Evaluates SdfPathExpressions with objects from a given UsdStage.
USD_API SdfPathExpression UsdComputePathExpressionFromCollectionMembershipQueryRuleMap(Usd_CollectionMembershipQueryBase::PathExpansionRuleMap const &ruleMap)
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