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, vtkTypeInt32, vtkTypeUInt64, vtkTypeInt64, vtkIdType>
vtkIntegerTypes;
44typedef boost::mpl::joint_view<vtkIntegerTypes, vtkFloatingPointTypes>
vtkNumericTypes;
50typedef boost::mpl::joint_view<vtkNumericTypes, vtkStringTypes>
vtkAllTypes;
53template<
template <
typename>
class TargetT,
typename FunctorT>
64 template<
typename ValueT>
70 TargetT<ValueT>*
const target1 = TargetT<ValueT>::SafeDownCast(
Source1);
86template<
template <
typename>
class TargetT,
typename FunctorT>
98 template<
typename ValueT>
104 TargetT<ValueT>*
const target1 = TargetT<ValueT>::SafeDownCast(
Source1);
105 TargetT<ValueT>*
const target2 = TargetT<ValueT>::SafeDownCast(
Source2);
106 if(target1 && target2)
109 this->
Functor(target1, target2);
122template<
template <
typename>
class TargetT,
typename FunctorT>
135 template<
typename ValueT>
141 TargetT<ValueT>*
const target1 = TargetT<ValueT>::SafeDownCast(
Source1);
142 TargetT<ValueT>*
const target2 = TargetT<ValueT>::SafeDownCast(
Source2);
143 TargetT<ValueT>*
const target3 = TargetT<ValueT>::SafeDownCast(
Source3);
144 if(target1 && target2 && target3)
147 this->
Functor(target1, target2, target3);
161template<
template <
typename>
class TargetT,
typename TypesT,
typename FunctorT>
164 bool succeeded =
false;
169template<
template <
typename>
class TargetT,
typename TypesT,
typename FunctorT>
172 bool succeeded =
false;
178template<
template <
typename>
class TargetT,
typename TypesT,
typename FunctorT>
181 bool succeeded =
false;
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