Lumiera 0.pre.04~rc.1
»edit your freedom«
Loading...
Searching...
No Matches
command-invocation.hpp
Go to the documentation of this file.
1/*
2 COMMAND-INVOCATION.hpp - shortcuts and helpers for calling Steam-Layer commands
3
4 Copyright (C)
5 2009, Hermann Vosseler <Ichthyostega@web.de>
6
7  **Lumiera** is free software; you can redistribute it and/or modify it
8  under the terms of the GNU General Public License as published by the
9  Free Software Foundation; either version 2 of the License, or (at your
10  option) any later version. See the file COPYING for further details.
11
12*/
13
14
37#ifndef CONTROL_COMMAND_INVOCACTION_H
38#define CONTROL_COMMAND_INVOCACTION_H
39
43
44#include <utility>
45
46
47
48namespace steam {
49namespace control {
50
51 using namespace lib::meta;
52
53
54
55 namespace com {
56 // define transient invoker objects, to allow for arbitrary bindings
57
58 template<typename SIG>
60 {
61 typedef ExecResult SIG_Bind(int);
62 };
63
64
70 template<typename SIG>
72 : AcceptArgumentTuple< typename _DefineBindFunc<SIG>::SIG_Bind
73 , CommandInvoker<SIG>
74 >
75 {
77
79 : com_(c)
80 { }
81
82
83 template<typename TYPES>
86 {
89 return com_();
90 }
91 };
92
93
94
105 {
107
111
112
116 template<typename...ARGS>
118 operator() (ARGS&& ...args)
119 {
120 com_.bind (std::forward<ARGS> (args)...);
121 return com_();
122 }
123 };
124 }
125
126
127
128 inline
129 com::RuntimeCheckedCommandInvoker
131 {
132 Command command = Command::get (cmdID);
133 ASSERT (command);
135 }
136
137
138 inline
139 com::RuntimeCheckedCommandInvoker
140 invoke (CStr cmdID)
141 {
142 return invoke(Symbol(cmdID));
143 }
144
145
146}} // namespace steam::control
147#endif
Mixin-templates providing arbitrary function call operators and argument binding functions.
Token or Atom with distinct identity.
Definition symbol.hpp:120
Helper Template for building a Functor or function-like class: Mix in a function call operator,...
Handle object representing a single Command instance to be used by client code.
Definition command.hpp:120
Command & bindArg(std::tuple< TYPES... > const &)
Definition command.hpp:243
static Command get(Symbol cmdID)
Access existing command for use.
Definition command.cpp:120
Result (Status) of command execution.
Steam-Layer command frontend.
const char * CStr
Definition error.hpp:42
Pre-defined command execution skeletons.
enable_if_c< Cond::value, T >::type enable_if
SFINAE helper to control the visibility of specialisations and overloads.
Definition meta/util.hpp:87
< Steam-Layer command implementation details
com::RuntimeCheckedCommandInvoker invoke(Symbol cmdID)
Steam-Layer implementation namespace root.
ExecResult bindArg(Tuple< TYPES > const &args)
ExecResult operator()(ARGS &&...args)
invoke command with arbitrary arguments