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

#include <schema.h>

+ Inheritance diagram for SdfSchemaBase:

Classes

struct  _FieldInfo
 
class  _SpecDefiner
 
class  _ValueTypeRegistrar
 A helper for registering value types. More...
 
class  EmptyTag
 
class  FieldDefinition
 
class  SpecDefinition
 

Public Member Functions

SDF_API const FieldDefinitionGetFieldDefinition (const TfToken &fieldKey) const
 
const SpecDefinitionGetSpecDefinition (SdfSpecType specType) const
 
SDF_API bool IsRegistered (const TfToken &fieldKey, VtValue *fallback=NULL) const
 
SDF_API bool HoldsChildren (const TfToken &fieldKey) const
 
SDF_API const VtValueGetFallback (const TfToken &fieldKey) const
 
SDF_API VtValue CastToTypeOf (const TfToken &fieldKey, const VtValue &value) const
 Coerce value to the correct type for the specified field. More...
 
SDF_API bool IsValidFieldForSpec (const TfToken &fieldKey, SdfSpecType specType) const
 Return whether the given field is valid for the given spec type. More...
 
SDF_API TfTokenVector GetFields (SdfSpecType specType) const
 Returns all fields registered for the given spec type. More...
 
SDF_API TfTokenVector GetMetadataFields (SdfSpecType specType) const
 Returns all metadata fields registered for the given spec type. More...
 
SDF_API TfToken GetMetadataFieldDisplayGroup (SdfSpecType specType, TfToken const &metadataField) const
 
SDF_API const TfTokenVectorGetRequiredFields (SdfSpecType specType) const
 Returns all required fields registered for the given spec type. More...
 
bool IsRequiredFieldName (const TfToken &fieldName) const
 
SDF_API SdfAllowed IsValidValue (const VtValue &value) const
 
SDF_API std::vector
< SdfValueTypeName
GetAllTypes () const
 Returns all registered type names. More...
 
SDF_API SdfValueTypeName FindType (const TfToken &typeName) const
 Return the type name object for the given type name token. More...
 
SDF_API SdfValueTypeName FindType (const char *typeName) const
 
SDF_API SdfValueTypeName FindType (std::string const &typeName) const
 
SDF_API SdfValueTypeName FindType (const TfType &type, const TfToken &role=TfToken()) const
 Return the type name object for the given type and optional role. More...
 
SDF_API SdfValueTypeName FindType (const VtValue &value, const TfToken &role=TfToken()) const
 Return the type name object for the value's type and optional role. More...
 
SDF_API SdfValueTypeName FindOrCreateType (const TfToken &typeName) const
 
- Public Member Functions inherited from TfWeakBase
 TfWeakBase ()
 
 TfWeakBase (const TfWeakBase &)
 
const TfWeakBase__GetTfWeakBase__ () const
 
const TfWeakBaseoperator= (const TfWeakBase &)
 
void EnableNotification2 () const
 
TF_API void constGetUniqueIdentifier () const
 

Static Public Member Functions

static SDF_API SdfAllowed IsValidAttributeConnectionPath (const SdfPath &path)
 
static SDF_API SdfAllowed IsValidIdentifier (const std::string &name)
 
static SDF_API SdfAllowed IsValidNamespacedIdentifier (const std::string &name)
 
static SDF_API SdfAllowed IsValidInheritPath (const SdfPath &path)
 
static SDF_API SdfAllowed IsValidPayload (const SdfPayload &payload)
 
static SDF_API SdfAllowed IsValidReference (const SdfReference &ref)
 
static SDF_API SdfAllowed IsValidRelationshipTargetPath (const SdfPath &path)
 
static SDF_API SdfAllowed IsValidRelocatesPath (const SdfPath &path)
 
static SDF_API SdfAllowed IsValidSpecializesPath (const SdfPath &path)
 
static SDF_API SdfAllowed IsValidSubLayer (const std::string &sublayer)
 
static SDF_API SdfAllowed IsValidVariantIdentifier (const std::string &name)
 
static SDF_API SdfAllowed IsValidVariantSelection (const std::string &sel)
 

Protected Types

typedef std::function< VtValue(const
std::string &, const JsValue &)> 
_DefaultValueFactoryFn
 

Protected Member Functions

 SdfSchemaBase ()
 
 SdfSchemaBase (EmptyTag)
 
virtual ~SdfSchemaBase ()
 
template<class T >
FieldDefinition_RegisterField (const TfToken &fieldKey, const T &fallback, bool plugin=false)
 
_SpecDefiner _Define (SdfSpecType type)
 
_SpecDefiner _ExtendSpecDefinition (SdfSpecType specType)
 
void _RegisterStandardFields ()
 Registers the standard fields. More...
 
void _RegisterPluginFields ()
 
void _RegisterStandardTypes ()
 Registers standard attribute value types. More...
 
