73 #ifndef vtkDispatcher_h
74 #define vtkDispatcher_h
85 template <
class BaseLhs,
typename ReturnType = void,
103 template <
class SomeLhs,
class Functor>
107 this->AddInternal<SomeLhs>(fun, 1);
114 template <
class SomeLhs>
117 return DoRemove(
typeid(SomeLhs));
138 ReturnType Go(BaseLhs* lhs);
146 typedef std::map<TypeInfo, MappedType>
MapType;
150 template <
class SomeLhs,
class Functor>
151 void AddInternal(Functor
const& fun,
long);
152 template <
class SomeLhs,
class Functor>
153 void AddInternal(Functor* fun,
int);
158 template <
class BaseLhs,
typename ReturnType,
template <
class,
class>
class CastingPolicy>
159 template <
class SomeLhs,
class Functor>
161 void
vtkDispatcher<BaseLhs, ReturnType, CastingPolicy>::AddInternal(const Functor& fun,
long)
164 CastingPolicy<SomeLhs, BaseLhs>, Functor>
168 DoAddFunctor(
typeid(SomeLhs), mt);
172 template <
class BaseLhs,
typename ReturnType,
template <
class,
class>
class CastingPolicy>
173 template <
class SomeLhs,
class Functor>
175 void
vtkDispatcher<BaseLhs, ReturnType, CastingPolicy>::AddInternal(Functor* fun,
int)
178 CastingPolicy<SomeLhs, BaseLhs>, Functor>
182 DoAddFunctor(
typeid(SomeLhs), mt);
186 template <
class BaseLhs,
typename ReturnType,
template <
class,
class>
class CastingPolicy>
194 template <
class BaseLhs,
typename ReturnType,
template <
class,
class>
class CastingPolicy>
198 return FunctorMap.erase(
TypeInfo(lhs)) == 1;
202 template <
class BaseLhs,
typename ReturnType,
template <
class,
class>
class CastingPolicy>
204 ReturnType
vtkDispatcher<BaseLhs, ReturnType, CastingPolicy>::Go(BaseLhs* lhs)
206 typename MapType::key_type k(
typeid(*lhs));
207 typename MapType::iterator i = FunctorMap.find(k);
208 if (i == FunctorMap.end())
213 return (i->second)(*lhs);
216 #endif // __VTK_WRAP__
217 #endif // vtkDispatcher_h