SdfAbstractData Class Referenceabstract

Interface for scene description data storage. More...

+ Inheritance diagram for SdfAbstractData:

Public Member Functions

virtual SDF_API void CopyFrom (const SdfAbstractDataConstPtr &source)
 Copy the data in source into this data object. More...
 
virtual SDF_API bool StreamsData () const =0
 Returns true if this data object streams its data to and from its serialized data store on demand. More...
 
virtual SDF_API bool IsEmpty () const
 Returns true if this data object has no specs, false otherwise. More...
 
virtual SDF_API bool Equals (const SdfAbstractDataRefPtr &rhs) const
 Returns true if this data object contains the same specs and fields as lhs, false otherwise. More...
 
virtual SDF_API void WriteToStream (std::ostream &out) const
 Writes the contents of this data object to out. More...
 
Spec API
virtual SDF_API void CreateSpec (const SdfPath &path, SdfSpecType specType)=0
 Create a new spec at path with the given specType. More...
 
virtual SDF_API bool HasSpec (const SdfPath &path) const =0
 Return true if this data has a spec for path. More...
 
virtual SDF_API void EraseSpec (const SdfPath &path)=0
 Erase the spec at path and any fields that are on it. More...
 
virtual SDF_API void MoveSpec (const SdfPath &oldPath, const SdfPath &newPath)=0
 Move the spec at oldPath to newPath, including all the fields that are on it. More...
 
virtual SdfSpecType GetSpecType (const SdfPath &path) const =0
 Return the spec type for the spec at path. More...
 
SDF_API void VisitSpecs (SdfAbstractDataSpecVisitor *visitor) const
 Visits every spec in this SdfAbstractData object with the given visitor. More...
 
Field API
virtual SDF_API bool Has (const SdfPath &path, const TfToken &fieldName, SdfAbstractDataValue *value) const =0
 Returns whether a value exists for the given path and fieldName. More...
 
virtual SDF_API bool Has (const SdfPath &path, const TfToken &fieldName, VtValue *value=NULL) const =0
 Return whether a value exists for the given path and fieldName. More...
 
virtual SDF_API bool HasSpecAndField (const SdfPath &path, const TfToken &fieldName, SdfAbstractDataValue *value, SdfSpecType *specType) const
 Fill specType (which cannot be nullptr) as if by a call to GetSpecType(path). More...
 
virtual SDF_API bool HasSpecAndField (const SdfPath &path, const TfToken &fieldName, VtValue *value, SdfSpecType *specType) const
 Fill specType (which cannot be nullptr) as if by a call to GetSpecType(path). More...
 
virtual SDF_API VtValue Get (const SdfPath &path, const TfToken &fieldName) const =0
 Return the value for the given path and fieldName. More...
 
virtual SDF_API std::type_info const & GetTypeid (const SdfPath &path, const TfToken &fieldName) const
 Return the type of the value for fieldName on spec path. More...
 
virtual SDF_API void Set (const SdfPath &path, const TfToken &fieldName, const VtValue &value)=0
 Set the value of the given path and fieldName. More...
 
virtual SDF_API void Set (const SdfPath &path, const TfToken &fieldName, const SdfAbstractDataConstValue &value)=0
 Set the value of the given path and fieldName. More...
 
virtual SDF_API void Erase (const SdfPath &path, const TfToken &fieldName)=0
 Remove the field at path and fieldName, if one exists. More...
 
virtual SDF_API std::vector< TfTokenList (const SdfPath &path) const =0
 Return the names of all the fields that are set at path. More...
 
template<class T >
GetAs (const SdfPath &path, const TfToken &fieldName, const T &defaultValue=T()) const
 Return the value for the given path and fieldName. More...
 
Dict key access API
virtual SDF_API bool HasDictKey (const SdfPath &path, const TfToken &fieldName, const TfToken &keyPath, SdfAbstractDataValue *value) const
 
virtual SDF_API bool HasDictKey (const SdfPath &path, const TfToken &fieldName, const TfToken &keyPath, VtValue *value=NULL) const
 
virtual SDF_API VtValue GetDictValueByKey (const SdfPath &path, const TfToken &fieldName, const TfToken &keyPath) const
 
virtual SDF_API void SetDictValueByKey (const SdfPath &path, const TfToken &fieldName, const TfToken &keyPath, const VtValue &value)
 
virtual SDF_API void SetDictValueByKey (const SdfPath &path, const TfToken &fieldName, const TfToken &keyPath, const SdfAbstractDataConstValue &value)
 
virtual SDF_API void EraseDictValueByKey (const SdfPath &path, const TfToken &fieldName, const TfToken &keyPath)
 
virtual SDF_API std::vector< TfTokenListDictKeys (const SdfPath &path, const TfToken &fieldName, const TfToken &keyPath) const
 
Time-sample API

This API supports narrowly-targeted queries against the "timeSamples" key of properties.

In particular, it enables asking for single time samples without pulling on the entire set of time samples, as well as asking about the set of sample times without pulling on the actual values at those times.

virtual SDF_API std::set< double > ListAllTimeSamples () const =0
 
virtual SDF_API std::set< double > ListTimeSamplesForPath (const SdfPath &path) const =0
 
virtual SDF_API bool GetBracketingTimeSamples (double time, double *tLower, double *tUpper) const =0
 
virtual SDF_API size_t GetNumTimeSamplesForPath (const SdfPath &path) const =0
 
virtual SDF_API bool GetBracketingTimeSamplesForPath (const SdfPath &path, double time, double *tLower, double *tUpper) const =0
 
virtual SDF_API bool QueryTimeSample (const SdfPath &path, double time, VtValue *optionalValue=NULL) const =0
 
virtual SDF_API bool QueryTimeSample (const SdfPath &path, double time, SdfAbstractDataValue *optionalValue) const =0
 
virtual SDF_API void SetTimeSample (const SdfPath &path, double time, const VtValue &value)=0
 
virtual SDF_API void EraseTimeSample (const SdfPath &path, double time)=0
 
- Public Member Functions inherited from TfRefBase
size_t GetCurrentCount () const
 Return the current reference count of this object. More...
 
bool IsUnique () const
 Return true if only one TfRefPtr points to this object. More...
 
const TfRefCountGetRefCount () const
 
void SetShouldInvokeUniqueChangedListener (bool shouldCall)
 
- Public Member Functions inherited from TfWeakBase
 TfWeakBase (const TfWeakBase &)
 
const TfWeakBase__GetTfWeakBase__ () const
 
const TfWeakBaseoperator= (const TfWeakBase &)
 
void EnableNotification2 () const
 
TF_API void const * GetUniqueIdentifier () const
 

Protected Member Functions

virtual SDF_API void _VisitSpecs (SdfAbstractDataSpecVisitor *visitor) const =0
 Visits every spec in this SdfAbstractData object with the given visitor. More...
 
- Protected Member Functions inherited from TfWeakBase
TfRefPtr< Tf_Remnant > _Register () const
 
template<class T >
TfRefPtr< Tf_Remnant > _Register (T *tempRmnt) const
 
bool _HasRemnant () const
 

Additional Inherited Members

- Public Types inherited from TfRefBase
typedef void(* UniqueChangedFuncPtr) (TfRefBase const *, bool)
 
- Static Public Member Functions inherited from TfRefBase
static TF_API void SetUniqueChangedListener (UniqueChangedListener listener)
 

Detailed Description

Interface for scene description data storage.

This is not a layer. SdfAbstractData is an anonymous container holding scene description values. It is like an STL container, but specialized for holding scene description.

For any given SdfPath, an SdfAbstractData can hold one or more key/value pairs which we call Fields. Most of the API on SdfAbstractData accesses or modifies the value stored in a Field for a particular path and field name.

SdfAbstractData does not provide undo, change notification, or any strong consistency guarantees about the scene description it contains. Instead, it is a basis for building those things.

Definition at line 73 of file abstractData.h.

Member Function Documentation

◆ _VisitSpecs()

virtual SDF_API void _VisitSpecs ( SdfAbstractDataSpecVisitor visitor) const
protectedpure virtual

Visits every spec in this SdfAbstractData object with the given visitor.

The order in which specs are visited is undefined. The visitor may not modify the SdfAbstractData object it is visiting. This method should not call Done() on the visitor.

See also
SdfAbstractDataSpecVisitor

Implemented in SdfData.

◆ CopyFrom()

virtual SDF_API void CopyFrom ( const SdfAbstractDataConstPtr &  source)
virtual

Copy the data in source into this data object.

The default implementation does a spec-by-spec, field-by-field copy of source into this object.

◆ CreateSpec()

virtual SDF_API void CreateSpec ( const SdfPath path,
SdfSpecType  specType 
)
pure virtual

Create a new spec at path with the given specType.

If the spec already exists the spec type will be changed.

Implemented in SdfData.

◆ Equals()

virtual SDF_API bool Equals ( const SdfAbstractDataRefPtr &  rhs) const
virtual

Returns true if this data object contains the same specs and fields as lhs, false otherwise.

The default implementation does a spec-by-spec, field-by-field comparison.

◆ Erase()

virtual SDF_API void Erase ( const SdfPath path,
const TfToken fieldName 
)
pure virtual

Remove the field at path and fieldName, if one exists.

Implemented in SdfData.

◆ EraseSpec()

virtual SDF_API void EraseSpec ( const SdfPath path)
pure virtual

Erase the spec at path and any fields that are on it.

Note that this does not erase child specs.

Implemented in SdfData.

◆ Get()

virtual SDF_API VtValue Get ( const SdfPath path,
const TfToken fieldName 
) const
pure virtual

Return the value for the given path and fieldName.

Returns an empty value if none is set.

Implemented in SdfData.

◆ GetAs()

T GetAs ( const SdfPath path,
const TfToken fieldName,
const T &  defaultValue = T() 
) const
inline

Return the value for the given path and fieldName.

Returns the provided defaultValue value if none is set.

Definition at line 378 of file abstractData.h.

◆ GetSpecType()

virtual SdfSpecType GetSpecType ( const SdfPath path) const
pure virtual

Return the spec type for the spec at path.

Returns SdfSpecTypeUnknown if the spec doesn't exist.

Implemented in SdfData.

◆ GetTypeid()

virtual SDF_API std::type_info const& GetTypeid ( const SdfPath path,
const TfToken fieldName 
) const
virtual

Return the type of the value for fieldName on spec path.

If no such field exists, return typeid(void). Derived classes may optionally override this for performance. The base implementation is equivalent to:

return Get(path, fieldName).GetTypeid();

◆ Has() [1/2]

virtual SDF_API bool Has ( const SdfPath path,
const TfToken fieldName,
SdfAbstractDataValue value 
) const
pure virtual

Returns whether a value exists for the given path and fieldName.

Optionally returns the value if it exists.

Implemented in SdfData.

◆ Has() [2/2]

virtual SDF_API bool Has ( const SdfPath path,
const TfToken fieldName,
VtValue value = NULL 
) const
pure virtual

Return whether a value exists for the given path and fieldName.

Optionally returns the value if it exists.

Implemented in SdfData.

◆ HasSpec()

virtual SDF_API bool HasSpec ( const SdfPath path) const
pure virtual

Return true if this data has a spec for path.

Implemented in SdfData.

◆ HasSpecAndField() [1/2]

virtual SDF_API bool HasSpecAndField ( const SdfPath path,
const TfToken fieldName,
SdfAbstractDataValue value,
SdfSpecType specType 
) const
virtual

Fill specType (which cannot be nullptr) as if by a call to GetSpecType(path).

If the resulting specType is not SdfSpecTypeUnknown, then act as if Has(path, fieldName, value) was called and return its result. In other words, the semantics of this function must be identical to this sequence:

*specType = GetSpecType(path);
return *specType != SdfSpecTypeUnknown && Has(path, fieldName, value);

Reimplemented in SdfData.

◆ HasSpecAndField() [2/2]

virtual SDF_API bool HasSpecAndField ( const SdfPath path,
const TfToken fieldName,
VtValue value,
SdfSpecType specType 
) const
virtual

Fill specType (which cannot be nullptr) as if by a call to GetSpecType(path).

If the resulting specType is not SdfSpecTypeUnknown, then act as if Has(path, fieldName, value) was called and return its result. In other words, the semantics of this function must be identical to this sequence:

*specType = GetSpecType(path);
return *specType != SdfSpecTypeUnknown && Has(path, fieldName, value);

Reimplemented in SdfData.

◆ IsEmpty()

virtual SDF_API bool IsEmpty ( ) const
virtual

Returns true if this data object has no specs, false otherwise.

The default implementation uses a visitor to check if any specs exist.

◆ List()

virtual SDF_API std::vector<TfToken> List ( const SdfPath path) const
pure virtual

Return the names of all the fields that are set at path.

Implemented in SdfData.

◆ MoveSpec()

virtual SDF_API void MoveSpec ( const SdfPath oldPath,
const SdfPath newPath 
)
pure virtual

Move the spec at oldPath to newPath, including all the fields that are on it.

This does not move any child specs.

Implemented in SdfData.

◆ Set() [1/2]

virtual SDF_API void Set ( const SdfPath path,
const TfToken fieldName,
const VtValue value 
)
pure virtual

Set the value of the given path and fieldName.

It's an error to set a field on a spec that does not exist. Setting a field to an empty VtValue is the same as calling Erase() on it.

Implemented in SdfData.

◆ Set() [2/2]

virtual SDF_API void Set ( const SdfPath path,
const TfToken fieldName,
const SdfAbstractDataConstValue value 
)
pure virtual

Set the value of the given path and fieldName.

It's an error to set a field on a spec that does not exist.

Implemented in SdfData.

◆ StreamsData()

virtual SDF_API bool StreamsData ( ) const
pure virtual

Returns true if this data object streams its data to and from its serialized data store on demand.

Sdf will treat layers with streaming data differently to avoid pulling in data unnecessarily. For example, reloading a streaming layer will not perform fine-grained change notification, since doing so would require the full contents of the layer to be loaded.

Implemented in SdfData.

◆ VisitSpecs()

SDF_API void VisitSpecs ( SdfAbstractDataSpecVisitor visitor) const

Visits every spec in this SdfAbstractData object with the given visitor.

The order in which specs are visited is undefined. The visitor may not modify the SdfAbstractData object it is visiting.

See also
SdfAbstractDataSpecVisitor

◆ WriteToStream()

virtual SDF_API void WriteToStream ( std::ostream &  out) const
virtual

Writes the contents of this data object to out.

This is primarily for debugging purposes.

The default implementation writes out each field for each spec.


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