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) ... )); \ 74 #define HD_DECLARE_DATASOURCE_INITIALIZER_LIST_NEW(type, T) \ 75 static Handle New(std::initializer_list<T> initList) { \ 76 return Handle(new type(initList)); \ 79 #define HD_DECLARE_DATASOURCE_HANDLES(type) \ 80 using type##Handle = type::Handle; \ 81 using type##AtomicHandle = type::AtomicHandle; 121 virtual HdDataSourceBaseHandle
Get(
const TfToken &name) = 0;
128 static HdDataSourceBaseHandle
Get(
129 const Handle &container,
154 virtual HdDataSourceBaseHandle
GetElement(
size_t element) = 0;
194 std::vector<Time> * outSampleTimes) = 0;
203 template <
typename T>
238 HdGetMergedContributingSampleTimesForInterval(
240 const HdSampledDataSourceHandle *inputDataSources,
241 HdSampledDataSource::Time startTime,
242 HdSampledDataSource::Time endTime,
243 std::vector<HdSampledDataSource::Time> * outSampleTimes);
248 HdDebugPrintDataSource(
250 HdDataSourceBaseHandle,
251 int indentLevel = 0);
256 HdDebugPrintDataSource(HdDataSourceBaseHandle,
int indentLevel = 0);
258 PXR_NAMESPACE_CLOSE_SCOPE
260 #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.
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...