All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
NdrRegistry Class Reference

The registry provides access to node information. More...

+ Inheritance diagram for NdrRegistry:

Public Types

using DiscoveryPluginRefPtrVec = NdrDiscoveryPluginRefPtrVector
 

Public Member Functions

NDR_API void SetExtraDiscoveryPlugins (DiscoveryPluginRefPtrVec plugins)
 Allows the client to set any additional discovery plugins that would otherwise NOT be found through the plugin system. More...
 
NDR_API void SetExtraDiscoveryPlugins (const std::vector< TfType > &pluginTypes)
 Allows the client to set any additional discovery plugins that would otherwise NOT be found through the plugin system. More...
 
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 plugin system. More...
 
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. More...
 
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. More...
 
NDR_API NdrStringVec GetSearchURIs () const
 Get the locations where the registry is searching for nodes. More...
 
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. More...
 
NDR_API NdrStringVec GetNodeNames (const TfToken &family=TfToken()) const
 Get the names of all the nodes that the registry is aware of. More...
 
NDR_API NdrNodeConstPtr GetNodeByIdentifier (const NdrIdentifier &identifier, const NdrTokenVec &typePriority=NdrTokenVec())
 Get the node with the specified identifier, and an optional priority list specifying the set of node SOURCE types (see NdrNode::GetSourceType()) that should be searched. More...
 
NDR_API NdrNodeConstPtr GetNodeByIdentifierAndType (const NdrIdentifier &identifier, const TfToken &nodeType)
 A convenience wrapper around GetNodeByIdentifier(). More...
 
NDR_API NdrNodeConstPtr GetNodeByName (const std::string &name, const NdrTokenVec &typePriority=NdrTokenVec(), NdrVersionFilter filter=NdrVersionFilterDefaultOnly)
 Get the node with the specified name. More...
 
NDR_API NdrNodeConstPtr GetNodeByNameAndType (const std::string &name, const TfToken &nodeType, NdrVersionFilter filter=NdrVersionFilterDefaultOnly)
 A convenience wrapper around GetNodeByName(). More...
 
NDR_API NdrNodeConstPtr GetNodeByURI (const std::string &uri)
 Gets the node matching the specified URI (eg, a filesystem path). More...
 
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). More...
 
NDR_API NdrNodeConstPtrVec GetNodesByName (const std::string &name, NdrVersionFilter filter=NdrVersionFilterDefaultOnly)
 Get all nodes matching the specified name. More...
 
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 family and/or the default version. More...
 
NDR_API NdrTokenVec GetAllNodeSourceTypes () const
 Get a sorted list of all node source types that may be present on the nodes in the registry. More...
 
- Public Member Functions inherited from TfWeakBase
 TfWeakBase (const TfWeakBase &)
 
const TfWeakBase__GetTfWeakBase__ () const
 
const TfWeakBaseoperator= (const TfWeakBase &)
 
void EnableNotification2 () const
 
TF_API void const * GetUniqueIdentifier () const
 

Static Public Member Functions

static NDR_API NdrRegistryGetInstance ()
 Get the single NdrRegistry instance. More...
 

Protected Member Functions

 NdrRegistry (const NdrRegistry &)=delete
 
NdrRegistryoperator= (const NdrRegistry &)=delete
 
- Protected Member Functions inherited from TfWeakBase
TfRefPtr< Tf_Remnant > _Register () const
 
template<class T >
TfRefPtr< Tf_Remnant > _Register (T *tempRmnt) const
 
bool _HasRemnant () const
 

Friends

class TfSingleton< NdrRegistry >
 
class _DiscoveryContext
 

Detailed Description

The registry provides access to node information.

"Discovery Plugins" are responsible for finding the nodes that should be included in the registry.

Discovery plugins are found through the plugin system. If additional discovery plugins need to be specified, a client can pass them to SetExtraDiscoveryPlugins().

When the registry is first told about the discovery plugins, the plugins will be asked to discover nodes. These plugins will generate NdrNodeDiscoveryResult instances, which only contain basic metadata. Once the client asks for information that would require the node's contents to be parsed (eg, what its inputs and outputs are), the registry will begin the parsing process on an as-needed basis. See NdrNodeDiscoveryResult for the information that can be retrieved without triggering a parse.

Some methods in this library may allow for a "family" to be provided. A family is simply a generic grouping which is optional.

Definition at line 63 of file registry.h.

Member Function Documentation

NDR_API NdrTokenVec GetAllNodeSourceTypes ( ) const

Get a sorted list of all node source types that may be present on the nodes in the registry.

Source types originate from the discovery process, but there is no guarantee that the discovered source types will also have a registered parser plugin. The actual supported source types here depend on the parsers that are available. Also note that some parser plugins may not advertise a source type.

See the documentation for NdrParserPlugin and NdrNode::GetSourceType() for more information.

static NDR_API NdrRegistry& GetInstance ( )
static

Get the single NdrRegistry instance.

NDR_API NdrNodeConstPtr GetNodeByIdentifier ( const NdrIdentifier identifier,
const NdrTokenVec &  typePriority = NdrTokenVec() 
)

Get the node with the specified identifier, and an optional priority list specifying the set of node SOURCE types (see NdrNode::GetSourceType()) that should be searched.

