Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the AppendDiscoveryResult to NdrRegistry #1810

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions pxr/usd/ndr/registry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,20 @@ NdrRegistry::SetExtraDiscoveryPlugins(const std::vector<TfType>& pluginTypes)
SetExtraDiscoveryPlugins(std::move(discoveryPlugins));
}

void NdrRegistry::AddDiscoveryResult(NdrNodeDiscoveryResult&& discoveryResult)
{
std::lock_guard<std::mutex> drLock(_discoveryResultMutex);
_AddDiscoveryResultNoLock(std::move(discoveryResult));
}

void NdrRegistry::AddDiscoveryResult(const NdrNodeDiscoveryResult& discoveryResult)
{
// Explicitly create a copy, otherwise this method will recurse
// into itself.
NdrNodeDiscoveryResult result = discoveryResult;
AddDiscoveryResult(std::move(result));
}

void
NdrRegistry::SetExtraParserPlugins(const std::vector<TfType>& pluginTypes)
{
Expand Down
17 changes: 17 additions & 0 deletions pxr/usd/ndr/registry.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,23 @@ class NdrRegistry : public TfWeakBase
NDR_API
void SetExtraDiscoveryPlugins(const std::vector<TfType>& pluginTypes);

/// Allows the client to explicitly set additional discovery results that
/// would otherwise NOT be found through the plugin system. For example
/// to support lazily-loaded plugins which cannot be easily discovered
/// in advance.
///
/// This method will not immediately spawn a parse call which will be
/// deferred until a GetNode*() method is called.
NDR_API
void AddDiscoveryResult(NdrNodeDiscoveryResult&& discoveryResult);

/// Copy version of the method above.
Copy link
Member

@spiffmon spiffmon Jun 2, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use the doxygen \overload directive, here?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

/// For performance reasons, one should prefer to use the rvalue reference
/// form.
/// \overload
NDR_API
void AddDiscoveryResult(const NdrNodeDiscoveryResult& discoveryResult);

/// Allows the client to set any additional parser plugins that would
/// otherwise NOT be found through the plugin system.
///
Expand Down