73 #ifndef vtkDoubleDispatcher_h 74 #define vtkDoubleDispatcher_h 82 class BaseRhs = BaseLhs,
83 typename ReturnType = void,
102 template <
class SomeLhs,
class SomeRhs,
class Functor>
103 void Add(Functor fun) { this->AddInternal<SomeLhs,SomeRhs>(fun, 1); }
109 template <
class SomeLhs,
class SomeRhs>
130 ReturnType
Go(BaseLhs* lhs, BaseRhs* rhs);
138 bool DoRemove(TypeInfo lhs, TypeInfo rhs);
141 typedef std::map<KeyType, MappedType >
MapType;
144 template <
class SomeLhs,
class SomeRhs,
class Functor>
145 void AddInternal(
const Functor& fun,
long);
146 template <
class SomeLhs,
class SomeRhs,
class Functor>
147 void AddInternal(Functor* fun,
int);
152 template<
class BaseLhs,
class BaseRhs,
typename ReturnType,
153 template <
class,
class>
class CastingPolicy>
154 template <
class SomeLhs,
class SomeRhs,
class Functor>
162 CastingPolicy<SomeLhs, BaseLhs>,
163 CastingPolicy<SomeRhs, BaseRhs>,
171 template<
class BaseLhs,
class BaseRhs,
typename ReturnType,
172 template <
class,
class>
class CastingPolicy>
173 template <
class SomeLhs,
class SomeRhs,
class Functor>
181 CastingPolicy<SomeLhs, BaseLhs>,
182 CastingPolicy<SomeRhs, BaseRhs>,
190 template<
class BaseLhs,
class BaseRhs,
typename ReturnType,
191 template <
class,
class>
class CastingPolicy>
199 template <
class BaseLhs,
class BaseRhs,
typename ReturnType,
200 template <
class,
class>
class CastingPolicy>
208 template <
class BaseLhs,
class BaseRhs,
typename ReturnType,
209 template <
class,
class>
class CastingPolicy>
211 ::Go(BaseLhs* lhs, BaseRhs* rhs)
213 typename MapType::key_type k(
typeid(*lhs),
typeid(*rhs));
214 typename MapType::iterator i =
FunctorMap.find(k);
221 return (i->second)(*lhs,*rhs);
224 #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