All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
discoveryPlugin.h
1//
2// Copyright 2018 Pixar
3//
4// Licensed under the terms set forth in the LICENSE.txt file available at
5// https://openusd.org/license.
6//
7
8#ifndef PXR_USD_NDR_DISCOVERY_PLUGIN_H
9#define PXR_USD_NDR_DISCOVERY_PLUGIN_H
10
12
13#include "pxr/pxr.h"
14#include "pxr/usd/ndr/api.h"
16#include "pxr/base/tf/type.h"
18#include "pxr/usd/ndr/declare.h"
19#include "pxr/usd/ndr/nodeDiscoveryResult.h"
20
21PXR_NAMESPACE_OPEN_SCOPE
22
26#define NDR_REGISTER_DISCOVERY_PLUGIN(DiscoveryPluginClass) \
27TF_REGISTRY_FUNCTION(TfType) \
28{ \
29 TfType::Define<DiscoveryPluginClass, TfType::Bases<NdrDiscoveryPlugin>>() \
30 .SetFactory<NdrDiscoveryPluginFactory<DiscoveryPluginClass>>(); \
31}
32
34
39{
40public:
41 NDR_API
42 virtual ~NdrDiscoveryPluginContext() = default;
43
46 NDR_API
47 virtual TfToken GetSourceType(const TfToken& discoveryType) const = 0;
48};
49
51
127{
128public:
130
131 NDR_API
133 NDR_API
134 virtual ~NdrDiscoveryPlugin();
135
138 NDR_API
139 virtual NdrNodeDiscoveryResultVec DiscoverNodes(const Context&) = 0;
140
142 NDR_API
143 virtual const NdrStringVec& GetSearchURIs() const = 0;
144};
145
146
149
150class NdrDiscoveryPluginFactoryBase : public TfType::FactoryBase
151{
152public:
153 NDR_API
154 virtual NdrDiscoveryPluginRefPtr New() const = 0;
155};
156
157template <class T>
158class NdrDiscoveryPluginFactory : public NdrDiscoveryPluginFactoryBase
159{
160public:
161 NdrDiscoveryPluginRefPtr New() const override
162 {
163 return TfCreateRefPtr(new T);
164 }
165};
166
168
169PXR_NAMESPACE_CLOSE_SCOPE
170
171#endif // PXR_USD_NDR_DISCOVERY_PLUGIN_H
A context for discovery.
virtual NDR_API TfToken GetSourceType(const TfToken &discoveryType) const =0
Returns the source type associated with the discovery type.
Interface for discovery plugins.
virtual NDR_API NdrNodeDiscoveryResultVec DiscoverNodes(const Context &)=0
Finds and returns all nodes that the implementing plugin should be aware of.
virtual NDR_API const NdrStringVec & GetSearchURIs() const =0
Gets the URIs that this plugin is searching for nodes in.
Enable a concrete base class for use with TfRefPtr.
Definition: refBase.h:56
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:71
Base class of all factory types.
Definition: type.h:56
Enable a concrete base class for use with TfWeakPtr.
Definition: weakBase.h:124
Standard pointer typedefs.
#define TF_DECLARE_WEAK_AND_REF_PTRS(type)
Define standard weak, ref, and vector pointer types.
Definition: declarePtrs.h:72
Common typedefs that are used throughout the NDR library.