Loading...
Searching...
No Matches
property.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_PROPERTY_H
9#define PXR_USD_NDR_PROPERTY_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/base/vt/value.h"
17#include "pxr/usd/ndr/declare.h"
18
19PXR_NAMESPACE_OPEN_SCOPE
20
34{
35public:
37 NDR_API
39 const TfToken& name,
40 const TfToken& type,
41 const VtValue& defaultValue,
42 bool isOutput,
43 size_t arraySize,
44 bool isDynamicArray,
45 const NdrTokenMap& metadata
46 );
47
49 NDR_API
50 virtual ~NdrProperty();
51
54
56 NDR_API
57 const TfToken& GetName() const { return _name; }
58
60 NDR_API
61 const TfToken& GetType() const { return _type; }
62
67 NDR_API
68 const VtValue& GetDefaultValue() const { return _defaultValue; }
69
71 NDR_API
72 bool IsOutput() const { return _isOutput; }
73
75 NDR_API
76 bool IsArray() const { return (_arraySize > 0) || _isDynamicArray; }
77
79 NDR_API
80 bool IsDynamicArray() const { return _isDynamicArray; };
81
90 NDR_API
91 int GetArraySize() const { return _arraySize; }
92
95 NDR_API
96 virtual std::string GetInfoString() const;
97
99
100
107
109 NDR_API
110 virtual const NdrTokenMap& GetMetadata() const { return _metadata; }
111
113
114
117
119 NDR_API
120 virtual bool IsConnectable() const;
121
123 NDR_API
124 virtual bool CanConnectTo(const NdrProperty& other) const;
125
127
128
131
146 NDR_API
147 virtual const NdrSdfTypeIndicator GetTypeAsSdfType() const;
148
156 NDR_API
157 virtual const VtValue& GetDefaultValueAsSdfType() const;
158
160
161protected:
162 NdrProperty& operator=(const NdrProperty&) = delete;
163
164 TfToken _name;
165 TfToken _type;
166 VtValue _defaultValue;
167 bool _isOutput;
168 size_t _arraySize;
169 bool _isDynamicArray;
170 bool _isConnectable;
171 NdrTokenMap _metadata;
172};
173
174PXR_NAMESPACE_CLOSE_SCOPE
175
176#endif // PXR_USD_NDR_PROPERTY_H
Represents a property (input or output) that is part of a NdrNode instance.
Definition: property.h:34
NDR_API const VtValue & GetDefaultValue() const
Gets this property's default value associated with the type of the property.
Definition: property.h:68
NDR_API bool IsOutput() const
Whether this property is an output.
Definition: property.h:72
virtual NDR_API bool IsConnectable() const
Whether this property can be connected to other properties.
virtual NDR_API bool CanConnectTo(const NdrProperty &other) const
Determines if this property can be connected to the specified property.
virtual NDR_API const NdrTokenMap & GetMetadata() const
All of the metadata that came from the parse process.
Definition: property.h:110
NDR_API const TfToken & GetType() const
Gets the type of the property.
Definition: property.h:61
virtual NDR_API const VtValue & GetDefaultValueAsSdfType() const
Provides default value corresponding to the SdfValueTypeName returned by GetTypeAsSdfType.
virtual NDR_API const NdrSdfTypeIndicator GetTypeAsSdfType() const
Converts the property's type from GetType() into a SdfValueTypeName.
virtual NDR_API std::string GetInfoString() const
Gets a string with basic information about this property.
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.
NDR_API bool IsDynamicArray() const
Whether this property's array type is dynamically-sized.
Definition: property.h:80
NDR_API int GetArraySize() const
Gets this property's array size.
Definition: property.h:91
NDR_API bool IsArray() const
Whether this property's type is an array type.
Definition: property.h:76
NDR_API const TfToken & GetName() const
Gets the name of the property.
Definition: property.h:57
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:71
Provides a container which may hold any type, and provides introspection and iteration over array typ...
Definition: value.h:147
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.