58 namespace visitor_concept_draft {
64 template<
class TOOL>
class Tag;
67 template<
class TOOL,
class TOOLImpl>
82 operator size_t()
const {
return tagID; }
85 template<
class TOOLImpl>
87 get (TOOLImpl*
const =0)
101 template<
class TOOL,
class TOOLImpl>
113 template<
typename RET>
129 template<
class TOOLImpl,
class BASE =Tool<
void>>
139 TOOLImpl* typeKey = 0;
152 template<
class TAR,
class TOOL>
162 template<
class TOOLImpl>
168 TOOLImpl& toolObj =
static_cast<TOOLImpl&
> (tool);
173 return toolObj.treat (obj);
210 cout <<
"Error Handler: unregistered combination of (Tool, TargetObject) invoked!\n";
225 template<
class TOOLImpl>
242 template<
class TAR,
class TOOL>
254 template<
class TAR,
class TOOLImpl,
class BASE=Tool<
void> >
257 using Ret = BASE::ReturnType;
263 TOOLImpl* typeKey = 0;
283 <
class TOOL = Tool<void>
317#define DEFINE_PROCESSABLE_BY(TOOL) \
318 virtual ReturnType apply (TOOL& tool) \
319 { return dispatchOp (*this, tool); }
365 cout <<
_Fmt{
"Hello %s, nice to meet you...\n"} % guy;
374 public ToolType<Babbler, VerboseVisitor>
416 cout <<
"=== Babbler meets Boss and BigBoss ===\n";
431 cout <<
"=== Babbler meets HomoSapiens and Visionary ===\n";
Access point to singletons and other kinds of dependencies designated by type.
any concrete visiting tool implementation has to inherit from this class for each kind of calls it wa...
For each possible call entry point via some subclass of the visitable hierarchy, we maintain a dispat...
ReturnType forwardCall(TAR &target, TOOL &tool)
std::vector< Trampoline > table_
custom VTable for storing the Trampoline pointers
TOOL::ReturnType ReturnType
void storePtr(size_t id, Trampoline func)
static lib::Depend< Dispatcher< TAR, TOOL > > instance
storage for the dispatcher table(s)
ReturnType(* Trampoline)(TAR &, TOOL &)
void enrol(TOOLImpl *typeKey)
static ReturnType errorHandler(TAR &, TOOL &)
static ReturnType callTrampoline(TAR &obj, TOOL &tool)
generator for Trampoline functions, used to dispatch calls down to the right "treat"-Function on the ...
Trampoline storedTrampoline(size_t id)
static Tag & get(TOOLImpl *const =0)
static size_t lastRegisteredID
Marker interface "visitable object".
static ReturnType dispatchOp(TAR &target, TOOL &tool)
TOOL::ReturnType ReturnType
virtual ReturnType apply(TOOL &)=0
to be defined by the DEFINE_PROCESSABLE_BY macro in all classes wanting to be treated by some tool
DEFINE_PROCESSABLE_BY(VisitingTool)
DEFINE_PROCESSABLE_BY(VisitingTool)
DEFINE_PROCESSABLE_BY(VisitingTool)
A front-end for using printf-style formatting.
Singleton services and Dependency Injection.
Lumiera public interface.
Test runner and basic definitions for tests.
Simplistic test class runner.
#define LAUNCHER(_TEST_CLASS_, _GROUPS_)
static Tag< TOOL > tag
storage for the Tag registry for each concrete tool
#define INSTANCEOF(CLASS, EXPR)
shortcut for subclass test, intended for assertions only.