discoveryPlugin.h
1
//
2
// Copyright 2018 Pixar
3
//
4
// Licensed under the Apache License, Version 2.0 (the "Apache License")
5
// with the following modification; you may not use this file except in
6
// compliance with the Apache License and the following modification to it:
7
// Section 6. Trademarks. is deleted and replaced with:
8
//
9
// 6. Trademarks. This License does not grant permission to use the trade
10
// names, trademarks, service marks, or product names of the Licensor
11
// and its affiliates, except as required to comply with Section 4(c) of
12
// the License and to reproduce the content of the NOTICE file.
13
//
14
// You may obtain a copy of the Apache License at
15
//
16
// http://www.apache.org/licenses/LICENSE-2.0
17
//
18
// Unless required by applicable law or agreed to in writing, software
19
// distributed under the Apache License with the above modification is
20
// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21
// KIND, either express or implied. See the Apache License for the specific
22
// language governing permissions and limitations under the Apache License.
23
//
24
25
#ifndef PXR_USD_NDR_DISCOVERY_PLUGIN_H
26
#define PXR_USD_NDR_DISCOVERY_PLUGIN_H
27
29
30
#include "
pxr/pxr.h
"
31
#include "pxr/usd/ndr/api.h"
32
#include "
pxr/base/tf/declarePtrs.h
"
33
#include "pxr/base/tf/type.h"
34
#include "
pxr/base/tf/weakBase.h
"
35
#include "
pxr/usd/ndr/declare.h
"
36
#include "pxr/usd/ndr/nodeDiscoveryResult.h"
37
38
PXR_NAMESPACE_OPEN_SCOPE
39
43
#define NDR_REGISTER_DISCOVERY_PLUGIN(DiscoveryPluginClass) \
44
TF_REGISTRY_FUNCTION(TfType) \
45
{ \
46
TfType::Define<DiscoveryPluginClass, TfType::Bases<NdrDiscoveryPlugin>>() \
47
.SetFactory<NdrDiscoveryPluginFactory<DiscoveryPluginClass>>(); \
48
}
49
50
TF_DECLARE_WEAK_AND_REF_PTRS
(
NdrDiscoveryPluginContext
);
51
55
class
NdrDiscoveryPluginContext
:
public
TfRefBase
,
public
TfWeakBase
56
{
57
public
:
58
NDR_API
59
virtual
~
NdrDiscoveryPluginContext
() =
default
;
60
63
NDR_API
64
virtual
TfToken
GetSourceType
(
const
TfToken
& discoveryType)
const
= 0;
65
};
66
67
TF_DECLARE_WEAK_AND_REF_PTRS
(
NdrDiscoveryPlugin
);
68
143
class
NdrDiscoveryPlugin
:
public
TfRefBase
,
public
TfWeakBase
144
{
145
public
:
146
using
Context
=
NdrDiscoveryPluginContext
;
147
148
NDR_API
149
NdrDiscoveryPlugin
();
150
NDR_API
151
virtual
~
NdrDiscoveryPlugin
();
152
155
NDR_API
156
virtual
NdrNodeDiscoveryResultVec
DiscoverNodes
(
const
Context
&) = 0;
157
159
NDR_API
160
virtual
const
NdrStringVec&
GetSearchURIs
()
const
= 0;
161
};
162
163
166
167
class
NdrDiscoveryPluginFactoryBase :
public
TfType::FactoryBase
168
{
169
public
:
170
NDR_API
171
virtual
NdrDiscoveryPluginRefPtr New()
const
= 0;
172
};
173
174
template
<
class
T>
175
class
NdrDiscoveryPluginFactory :
public
NdrDiscoveryPluginFactoryBase
176
{
177
public
:
178
NdrDiscoveryPluginRefPtr New()
const override
179
{
180
return
TfCreateRefPtr(
new
T);
181
}
182
};
183
185
186
PXR_NAMESPACE_CLOSE_SCOPE
187
188
#endif // PXR_USD_NDR_DISCOVERY_PLUGIN_H
declarePtrs.h
Standard pointer typedefs.
NdrDiscoveryPluginContext::GetSourceType
virtual NDR_API TfToken GetSourceType(const TfToken &discoveryType) const =0
Returns the source type associated with the discovery type.
TF_DECLARE_WEAK_AND_REF_PTRS
#define TF_DECLARE_WEAK_AND_REF_PTRS(type)
Define standard weak, ref, and vector pointer types.
Definition:
declarePtrs.h:89
NdrDiscoveryPlugin::DiscoverNodes
virtual NDR_API NdrNodeDiscoveryResultVec DiscoverNodes(const Context &)=0
Finds and returns all nodes that the implementing plugin should be aware of.
TfType::FactoryBase
Base class of all factory types.
Definition:
type.h:73
TfRefBase
Enable a concrete base class for use with TfRefPtr.
Definition:
refBase.h:71
TfToken
Token for efficient comparison, assignment, and hashing of known strings.
Definition:
token.h:87
declare.h
NdrDiscoveryPlugin
Interface for discovery plugins.
Definition:
discoveryPlugin.h:143
pxr.h
NdrDiscoveryPluginContext
A context for discovery.
Definition:
discoveryPlugin.h:55
NdrDiscoveryPlugin::GetSearchURIs
virtual NDR_API const NdrStringVec & GetSearchURIs() const =0
Gets the URIs that this plugin is searching for nodes in.
TfWeakBase
Enable a concrete base class for use with TfWeakPtr.
Definition:
weakBase.h:141
weakBase.h
pxr
usd
ndr
discoveryPlugin.h
Generated on Mon Jan 23 2023 19:10:40 for Universal Scene Description by
1.8.15