5#ifndef vtkTryDowncast_h
6#define vtkTryDowncast_h
12#include <boost/mpl/for_each.hpp>
13#include <boost/mpl/joint_view.hpp>
14#include <boost/mpl/vector.hpp>
21VTK_ABI_NAMESPACE_BEGIN
22typedef boost::mpl::vector<vtkTypeUInt8, vtkTypeInt8, vtkTypeUInt16, vtkTypeInt16, vtkTypeUInt32,
23 vtkTypeInt32, vtkTypeUInt64, vtkTypeInt64,
vtkIdType>
30typedef boost::mpl::joint_view<vtkIntegerTypes, vtkFloatingPointTypes>
vtkNumericTypes;
36typedef boost::mpl::joint_view<vtkNumericTypes, vtkStringTypes>
vtkAllTypes;
39template <
template <
typename>
class TargetT,
typename FunctorT>
50 template <
typename ValueT>
56 TargetT<ValueT>*
const target1 = TargetT<ValueT>::SafeDownCast(
Source1);
72template <
template <
typename>
class TargetT,
typename FunctorT>
84 template <
typename ValueT>
90 TargetT<ValueT>*
const target1 = TargetT<ValueT>::SafeDownCast(
Source1);
91 TargetT<ValueT>*
const target2 = TargetT<ValueT>::SafeDownCast(
Source2);
92 if (target1 && target2)
95 this->
Functor(target1, target2);
108template <
template <
typename>
class TargetT,
typename FunctorT>
122 template <
typename ValueT>
128 TargetT<ValueT>*
const target1 = TargetT<ValueT>::SafeDownCast(
Source1);
129 TargetT<ValueT>*
const target2 = TargetT<ValueT>::SafeDownCast(
Source2);
130 TargetT<ValueT>*
const target3 = TargetT<ValueT>::SafeDownCast(
Source3);
131 if (target1 && target2 && target3)
134 this->
Functor(target1, target2, target3);
148template <
template <
typename>
class TargetT,
typename TypesT,
typename FunctorT>
151 bool succeeded =
false;
152 boost::mpl::for_each<TypesT>(
157template <
template <
typename>
class TargetT,
typename TypesT,
typename FunctorT>
160 bool succeeded =
false;
161 boost::mpl::for_each<TypesT>(
166template <
template <
typename>
class TargetT,
typename TypesT,
typename FunctorT>
169 bool succeeded =
false;
170 boost::mpl::for_each<TypesT>(
abstract base class for most VTK objects
vtkTryDowncastHelper1(vtkObject *source1, FunctorT functor, bool &succeeded)
void operator()(ValueT) const
void operator()(ValueT) const
vtkTryDowncastHelper2(vtkObject *source1, vtkObject *source2, FunctorT functor, bool &succeeded)
vtkTryDowncastHelper3(vtkObject *source1, vtkObject *source2, vtkObject *source3, FunctorT functor, bool &succeeded)
void operator()(ValueT) const
boost::mpl::joint_view< vtkIntegerTypes, vtkFloatingPointTypes > vtkNumericTypes
boost::mpl::joint_view< vtkNumericTypes, vtkStringTypes > vtkAllTypes
boost::mpl::vector< vtkStdString > vtkStringTypes
bool vtkTryDowncast(vtkObject *source1, FunctorT functor)
boost::mpl::vector< vtkTypeFloat32, vtkTypeFloat64 > vtkFloatingPointTypes
boost::mpl::vector< vtkTypeUInt8, vtkTypeInt8, vtkTypeUInt16, vtkTypeInt16, vtkTypeUInt32, vtkTypeInt32, vtkTypeUInt64, vtkTypeInt64, vtkIdType > vtkIntegerTypes