 |
VTK
9.0.1
|
Go to the documentation of this file.
30 #ifndef vtkDispatcher_Private_h
31 #define vtkDispatcher_Private_h
33 #include "vtkConfigure.h"
35 #ifndef VTK_LEGACY_REMOVE
47 template <
class BaseLhs,
class SomeLhs,
typename RT,
class CastLhs,
class Fun>
73 template <
class BaseLhs,
class SomeLhs,
typename RT,
class CastLhs,
class Fun>
96 template <
typename R,
typename P1>
112 U* pClone =
static_cast<U*
>(pObj->DoClone());
113 assert(
typeid(*pClone) ==
typeid(*pObj));
128 template <
class ParentFunctor,
typename Fun>
131 typedef typename ParentFunctor::Impl Base;
149 : ParentFunctor::Impl(b)
159 template <
typename R,
typename Parm1>
172 : spImpl_(
Impl::Clone(rhs.spImpl_.
get()))
176 template <
typename Fun>
185 spImpl_.swap(copy.spImpl_);
192 std::unique_ptr<Impl> spImpl_;
203 template <
class BaseLhs,
class BaseRhs,
class SomeLhs,
class SomeRhs,
typename RT,
class CastLhs,
204 class CastRhs,
class Fun>
222 return fun_(CastLhs::Cast(lhs), CastRhs::Cast(rhs));
229 template <
class BaseLhs,
class BaseRhs,
class SomeLhs,
class SomeRhs,
typename RT,
class CastLhs,
230 class CastRhs,
class Fun>
248 return fun_(CastLhs::Cast(lhs), CastRhs::Cast(rhs));
255 template <
typename R,
typename P1,
typename P2>
272 U* pClone =
static_cast<U*
>(pObj->DoClone());
273 assert(
typeid(*pClone) ==
typeid(*pObj));
288 template <
class ParentFunctor,
typename Fun>
291 typedef typename ParentFunctor::Impl Base;
311 : ParentFunctor::Impl(b)
321 template <
typename R,
typename Parm1,
typename Parm2>
334 : spImpl_(
Impl::Clone(rhs.spImpl_.
get()))
338 template <
typename Fun>
347 spImpl_.swap(copy.spImpl_);
354 std::unique_ptr<Impl> spImpl_;
361 template <
class To,
class From>
364 static To&
Cast(From& obj) {
return dynamic_cast<To&
>(obj); }
366 static To*
Cast(From* obj) {
return dynamic_cast<To*
>(obj); }
369 template <
class To,
class From>
372 static To&
Cast(From& obj) {
return *(To::SafeDownCast(&obj)); }
374 static To*
Cast(From* obj) {
return To::SafeDownCast(obj); }
385 const std::type_info&
Get()
const;
388 const char*
name()
const;
391 const std::type_info* pInfo_;
401 pInfo_ = &
typeid(Nil);
415 return pInfo_->before(*rhs.pInfo_) != 0;
427 return pInfo_->name();
435 return (lhs.
Get() == rhs.
Get()) != 0;
445 return !(lhs == rhs);
466 #endif // legacy remove
467 #endif // vtkDispatcherPrivate_h
ResultType operator()(BaseLhs &lhs)
Functor & operator=(const Functor &rhs)
FunctorDispatcherHelper(const FunctorDispatcherHelper &rhs)
static To * Cast(From *obj)
bool operator>(const TypeInfo &lhs, const TypeInfo &rhs)
ResultType operator()(Parm1 &p1) override
ResultType operator()(BaseLhs &lhs)
FunctorHandler(const Fun &fun)
static To & Cast(From &obj)
ResultType operator()(Parm1 &p1, Parm2 &p2) override
bool operator<(const TypeInfo &lhs, const TypeInfo &rhs)
static To * Cast(From *obj)
FunctorHandler * DoClone() const override
bool operator==(const TypeInfo &lhs, const TypeInfo &rhs)
~FunctorHandler() override
FunctorDoubleDispatcherHelper(const FunctorDoubleDispatcherHelper &rhs)
ResultType operator()(BaseLhs &lhs, BaseRhs &rhs)
static U * Clone(U *pObj)
FunctorRefDispatcherHelper(Fun &f)
virtual R operator()(P1 &, P2 &)=0
FunctorDoubleDispatcherHelper(Fun fun)
const std::type_info & Get() const
FunctorRefDispatcherHelper(const FunctorRefDispatcherHelper &rhs)
~FunctorHandler() override
Functor(const Functor &rhs)
double get(vtkDataArray *const &arr, vtkIdType key)
FunctorImpl(const FunctorImpl &)
bool operator>=(const TypeInfo &lhs, const TypeInfo &rhs)
FunctorImpl(const FunctorImpl &)
virtual R operator()(P1 &)=0
static To & Cast(From &obj)
FunctorHandler * DoClone() const override
FunctorRefDispatcherHelper(const FunctorRefDispatcherHelper &rhs)
FunctorImpl< R, Parm1 > Impl
const char * name() const
ResultType operator()(Parm1 &p1)
bool operator<=(const TypeInfo &lhs, const TypeInfo &rhs)
static U * Clone(U *pObj)
Base::ResultType ResultType
Functor(const Functor &rhs)
virtual FunctorImpl * DoClone() const =0
ResultType operator()(Parm1 &p1, Parm2 &p2)
bool operator!=(const TypeInfo &lhs, const TypeInfo &rhs)
FunctorImpl< R, Parm1, Parm2 > Impl
bool before(const TypeInfo &rhs) const
Base::ResultType ResultType
virtual FunctorImpl * DoClone() const =0
FunctorDispatcherHelper(Fun fun)
FunctorRefDispatcherHelper(Fun &fun)
ResultType operator()(BaseLhs &lhs, BaseRhs &rhs)
Functor & operator=(const Functor &rhs)