22#ifndef vtkTryDowncast_h
23#define vtkTryDowncast_h
29#include <boost/mpl/for_each.hpp>
30#include <boost/mpl/joint_view.hpp>
31#include <boost/mpl/vector.hpp>
38typedef boost::mpl::vector<vtkTypeUInt8, vtkTypeInt8, vtkTypeUInt16, vtkTypeInt16, vtkTypeUInt32,
39 vtkTypeInt32, vtkTypeUInt64, vtkTypeInt64,
vtkIdType>
46typedef boost::mpl::joint_view<vtkIntegerTypes, vtkFloatingPointTypes>
vtkNumericTypes;
52typedef boost::mpl::joint_view<vtkNumericTypes, vtkStringTypes>
vtkAllTypes;
55template <
template <
typename>
class TargetT,
typename FunctorT>
66 template <
typename ValueT>
72 TargetT<ValueT>*
const target1 = TargetT<ValueT>::SafeDownCast(
Source1);
88template <
template <
typename>
class TargetT,
typename FunctorT>
100 template <
typename ValueT>
106 TargetT<ValueT>*
const target1 = TargetT<ValueT>::SafeDownCast(
Source1);
107 TargetT<ValueT>*
const target2 = TargetT<ValueT>::SafeDownCast(
Source2);
108 if (target1 && target2)
111 this->
Functor(target1, target2);
124template <
template <
typename>
class TargetT,
typename FunctorT>
138 template <
typename ValueT>
144 TargetT<ValueT>*
const target1 = TargetT<ValueT>::SafeDownCast(
Source1);
145 TargetT<ValueT>*
const target2 = TargetT<ValueT>::SafeDownCast(
Source2);
146 TargetT<ValueT>*
const target3 = TargetT<ValueT>::SafeDownCast(
Source3);
147 if (target1 && target2 && target3)
150 this->
Functor(target1, target2, target3);
164template <
template <
typename>
class TargetT,
typename TypesT,
typename FunctorT>
167 bool succeeded =
false;
168 boost::mpl::for_each<TypesT>(
173template <
template <
typename>
class TargetT,
typename TypesT,
typename FunctorT>
176 bool succeeded =
false;
177 boost::mpl::for_each<TypesT>(
182template <
template <
typename>
class TargetT,
typename TypesT,
typename FunctorT>
185 bool succeeded =
false;
186 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, vtkUnicodeString > 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