7#ifndef PXR_EXEC_VDF_TYPE_DISPATCH_TABLE_H
8#define PXR_EXEC_VDF_TYPE_DISPATCH_TABLE_H
17#include "pxr/exec/vdf/api.h"
20#include "pxr/base/tf/pxrTslRobinMap/robin_map.h"
21#include "pxr/base/tf/type.h"
23#include <tbb/spin_rw_mutex.h>
28PXR_NAMESPACE_OPEN_SCOPE
63 mutable tbb::spin_rw_mutex _mutex;
118template <
template <
typename>
class Fn>
135 template <
typename Type>
140 const std::type_info &ti =
typeid(Type);
149 template <
typename RetType,
typename... Args>
153 (std::forward<Args>(args)...);
157PXR_NAMESPACE_CLOSE_SCOPE
TfType represents a dynamic runtime type.
This file defines VdfTypeDispatchTable, a template that can be used to perform runtime type dispatch.
VDF_API bool _RegisterType(const std::type_info &ti, void *f)
Register function pointer f as the implementation to dispatch to for type ti.
VDF_API void * _FindOrFatalError(TfType t) const
Find a registered function pointer for type t.
VDF_API bool IsTypeRegistered(TfType t) const
Returns true if a function has been registered for type t.
Dispatches calls to template instantiations based on a TfType that is determined at runtime.
decltype(Fn< int >::Call) FnSignature
The signature of the functions dispatched by the table.
bool RegisterType()
Register an additional type with the type dispatch table.
RetType Call(TfType key, Args &&... args) const
Invoke the function registered for key type.