HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SdfAbstractData Class Referenceabstract

#include <abstractData.h>

+ Inheritance diagram for SdfAbstractData:

Public Member Functions

 SdfAbstractData ()
 
virtual SDF_API ~SdfAbstractData ()
 
virtual SDF_API void CopyFrom (const SdfAbstractDataConstPtr &source)
 
virtual SDF_API bool StreamsData () const =0
 
virtual SDF_API bool IsEmpty () const
 
virtual SDF_API bool Equals (const SdfAbstractDataRefPtr &rhs) const
 
virtual SDF_API void WriteToStream (std::ostream &out) const
 
Spec API
virtual SDF_API void CreateSpec (const SdfPath &path, SdfSpecType specType)=0
 
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
 
virtual SDF_API void MoveSpec (const SdfPath &oldPath, const SdfPath &newPath)=0
 
virtual SdfSpecType GetSpecType (const SdfPath &path) const =0
 
SDF_API void VisitSpecs (SdfAbstractDataSpecVisitor *visitor) const
 
Field API
virtual SDF_API bool Has (const SdfPath &path, const TfToken &fieldName, SdfAbstractDataValue *value) const =0
 
virtual SDF_API bool Has (const SdfPath &path, const TfToken &fieldName, VtValue *value=NULL) const =0
 
virtual SDF_API bool HasSpecAndField (const SdfPath &path, const TfToken &fieldName, SdfAbstractDataValue *value, SdfSpecType *specType) const
 
virtual SDF_API bool HasSpecAndField (const SdfPath &path, const TfToken &fieldName, VtValue *value, SdfSpecType *specType) const
 
virtual SDF_API VtValue Get (const SdfPath &path, const TfToken &fieldName) const =0
 
virtual SDF_API std::type_info
const
GetTypeid (const SdfPath &path, const TfToken &fieldName) const
 
virtual SDF_API void Set (const SdfPath &path, const TfToken &fieldName, const VtValue &value)=0
 
virtual SDF_API void Set (const SdfPath &path, const TfToken &fieldName, const SdfAbstractDataConstValue &value)=0
 
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
< TfToken
List (const SdfPath &path) const =0
 Return the names of all the fields that are set at path. More...
 
template<class T >
T GetAs (const SdfPath &path, const TfToken &fieldName, const T &defaultValue=T()) const
 
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
< TfToken
ListDictKeys (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 ()
 
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 ()
 
 TfWeakBase (const TfWeakBase &)
 
const TfWeakBase__GetTfWeakBase__ () const
 
const TfWeakBaseoperator= (const TfWeakBase &)
 
void EnableNotification2 () const
 
TF_API void constGetUniqueIdentifier () const
 

Protected Member Functions

virtual SDF_API void _VisitSpecs (SdfAbstractDataSpecVisitor *visitor) const =0
 
- Protected Member Functions inherited from TfRefBase
virtual TF_API ~TfRefBase ()
 
- 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
 

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.

virtual SDF_API SdfAbstractData::~SdfAbstractData ( )
virtual

Member Function Documentation

virtual SDF_API void SdfAbstractData::_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.

virtual SDF_API void SdfAbstractData::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.

virtual SDF_API void SdfAbstractData::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.

virtual SDF_API bool SdfAbstractData::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.

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

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

Implemented in SdfData.

virtual SDF_API void SdfAbstractData::EraseDictValueByKey ( const SdfPath path,
const TfToken fieldName,
const TfToken keyPath 
)
virtual
virtual SDF_API void SdfAbstractData::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.

virtual SDF_API void SdfAbstractData::EraseTimeSample ( const SdfPath path,
double  time 
)
pure virtual

Implemented in SdfData.

virtual SDF_API VtValue SdfAbstractData::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.

template<class T >
T SdfAbstractData::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.

virtual SDF_API bool SdfAbstractData::GetBracketingTimeSamples ( double  time,
double *  tLower,
double *  tUpper 
) const
pure virtual

Implemented in SdfData.

virtual SDF_API bool SdfAbstractData::GetBracketingTimeSamplesForPath ( const SdfPath path,
double  time,
double *  tLower,
double *  tUpper 
) const
pure virtual

Implemented in SdfData.

virtual SDF_API VtValue SdfAbstractData::GetDictValueByKey ( const SdfPath path,
const TfToken fieldName,
const TfToken keyPath 
) const
virtual
virtual SDF_API size_t SdfAbstractData::GetNumTimeSamplesForPath ( const SdfPath path) const
pure virtual

Implemented in SdfData.

virtual SdfSpecType SdfAbstractData::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.

virtual SDF_API std::type_info const& SdfAbstractData::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 bool SdfAbstractData::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.

virtual SDF_API bool SdfAbstractData::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.

virtual SDF_API bool SdfAbstractData::HasDictKey ( const SdfPath path,
const TfToken fieldName,
const TfToken keyPath,
SdfAbstractDataValue value 
) const
virtual
virtual SDF_API bool SdfAbstractData::HasDictKey ( const SdfPath path,
const TfToken fieldName,
const TfToken keyPath,
VtValue value = NULL 
) const
virtual
virtual SDF_API bool SdfAbstractData::HasSpec ( const SdfPath path) const
pure virtual

Return true if this data has a spec for path.

Implemented in SdfData.

virtual SDF_API bool SdfAbstractData::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.

virtual SDF_API bool SdfAbstractData::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.

virtual SDF_API bool SdfAbstractData::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.

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

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

Implemented in SdfData.

virtual SDF_API std::set<double> SdfAbstractData::ListAllTimeSamples ( ) const
pure virtual

Implemented in SdfData.

virtual SDF_API std::vector<TfToken> SdfAbstractData::ListDictKeys ( const SdfPath path,
const TfToken fieldName,
const TfToken keyPath 
) const
virtual
virtual SDF_API std::set<double> SdfAbstractData::ListTimeSamplesForPath ( const SdfPath path) const
pure virtual

Implemented in SdfData.

virtual SDF_API void SdfAbstractData::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.

virtual SDF_API bool SdfAbstractData::QueryTimeSample ( const SdfPath path,
double  time,
VtValue optionalValue = NULL 
) const
pure virtual

Implemented in SdfData.

virtual SDF_API bool SdfAbstractData::QueryTimeSample ( const SdfPath path,
double  time,
SdfAbstractDataValue optionalValue 
) const
pure virtual

Implemented in SdfData.

virtual SDF_API void SdfAbstractData::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.

virtual SDF_API void SdfAbstractData::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.

virtual SDF_API void SdfAbstractData::SetDictValueByKey ( const SdfPath path,
const TfToken fieldName,
const TfToken keyPath,
const VtValue value 
)
virtual
virtual SDF_API void SdfAbstractData::SetDictValueByKey ( const SdfPath path,
const TfToken fieldName,
const TfToken keyPath,
const SdfAbstractDataConstValue value 
)
virtual
virtual SDF_API void SdfAbstractData::SetTimeSample ( const SdfPath path,
double  time,
const VtValue value 
)
pure virtual

Implemented in SdfData.

virtual SDF_API bool SdfAbstractData::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.

SDF_API void SdfAbstractData::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
virtual SDF_API void SdfAbstractData::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: