Loading...
Searching...
No Matches
node.h
Go to the documentation of this file.
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_NODE_H
9#define PXR_USD_NDR_NODE_H
10
16
17#include "pxr/pxr.h"
18#include "pxr/usd/ndr/api.h"
19#include "pxr/base/tf/token.h"
20#include "pxr/usd/ndr/declare.h"
21#include "pxr/usd/ndr/nodeDiscoveryResult.h"
23
24PXR_NAMESPACE_OPEN_SCOPE
25
38{
39public:
41 NDR_API
42 NdrNode(const NdrIdentifier& identifier,
43 const NdrVersion& version,
44 const std::string& name,
45 const TfToken& family,
46 const TfToken& context,
47 const TfToken& sourceType,
48 const std::string& definitionURI,
49 const std::string& implementationURI,
50 NdrPropertyUniquePtrVec&& properties,
51 const NdrTokenMap& metadata = NdrTokenMap(),
52 const std::string &sourceCode = std::string());
53
55 NDR_API
56 virtual ~NdrNode();
57
60
62 const NdrIdentifier& GetIdentifier() const { return _identifier; }
63
68 NdrVersion GetVersion() const { return _version; }
69
71 const std::string& GetName() const { return _name; }
72
75 const TfToken& GetFamily() const { return _family; }
76
89 const TfToken& GetContext() const { return _context; }
90
103 const TfToken& GetSourceType() const { return _sourceType; }
104
110 const std::string& GetResolvedDefinitionURI() const { return _definitionURI; }
111
117 const std::string& GetResolvedImplementationURI() const { return _implementationURI; }
118
130 const std::string &GetSourceCode() const { return _sourceCode; }
131
140 NDR_API
141 virtual bool IsValid() const { return _isValid; }
142
145 NDR_API
146 virtual std::string GetInfoString() const;
147
149
150
154
159 NDR_API
160 const NdrTokenVec& GetInputNames() const;
161
166 NDR_API
167 const NdrTokenVec& GetOutputNames() const;
168
174 NDR_API
175 NdrPropertyConstPtr GetInput(const TfToken& inputName) const;
176
182 NDR_API
183 NdrPropertyConstPtr GetOutput(const TfToken& outputName) const;
184
186
187
194
198 NDR_API
199 const NdrTokenMap& GetMetadata() const;
200
202
203protected:
204 NdrNode& operator=(const NdrNode&) = delete;
205
206 bool _isValid;
207 NdrIdentifier _identifier;
208 NdrVersion _version;
209 std::string _name;
210 TfToken _family;
211 TfToken _context;
212 TfToken _sourceType;
213 std::string _definitionURI;
214 std::string _implementationURI;
215 NdrPropertyUniquePtrVec _properties;
216 NdrTokenMap _metadata;
217 std::string _sourceCode;
218
219 NdrPropertyPtrMap _inputs;
220 NdrTokenVec _inputNames;
221 NdrPropertyPtrMap _outputs;
222 NdrTokenVec _outputNames;
223};
224
225PXR_NAMESPACE_CLOSE_SCOPE
226
227#endif // PXR_USD_NDR_NODE_H
Represents an abstract node.
Definition: node.h:38
NDR_API NdrNode(const NdrIdentifier &identifier, const NdrVersion &version, const std::string &name, const TfToken &family, const TfToken &context, const TfToken &sourceType, const std::string &definitionURI, const std::string &implementationURI, NdrPropertyUniquePtrVec &&properties, const NdrTokenMap &metadata=NdrTokenMap(), const std::string &sourceCode=std::string())
Constructor.
NdrVersion GetVersion() const
Return the version of the node.
Definition: node.h:68
NDR_API NdrPropertyConstPtr GetInput(const TfToken &inputName) const
Get an input property by name.
const TfToken & GetFamily() const
Gets the name of the family that the node belongs to.
Definition: node.h:75
NDR_API NdrPropertyConstPtr GetOutput(const TfToken &outputName) const
Get an output property by name.
virtual NDR_API bool IsValid() const
Whether or not this node is valid.
Definition: node.h:141
const std::string & GetName() const
Gets the name of the node.
Definition: node.h:71
virtual NDR_API std::string GetInfoString() const
Gets a string with basic information about this node.
const TfToken & GetContext() const
Gets the context of the node.
Definition: node.h:89
virtual NDR_API ~NdrNode()
Destructor.
NDR_API const NdrTokenMap & GetMetadata() const
All metadata that came from the parse process.
NDR_API const NdrTokenVec & GetInputNames() const
Get an ordered list of all the input names on this node.
const std::string & GetResolvedImplementationURI() const
Gets the URI to the resource that provides this node's implementation.
Definition: node.h:117
const std::string & GetSourceCode() const
Returns the source code for this node.
Definition: node.h:130
NDR_API const NdrTokenVec & GetOutputNames() const
Get an ordered list of all the output names on this node.
const TfToken & GetSourceType() const
Gets the type of source that this node originated from.
Definition: node.h:103
const NdrIdentifier & GetIdentifier() const
Return the identifier of the node.
Definition: node.h:62
const std::string & GetResolvedDefinitionURI() const
Gets the URI to the resource that provided this node's definition.
Definition: node.h:110
NdrVersion.
Definition: declare.h:79
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:71
TfToken class for efficient string referencing and hashing, plus conversions to and from stl string c...
Common typedefs that are used throughout the NDR library.