This document is for a version of USD that is under development. See this page for the current release.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
accessorHelpers.h File Reference
+ Include dependency graph for accessorHelpers.h:

Go to the source code of this file.

Macros

#define _GET_KEY_(key_)   key_
 
#define SDF_NO_PREDICATE   true
 
#define _GET_WITH_FALLBACK(key_, heldType_)
 
#define SDF_DEFINE_GET(name_, key_, heldType_)
 
#define SDF_DEFINE_IS(name_, key_)
 
#define SDF_DEFINE_SET(name_, key_, argType_)
 
#define SDF_DEFINE_HAS(name_, key_)
 
#define SDF_DEFINE_CLEAR(name_, key_)
 
#define SDF_DEFINE_GET_PRIVATE(name_, key_, heldType_)
 
#define SDF_DEFINE_DICTIONARY_GET(name_, key_)
 
#define SDF_DEFINE_DICTIONARY_SET(name_, key_)
 
#define SDF_DEFINE_TYPED_GET_SET(name_, key_, getType_, setType_)
 
#define SDF_DEFINE_TYPED_GET_SET_HAS_CLEAR(name_, key_, getType_, setType_)
 
#define SDF_DEFINE_GET_SET(name_, key_, type_)
 
#define SDF_DEFINE_GET_SET_HAS_CLEAR(name_, key_, type_)
 
#define SDF_DEFINE_IS_SET(name_, key_)
 
#define SDF_DEFINE_DICTIONARY_GET_SET(getName_, setName_, key_)
 

Macro Definition Documentation

◆ _GET_KEY_

#define _GET_KEY_ (   key_)    key_

Definition at line 40 of file accessorHelpers.h.

◆ _GET_WITH_FALLBACK

#define _GET_WITH_FALLBACK (   key_,
  heldType_ 
)
Value:
{ \
typedef Sdf_AccessorHelpers<SDF_ACCESSOR_CLASS> _Helper; \
const VtValue& value = _Helper::GetField(this, key_); \
if (value.IsEmpty() || !value.IsHolding<heldType_>()) { \
const SdfSchemaBase& schema = _Helper::GetSchema(this); \
return schema.GetFallback(_GET_KEY_(key_)).Get<heldType_>(); \
} \
else { \
return value.Get<heldType_>(); \
} \
}
Generic class that provides information about scene description fields but doesn't actually provide a...
Definition: schema.h:45
SDF_API const VtValue & GetFallback(const TfToken &fieldKey) const
Return the fallback value for the specified fieldKey or the empty value if fieldKey is not registered...
Provides a container which may hold any type, and provides introspection and iteration over array typ...
Definition: value.h:147
bool IsEmpty() const
Returns true iff this value is empty.
Definition: value.h:1285
T const & Get() const &
Returns a const reference to the held object if the held object is of type T.
Definition: value.h:1121
bool IsHolding() const
Return true if this value is holding an object of type T, false otherwise.
Definition: value.h:1064

Definition at line 43 of file accessorHelpers.h.

◆ SDF_DEFINE_CLEAR

#define SDF_DEFINE_CLEAR (   name_,
  key_ 
)
Value:
void \
SDF_ACCESSOR_CLASS::Clear ## name_() \
{ \
typedef Sdf_AccessorHelpers<SDF_ACCESSOR_CLASS> _Helper; \
if (SDF_ACCESSOR_WRITE_PREDICATE(_GET_KEY_(key_))) { \
_Helper::ClearField(this, _GET_KEY_(key_)); \
} \
}

Definition at line 100 of file accessorHelpers.h.

◆ SDF_DEFINE_DICTIONARY_GET

#define SDF_DEFINE_DICTIONARY_GET (   name_,
  key_ 
)
Value:
SdfDictionaryProxy \
SDF_ACCESSOR_CLASS::name_() const \
{ \
typedef Sdf_AccessorHelpers<SDF_ACCESSOR_CLASS> _Helper; \
return SDF_ACCESSOR_READ_PREDICATE(_GET_KEY_(key_)) ? \
SdfDictionaryProxy(_Helper::GetSpecHandle(this), _GET_KEY_(key_)) : \
}
A proxy for editing map-like values.
Definition: mapEditProxy.h:101

Definition at line 127 of file accessorHelpers.h.

◆ SDF_DEFINE_DICTIONARY_GET_SET

#define SDF_DEFINE_DICTIONARY_GET_SET (   getName_,
  setName_,
  key_ 
)
Value:
SDF_DEFINE_DICTIONARY_GET(getName_, key_) \
SDF_DEFINE_DICTIONARY_SET(setName_, key_)

Definition at line 186 of file accessorHelpers.h.

◆ SDF_DEFINE_DICTIONARY_SET

#define SDF_DEFINE_DICTIONARY_SET (   name_,
  key_ 
)
Value:
void \
SDF_ACCESSOR_CLASS::name_( \
const std::string& name, \
const VtValue& value) \
{ \
typedef Sdf_AccessorHelpers<SDF_ACCESSOR_CLASS> _Helper; \
if (SDF_ACCESSOR_WRITE_PREDICATE(_GET_KEY_(key_))) { \
_Helper::GetSpecHandle(this), _GET_KEY_(key_)); \
if (value.IsEmpty()) { \
proxy.erase(name); \
} \
else { \
proxy[name] = value; \
} \
} \
}

