Lumiera 0.pre.04~rc.1
»edit your freedom«
Loading...
Searching...
No Matches
session-command-service.cpp
Go to the documentation of this file.
1/*
2 SessionCommandService - public service to invoke commands on the session
3
4 Copyright (C)
5 2016, 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
27#include "include/logging.h"
28#include "lib/depend.hpp"
29#include "lib/symbol.hpp"
30#include "lib/util.hpp"
31
32extern "C" {
34}
35
36#include <string>
37
38
39
40
41namespace steam {
42namespace control {
43
44 using lib::Symbol;
45 using std::string;
46
47
48 Symbol
50 {
52 }
53
54
67 void
74
75
85 void
91
92
101 void
106
107
108 namespace { // facade implementation details
109
110
111 /* ================== define an lumieraorg_GuiNotification instance ======================= */
112
115 , NULL, NULL, NULL
117 const char*, (LumieraInterface ifa),
118 { (void)ifa; return "SessionCommand"; }
119 )
121 const char*, (LumieraInterface ifa),
122 { (void)ifa; return "Session Interface: invoke pre-defined commands to operate on the session"; }
123 )
125 const char*, (LumieraInterface ifa),
126 { (void)ifa; return "http://www.lumiera.org/develompent.html" ;}
127 )
128 , LUMIERA_INTERFACE_INLINE (version,
129 const char*, (LumieraInterface ifa),
130 { (void)ifa; return "0.3~pre"; }
131 )
133 const char*, (LumieraInterface ifa),
134 { (void)ifa; return "Hermann Vosseler"; }
135 )
137 const char*, (LumieraInterface ifa),
138 { (void)ifa; return "Ichthyostega@web.de"; }
139 )
141 const char*, (LumieraInterface ifa),
142 {
143 (void)ifa;
144 return
145 "Copyright (C)\n"
146 " 2016, Hermann Vosseler <Ichthyostega@web.de>";
147 }
148 )
150 const char*, (LumieraInterface ifa),
151 {
152 (void)ifa;
153 return
154 "**Lumiera** is free software; you can redistribute it and/or modify it\n"
155 "under the terms of the GNU General Public License as published by the\n"
156 "Free Software Foundation; either version 2 of the License, or (at your\n"
157 "option) any later version. See the file COPYING for further details."
158 ;
159 }
160 )
162 int, (LumieraInterface ifa),
164 )
166 int, (const char* a, const char* b),
167 {(void)a;(void)b; return 0;}
168 )
169 );
170
171
172
173
174
175 using LERR_(LIFECYCLE);
176
178
179
180
184 , NULL /* on open */
185 , NULL /* on close */
187 const char*, (const char* cmdID, const char* invocationID),
188 {
189 if (!_instance)
190 return lumiera_error_set (LUMIERA_ERROR_LIFECYCLE, cmdID);
191 else
192 return _instance().cycle(cmdID, invocationID);
193 }
194 )
195 , LUMIERA_INTERFACE_INLINE (trigger,
196 void, (const char* cmdID, const void* args),
197 {
198 if (!_instance) lumiera_error_set (LUMIERA_ERROR_LIFECYCLE, cmdID);
199 else
200 _instance().trigger(cmdID, *static_cast<Rec const *> (args));
201 }
202 )
203 , LUMIERA_INTERFACE_INLINE (bindArg,
204 void, (const char* cmdID, const void* args),
205 {
206 if (!_instance) lumiera_error_set (LUMIERA_ERROR_LIFECYCLE, cmdID);
207 else
208 _instance().bindArg(cmdID, *static_cast<Rec const *> (args));
209 }
210 )
212 void, (const char* cmdID),
213 {
214 if (!_instance) lumiera_error_set (LUMIERA_ERROR_LIFECYCLE, cmdID);
215 else
216 _instance().invoke(cmdID);
217 }
218 )
219 );
220
221
222
223 } // (END) facade implementation details
224
225
226
229 : dispatcher_{dispatcherLoopInterface}
230 , instanceManager_{dispatcher_}
232 {
233 INFO (stage, "SessionCommand Facade opened.");
234 }
235
236
237
238
239}} // namespace steam::control
Access point to singletons and other kinds of dependencies designated by type.
Definition depend.hpp:281
Token or Atom with distinct identity.
Definition symbol.hpp:120
Interface of a service to perform Commands on the session.
Command getInstance(Symbol instanceID)
access the currently "opened" instance with the given instanceID
void dispatch(Symbol instanceID)
hand over the designated command instance to the dispatcher installed on construction.
Symbol newInstance(Symbol prototypeID, string const &invocationID)
Create and thus "open" a new anonymous command instance.
Command & bindArg(std::tuple< TYPES... > const &)
Definition command.hpp:243
Symbol cycle(Symbol cmdID, string const &invocationID) override
start next command cycle and "open" a new anonymous command instance
SessionCommandService(CommandDispatch &dispatcherLoopInterface)
void trigger(Symbol cmdID, Rec const &args) override
void bindArg(Symbol cmdID, Rec const &args) override
Steam-Layer command frontend.
Singleton services and Dependency Injection.
lumiera_err lumiera_error_set(lumiera_err nerr, const char *extra)
Set error state for the current thread.
Definition error-state.c:96
#define LERR_(_NAME_)
Definition error.hpp:45
A data record to describe interface, interface instances and plug-in instances.
@ LUMIERA_INTERFACE_EXPERIMENTAL
Not finished development code.
#define LUMIERA_INTERFACE_REF(iname, version, dname)
Return a reference (pointer) to an interface implementation.
Definition interface.h:119
#define LUMIERA_INTERFACE_INSTANCE(iname, version, name, descriptor, acquire, release,...)
Define an interface instance.
Definition interface.h:185
lumiera_interface * LumieraInterface
Definition interface.h:355
return NULL
Definition llist.h:586
This header is for including and configuring NoBug.
enable_if_c< Cond::value, T >::type enable_if
SFINAE helper to control the visibility of specialisations and overloads.
Definition meta/util.hpp:87
Lumiera GTK UI implementation root.
Definition guifacade.cpp:37
com::RuntimeCheckedCommandInvoker invoke(Symbol cmdID)
Steam-Layer implementation namespace root.
A public service offered by the Session, implementing the SessionCommand facade interface.
Marker types to indicate a literal string and a Symbol.
Tiny helper functions and shortcuts to be used everywhere Consider this header to be effectively incl...