diff --git a/src/lib/meta/typelist.hpp b/src/lib/meta/typelist.hpp index c2d4568d0..726381bf5 100644 --- a/src/lib/meta/typelist.hpp +++ b/src/lib/meta/typelist.hpp @@ -59,10 +59,8 @@ This code is heavily inspired by -namespace lumiera - { - namespace typelist - { +namespace lumiera { +namespace typelist{ class NullType { @@ -120,7 +118,5 @@ namespace lumiera typedef Node NodeNull; - } // namespace typelist - -} // namespace lumiera +}} // namespace lumiera::typelist #endif diff --git a/src/proc/control/command-def.hpp b/src/proc/control/command-def.hpp index 9850c7abf..a6b6c2c1d 100644 --- a/src/proc/control/command-def.hpp +++ b/src/proc/control/command-def.hpp @@ -48,6 +48,7 @@ #define CONTROL_COMMAND_H //#include "pre.hpp" +#include "include/symbol.hpp" #include "proc/control/command.hpp" #include "proc/control/mutation.hpp" #include "proc/control/command-closure.hpp" @@ -59,7 +60,7 @@ namespace control { -// using lumiera::Symbol; + using lumiera::Symbol; // using std::tr1::shared_ptr; diff --git a/tests/components/proc/control/command-basic-test.cpp b/tests/components/proc/control/command-basic-test.cpp index 999124c18..00fac7b28 100644 --- a/tests/components/proc/control/command-basic-test.cpp +++ b/tests/components/proc/control/command-basic-test.cpp @@ -32,45 +32,231 @@ //#include "proc/mobject/placement-index.hpp" //#include "proc/mobject/explicitplacement.hpp" #include "proc/control/command-def.hpp" +#include "lib/lumitime.hpp" //#include "lib/util.hpp" +#include "lib/meta/typelist.hpp" +#include "lib/meta/typelistutil.hpp" + #include //#include //#include #include -//using std::tr1::bind; +using std::tr1::bind; +//using std::tr1::placeholders::_1; +//using std::tr1::placeholders::_2; using std::tr1::function; //using boost::format; -//using lumiera::Time; +using lumiera::Time; //using util::contains; using std::string; //using std::cout; +namespace lumiera { +namespace typelist{ + + + ////////////////////////////////////////////TODO braindump + + template< typename SIG> + struct FunctionSignature; + + template< typename RET> + struct FunctionSignature< function > + { + typedef RET Ret; + typedef Types<> Args; + }; + + template< typename RET + , typename A1 + > + struct FunctionSignature< function > + { + typedef RET Ret; + typedef Types Args; + }; + + template< typename RET + , typename A1 + , typename A2 + > + struct FunctionSignature< function > + { + typedef RET Ret; + typedef Types Args; + }; + + template< typename RET + , typename A1 + , typename A2 + , typename A3 + > + struct FunctionSignature< function > + { + typedef RET Ret; + typedef Types Args; + }; + + template< typename RET + , typename A1 + , typename A2 + , typename A3 + , typename A4 + > + struct FunctionSignature< function > + { + typedef RET Ret; + typedef Types Args; + }; + + template< typename RET + , typename A1 + , typename A2 + , typename A3 + , typename A4 + , typename A5 + > + struct FunctionSignature< function > + { + typedef RET Ret; + typedef Types Args; + }; + + + template + struct FunctionTypedef; + + template< typename RET> + struct FunctionTypedef > + { + typedef function Func; + typedef RET Sig(); + }; + + template< typename RET + , typename A1 + > + struct FunctionTypedef > + { + typedef function Func; + typedef RET Sig(A1); + }; + + template< typename RET + , typename A1 + , typename A2 + > + struct FunctionTypedef > + { + typedef function Func; + typedef RET Sig(A1,A2); + }; + + template< typename RET + , typename A1 + , typename A2 + , typename A3 + > + struct FunctionTypedef > + { + typedef function Func; + typedef RET Sig(A1,A2,A3); + }; + + template< typename RET + , typename A1 + , typename A2 + , typename A3 + , typename A4 + > + struct FunctionTypedef > + { + typedef function Func; + typedef RET Sig(A1,A2,A3,A4); + }; + + template< typename RET + , typename A1 + , typename A2 + , typename A3 + , typename A4 + , typename A5 + > + struct FunctionTypedef > + { + typedef function Func; + typedef RET Sig(A1,A2,A3,A4,A5); + }; + + + + + template + struct Prepend; + + template< typename A1 + , typename A2 + , typename A3 + , typename A4 + , typename A5 + , typename IGN + > + struct Prepend > + { + typedef Types Tuple; + }; + + template + struct Tuple; + + template<> + struct Tuple + { + typedef Types<> Type; + }; + + template + struct Tuple > + { + typedef typename Prepend::Type >::Tuple Type; + }; + + + +}} // namespace lumiera::typelist + namespace control { namespace test { // using session::test::TestClip; - using lib::P; - - ////////////////////////////////////////////TODO braindump + using lumiera::P; + + using lumiera::typelist::FunctionSignature; + using lumiera::typelist::FunctionTypedef; + + using lumiera::typelist::Tuple; + using lumiera::typelist::Append; template - struct BuildUndoCapturing_Signature; - - template - struct BuildUndoCapturing_Signature + struct BuildUndoCapturing_Signature { - typedef function type; + typedef typename FunctionSignature< function >::Args Args; + typedef typename FunctionTypedef::Sig type; }; template struct BuildUndoOperation_Signature { - typedef function type; + typedef typename FunctionSignature< function >::Args::List Args; + typedef typename Append::List ExtendedArglist; + typedef typename Tuple::Type ExtendedArgs; + typedef typename FunctionTypedef::Sig type; }; + class CommDef { Symbol id_; @@ -78,9 +264,12 @@ namespace test { template struct UndoDefinition { + typedef typename BuildUndoOperation_Signature::type UndoSig; + UndoDefinition - undoOperation (typename BuildUndoOperation_Signature::type how_to_Undo) + undoOperation (UndoSig& how_to_Undo) { + function opera3 (how_to_Undo); } @@ -91,8 +280,11 @@ namespace test { { template UndoDefinition - captureUndo (typename BuildUndoCapturing_Signature,MEM>::type how_to_capture_UndoState) + captureUndo (typename BuildUndoCapturing_Signature::type& how_to_capture_UndoState) { + typedef typename BuildUndoCapturing_Signature::type UndoCapSig; + + function opera2 (how_to_capture_UndoState); } @@ -105,9 +297,9 @@ namespace test { template BasicDefinition - operation (function operation_to_define) + operation (SIG& operation_to_define) { - + function opera1 (operation_to_define); } }; @@ -129,19 +321,19 @@ namespace test { */ namespace command1 { void - command1_do (P dummyObj, int randVal) + operate (P