Definition at line 137 of file accessorHelpers.h.

◆ SDF_DEFINE_GET

#define SDF_DEFINE_GET (   name_,
  key_,
  heldType_ 
)
Value:
heldType_ \
SDF_ACCESSOR_CLASS::Get ## name_() const \
{ \
if (SDF_ACCESSOR_READ_PREDICATE(_GET_KEY_(key_))) { \
/* Empty clause needed to prevent compiler complaints */ \
} \
\
_GET_WITH_FALLBACK(key_, heldType_); \
}

Definition at line 59 of file accessorHelpers.h.

◆ SDF_DEFINE_GET_PRIVATE

#define SDF_DEFINE_GET_PRIVATE (   name_,
  key_,
  heldType_ 
)
Value:
heldType_ \
SDF_ACCESSOR_CLASS::_Get ## name_() const \
{ \
if (SDF_ACCESSOR_READ_PREDICATE(_GET_KEY_(key_))) { \
/* Empty clause needed to prevent compiler complaints */ \
} \
\
_GET_WITH_FALLBACK(key_, heldType_); \
}

Definition at line 113 of file accessorHelpers.h.

◆ SDF_DEFINE_GET_SET

#define SDF_DEFINE_GET_SET (   name_,
  key_,
  type_ 
)
Value:
SDF_DEFINE_TYPED_GET_SET(name_, key_, type_, \
Sdf_SetParameter<type_>::type)

Definition at line 174 of file accessorHelpers.h.

◆ SDF_DEFINE_GET_SET_HAS_CLEAR

#define SDF_DEFINE_GET_SET_HAS_CLEAR (   name_,
  key_,
  type_ 
)
Value:
SDF_DEFINE_TYPED_GET_SET_HAS_CLEAR(name_, key_, type_, \
Sdf_SetParameter<type_>::type)

Definition at line 178 of file accessorHelpers.h.

◆ SDF_DEFINE_HAS

#define SDF_DEFINE_HAS (   name_,
  key_ 
)
Value:
bool \
SDF_ACCESSOR_CLASS::Has ## name_() const \
{ \
typedef Sdf_AccessorHelpers<SDF_ACCESSOR_CLASS> _Helper; \
return SDF_ACCESSOR_READ_PREDICATE(_GET_KEY_(key_)) ? \
_Helper::HasField(this, _GET_KEY_(key_)) : false; \
}

Definition at line 91 of file accessorHelpers.h.

◆ SDF_DEFINE_IS

#define SDF_DEFINE_IS (   name_,
  key_ 
)
Value:
bool \
SDF_ACCESSOR_CLASS::Is ## name_() const \
{ \
if (!SDF_ACCESSOR_READ_PREDICATE(_GET_KEY_(key_))) { \
return false; \
} \
\
_GET_WITH_FALLBACK(key_, bool); \
}

Definition at line 70 of file accessorHelpers.h.

◆ SDF_DEFINE_IS_SET

#define SDF_DEFINE_IS_SET (   name_,
  key_ 
)
Value:
SDF_DEFINE_IS(name_, key_) \
SDF_DEFINE_SET(name_, key_, bool)

Definition at line 182 of file accessorHelpers.h.

◆ SDF_DEFINE_SET

#define SDF_DEFINE_SET (   name_,
  key_,
  argType_ 
)
Value:
void \
SDF_ACCESSOR_CLASS::Set ## name_(argType_ value) \
{ \
if (SDF_ACCESSOR_WRITE_PREDICATE(_GET_KEY_(key_))) { \
typedef Sdf_AccessorHelpers<SDF_ACCESSOR_CLASS> _Helper; \
_Helper::SetField(this, _GET_KEY_(key_), value); \
} \
}

Definition at line 81 of file accessorHelpers.h.

◆ SDF_DEFINE_TYPED_GET_SET

#define SDF_DEFINE_TYPED_GET_SET (   name_,
  key_,
  getType_,
  setType_ 
)
Value:
SDF_DEFINE_GET(name_, key_, getType_) \
SDF_DEFINE_SET(name_, key_, setType_)

Definition at line 165 of file accessorHelpers.h.

◆ SDF_DEFINE_TYPED_GET_SET_HAS_CLEAR

#define SDF_DEFINE_TYPED_GET_SET_HAS_CLEAR (   name_,
  key_,
  getType_,
  setType_ 
)
Value:
SDF_DEFINE_TYPED_GET_SET(name_, key_, getType_, setType_) \
SDF_DEFINE_HAS(name_, key_) \
SDF_DEFINE_CLEAR(name_, key_)

Definition at line 169 of file accessorHelpers.h.

◆ SDF_NO_PREDICATE

#define SDF_NO_PREDICATE   true

Definition at line 41 of file accessorHelpers.h.