Lumiera 0.pre.04~rc.1
»edit your freedom«
Loading...
Searching...
No Matches
Dispatcher< TAR, TOOL > Class Template Reference

#include "lib/visitor-dispatcher.hpp"

Description

template<class TAR, class TOOL>
class lib::visitor::Dispatcher< TAR, TOOL >

For each possible call entry point via some subclass of the visitable hierarchy, we maintain a dispatcher table to keep track of all concrete tool implementations able to receive and process calls on objects of this subclass.

Parameters
TARthe concrete target (subclass) type within the visitable hierarchy
TOOLthe overall tool family (base class of all concrete tools)

Definition at line 109 of file visitor-dispatcher.hpp.

Static Public Attributes

static Depend< Dispatcher< TAR, TOOL > > instance
 storage for the dispatcher table(s)
 

Public Member Functions

ReturnType forwardCall (TAR &target, TOOL &tool)
 
template<class TOOLImpl >
void enrol (TOOLImpl *typeref)
 

Private Types

using ReturnType = TOOL::ReturnType
 
typedef ReturnType(* Trampoline) (TAR &, TOOL &)
 

Private Member Functions

void accomodate (size_t index)
 
bool is_known (size_t id)
 
void storePtr (size_t id, Trampoline func)
 
Trampoline storedTrampoline (size_t id)
 

Static Private Member Functions

template<class TOOLImpl >
static ReturnType callTrampoline (TAR &obj, TOOL &tool)
 generator for Trampoline functions, used to dispatch calls down to the right "treat"-Function on the correct concrete tool implementation class
 
static ReturnType errorHandler (TAR &target, TOOL &tool)
 

Private Attributes

std::vector< Trampolinetable_
 VTable for storing the Trampoline pointers.
 

Member Typedef Documentation

◆ ReturnType

template<class TAR , class TOOL >
using ReturnType = TOOL::ReturnType
private

Definition at line 111 of file visitor-dispatcher.hpp.

◆ Trampoline

template<class TAR , class TOOL >
typedef ReturnType(* Trampoline) (TAR &, TOOL &)
private

Definition at line 132 of file visitor-dispatcher.hpp.

Member Function Documentation

◆ callTrampoline()

template<class TAR , class TOOL >
template<class TOOLImpl >
static ReturnType callTrampoline ( TAR &  obj,
TOOL &  tool 
)
inlinestaticprivate

generator for Trampoline functions, used to dispatch calls down to the right "treat"-Function on the correct concrete tool implementation class

Definition at line 120 of file visitor-dispatcher.hpp.

References INSTANCEOF.

◆ accomodate()

template<class TAR , class TOOL >
void accomodate ( size_t  index)
inlineprivate

Definition at line 140 of file visitor-dispatcher.hpp.

References Dispatcher< TAR, TOOL >::table_.

Referenced by Dispatcher< TAR, TOOL >::storePtr().

+ Here is the caller graph for this function:

◆ is_known()

template<class TAR , class TOOL >
bool is_known ( size_t  id)
inlineprivate

Definition at line 148 of file visitor-dispatcher.hpp.

References Dispatcher< TAR, TOOL >::table_.

Referenced by Dispatcher< TAR, TOOL >::enrol().

+ Here is the caller graph for this function:

◆ storePtr()

template<class TAR , class TOOL >
void storePtr ( size_t  id,
Trampoline  func 
)
inlineprivate

Definition at line 154 of file visitor-dispatcher.hpp.

References Dispatcher< TAR, TOOL >::accomodate(), and Dispatcher< TAR, TOOL >::table_.

Referenced by Dispatcher< TAR, TOOL >::enrol().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ storedTrampoline()

template<class TAR , class TOOL >
Trampoline storedTrampoline ( size_t  id)
inlineprivate

Definition at line 164 of file visitor-dispatcher.hpp.

References Dispatcher< TAR, TOOL >::errorHandler(), and Dispatcher< TAR, TOOL >::table_.

Referenced by Dispatcher< TAR, TOOL >::forwardCall().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ errorHandler()

template<class TAR , class TOOL >
static ReturnType errorHandler ( TAR &  target,
TOOL &  tool 
)
inlinestaticprivate

Definition at line 173 of file visitor-dispatcher.hpp.

Referenced by Dispatcher< TAR, TOOL >::storedTrampoline().

+ Here is the caller graph for this function:

◆ forwardCall()

template<class TAR , class TOOL >
ReturnType forwardCall ( TAR &  target,
TOOL &  tool 
)
inline

Definition at line 183 of file visitor-dispatcher.hpp.

References Dispatcher< TAR, TOOL >::storedTrampoline().

+ Here is the call graph for this function:

◆ enrol()

template<class TAR , class TOOL >
template<class TOOLImpl >
void enrol ( TOOLImpl *  typeref)
inline

Definition at line 192 of file visitor-dispatcher.hpp.

References Tag< TOOL >::get(), Dispatcher< TAR, TOOL >::is_known(), and Dispatcher< TAR, TOOL >::storePtr().

+ Here is the call graph for this function:

Member Data Documentation

◆ table_

template<class TAR , class TOOL >
std::vector<Trampoline> table_
private

◆ instance

template<class TAR , class TOOL >
Depend< Dispatcher< TAR, TOOL > > instance
static

storage for the dispatcher table(s)

Definition at line 180 of file visitor-dispatcher.hpp.

Referenced by Applicable< TOOLImpl, typelist::Node< TAR, TYPES >, BASE >::Applicable(), and Visitable< TOOL >::dispatchOp().

+ Collaboration diagram for Dispatcher< TAR, TOOL >:

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