30#ifndef vtkDispatcher_Private_h
31#define vtkDispatcher_Private_h
46template <
class BaseLhs,
class SomeLhs,
typename RT,
class CastLhs,
class Fun>
72template <
class BaseLhs,
class SomeLhs,
typename RT,
class CastLhs,
class Fun>
95template <
typename R,
typename P1>
111 U* pClone =
static_cast<U*
>(pObj->DoClone());
112 assert(
typeid(*pClone) ==
typeid(*pObj));
127template <
class ParentFunctor,
typename Fun>
130 typedef typename ParentFunctor::Impl Base;
148 : ParentFunctor::Impl(b)
158template <
typename R,
typename Parm1>
171 : spImpl_(
Impl::Clone(rhs.spImpl_.
get()))
175 template <
typename Fun>
184 spImpl_.swap(copy.spImpl_);
191 std::unique_ptr<Impl> spImpl_;
202template <
class BaseLhs,
class BaseRhs,
class SomeLhs,
class SomeRhs,
typename RT,
class CastLhs,
203 class CastRhs,
class Fun>
221 return fun_(CastLhs::Cast(lhs), CastRhs::Cast(rhs));
228template <
class BaseLhs,
class BaseRhs,
class SomeLhs,
class SomeRhs,
typename RT,
class CastLhs,
229 class CastRhs,
class Fun>
247 return fun_(CastLhs::Cast(lhs), CastRhs::Cast(rhs));
254template <
typename R,
typename P1,
typename P2>
271 U* pClone =
static_cast<U*
>(pObj->DoClone());
272 assert(
typeid(*pClone) ==
typeid(*pObj));
287template <
class ParentFunctor,
typename Fun>
290 typedef typename ParentFunctor::Impl Base;
310 : ParentFunctor::Impl(b)
320template <
typename R,
typename Parm1,
typename Parm2>
333 : spImpl_(
Impl::Clone(rhs.spImpl_.
get()))
337 template <
typename Fun>
346 spImpl_.swap(copy.spImpl_);
353 std::unique_ptr<Impl> spImpl_;
360template <
class To,
class From>
363 static To&
Cast(From& obj) {
return dynamic_cast<To&
>(obj); }
365 static To*
Cast(From* obj) {
return dynamic_cast<To*
>(obj); }
368template <
class To,
class From>
371 static To&
Cast(From& obj) {
return *(To::SafeDownCast(&obj)); }
373 static To*
Cast(From* obj) {
return To::SafeDownCast(obj); }
384 const std::type_info&
Get()
const;
387 const char*
name()
const;
390 const std::type_info* pInfo_;
400 pInfo_ = &
typeid(Nil);
414 return pInfo_->before(*rhs.pInfo_) != 0;
426 return pInfo_->name();
434 return (lhs.
Get() == rhs.
Get()) != 0;
444 return !(lhs == rhs);
bool before(const TypeInfo &rhs) const
const char * name() const
const std::type_info & Get() const
FunctorDispatcherHelper(Fun fun)
ResultType operator()(BaseLhs &lhs)
FunctorDispatcherHelper(const FunctorDispatcherHelper &rhs)
ResultType operator()(Parm1 &p1) override
~FunctorHandler() override=default
FunctorHandler * DoClone() const override
Base::ResultType ResultType
FunctorImpl(const FunctorImpl &)=default
virtual FunctorImpl * DoClone() const =0
virtual ~FunctorImpl()=default
virtual R operator()(P1 &)=0
static U * Clone(U *pObj)
FunctorRefDispatcherHelper(Fun &f)
FunctorRefDispatcherHelper(const FunctorRefDispatcherHelper &rhs)
ResultType operator()(BaseLhs &lhs)
Functor(const Functor &rhs)
Functor & operator=(const Functor &rhs)
FunctorImpl< R, Parm1 > Impl
ResultType operator()(Parm1 &p1)
FunctorDoubleDispatcherHelper(Fun fun)
ResultType operator()(BaseLhs &lhs, BaseRhs &rhs)
FunctorDoubleDispatcherHelper(const FunctorDoubleDispatcherHelper &rhs)
~FunctorHandler() override=default
ResultType operator()(Parm1 &p1, Parm2 &p2) override
FunctorHandler(const Fun &fun)
FunctorHandler * DoClone() const override
Base::ResultType ResultType
FunctorImpl(const FunctorImpl &)=default
virtual ~FunctorImpl()=default
virtual FunctorImpl * DoClone() const =0
virtual R operator()(P1 &, P2 &)=0
static U * Clone(U *pObj)
FunctorRefDispatcherHelper(Fun &fun)
FunctorRefDispatcherHelper(const FunctorRefDispatcherHelper &rhs)
ResultType operator()(BaseLhs &lhs, BaseRhs &rhs)
Functor(const Functor &rhs)
ResultType operator()(Parm1 &p1, Parm2 &p2)
Functor & operator=(const Functor &rhs)
FunctorImpl< R, Parm1, Parm2 > Impl
double get(vtkDataArray *const &arr, vtkIdType key)
bool operator<=(const TypeInfo &lhs, const TypeInfo &rhs)
bool operator!=(const TypeInfo &lhs, const TypeInfo &rhs)
bool operator>=(const TypeInfo &lhs, const TypeInfo &rhs)
bool operator==(const TypeInfo &lhs, const TypeInfo &rhs)
bool operator<(const TypeInfo &lhs, const TypeInfo &rhs)
bool operator>(const TypeInfo &lhs, const TypeInfo &rhs)
static To & Cast(From &obj)
static To * Cast(From *obj)
static To & Cast(From &obj)
static To * Cast(From *obj)