All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
node.h
Go to the documentation of this file.
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_NODE_H
26 #define PXR_USD_NDR_NODE_H
27 
29 
30 #include "pxr/pxr.h"
31 #include "pxr/usd/ndr/api.h"
32 #include "pxr/base/tf/token.h"
33 #include "pxr/usd/ndr/declare.h"
34 #include "pxr/usd/ndr/nodeDiscoveryResult.h"
35 #include "pxr/usd/ndr/property.h"
36 
37 PXR_NAMESPACE_OPEN_SCOPE
38 
48 class NdrNode
49 {
50 public:
52  NDR_API
53  NdrNode(const NdrIdentifier& identifier,
54  const NdrVersion& version,
55  const std::string& name,
56  const TfToken& family,
57  const TfToken& context,
58  const TfToken& sourceType,
59  const std::string& definitionURI,
60  const std::string& implementationURI,
61  NdrPropertyUniquePtrVec&& properties,
62  const NdrTokenMap& metadata = NdrTokenMap(),
63  const std::string &sourceCode = std::string());
64 
66  NDR_API
67  virtual ~NdrNode();
68 
71 
73  const NdrIdentifier& GetIdentifier() const { return _identifier; }
74 
76  NdrVersion GetVersion() const { return _version; }
77 
79  const std::string& GetName() const { return _name; }
80 
83  const TfToken& GetFamily() const { return _family; }
84 
97  const TfToken& GetContext() const { return _context; }
98 
111  const TfToken& GetSourceType() const { return _sourceType; }
112 
118  const std::string& GetResolvedDefinitionURI() const { return _definitionURI; }
119 
125  const std::string& GetResolvedImplementationURI() const { return _implementationURI; }
126 
138  const std::string &GetSourceCode() const { return _sourceCode; }
139 
148  NDR_API
149  virtual bool IsValid() const { return _isValid; }
150 
153  NDR_API
154  virtual std::string GetInfoString() const;
155 
157 
158 
162 
164  NDR_API
165  const NdrTokenVec& GetInputNames() const;
166 
168  NDR_API
169  const NdrTokenVec& GetOutputNames() const;
170 
173  NDR_API
174  NdrPropertyConstPtr GetInput(const TfToken& inputName) const;
175 
178  NDR_API
179  NdrPropertyConstPtr GetOutput(const TfToken& outputName) const;
180 
182 
183 
190 
194  NDR_API
195  const NdrTokenMap& GetMetadata() const;
196 
198 
199 protected:
200  NdrNode& operator=(const NdrNode&) = delete;
201 
202  bool _isValid;
203  NdrIdentifier _identifier;
204  NdrVersion _version;
205  std::string _name;
206  TfToken _family;
207  TfToken _context;
208  TfToken _sourceType;
209  std::string _definitionURI;
210  std::string _implementationURI;
211  NdrPropertyUniquePtrVec _properties;
212  NdrTokenMap _metadata;
213  std::string _sourceCode;
214 
215  NdrPropertyPtrMap _inputs;
216  NdrTokenVec _inputNames;
217  NdrPropertyPtrMap _outputs;
218  NdrTokenVec _outputNames;
219 };
220 
221 PXR_NAMESPACE_CLOSE_SCOPE
222 
223 #endif // PXR_USD_NDR_NODE_H
const std::string & GetResolvedDefinitionURI() const
Gets the URI to the resource that provided this node's definition.
Definition: node.h:118
const TfToken & GetFamily() const
Gets the name of the family that the node belongs to.
Definition: node.h:83
virtual NDR_API std::string GetInfoString() const
Gets a string with basic information about this node.
const NdrIdentifier & GetIdentifier() const
Return the identifier of the node.
Definition: node.h:73
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:76
NDR_API NdrPropertyConstPtr GetInput(const TfToken &inputName) const
Get an input property by name.
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:87
const TfToken & GetSourceType() const
Gets the type of source that this node originated from.
Definition: node.h:111
Represents an abstract node.
Definition: node.h:48
const std::string & GetName() const
Gets the name of the node.
Definition: node.h:79
NDR_API const NdrTokenVec & GetOutputNames() const
Get an ordered list of all the output names on this node.
const std::string & GetResolvedImplementationURI() const
Gets the URI to the resource that provides this node's implementation.
Definition: node.h:125
NDR_API NdrPropertyConstPtr GetOutput(const TfToken &outputName) const
Get an output property by name.
const std::string & GetSourceCode() const
Returns the source code for this node.
Definition: node.h:138
const TfToken & GetContext() const
Gets the context of the node.
Definition: node.h:97
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.
virtual NDR_API bool IsValid() const
Whether or not this node is valid.
Definition: node.h:149
virtual NDR_API ~NdrNode()
Destructor.