HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
NdrProperty Class Reference

#include <property.h>

+ Inheritance diagram for NdrProperty:

Public Member Functions

NDR_API NdrProperty (const TfToken &name, const TfToken &type, const VtValue &defaultValue, bool isOutput, size_t arraySize, bool isDynamicArray, const NdrTokenMap &metadata)
 Constructor. More...
 
virtual NDR_API ~NdrProperty ()
 Destructor. More...
 
The Basics
NDR_API const TfTokenGetName () const
 Gets the name of the property. More...
 
NDR_API const TfTokenGetType () const
 Gets the type of the property. More...
 
NDR_API const VtValueGetDefaultValue () const
 
NDR_API bool IsOutput () const
 Whether this property is an output. More...
 
NDR_API bool IsArray () const
 Whether this property's type is an array type. More...
 
NDR_API bool IsDynamicArray () const
 Whether this property's array type is dynamically-sized. More...
 
NDR_API int GetArraySize () const
 
virtual NDR_API std::string GetInfoString () const
 
Metadata

The metadata returned here is a direct result of what the parser plugin is able to determine about the node. See the documentation for a specific parser plugin to get help on what the parser is looking for to populate these values.

virtual NDR_API const NdrTokenMapGetMetadata () const
 All of the metadata that came from the parse process. More...
 
Connection Information
virtual NDR_API bool IsConnectable () const
 Whether this property can be connected to other properties. More...
 
virtual NDR_API bool CanConnectTo (const NdrProperty &other) const
 Determines if this property can be connected to the specified property. More...
 
Utilities
virtual NDR_API const
NdrSdfTypeIndicator 
GetTypeAsSdfType () const
 
virtual NDR_API const VtValueGetDefaultValueAsSdfType () const
 

Protected Member Functions

NdrPropertyoperator= (const NdrProperty &)=delete
 

Protected Attributes

TfToken _name
 
TfToken _type
 
VtValue _defaultValue
 
bool _isOutput
 
size_t _arraySize
 
bool _isDynamicArray
 
bool _isConnectable
 
NdrTokenMap _metadata
 

Detailed Description

Represents a property (input or output) that is part of a NdrNode instance.

A property must have a name and type, but may also specify a host of additional metadata. Instances can also be queried to determine if another NdrProperty instance can be connected to it.

In almost all cases, this class will not be used directly. More specialized properties can be created that derive from NdrProperty; those specialized properties can add their own domain-specific data and methods.

Definition at line 50 of file property.h.

Constructor & Destructor Documentation

NDR_API NdrProperty::NdrProperty ( const TfToken name,
const TfToken type,
const VtValue defaultValue,
bool  isOutput,
size_t  arraySize,
bool  isDynamicArray,
const NdrTokenMap metadata 
)

Constructor.

virtual NDR_API NdrProperty::~NdrProperty ( )
virtual

Destructor.

Member Function Documentation

virtual NDR_API bool NdrProperty::CanConnectTo ( const NdrProperty other) const
virtual

Determines if this property can be connected to the specified property.

Reimplemented in SdrShaderProperty.

NDR_API int NdrProperty::GetArraySize ( ) const
inline

Gets this property's array size.

If this property is a fixed-size array type, the array size is returned. In the case of a dynamically-sized array, this method returns the array size that the parser reports, and should not be relied upon to be accurate. A parser may report -1 for the array size, for example, to indicate a dynamically-sized array. For types that are not a fixed-size array or dynamic array, this returns 0.

Definition at line 108 of file property.h.

NDR_API const VtValue& NdrProperty::GetDefaultValue ( ) const
inline

Gets this property's default value associated with the type of the property.

See Also
GetType()

Definition at line 85 of file property.h.

virtual NDR_API const VtValue& NdrProperty::GetDefaultValueAsSdfType ( ) const
virtual

Provides default value corresponding to the SdfValueTypeName returned by GetTypeAsSdfType.

Derived classes providing an implementation for GetTypeAsSdfType should also provide an implementation for this.

See Also
GetTypeAsSdfType()

Reimplemented in SdrShaderProperty.

virtual NDR_API std::string NdrProperty::GetInfoString ( ) const
virtual

Gets a string with basic information about this property. Helpful for things like adding this property to a log.

virtual NDR_API const NdrTokenMap& NdrProperty::GetMetadata ( ) const
inlinevirtual

All of the metadata that came from the parse process.

Definition at line 127 of file property.h.

NDR_API const TfToken& NdrProperty::GetName ( ) const
inline

Gets the name of the property.

Definition at line 74 of file property.h.

NDR_API const TfToken& NdrProperty::GetType ( ) const
inline

Gets the type of the property.

Definition at line 78 of file property.h.

virtual NDR_API const NdrSdfTypeIndicator NdrProperty::GetTypeAsSdfType ( ) const
virtual

Converts the property's type from GetType() into a SdfValueTypeName.

Two scenarios can result: an exact mapping from property type to Sdf type, and an inexact mapping. In the first scenario, the first element in the pair will be the cleanly-mapped Sdf type, and the second element, a TfToken, will be empty. In the second scenario, the Sdf type will be set to Token to indicate an unclean mapping, and the second element will be set to the original type returned by GetType().

This base property class is generic and cannot know ahead of time how to perform this mapping reliably, thus it will always fall into the second scenario. It is up to specialized properties to perform the mapping.

See Also
GetDefaultValueAsSdfType()

Reimplemented in SdrShaderProperty.

NDR_API bool NdrProperty::IsArray ( ) const
inline

Whether this property's type is an array type.

Definition at line 93 of file property.h.

virtual NDR_API bool NdrProperty::IsConnectable ( ) const
virtual

Whether this property can be connected to other properties.

Reimplemented in SdrShaderProperty.

NDR_API bool NdrProperty::IsDynamicArray ( ) const
inline

Whether this property's array type is dynamically-sized.

Definition at line 97 of file property.h.

NDR_API bool NdrProperty::IsOutput ( ) const
inline

Whether this property is an output.

Definition at line 89 of file property.h.

NdrProperty& NdrProperty::operator= ( const NdrProperty )
protecteddelete

Member Data Documentation

size_t NdrProperty::_arraySize
protected

Definition at line 185 of file property.h.

VtValue NdrProperty::_defaultValue
protected

Definition at line 183 of file property.h.

bool NdrProperty::_isConnectable
protected

Definition at line 187 of file property.h.

bool NdrProperty::_isDynamicArray
protected

Definition at line 186 of file property.h.

bool NdrProperty::_isOutput
protected

Definition at line 184 of file property.h.

NdrTokenMap NdrProperty::_metadata
protected

Definition at line 188 of file property.h.

TfToken NdrProperty::_name
protected

Definition at line 181 of file property.h.

TfToken NdrProperty::_type
protected

Definition at line 182 of file property.h.


The documentation for this class was generated from the following file: