10 #ifndef vtk_m_cont_ExecutionAndControlObjectBase_h
11 #define vtk_m_cont_ExecutionAndControlObjectBase_h
38 struct CheckPrepareForControl
41 static auto check(T* p) -> decltype(p->PrepareForControl(), std::true_type());
44 static auto check(...) -> std::false_type;
50 using IsExecutionAndControlObjectBase =
51 std::is_base_of<vtkm::cont::ExecutionAndControlObjectBase, typename std::decay<T>::type>;
54 struct HasPrepareForControl
55 : decltype(detail::CheckPrepareForControl::check<typename std::decay<T>::type>(nullptr))
61 #define VTKM_IS_EXECUTION_AND_CONTROL_OBJECT(execObject) \
62 static_assert(::vtkm::cont::internal::IsExecutionAndControlObjectBase<execObject>::value, \
63 "Provided type is not a subclass of vtkm::cont::ExecutionAndControlObjectBase."); \
64 static_assert(::vtkm::cont::internal::HasPrepareForExecution<execObject>::value, \
65 "Provided type does not have requisite PrepareForExecution method."); \
66 static_assert(::vtkm::cont::internal::HasPrepareForControl<execObject>::value, \
67 "Provided type does not have requisite PrepareForControl method.")
77 VTKM_CONT auto CallPrepareForControl(T&& execObject) -> decltype(execObject.PrepareForControl())
81 return execObject.PrepareForControl();
92 template <
typename ExecutionAndControlObject>
93 using ControlObjectType =
94 decltype(CallPrepareForControl(std::declval<ExecutionAndControlObject>()));
100 #endif //vtk_m_cont_ExecutionAndControlObjectBase_h