Nodes of the same identifier but different source type can exist in the registry. If a node 'Foo' with source types 'abc' and 'xyz' exist in the registry, and you want to make sure the 'abc' version is fetched before the 'xyz' version, the priority list would be specified as ['abc', 'xyz']. If the 'abc' version did not exist in the registry, then the 'xyz' version would be returned.

Note that this will run the parsing routine. However, unlike some other methods that run parsing, this will only parse the node(s) that matches the specified identifier and type(s).

Returns nullptr if a node matching the arguments can't be found.

NDR_API NdrNodeConstPtr GetNodeByIdentifierAndType ( const NdrIdentifier identifier,
const TfToken nodeType 
)

A convenience wrapper around GetNodeByIdentifier().

Instead of providing a priority list, an exact type is specified, and nullptr is returned if a node with the exact identifier and type does not exist.

NDR_API NdrNodeConstPtr GetNodeByName ( const std::string &  name,
const NdrTokenVec &  typePriority = NdrTokenVec(),
NdrVersionFilter  filter = NdrVersionFilterDefaultOnly 
)

Get the node with the specified name.

An optional priority list specifies the set of node SOURCE types (

See Also
NdrNode::GetSourceType()) that should be searched and in what order.

Optionally, a filter can be specified to consider just the default versions of nodes matching name (the default) or all versions of the nodes.

See Also
GetNodeByIdentifier().
NDR_API NdrNodeConstPtr GetNodeByNameAndType ( const std::string &  name,
const TfToken nodeType,
NdrVersionFilter  filter = NdrVersionFilterDefaultOnly 
)

A convenience wrapper around GetNodeByName().

Instead of providing a priority list, an exact type is specified, and nullptr is returned if a node with the exact identifier and type does not exist.

Optionally, a filter can be specified to consider just the default versions of nodes matching name (the default) or all versions of the nodes.

NDR_API NdrNodeConstPtr GetNodeByURI ( const std::string &  uri)

Gets the node matching the specified URI (eg, a filesystem path).

The URI specified here must match the node's URI exactly (eg, a relative filesystem path would not match an absolute path). Only runs the parsing process for the single node matching the specified URI. Returns nullptr if a node matching the URI does not exist.

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.

Nodes created from an asset using this API can be looked up by the unique identifier and sourceType of the returned node, or by URI, which will be set to the unresolved asset path value.

metadata contains additional metadata needed for parsing and compiling the source code in the file pointed to by asset correctly. This metadata supplements the metadata available in the asset and overrides it in cases where there are key collisions.

subidentifier is optional, and it would be used to indicate a particular definition in the asset file if the asset contains multiple node definitions.

sourceType is optional, and it is only needed to indicate a particular type if the asset file is capable of representing a node definition of multiple source types.

Returns a valid node if the asset is parsed successfully using one of the registered parser plugins.

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.

The parser to be used is determined by the specified sourceType.

Nodes created from source code using this API can be looked up by the unique identifier and sourceType of the returned node.

metadata contains additional metadata needed for parsing and compiling the source code correctly. This metadata supplements the metadata available in sourceCode and overrides it cases where there are key collisions.

Returns a valid node if the given source code is parsed successfully using the parser plugins that is registered for the specified sourceType.

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.

This will not run the parsing plugins on the nodes that have been discovered, so this method is relatively quick. Optionally, a "family" name can be specified to only get the identifiers of nodes that belong to that family and a filter can be specified to get just the default version (the default) or all versions of the node.

NDR_API NdrStringVec GetNodeNames ( const TfToken family = TfToken()) const

Get the names of all the nodes that the registry is aware of.

This will not run the parsing plugins on the nodes that have been discovered, so this method is relatively quick. Optionally, a "family" name can be specified to only get the names of nodes that belong to that family.

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 family and/or the default version.

Note that this will parse all nodes that the registry is aware of (unless a family is specified), so this may take some time to run the first time it is called.

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).

Only nodes matching the specified identifier will be parsed. If no nodes match the identifier, an empty vector is returned.

NDR_API NdrNodeConstPtrVec GetNodesByName ( const std::string &  name,
NdrVersionFilter  filter = NdrVersionFilterDefaultOnly 
)

Get all nodes matching the specified name.

Only nodes matching the specified name will be parsed. Optionally, a filter can be specified to get just the default version (the default) or all versions of the node. If no nodes match an empty vector is returned.

NDR_API NdrStringVec GetSearchURIs ( ) const

Get the locations where the registry is searching for nodes.

Depending on which discovery plugins were used, this may include non-filesystem paths.

NDR_API void SetExtraDiscoveryPlugins ( DiscoveryPluginRefPtrVec  plugins)

Allows the client to set any additional discovery plugins that would otherwise NOT be found through the plugin system.

Runs the discovery process for the specified plugins immediately.

Note that this method cannot be called after any nodes in the registry have been parsed (eg, through GetNode*()), otherwise an error will result.

NDR_API void SetExtraDiscoveryPlugins ( const std::vector< TfType > &  pluginTypes)

Allows the client to set any additional discovery plugins that would otherwise NOT be found through the plugin system.

Runs the discovery process for the specified plugins immediately.

Note that this method cannot be called after any nodes in the registry have been parsed (eg, through GetNode*()), otherwise an error will result.

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 plugin system.

Note that this method cannot be called after any nodes in the registry have been parsed (eg, through GetNode*()), otherwise an error will result.


The documentation for this class was generated from the following file: