This document is for a version of USD that is under development. See this page for the current release.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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
12
13#include "pxr/pxr.h"
14#include "pxr/usd/ndr/api.h"
15#include "pxr/base/tf/token.h"
16#include "pxr/usd/ndr/declare.h"
17#include "pxr/usd/ndr/nodeDiscoveryResult.h"
19
20PXR_NAMESPACE_OPEN_SCOPE
21
32{
33public:
35 NDR_API
36 NdrNode(const NdrIdentifier& identifier,
37 const NdrVersion& version,
38 const std::string& name,
39 const TfToken& family,
40 const TfToken& context,
41 const TfToken& sourceType,
42 const std::string& definitionURI,
43 const std::string& implementationURI,
44 NdrPropertyUniquePtrVec&& properties,
45 const NdrTokenMap& metadata = NdrTokenMap(),
46 const std::string &sourceCode = std::string());
47
49 NDR_API
50 virtual ~NdrNode();
51
54
56 const NdrIdentifier& GetIdentifier() const { return _identifier; }
57
59 NdrVersion GetVersion() const { return _version; }
60
62 const std::string& GetName() const { return _name; }
63
66 const TfToken& GetFamily() const { return _family; }
67
80 const TfToken& GetContext() const { return _context; }
81
94 const TfToken& GetSourceType() const { return _sourceType; }
95
101 const std::string& GetResolvedDefinitionURI() const { return _definitionURI; }
102
108 const std::string& GetResolvedImplementationURI() const { return _implementationURI; }
109
121 const std::string &GetSourceCode() const { return _sourceCode; }
122
131 NDR_API
132 virtual bool IsValid() const { return _isValid; }
133
136 NDR_API
137 virtual std::string GetInfoString() const;
138
140
141
145
147 NDR_API
148 const NdrTokenVec& GetInputNames() const;
149
151 NDR_API
152 const NdrTokenVec& GetOutputNames() const;
153
156 NDR_API
157 NdrPropertyConstPtr GetInput(const TfToken& inputName) const;
158
161 NDR_API
162 NdrPropertyConstPtr GetOutput(const TfToken& outputName) const;
163
165
166
173
177 NDR_API
178 const NdrTokenMap& GetMetadata() const;
179
181
182protected:
183 NdrNode& operator=(const NdrNode&) = delete;
184
185 bool _isValid;
186 NdrIdentifier _identifier;
187 NdrVersion _version;
188 std::string _name;
189 TfToken _family;
190 TfToken _context;
191 TfToken _sourceType;
192 std::string _definitionURI;
193 std::string _implementationURI;
194 NdrPropertyUniquePtrVec _properties;
195 NdrTokenMap _metadata;
196 std::string _sourceCode;
197
198 NdrPropertyPtrMap _inputs;
199 NdrTokenVec _inputNames;
200 NdrPropertyPtrMap _outputs;
201 NdrTokenVec _outputNames;
202};
203
204PXR_NAMESPACE_CLOSE_SCOPE
205
206#endif // PXR_USD_NDR_NODE_H
Represents an abstract node.
Definition: node.h:32
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:59
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:66
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:132
const std::string & GetName() const
Gets the name of the node.
Definition: node.h:62
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:80
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:108
const std::string & GetSourceCode() const
Returns the source code for this node.
Definition: node.h:121
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:94
const NdrIdentifier & GetIdentifier() const
Return the identifier of the node.
Definition: node.h:56
const std::string & GetResolvedDefinitionURI() const
Gets the URI to the resource that provided this node's definition.
Definition: node.h:101
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.