void _RegisterLegacyTypes ()
 Registers legacy attribute value types. More...
 
_ValueTypeRegistrar _GetTypeRegistrar () const
 Returns a type registrar. More...
 
const std::vector< const
SdfSchemaBase::FieldDefinition * > 
_UpdateMetadataFromPlugins (const PlugPluginPtrVector &plugins, const std::string &metadataTag=std::string(), const _DefaultValueFactoryFn &defFactory=_DefaultValueFactoryFn())
 
- Protected Member Functions inherited from TfWeakBase
 ~TfWeakBase ()
 
TfRefPtr< Tf_Remnant_Register () const
 
template<class T >
TfRefPtr< Tf_Remnant_Register (T *tempRmnt) const
 
bool _HasRemnant () const
 

Friends

class _SpecDefiner
 
struct Sdf_SchemaFieldTypeRegistrar
 

Detailed Description

Generic class that provides information about scene description fields but doesn't actually provide any fields.

Definition at line 62 of file schema.h.

Member Typedef Documentation

Factory function for creating a default value for a metadata field. The parameters are the value type name and default value (if any) specified in the defining plugin.

Definition at line 511 of file schema.h.

Constructor & Destructor Documentation

SdfSchemaBase::SdfSchemaBase ( )
protected
SdfSchemaBase::SdfSchemaBase ( EmptyTag  )
protected
virtual SdfSchemaBase::~SdfSchemaBase ( )
protectedvirtual

Member Function Documentation

_SpecDefiner SdfSchemaBase::_Define ( SdfSpecType  type)
inlineprotected

Registers the given spec type with this schema and return a _SpecDefiner for specifying additional fields.

Definition at line 481 of file schema.h.

_SpecDefiner SdfSchemaBase::_ExtendSpecDefinition ( SdfSpecType  specType)
protected

Returns a _SpecDefiner for the previously-defined spec type for specifying additional fields.

_ValueTypeRegistrar SdfSchemaBase::_GetTypeRegistrar ( ) const
protected

Returns a type registrar.

template<class T >
FieldDefinition& SdfSchemaBase::_RegisterField ( const TfToken fieldKey,
const T fallback,
bool  plugin = false 
)
inlineprotected

Creates and registers a new field named fieldKey with the fallback value fallback. If plugin is specified, it indicates that this field is not a built-in field from this schema, but rather a field that was externally registered.

It is a fatal error to call this function with a key that has already been used for another field.

Definition at line 473 of file schema.h.

void SdfSchemaBase::_RegisterLegacyTypes ( )
protected

Registers legacy attribute value types.

void SdfSchemaBase::_RegisterPluginFields ( )
protected

Registers plugin fields and sets up handling so that fields will be added when additional plugins are registered.

void SdfSchemaBase::_RegisterStandardFields ( )
protected

Registers the standard fields.

void SdfSchemaBase::_RegisterStandardTypes ( )
protected

Registers standard attribute value types.

const std::vector<const SdfSchemaBase::FieldDefinition *> SdfSchemaBase::_UpdateMetadataFromPlugins ( const PlugPluginPtrVector &  plugins,
const std::string metadataTag = std::string(),
const _DefaultValueFactoryFn defFactory = _DefaultValueFactoryFn() 
)
protected

Registers all metadata fields specified in the given plugins under the given metadata tag.

SDF_API VtValue SdfSchemaBase::CastToTypeOf ( const TfToken fieldKey,
const VtValue value 
) const

Coerce value to the correct type for the specified field.

SDF_API SdfValueTypeName SdfSchemaBase::FindOrCreateType ( const TfToken typeName) const

Return the type name object for the given type name string if it exists otherwise create a temporary type name object. Clients should not normally need to call this.

SDF_API SdfValueTypeName SdfSchemaBase::FindType ( const TfToken typeName) const

Return the type name object for the given type name token.

SDF_API SdfValueTypeName SdfSchemaBase::FindType ( const char *  typeName) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

SDF_API SdfValueTypeName SdfSchemaBase::FindType ( std::string const typeName) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

SDF_API SdfValueTypeName SdfSchemaBase::FindType ( const TfType type,
const TfToken role = TfToken() 
) const

Return the type name object for the given type and optional role.

SDF_API SdfValueTypeName SdfSchemaBase::FindType ( const VtValue value,
const TfToken role = TfToken() 
) const

Return the type name object for the value's type and optional role.

SDF_API std::vector<SdfValueTypeName> SdfSchemaBase::GetAllTypes ( ) const

Returns all registered type names.

SDF_API const VtValue& SdfSchemaBase::GetFallback ( const TfToken fieldKey) const

Return the fallback value for the specified fieldKey or the empty value if fieldKey is not registered.

SDF_API const FieldDefinition* SdfSchemaBase::GetFieldDefinition ( const TfToken fieldKey) const

Returns the field definition for the given field. Returns NULL if no definition exists for given field.

