25 #ifndef PXR_USD_NDR_REGISTRY_H
26 #define PXR_USD_NDR_REGISTRY_H
31 #include "pxr/usd/ndr/api.h"
34 #include "pxr/usd/ndr/discoveryPlugin.h"
36 #include "pxr/usd/ndr/nodeDiscoveryResult.h"
41 PXR_NAMESPACE_OPEN_SCOPE
66 using DiscoveryPluginRefPtrVec = NdrDiscoveryPluginRefPtrVector;
121 const NdrTokenMap &metadata,
143 const NdrTokenMap &metadata);
163 NdrVersionFilterDefaultOnly)
const;
201 const NdrTokenVec& sourceTypePriority = NdrTokenVec());
225 const NdrTokenVec& sourceTypePriority = NdrTokenVec(),
240 NdrVersionFilterDefaultOnly);
258 NdrVersionFilterDefaultOnly);
269 NdrVersionFilterDefaultOnly);
296 class _DiscoveryContext;
297 friend class _DiscoveryContext;
301 typedef std::pair<NdrIdentifier, TfToken> NodeMapKey;
302 struct NodeMapKeyHashFunctor {
303 size_t operator()(
const NodeMapKey& x)
const {
308 typedef std::unordered_multimap<NodeMapKey, NdrNodeUniquePtr,
309 NodeMapKeyHashFunctor> NodeMap;
313 mutable std::mutex _discoveryResultMutex;
317 mutable std::mutex _nodeMapMutex;
321 void _RunDiscoveryPlugins(
const DiscoveryPluginRefPtrVec& discoveryPlugins);
324 void _FindAndInstantiateDiscoveryPlugins();
327 void _FindAndInstantiateParserPlugins();
331 void _InstantiateParserPlugins(
const std::set<TfType>& parserPluginTypes);
335 NdrNodeConstPtr _ParseNodeMatchingIdentifier(
340 NdrNodeConstPtr _ParseNodeMatchingAlias(
345 NdrNodeConstPtr _ParseNodeMatchingNameAndFilter(
352 NdrNodeConstPtr _GetNodeByIdentifierAndTypeImpl(
357 NdrNodeConstPtr _GetNodeByNameAndTypeImpl(
358 const std::string& name,
const TfToken& sourceType,
368 NdrNodeConstPtrVec _GetNodeMapAsNodePtrVec(
const TfToken& family,
374 _GetParserForDiscoveryType(
const TfToken& discoveryType)
const;
378 DiscoveryPluginRefPtrVec _discoveryPlugins;
382 TypeToParserPluginMap _parserPluginMap;
385 std::vector<std::unique_ptr<NdrParserPlugin>> _parserPlugins;
389 NdrNodeDiscoveryResultVec _discoveryResults;
394 std::map<TfToken, std::vector<size_t>> _discoveryResultIndicesBySourceType;
401 PXR_NAMESPACE_CLOSE_SCOPE
403 #endif // PXR_USD_NDR_REGISTRY_H
NdrVersionFilter
Enumeration used to select nodes by version.
NDR_API NdrNodeConstPtr GetNodeByName(const std::string &name, const NdrTokenVec &sourceTypePriority=NdrTokenVec(), NdrVersionFilter filter=NdrVersionFilterDefaultOnly)
Get the node with the specified name.
Interface for parser plugins.
NDR_API NdrNodeConstPtrVec GetNodesByFamily(const TfToken &family=TfToken(), NdrVersionFilter filter=NdrVersionFilterDefaultOnly)
Get all nodes from the registry, optionally restricted to the nodes that fall under a specified famil...
NDR_API NdrStringVec GetNodeNames(const TfToken &family=TfToken()) const
Get the names of all the nodes that the registry is aware of.
NDR_API NdrNodeConstPtr GetNodeFromAsset(const SdfAssetPath &asset, const NdrTokenMap &metadata, const TfToken &subIdentifier=TfToken(), const TfToken &sourceType=TfToken())
Parses the given asset, constructs a NdrNode from it and adds it to the registry. ...
Functor to use for hash maps from tokens to other things.
NDR_API void SetExtraParserPlugins(const std::vector< TfType > &pluginTypes)
Allows the client to set any additional parser plugins that would otherwise NOT be found through the ...
NDR_API NdrNodeConstPtr GetNodeByIdentifierAndType(const NdrIdentifier &identifier, const TfToken &sourceType)
Get the node with the specified identifier and sourceType.
NDR_API NdrNodeConstPtr GetNodeByIdentifier(const NdrIdentifier &identifier, const NdrTokenVec &sourceTypePriority=NdrTokenVec())
Get the node with the specified identifier, and an optional sourceTypePriority list specifying the se...
NDR_API NdrIdentifierVec GetNodeIdentifiers(const TfToken &family=TfToken(), NdrVersionFilter filter=NdrVersionFilterDefaultOnly) const
Get the identifiers of all the nodes that the registry is aware of.
Token for efficient comparison, assignment, and hashing of known strings.
NDR_API NdrStringVec GetSearchURIs() const
Get the locations where the registry is searching for nodes.
The registry provides access to node information.
NDR_API NdrNodeConstPtrVec GetNodesByIdentifier(const NdrIdentifier &identifier)
Get all nodes matching the specified identifier (multiple nodes of the same identifier, but different source types, may exist) as well as any nodes which have an alias that matches the identifier.
Represents the raw data of a node, and some other bits of metadata, that were determined via a NdrDis...
NDR_API NdrTokenVec GetAllNodeSourceTypes() const
Get a sorted list of all node source types that may be present on the nodes in the registry...
NDR_API NdrNodeConstPtr GetNodeByNameAndType(const std::string &name, const TfToken &sourceType, NdrVersionFilter filter=NdrVersionFilterDefaultOnly)
A convenience wrapper around GetNodeByName().
Contains an asset path and an optional resolved path.
NDR_API void SetExtraDiscoveryPlugins(DiscoveryPluginRefPtrVec plugins)
Allows the client to set any additional discovery plugins that would otherwise NOT be found through t...
NDR_API NdrNodeConstPtrVec GetNodesByName(const std::string &name, NdrVersionFilter filter=NdrVersionFilterDefaultOnly)
Get all nodes matching the specified name.
NDR_API NdrNodeConstPtr GetNodeFromSourceCode(const std::string &sourceCode, const TfToken &sourceType, const NdrTokenMap &metadata)
Parses the given sourceCode string, constructs a NdrNode from it and adds it to the registry...
Enable a concrete base class for use with TfWeakPtr.