70 #ifndef vtkDoubleDispatcher_h 71 #define vtkDoubleDispatcher_h 79 class BaseRhs = BaseLhs,
80 typename ReturnType = void,
99 template <
class SomeLhs,
class SomeRhs,
class Functor>
100 void Add(Functor fun) { this->AddInternal<SomeLhs,SomeRhs>(fun, 1); }
106 template <
class SomeLhs,
class SomeRhs>
127 ReturnType
Go(BaseLhs* lhs, BaseRhs* rhs);
135 bool DoRemove(TypeInfo lhs, TypeInfo rhs);
138 typedef std::map<KeyType, MappedType >
MapType;
141 template <
class SomeLhs,
class SomeRhs,
class Functor>
142 void AddInternal(
const Functor& fun,
long);
143 template <
class SomeLhs,
class SomeRhs,
class Functor>
144 void AddInternal(Functor* fun,
int);
149 template<
class BaseLhs,
class BaseRhs,
typename ReturnType,
150 template <
class,
class>
class CastingPolicy>
151 template <
class SomeLhs,
class SomeRhs,
class Functor>
159 CastingPolicy<SomeLhs, BaseLhs>,
160 CastingPolicy<SomeRhs, BaseRhs>,
168 template<
class BaseLhs,
class BaseRhs,
typename ReturnType,
169 template <
class,
class>
class CastingPolicy>
170 template <
class SomeLhs,
class SomeRhs,
class Functor>
178 CastingPolicy<SomeLhs, BaseLhs>,
179 CastingPolicy<SomeRhs, BaseRhs>,
187 template<
class BaseLhs,
class BaseRhs,
typename ReturnType,
188 template <
class,
class>
class CastingPolicy>
196 template <
class BaseLhs,
class BaseRhs,
typename ReturnType,
197 template <
class,
class>
class CastingPolicy>
205 template <
class BaseLhs,
class BaseRhs,
typename ReturnType,
206 template <
class,
class>
class CastingPolicy>
208 ::Go(BaseLhs* lhs, BaseRhs* rhs)
210 typename MapType::key_type k(
typeid(*lhs),
typeid(*rhs));
211 typename MapType::iterator i =
FunctorMap.find(k);
218 return (i->second)(*lhs,*rhs);
221 #endif // vtkDoubleDispatcher_h ReturnType Go(BaseLhs *lhs, BaseRhs *rhs)
Given two pointers of objects that derive from the BaseLhs and BaseRhs we find the matching functor t...
std::map< KeyType, MappedType > MapType
void DoAddFunctor(TypeInfo lhs, TypeInfo rhs, MappedType fun)
void Add(Functor fun)
Add in a functor that is mapped to the combination of the two template parameters passed in...
vtkDispatcherCommon::TypeInfo TypeInfo
Dispatch to functor based on two pointer types.
bool Remove()
Remove a functor that is bound to the given parameter types.
bool DoRemove(TypeInfo lhs, TypeInfo rhs)
std::pair< TypeInfo, TypeInfo > KeyType
vtkDoubleDispatcherPrivate::Functor< ReturnType, BaseLhs, BaseRhs > MappedType