Classes | Public Member Functions

OpenTissue::utility::dispatchers::DynamicTableDispatcher< Base, Mirrored, R, T3 > Class Template Reference

#include <dispatchers_dynamic_table_dispatcher.h>

List of all members.

Classes

class  Functor
class  FunctorBase

Public Member Functions

 DynamicTableDispatcher ()
template<class T1 , class T2 >
void bind (R(*f)(T1 &, T2 &, T3 &))
operator() (Base &t1, Base &t2, T3 &t3)

Detailed Description

template<class Base, bool Mirrored = false, typename R = void, typename T3 = void>
class OpenTissue::utility::dispatchers::DynamicTableDispatcher< Base, Mirrored, R, T3 >

A function table-based implementation of a dynamic multiple dispatcher.

Usage:
  1. Create (or alter) a common base-class for the dispatchable classes, which inherits ClassIDInterface. The inheriting has to be virtual public to avoid ambiguousity in the derived classes.
  2. Let all dispatchable objects inherite from the base-class and from the ClassID template using themself as template parameter.
  3. Create a dispatcher objects using the MultiDispatcher template and bind the dispatch functions.
Template Parameters:
Base The base class of the dispatchable classes supported by this dispatcher.
Mirrored Whether the dispatcher should use mirroring or not.
R The return type of the dispatch functions.
T3 The type of an optional third parameter.

Constructor & Destructor Documentation

template<class Base, bool Mirrored = false, typename R = void, typename T3 = void>
OpenTissue::utility::dispatchers::DynamicTableDispatcher< Base, Mirrored, R, T3 >::DynamicTableDispatcher (  )  [inline]

Member Function Documentation

template<class Base, bool Mirrored = false, typename R = void, typename T3 = void>
template<class T1 , class T2 >
void OpenTissue::utility::dispatchers::DynamicTableDispatcher< Base, Mirrored, R, T3 >::bind ( R(*)(T1 &, T2 &, T3 &)  f  )  [inline]

Bind a dispatch function to the dispatcher.

Note:
There is no way to unbind a function once it's bound other than replacing it with another function. This is a deliberate design choice.
Template Parameters:
T1 The type of the first parameter for the dispatch function, f.
T2 The type of the second parameter for the dispatch function, f.
Parameters:
[in] f The dispatch function to bind. The types of the the parameters are automatically extracted.
template<class Base, bool Mirrored = false, typename R = void, typename T3 = void>
R OpenTissue::utility::dispatchers::DynamicTableDispatcher< Base, Mirrored, R, T3 >::operator() ( Base &  t1,
Base &  t2,
T3 &  t3 
) [inline]

Execute the dispatcher on 2 dispatchable objects and an optional third

Parameters:
[in] t1 The first dispatchable object
[in] t2 The second dispatchable object
[in] t3 The third (non-dispatchable) object
Returns:
The result from the dispatch function.
Exceptions:
UnboundDispatchFuntion The dispatcher have no dispatch function bound to this combination of classes.

The documentation for this class was generated from the following file: