Loading...
Searching...
No Matches
SdfAbstractData Class Referenceabstract

Interface for scene description data storage. More...

#include <abstractData.h>

+ Inheritance diagram for SdfAbstractData:

Public Member Functions

virtual SDF_API void CopyFrom (const SdfAbstractDataConstPtr &source)
 Copy the data in source into this data object.
 
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.
 
virtual SDF_API bool IsDetached () const
 Returns true if this data object is detached from its serialized data store, false otherwise.
 
virtual SDF_API bool IsEmpty () const
 Returns true if this data object has no specs, false otherwise.
 
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.
 
virtual SDF_API void WriteToStream (std::ostream &out) const
 Writes the contents of this data object to out.
 
Spec API
virtual SDF_API void CreateSpec (const SdfPath &path, SdfSpecType specType)=0
 Create a new spec at path with the given specType.
 
virtual SDF_API bool HasSpec (const SdfPath &path) const =0
 Return true if this data has a spec for path.
 
virtual SDF_API void EraseSpec (const SdfPath &path)=0
 Erase the spec at path and any fields that are on it.
 
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.
 
virtual SdfSpecType GetSpecType (const SdfPath &path) const =0
 Return the spec type for the spec at path.
 
SDF_API void VisitSpecs (SdfAbstractDataSpecVisitor *visitor) const
 Visits every spec in this SdfAbstractData object with the given visitor.
 
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.
 
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.
 
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).
 
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).
 
virtual SDF_API VtValue Get (const SdfPath &path, const TfToken &fieldName) const =0
 Return the value for the given path and fieldName.
 
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.
 
virtual SDF_API void Set (const SdfPath &path, const TfToken &fieldName, const VtValue &value)=0
 Set the value of the given path and fieldName.
 
virtual SDF_API void Set (const SdfPath &path, const TfToken &fieldName, const SdfAbstractDataConstValue &value)=0
 Set the value of the given path and fieldName.
 
virtual SDF_API void Erase (const SdfPath &path, const TfToken &fieldName)=0
 Remove the field at path and fieldName, if one exists.
 
virtual SDF_API std::vector< TfTokenList (const SdfPath &path) const =0
 Return the names of all the fields that are set at path.
 
template<class T >
GetAs (const SdfPath &path, const TfToken &fieldName, const T &defaultValue=T()) const
 Return the value for the given path and fieldName.
 
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
 TfRefBase (TfRefBase const &)
 
TfRefBaseoperator= (TfRefBase const &)
 
size_t GetCurrentCount () const
 Return the current reference count of this object.
 
bool IsUnique () const
 Return true if only one TfRefPtr points to this object.
 
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.
 
- 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.

Constructor & Destructor Documentation

◆ SdfAbstractData()

SdfAbstractData ( )
inline

Definition at line 76 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 399 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();
virtual SDF_API VtValue Get(const SdfPath &path, const TfToken &fieldName) const =0
Return the value for the given path and fieldName.
VT_API std::type_info const & GetTypeid() const
Returns the typeid of the type held by this value.

◆ 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);
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.
virtual SdfSpecType GetSpecType(const SdfPath &path) const =0
Return the spec type for the spec at path.

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.

◆ IsDetached()

virtual SDF_API bool IsDetached ( ) const
virtual

Returns true if this data object is detached from its serialized data store, false otherwise.

A detached data object must not be affected by external changes to the serialized data.

Sdf allows clients to specify detached layers to avoid problems that may occur if the underlying data is modified by an external process. For example, a data object that maintains an open file handle or memory mapping to the original layer on disk and reads data on demand is not detached. But a data object that pulls all of the layer contents into memory is detached.

The default implementation returns !StreamsData(). Non-streaming data objects are assumed to be detached from their serialized data, while streaming objects are conservatively assumed to not be detached. Note that it is possible to have a streaming data object that is also detached – for example, if the data object were to make a private copy of the serialized data for its own use and streamed data from it.

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 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.

◆ Set() [2/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.

◆ 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: