All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
property.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_PROPERTY_H
26 #define PXR_USD_NDR_PROPERTY_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/base/vt/value.h"
34 #include "pxr/usd/ndr/declare.h"
35 
36 PXR_NAMESPACE_OPEN_SCOPE
37 
51 {
52 public:
54  NDR_API
56  const TfToken& name,
57  const TfToken& type,
58  const VtValue& defaultValue,
59  bool isOutput,
60  size_t arraySize,
61  bool isDynamicArray,
62  const NdrTokenMap& metadata
63  );
64 
66  NDR_API
67  virtual ~NdrProperty();
68 
71 
73  NDR_API
74  const TfToken& GetName() const { return _name; }
75 
77  NDR_API
78  const TfToken& GetType() const { return _type; }
79 
81  NDR_API
82  const VtValue& GetDefaultValue() const { return _defaultValue; }
83 
85  NDR_API
86  bool IsOutput() const { return _isOutput; }
87 
89  NDR_API
90  bool IsArray() const { return (_arraySize > 0) || _isDynamicArray; }
91 
93  NDR_API
94  bool IsDynamicArray() const { return _isDynamicArray; };
95 
104  NDR_API
105  int GetArraySize() const { return _arraySize; }
106 
109  NDR_API
110  virtual std::string GetInfoString() const;
111 
113 
114 
121 
123  NDR_API
124  virtual const NdrTokenMap& GetMetadata() const { return _metadata; }
125 
127 
128 
131 
133  NDR_API
134  virtual bool IsConnectable() const;
135 
137  NDR_API
138  virtual bool CanConnectTo(const NdrProperty& other) const;
139 
141 
142 
145 
158  NDR_API
159  virtual const NdrSdfTypeIndicator GetTypeAsSdfType() const;
160 
162 
163 protected:
164  NdrProperty& operator=(const NdrProperty&) = delete;
165 
166  TfToken _name;
167  TfToken _type;
168  VtValue _defaultValue;
169  bool _isOutput;
170  size_t _arraySize;
171  bool _isDynamicArray;
172  bool _isConnectable;
173  NdrTokenMap _metadata;
174 };
175 
176 PXR_NAMESPACE_CLOSE_SCOPE
177 
178 #endif // PXR_USD_NDR_PROPERTY_H
virtual NDR_API bool IsConnectable() const
Whether this property can be connected to other properties.
virtual NDR_API const NdrTokenMap & GetMetadata() const
All of the metadata that came from the parse process.
Definition: property.h:124
NDR_API const TfToken & GetType() const
Gets the type of the property.
Definition: property.h:78
NDR_API bool IsDynamicArray() const
Whether this property's array type is dynamically-sized.
Definition: property.h:94
NDR_API bool IsOutput() const
Whether this property is an output.
Definition: property.h:86
virtual NDR_API const NdrSdfTypeIndicator GetTypeAsSdfType() const
Converts the property's type from GetType() into a SdfValueTypeName.
virtual NDR_API ~NdrProperty()
Destructor.
NDR_API NdrProperty(const TfToken &name, const TfToken &type, const VtValue &defaultValue, bool isOutput, size_t arraySize, bool isDynamicArray, const NdrTokenMap &metadata)
Constructor.
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:87
Represents a property (input or output) that is part of a NdrNode instance.
Definition: property.h:50
NDR_API const VtValue & GetDefaultValue() const
Gets this property's default value.
Definition: property.h:82
NDR_API bool IsArray() const
Whether this property's type is an array type.
Definition: property.h:90
NDR_API const TfToken & GetName() const
Gets the name of the property.
Definition: property.h:74
virtual NDR_API std::string GetInfoString() const
Gets a string with basic information about this property.
virtual NDR_API bool CanConnectTo(const NdrProperty &other) const
Determines if this property can be connected to the specified property.
NDR_API int GetArraySize() const
Gets this property's array size.
Definition: property.h:105
Provides a container which may hold any type, and provides introspection and iteration over array typ...
Definition: value.h:168
TfToken class for efficient string referencing and hashing, plus conversions to and from stl string c...