HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
NdrDiscoveryPlugin Class Referenceabstract

#include <discoveryPlugin.h>

+ Inheritance diagram for NdrDiscoveryPlugin:

Public Types

using Context = NdrDiscoveryPluginContext
 
- Public Types inherited from TfRefBase
typedef void(* UniqueChangedFuncPtr )(TfRefBase const *, bool)
 

Public Member Functions

NDR_API NdrDiscoveryPlugin ()
 
virtual NDR_API ~NdrDiscoveryPlugin ()
 
virtual NDR_API
NdrNodeDiscoveryResultVec 
DiscoverNodes (const Context &)=0
 
virtual NDR_API const
NdrStringVec
GetSearchURIs () const =0
 Gets the URIs that this plugin is searching for nodes in. More...
 
- Public Member Functions inherited from TfRefBase
 TfRefBase ()
 
 TfRefBase (TfRefBase const &)
 
TfRefBaseoperator= (TfRefBase const &)
 
size_t GetCurrentCount () const
 Return the current reference count of this object. More...
 
bool IsUnique () const
 Return true if only one TfRefPtr points to this object. More...
 
void SetShouldInvokeUniqueChangedListener (bool shouldCall)
 
- Public Member Functions inherited from TfWeakBase
 TfWeakBase ()
 
 TfWeakBase (const TfWeakBase &)
 
const TfWeakBase__GetTfWeakBase__ () const
 
const TfWeakBaseoperator= (const TfWeakBase &)
 
void EnableNotification2 () const
 
TF_API void const * GetUniqueIdentifier () const
 

Additional Inherited Members

- Static Public Member Functions inherited from TfRefBase
static TF_API void SetUniqueChangedListener (UniqueChangedListener listener)
 
- Protected Member Functions inherited from TfRefBase
virtual TF_API ~TfRefBase ()
 
- Protected Member Functions inherited from TfWeakBase
 ~TfWeakBase ()
 
TfRefPtr< Tf_Remnant_Register () const
 
template<class T >
TfRefPtr< Tf_Remnant_Register (T *tempRmnt) const
 
bool _HasRemnant () const
 

Detailed Description

Interface for discovery plugins.

Discovery plugins, like the name implies, find nodes. Where the plugin searches is up to the plugin that implements this interface. Examples of discovery plugins could include plugins that look for nodes on the filesystem, another that finds nodes in a cloud service, and another that searches a local database. Multiple discovery plugins that search the filesystem in specific locations/ways could also be created. All discovery plugins are executed as soon as the registry is instantiated.

These plugins simply report back to the registry what nodes they found in a generic way. The registry doesn't know much about the innards of the nodes yet, just that the nodes exist. Understanding the nodes is the responsibility of another set of plugins defined by the NdrParserPlugin interface.

Discovery plugins report back to the registry via NdrNodeDiscoveryResults. These are small, lightweight classes that contain the information for a single node that was found during discovery. The discovery result only includes node information that can be gleaned pre-parse, so the data is fairly limited; to see exactly what's included, and what is expected to be populated, see the documentation for NdrNodeDiscoveryResult.

How to Create a Parser Plugin

There are three steps to creating a discovery plugin:

  • Implement the discovery plugin interface, NdrDiscoveryPlugin
  • Register your new plugin with the registry. The registration macro must be called in your plugin's implementation file:
    NDR_REGISTER_DISCOVERY_PLUGIN(YOUR_DISCOVERY_PLUGIN_CLASS_NAME)
    This macro is available in discoveryPlugin.h.
  • In the same folder as your plugin, create a plugInfo.json file. This file must be formatted like so, substituting YOUR_LIBRARY_NAME, YOUR_CLASS_NAME, and YOUR_DISPLAY_NAME:

    {
    "Plugins": [{
    "Type": "library",
    "Name": "YOUR_LIBRARY_NAME",
    "Root": "@PLUG_INFO_ROOT@",
    "LibraryPath": "@PLUG_INFO_LIBRARY_PATH@",
    "ResourcePath": "@PLUG_INFO_RESOURCE_PATH@",
    "Info": {
    "Types": {
    "YOUR_CLASS_NAME" : {
    "bases": ["NdrDiscoveryPlugin"],
    "displayName": "YOUR_DISPLAY_NAME"
    }
    }
    }
    }]
    }

    The NDR ships with one discovery plugin, the _NdrFilesystemDiscoveryPlugin. Take a look at NDR's plugInfo.json file for example values for YOUR_LIBRARY_NAME, YOUR_CLASS_NAME, and YOUR_DISPLAY_NAME. If multiple discovery plugins exist in the same folder, you can continue adding additional plugins under the Types key in the JSON. More detailed information about the plugInfo.json format can be found in the documentation for the plug library (in pxr/base).

Definition at line 143 of file discoveryPlugin.h.

Member Typedef Documentation

Constructor & Destructor Documentation

NDR_API NdrDiscoveryPlugin::NdrDiscoveryPlugin ( )
virtual NDR_API NdrDiscoveryPlugin::~NdrDiscoveryPlugin ( )
virtual

Member Function Documentation

virtual NDR_API NdrNodeDiscoveryResultVec NdrDiscoveryPlugin::DiscoverNodes ( const Context )
pure virtual

Finds and returns all nodes that the implementing plugin should be aware of.

Implemented in _NdrFilesystemDiscoveryPlugin, and UsdHydraDiscoveryPlugin.

virtual NDR_API const NdrStringVec& NdrDiscoveryPlugin::GetSearchURIs ( ) const
pure virtual

Gets the URIs that this plugin is searching for nodes in.

Implemented in _NdrFilesystemDiscoveryPlugin, and UsdHydraDiscoveryPlugin.


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