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 NDR_NODE_H
26 #define 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  NdrPropertyUniquePtrVec&& properties,
61  const NdrTokenMap& metadata = NdrTokenMap(),
62  const std::string &sourceCode = std::string());
63 
65  NDR_API
66  virtual ~NdrNode();
67 
70 
72  const NdrIdentifier& GetIdentifier() const { return _identifier; }
73 
75  NdrVersion GetVersion() const { return _version; }
76 
78  const std::string& GetName() const { return _name; }
79 
82  const TfToken& GetFamily() const { return _family; }
83 
96  const TfToken& GetContext() const { return _context; }
97 
110  const TfToken& GetSourceType() const { return _sourceType; }
111 
114  const std::string& GetSourceURI() const { return _uri; }
115 
127  const std::string &GetSourceCode() const { return _sourceCode; }
128 
137  NDR_API
138  virtual bool IsValid() const { return _isValid; }
139 
142  NDR_API
143  virtual std::string GetInfoString() const;
144 
146 
147 
151 
153  NDR_API
154  const NdrTokenVec& GetInputNames() const;
155 
157  NDR_API
158  const NdrTokenVec& GetOutputNames() const;
159 
162  NDR_API
163  NdrPropertyConstPtr GetInput(const TfToken& inputName) const;
164 
167  NDR_API
168  NdrPropertyConstPtr GetOutput(const TfToken& outputName) const;
169 
171 
172 
179 
183  NDR_API
184  const NdrTokenMap& GetMetadata() const;
185 
187 
188 protected:
189  NdrNode& operator=(const NdrNode&) = delete;
190 
191  bool _isValid;
192  NdrIdentifier _identifier;
193  NdrVersion _version;
194  std::string _name;
195  TfToken _family;
196  TfToken _context;
197  TfToken _sourceType;
198  std::string _uri;
199  NdrPropertyUniquePtrVec _properties;
200  NdrTokenMap _metadata;
201  std::string _sourceCode;
202 
203  NdrPropertyPtrMap _inputs;
204  NdrTokenVec _inputNames;
205  NdrPropertyPtrMap _outputs;
206  NdrTokenVec _outputNames;
207 };
208 
209 PXR_NAMESPACE_CLOSE_SCOPE
210 
211 #endif // NDR_NODE_H
const TfToken & GetFamily() const
Gets the name of the family that the node belongs to.
Definition: node.h:82
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:72
NdrVersion GetVersion() const
Return the version of the node.
Definition: node.h:75
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:89
const TfToken & GetSourceType() const
Gets the type of source that this node originated from.
Definition: node.h:110
Represents an abstract node.
Definition: node.h:48
const std::string & GetName() const
Gets the name of the node.
Definition: node.h:78
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:127
const TfToken & GetContext() const
Gets the context of the node.
Definition: node.h:96
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.
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, NdrPropertyUniquePtrVec &&properties, const NdrTokenMap &metadata=NdrTokenMap(), const std::string &sourceCode=std::string())
Constructor.
virtual NDR_API bool IsValid() const
Whether or not this node is valid.
Definition: node.h:138
const std::string & GetSourceURI() const
Gets the URI to the resource that this node originated from.
Definition: node.h:114
virtual NDR_API ~NdrNode()
Destructor.