From a95103eb3b260a088df7aa90364d226f308a5e28 Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Sat, 23 Jan 2016 11:57:19 +0100 Subject: [PATCH] research: define new metaprogramming task need to bridge between generic typing of tuples and the DOM-like typing of UI-Bus messages --- research/try.cpp | 129 +++++++-------------------------------- wiki/thinkPad.ichthyo.mm | 121 ++++++++++++++++++++++++++++++------ 2 files changed, 122 insertions(+), 128 deletions(-) diff --git a/research/try.cpp b/research/try.cpp index 4c7342111..5d2c9f6d9 100644 --- a/research/try.cpp +++ b/research/try.cpp @@ -30,94 +30,46 @@ // 8/15 - Segfault when loading into GDB (on Debian/Jessie 64bit // 8/15 - generalising the Variant::Visitor // 1/16 - generic to-string conversion for ostream -// 1/16 - generate receiver function with arbitrary arguments +// 1/16 - build tuple from runtime-typed variant container /** @file try.cpp - ** Metaprogramming: how to generate a function to accept a fixed set - ** of typed arguments, where the sequence of arguments is given as type sequence - ** or as variadic parameter pack. Also how to bind concrete argument values to - ** such a function, where the concrete arguments come as runtime collection - ** of variant holders. + ** Metaprogramming: how to unload the contents of a runtime typed variant sequence + ** into ctor arguments of a (compile time typed) tuple. This involves two problems + ** - how to combine iteration, compile-time indexing and run-time access. + ** - how to overcome the runtime-to-compiletime barrier, using a pre-generated + ** double-dispatch (visitor). + ** + ** The concrete problem prompting this research is the necessity to receive + ** a command invocation parameter tuple from a Record ** */ typedef unsigned int uint; -//#include "lib/diff/gen-node.hpp" - +#include "lib/symbol.hpp" +#include "lib/diff/gen-node.hpp" #include "lib/time/timevalue.hpp" -#include "proc/control/command-def.hpp" +#include "lib/meta/tuple-helper.hpp" #include "lib/format-cout.hpp" #include "lib/format-util.hpp" #include -#include #include -//using lib::diff::GenNode; +using lib::Literal; +using lib::diff::GenNode; using lib::meta::Types; -using lib::meta::NullType; -using proc::control::CommandSignature; -using proc::control::CommandDef; -using proc::control::Command; +//using lib::meta::NullType; +using lib::meta::Tuple; using lib::time::TimeVar; using lib::time::Time; using util::stringify; using util::join; using std::function; -using std::vector; using std::string; - -using VecS = vector; - -template -struct TyS - { - using Seq = TyS; - }; - -template -struct ArgSeq; - -template -struct ArgSeq - { - using Seq = TyS; - }; - - - -template -struct Funny - { - static void - operate (ARGS ...args) - { - VecS strs = stringify (args...); - cout << join (strs) < (args...); - return join (strs); - } - - static void - undo (ARGS ...args, string plonk) - { - VecS strs = stringify (args...); - cout << "UNDO..." << plonk << "| args=" << join (strs) < -struct Funny> - : Funny - { }; +using std::tuple; @@ -131,51 +83,12 @@ struct Funny> int main (int, char**) { - cout << Funny::capture ("lalü", string("lala"), 12, 34L, 56.78) <; + using UgglyTypes = Types; + Tuple uggs("lalü", "lala", 12, 34, 5.6, Time(7,8,9)); - auto ops = Funny::operate; - - using FunnySIG = lib::meta::_Fun::Sig; - - using SIG_Opr = CommandSignature::OperateSig; - using SIG_Cap = CommandSignature::CaptureSig; - using SIG_Udo = CommandSignature::UndoOp_Sig; - - SHOW_TYPE (SIG_Opr); - SHOW_TYPE (SIG_Cap); - SHOW_TYPE (SIG_Udo); - - using ArgS = ArgSeq::Seq; - SHOW_TYPE (ArgS); - - function funny; - function capy; - function undy; - - cout << "funny? " << bool(funny) <::operate; - capy = Funny::capture; - undy = Funny::undo; - cout << "funny? " << bool(funny) <::operate) - .captureUndo(Funny::capture) - .undoOperation(Funny::undo); - - cout << Command("lalü") << endl; - - Command com = Command("lalü"); - - com.bind(12.33445566778899, TimeVar(Time(4,3,2,1))); - - com(); - com.undo(); + cout << uggs < - + + @@ -198,8 +199,7 @@ ...wird sinnvoll im Rahmen von InteractionControl

- - +
@@ -229,8 +229,7 @@ Dann mußte das allerdigns jeweils für alle Elemente sinnvoll sein

- - +
@@ -243,8 +242,7 @@ und der muß vom konkreten Widget implementiert werden

- - +
@@ -257,8 +255,7 @@ dann wird eine state mark ausgesendet

- - +
@@ -280,8 +277,7 @@ need to bubble up

- - +
@@ -411,8 +407,7 @@ ...was ich einen Monat später schon wieder vergessen hatte...

- - + @@ -446,8 +441,7 @@ den InvocationTrail manuell im Testcode binden

- - + @@ -498,8 +492,7 @@ der unimttelbar Datenwerte nimmt und sie in einen Argument-Record packt

- - + @@ -647,8 +640,9 @@ - + + @@ -680,9 +674,96 @@ + + + + + + + + +

+ Mechanismus, der es erlaubt +

+
    +
  • + log-Nachrichten aus Mocks zu hinterlassen +
  • +
  • + in der Test-Fixture auf diese zu matchen +
  • +
+ + +
+
- - + + + + + + + + + + +

+ Dienste im UI, erreichbar über den Bus. +

+

+ Sie stellen die Verbindung zu zentralen Belangen her +

+

+ wie Session- und State-Managment, Commands etc. +

+ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +