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& uri,
60  const std::string& resolvedUri,
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& GetSourceURI() const { return _uri; }
119 
124  const std::string& GetResolvedSourceURI() const { return _resolvedUri; }
125 
137  const std::string &GetSourceCode() const { return _sourceCode; }
138 
147  NDR_API
148  virtual bool IsValid() const { return _isValid; }
149 
152  NDR_API
153  virtual std::string GetInfoString() const;
154 
156 
157 
161 
163  NDR_API
164  const NdrTokenVec& GetInputNames() const;
165 
167  NDR_API
168  const NdrTokenVec& GetOutputNames() const;
169 
172  NDR_API
173  NdrPropertyConstPtr GetInput(const TfToken& inputName) const;
174 
177  NDR_API
178  NdrPropertyConstPtr GetOutput(const TfToken& outputName) const;
179 
181 
182 
189 
193  NDR_API
194  const NdrTokenMap& GetMetadata() const;
195 
197 
198 protected:
199  NdrNode& operator=(const NdrNode&) = delete;
200 
201  bool _isValid;
202  NdrIdentifier _identifier;
203  NdrVersion _version;
204  std::string _name;
205  TfToken _family;
206  TfToken _context;
207  TfToken _sourceType;
208  std::string _uri;
209  std::string _resolvedUri;
210  NdrPropertyUniquePtrVec _properties;
211  NdrTokenMap _metadata;
212  std::string _sourceCode;
213 
214  NdrPropertyPtrMap _inputs;
215  NdrTokenVec _inputNames;
216  NdrPropertyPtrMap _outputs;
217  NdrTokenVec _outputNames;
218 };
219 
220 PXR_NAMESPACE_CLOSE_SCOPE
221 
222 #endif // PXR_USD_NDR_NODE_H
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 std::string & GetResolvedSourceURI() const
Gets the resolved source URI of the node.
Definition: node.h:124
const NdrIdentifier & GetIdentifier() const
Return the identifier of the node.
Definition: node.h:73
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.
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 &uri, const std::string &resolvedUri, NdrPropertyUniquePtrVec &&properties, const NdrTokenMap &metadata=NdrTokenMap(), const std::string &sourceCode=std::string())
Constructor.
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.
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:137
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:148
const std::string & GetSourceURI() const
Gets the URI to the resource that this node originated from.
Definition: node.h:118
virtual NDR_API ~NdrNode()
Destructor.