HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
dataSource.h File Reference
#include "pxr/pxr.h"
#include "pxr/imaging/hd/api.h"
#include "pxr/imaging/hd/dataSourceLocator.h"
#include "pxr/base/tf/token.h"
#include "pxr/base/vt/value.h"
#include "pxr/base/vt/visitValue.h"
#include <iosfwd>
#include <memory>
#include <vector>
#include <atomic>
+ Include dependency graph for dataSource.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  HdDataSourceBase
 
class  HdContainerDataSource
 
class  HdVectorDataSource
 
class  HdSampledDataSource
 
class  HdTypedSampledDataSource< T >
 
class  HdBlockDataSource
 
class  Hd_SampledDataSourceDefaultValueAccessor
 
struct  Hd_CopySampledDataSourceTypeVisitor< T, DataSource, UntypedDataSource >
 

Macros

#define HD_DECLARE_DATASOURCE_ABSTRACT(type)
 
#define HD_DECLARE_DATASOURCE(type)
 
#define HD_DECLARE_DATASOURCE_INITIALIZER_LIST_NEW(type, T)
 
#define HD_DECLARE_DATASOURCE_HANDLES(type)
 

Functions

 HD_DECLARE_DATASOURCE_HANDLES (HdDataSourceBase)
 
 HD_DECLARE_DATASOURCE_HANDLES (HdContainerDataSource)
 
 HD_DECLARE_DATASOURCE_HANDLES (HdVectorDataSource)
 
 HD_DECLARE_DATASOURCE_HANDLES (HdSampledDataSource)
 
 HD_DECLARE_DATASOURCE_HANDLES (HdBlockDataSource)
 
template<template< class T, class...> class Visitor, typename... TypeArgs, typename... FnArgs>
auto HdVisitSampledDataSourceType (const HdSampledDataSourceHandle &dataSource, FnArgs &&...args)
 
template<template< class T, template< class...> class, class...> class Visitor, template< class...> class Tmpl, typename... TypeArgs, typename... FnArgs>
auto HdVisitSampledDataSourceType (const HdSampledDataSourceHandle &dataSource, FnArgs &&...args)
 
template<template< typename...> class DataSource, class UntypedDataSource = void, typename... Args>
HdDataSourceBaseHandle HdCopySampledDataSourceType (const HdSampledDataSourceHandle &dataSource, Args &&...args)
 
HD_API bool HdGetMergedContributingSampleTimesForInterval (size_t count, const HdSampledDataSourceHandle *inputDataSources, HdSampledDataSource::Time startTime, HdSampledDataSource::Time endTime, std::vector< HdSampledDataSource::Time > *outSampleTimes)
 Merges contributing sample times from several data sources. More...
 
HD_API void HdDebugPrintDataSource (std::ostream &, HdDataSourceBaseHandle, int indentLevel=0)
 Print a datasource to a stream, for debugging/testing. More...
 
HD_API void HdDebugPrintDataSource (HdDataSourceBaseHandle, int indentLevel=0)
 Print a datasource to stdout, for debugging/testing. More...
 

Macro Definition Documentation

#define HD_DECLARE_DATASOURCE (   type)
Value:
template <typename ... Args> \
static Handle New(Args&& ... args) { \
return Handle(new type(std::forward<Args>(args) ... )); \
}
type
Definition: core.h:556
GLint GLint GLsizei GLint GLenum GLenum type
Definition: glcorearb.h:108
#define HD_DECLARE_DATASOURCE_ABSTRACT(type)
Definition: dataSource.h:29
**If you just want to fire and args
Definition: thread.h:618
void * Handle
Definition: plugin.h:27

HD_DECLARE_DATASOURCE Used for instantiable classes, this defines functions for manipulating and allocating handles to this type of datasource.

Use of this macro in derived classes is important to make sure that core and client code share the same handle type and allocator.

Definition at line 53 of file dataSource.h.

#define HD_DECLARE_DATASOURCE_ABSTRACT (   type)
Value:
using Handle = std::shared_ptr<type>; \
using AtomicHandle = Handle; \
static Handle AtomicLoad(AtomicHandle &ptr) { \
return std::atomic_load(&ptr); \
} \
static void AtomicStore(AtomicHandle &ptr, const Handle &v) { \
std::atomic_store(&ptr, v); \
} \
static bool AtomicCompareExchange(AtomicHandle &ptr, \
AtomicHandle &expected, \
const Handle &desired) { \
return std::atomic_compare_exchange_strong(&ptr, &expected, desired); \
} \
static Handle Cast(const HdDataSourceBase::Handle &v) { \
return std::dynamic_pointer_cast<type>(v); \
}
const GLdouble * v
Definition: glcorearb.h:837
GLint GLint GLsizei GLint GLenum GLenum type
Definition: glcorearb.h:108
auto ptr(T p) -> const void *
Definition: format.h:4331
void * Handle
Definition: plugin.h:27

HD_DECLARE_DATASOURCE_ABSTRACT Used for non-instantiable classes, this defines a set of functions for manipulating handles to this type of datasource.

Definition at line 29 of file dataSource.h.

#define HD_DECLARE_DATASOURCE_HANDLES (   type)
Value:
using type##AtomicHandle = type::AtomicHandle;
GLint GLint GLsizei GLint GLenum GLenum type
Definition: glcorearb.h:108
void * Handle
Definition: plugin.h:27

Definition at line 68 of file dataSource.h.

#define HD_DECLARE_DATASOURCE_INITIALIZER_LIST_NEW (   type,
 
)
Value:
static Handle New(std::initializer_list<T> initList) { \
return Handle(new type(initList)); \
}
type
Definition: core.h:556
void * Handle
Definition: plugin.h:27

HD_DECLARE_DATASOURCE_INITIALIZER_LIST_NEW Used for declaring a New function for datasource types that have a constructor that takes an initializer_list<T>.

Definition at line 63 of file dataSource.h.

Function Documentation

HD_DECLARE_DATASOURCE_HANDLES ( HdDataSourceBase  )
HD_DECLARE_DATASOURCE_HANDLES ( HdContainerDataSource  )
HD_DECLARE_DATASOURCE_HANDLES ( HdVectorDataSource  )
HD_DECLARE_DATASOURCE_HANDLES ( HdSampledDataSource  )
HD_DECLARE_DATASOURCE_HANDLES ( HdBlockDataSource  )
template<template< typename...> class DataSource, class UntypedDataSource = void, typename... Args>
HdDataSourceBaseHandle HdCopySampledDataSourceType ( const HdSampledDataSourceHandle &  dataSource,
Args &&...  args 
)

Helper function to create a new typed data source with the same type as the input sampled data source. DataSource<T>::New will be returned using the provided args. For untyped input data sources nullptr or UntypedDataSource::New will be returned (if UntypedDataSource was provided).

Definition at line 330 of file dataSource.h.

HD_API void HdDebugPrintDataSource ( std::ostream &  ,
HdDataSourceBaseHandle  ,
int  indentLevel = 0 
)

Print a datasource to a stream, for debugging/testing.

HD_API void HdDebugPrintDataSource ( HdDataSourceBaseHandle  ,
int  indentLevel = 0 
)

Print a datasource to stdout, for debugging/testing.

HD_API bool HdGetMergedContributingSampleTimesForInterval ( size_t  count,
const HdSampledDataSourceHandle *  inputDataSources,
HdSampledDataSource::Time  startTime,
HdSampledDataSource::Time  endTime,
std::vector< HdSampledDataSource::Time > *  outSampleTimes 
)

Merges contributing sample times from several data sources.

template<template< class T, class...> class Visitor, typename... TypeArgs, typename... FnArgs>
auto HdVisitSampledDataSourceType ( const HdSampledDataSourceHandle &  dataSource,
FnArgs &&...  args 
)

Helper function to determine the type of a TypeSampledDataSource and perform some operations. Takes a "SampledDataSource", a "Visitor" class (which has a static "Visit" function) and some arguments. The data source's type "T" will be determined and Visitor<T>::Visit will be called with your arguments. If the data source's type cannot be determined or it is an untyped SampledDataSource, Visitor<VtValue>::Visit will be called.

This is identical to VtVisitValueType<Visitor, TypeArgs...>(value, args...) except that instead of a VtValue value, the value type is determined by the passed dataSource.

Definition at line 265 of file dataSource.h.

template<template< class T, template< class...> class, class...> class Visitor, template< class...> class Tmpl, typename... TypeArgs, typename... FnArgs>
auto HdVisitSampledDataSourceType ( const HdSampledDataSourceHandle &  dataSource,
FnArgs &&...  args 
)

Overload that accepts a leading class template argument that is passed to the visitor as the second template argument.

This is identical to VtVisitValueType<Visitor, Tmpl, TypeArgs...>(value, args...) except that instead of a VtValue value, the value type is determined by the passed dataSource.

Definition at line 286 of file dataSource.h.