SDF_API TfTokenVector SdfSchemaBase::GetFields ( SdfSpecType  specType) const

Returns all fields registered for the given spec type.

SDF_API TfToken SdfSchemaBase::GetMetadataFieldDisplayGroup ( SdfSpecType  specType,
TfToken const metadataField 
) const

Return the metadata field display group for metadata metadataField on specType. Return the empty token if metadataField is not a metadata field, or if it has no display group.

SDF_API TfTokenVector SdfSchemaBase::GetMetadataFields ( SdfSpecType  specType) const

Returns all metadata fields registered for the given spec type.

SDF_API const TfTokenVector& SdfSchemaBase::GetRequiredFields ( SdfSpecType  specType) const

Returns all required fields registered for the given spec type.

const SpecDefinition* SdfSchemaBase::GetSpecDefinition ( SdfSpecType  specType) const
inline

Returns the spec definition for the given spec type. Returns NULL if no definition exists for the given spec type.

Definition at line 228 of file schema.h.

SDF_API bool SdfSchemaBase::HoldsChildren ( const TfToken fieldKey) const

Returns whether the given field is a 'children' field – that is, it indexes certain children beneath the owning spec.

SDF_API bool SdfSchemaBase::IsRegistered ( const TfToken fieldKey,
VtValue fallback = NULL 
) const

Convenience functions for accessing specific field information.Return whether the specified field has been registered. Also optionally return the fallback value.

bool SdfSchemaBase::IsRequiredFieldName ( const TfToken fieldName) const
inline

Return true if fieldName is a required field name for at least one spec type, return false otherwise. The main use of this function is to quickly rule out field names that aren't required (and thus don't need special handling).

Definition at line 279 of file schema.h.

static SDF_API SdfAllowed SdfSchemaBase::IsValidAttributeConnectionPath ( const SdfPath path)
static

Specific validation functions for various fields. These are internally registered as validators for the associated field, but can also be used directly.

SDF_API bool SdfSchemaBase::IsValidFieldForSpec ( const TfToken fieldKey,
SdfSpecType  specType 
) const

Return whether the given field is valid for the given spec type.

static SDF_API SdfAllowed SdfSchemaBase::IsValidIdentifier ( const std::string name)
static

Specific validation functions for various fields. These are internally registered as validators for the associated field, but can also be used directly.

static SDF_API SdfAllowed SdfSchemaBase::IsValidInheritPath ( const SdfPath path)
static

Specific validation functions for various fields. These are internally registered as validators for the associated field, but can also be used directly.

static SDF_API SdfAllowed SdfSchemaBase::IsValidNamespacedIdentifier ( const std::string name)
static

Specific validation functions for various fields. These are internally registered as validators for the associated field, but can also be used directly.

static SDF_API SdfAllowed SdfSchemaBase::IsValidPayload ( const SdfPayload payload)
static

Specific validation functions for various fields. These are internally registered as validators for the associated field, but can also be used directly.

static SDF_API SdfAllowed SdfSchemaBase::IsValidReference ( const SdfReference ref)
static

Specific validation functions for various fields. These are internally registered as validators for the associated field, but can also be used directly.

static SDF_API SdfAllowed SdfSchemaBase::IsValidRelationshipTargetPath ( const SdfPath path)
static

Specific validation functions for various fields. These are internally registered as validators for the associated field, but can also be used directly.

static SDF_API SdfAllowed SdfSchemaBase::IsValidRelocatesPath ( const SdfPath path)
static

Specific validation functions for various fields. These are internally registered as validators for the associated field, but can also be used directly.

static SDF_API SdfAllowed SdfSchemaBase::IsValidSpecializesPath ( const SdfPath path)
static

Specific validation functions for various fields. These are internally registered as validators for the associated field, but can also be used directly.

static SDF_API SdfAllowed SdfSchemaBase::IsValidSubLayer ( const std::string sublayer)
static

Specific validation functions for various fields. These are internally registered as validators for the associated field, but can also be used directly.

SDF_API SdfAllowed SdfSchemaBase::IsValidValue ( const VtValue value) const

Scene description value typesGiven a value, check if it is a valid value type. This function only checks that the type of the value is valid for this schema. It does not imply that the value is valid for a particular field – the field's validation function must be used for that.

static SDF_API SdfAllowed SdfSchemaBase::IsValidVariantIdentifier ( const std::string name)
static

Specific validation functions for various fields. These are internally registered as validators for the associated field, but can also be used directly.

static SDF_API SdfAllowed SdfSchemaBase::IsValidVariantSelection ( const std::string sel)
static

Specific validation functions for various fields. These are internally registered as validators for the associated field, but can also be used directly.

Friends And Related Function Documentation

friend class _SpecDefiner
friend

Definition at line 523 of file schema.h.

friend struct Sdf_SchemaFieldTypeRegistrar
friend

Definition at line 536 of file schema.h.


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