Lumiera  0.pre.03
»edityourfreedom«
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
command-signature.hpp
Go to the documentation of this file.
1 /*
2  COMMAND-SIGNATURE.hpp - deriving suitable command function signatures
3 
4  Copyright (C) Lumiera.org
5  2009, Hermann Vosseler <Ichthyostega@web.de>
6 
7  This program is free software; you can redistribute it and/or
8  modify it under the terms of the GNU General Public License as
9  published by the Free Software Foundation; either version 2 of
10  the License, or (at your option) any later version.
11 
12  This program is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with this program; if not, write to the Free Software
19  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 
21 */
22 
23 
46 #ifndef CONTROL_COMMAND_SIGNATURE_H
47 #define CONTROL_COMMAND_SIGNATURE_H
48 
49 #include "lib/meta/function.hpp"
50 #include "lib/meta/typelist.hpp"
53 
54 #include <functional>
55 
56 
57 
58 
59 namespace proc {
60 namespace control {
61 
62  using std::function;
63 
65  using lib::meta::_Fun;
66  using lib::meta::Types;
67  using lib::meta::Append;
69 
70 
78  template<typename SIG, typename MEM>
80  {
81  using Args = typename _Fun<SIG>::Args;
82  using ArgList = typename Args::List;
85 
86  public:
90  using CmdArgs = Args;
91  using Memento = MEM;
92  };
93 
94 
95 
96 
111  template<typename SIG>
113  {
114  // preparation: dissect the function signature into arguments and result
115  using Args = typename _Fun<SIG>::Args;
116  using Ret = typename _Fun<SIG>::Ret;
117 
119  template<typename RET, typename ARG>
120  struct Case
121  {
122  using Memento = RET;
123 
126 
130  };
132  template<typename ARG>
133  struct Case<void,ARG>
134  {
135  using Args = typename ARG::List;
136 
137  using Memento = typename SplitLast<Args>::Type;
140 
144  };
145 
146  public:
151  };
152 
153 
154 
155 }} // namespace proc::control
156 #endif
typename FunctionTypedef< Ret, ARG >::Sig CaptureSig
typename SplitLast< Args >::List OperationArglist
A template metaprogramming technique for manipulating collections of types.
typename FunctionTypedef< Ret, OperationArgs >::Sig CaptureSig
typename _Fun< SIG >::Args Args
typename Case< Ret, Args >::UndoOp_Sig UndoOp_Sig
typename Types< ExtendedArglist >::Seq ExtendedArgs
typename Append< ArgList, MEM >::List ExtendedArglist
Case1: defining the Undo-Capture function.
typename FunctionTypedef< MEM, Args >::Sig CaptureSig
typename FunctionTypedef< void, Args >::Sig OperateSig
LinkedElements< Nummy > List
default case: ownership for heap allocated nodes
Helper for uniform access to function signature types.
Definition: function.hpp:108
append lists-of-types
Some basic facilities for manipulating type sequences.
typename FunctionTypedef< void, OperationArgs >::Sig OperateSig
typename Types< OperationArglist >::Seq OperationArgs
typename FunctionTypedef< void, ARG >::Sig OperateSig
typename FunctionTypedef< void, ARG >::Sig UndoOp_Sig
typename Append< ARG, Memento >::List ExtendedArglist
Build function types from given Argument types.
Definition: function.hpp:180
typename Types< ExtendedArglist >::Seq ExtendedArgs
Metaprogramming tools for transforming functor types.
typename Case< Ret, Args >::CaptureSig CaptureSig
typename _Fun< SIG >::Args Args
typename FunctionTypedef< void, ExtendedArgs >::Sig UndoOp_Sig
typename FunctionTypedef< void, ExtendedArgs >::Sig UndoOp_Sig
access the last list element
Proc-Layer implementation namespace root.
Definition: id-scheme.hpp:63
typename Case< Ret, Args >::OperateSig OperateSig
Metaprogramming: Helpers for manipulating lists-of-types.
Type analysis helper template.
typename _Fun< SIG >::Ret Ret
Metaprogramming helper for building Command function signatures.
typename Case< Ret, Args >::Memento Memento