24 #ifndef PXR_IMAGING_HD_DATASOURCE_H 25 #define PXR_IMAGING_HD_DATASOURCE_H 29 #include "pxr/imaging/hd/api.h" 30 #include "pxr/imaging/hd/dataSourceLocator.h" 33 #include "pxr/base/vt/value.h" 40 PXR_NAMESPACE_OPEN_SCOPE
45 #define HD_DECLARE_DATASOURCE_ABSTRACT(type) \ 46 using Handle = std::shared_ptr<type>; \ 47 using AtomicHandle = Handle; \ 48 static Handle AtomicLoad(AtomicHandle &ptr) { \ 49 return std::atomic_load(&ptr); \ 51 static void AtomicStore(AtomicHandle &ptr, const Handle &v) { \ 52 std::atomic_store(&ptr, v); \ 54 static Handle Cast(const HdDataSourceBase::Handle &v) { \ 55 return std::dynamic_pointer_cast<type>(v); \ 64 #define HD_DECLARE_DATASOURCE(type) \ 65 HD_DECLARE_DATASOURCE_ABSTRACT(type) \ 66 template <typename ... Args> \ 67 static Handle New(Args&& ... args) { \ 68 return Handle(new type(std::forward<Args>(args) ... )); \ 71 #define HD_DECLARE_DATASOURCE_HANDLES(type) \ 72 using type##Handle = type::Handle; \ 73 using type##AtomicHandle = type::AtomicHandle; 118 virtual HdDataSourceBaseHandle
Get(
const TfToken &name) = 0;
125 static HdDataSourceBaseHandle
Get(
126 const Handle &container,
151 virtual HdDataSourceBaseHandle
GetElement(
size_t element) = 0;
191 std::vector<Time> * outSampleTimes) = 0;
200 template <
typename T>
235 HdGetMergedContributingSampleTimesForInterval(
237 const HdSampledDataSourceHandle *inputDataSources,
238 HdSampledDataSource::Time startTime,
239 HdSampledDataSource::Time endTime,
240 std::vector<HdSampledDataSource::Time> * outSampleTimes);
243 void HdDebugPrintDataSource(
245 HdDataSourceBaseHandle,
246 int indentLevel = 0);
249 void HdDebugPrintDataSource(HdDataSourceBaseHandle,
int indentLevel = 0);
251 PXR_NAMESPACE_CLOSE_SCOPE
253 #endif // PXR_IMAGING_HD_DATASOURCE_H A datasource representing indexed data.
virtual HdDataSourceBaseHandle Get(const TfToken &name)=0
Returns the child datasource of the given name.
virtual bool GetContributingSampleTimesForInterval(Time startTime, Time endTime, std::vector< Time > *outSampleTimes)=0
Given a shutter window of interest (startTime and endTime relative to the current frame),...
A datasource representing structured (named, hierarchical) data, for example a geometric primitive or...
virtual VtValue GetValue(Time shutterOffset)=0
Returns the value of this data source at frame-relative time shutterOffset.
Token for efficient comparison, assignment, and hashing of known strings.
virtual HdDataSourceBaseHandle GetElement(size_t element)=0
Return the element at position element in this datasource.
Represents an object that can identify the location of a data source.
A datasource representing the absence of a datasource.
A datasource representing a concretely-typed sampled value.
virtual size_t GetNumElements()=0
Return the number of elements in this datasource.
virtual bool Has(const TfToken &name)=0
Returns true if the container has a child datasource of the given name, in which case Get(name) is ex...
std::vector< TfToken > TfTokenVector
Convenience types.
virtual T GetTypedValue(Time shutterOffset)=0
Returns the value of this data source at frame-relative time shutterOffset, as type T.
Represents an object which can produce scene data.
Provides a container which may hold any type, and provides introspection and iteration over array typ...
virtual TfTokenVector GetNames()=0
Returns the list of names for which Get(...) is expected to return a non-null value.
A datasource representing time-sampled values.
TfToken class for efficient string referencing and hashing, plus conversions to and from stl string c...