2016-12-12 02:20:58 +01:00
|
|
|
|
/*
|
2016-12-12 03:09:08 +01:00
|
|
|
|
SESSION-COMMAND-FACADE.h - access point for invoking commands on the session
|
2016-12-12 02:20:58 +01:00
|
|
|
|
|
Copyright: clarify and simplify the file headers
* Lumiera source code always was copyrighted by individual contributors
* there is no entity "Lumiera.org" which holds any copyrights
* Lumiera source code is provided under the GPL Version 2+
== Explanations ==
Lumiera as a whole is distributed under Copyleft, GNU General Public License Version 2 or above.
For this to become legally effective, the ''File COPYING in the root directory is sufficient.''
The licensing header in each file is not strictly necessary, yet considered good practice;
attaching a licence notice increases the likeliness that this information is retained
in case someone extracts individual code files. However, it is not by the presence of some
text, that legally binding licensing terms become effective; rather the fact matters that a
given piece of code was provably copyrighted and published under a license. Even reformatting
the code, renaming some variables or deleting parts of the code will not alter this legal
situation, but rather creates a derivative work, which is likewise covered by the GPL!
The most relevant information in the file header is the notice regarding the
time of the first individual copyright claim. By virtue of this initial copyright,
the first author is entitled to choose the terms of licensing. All further
modifications are permitted and covered by the License. The specific wording
or format of the copyright header is not legally relevant, as long as the
intention to publish under the GPL remains clear. The extended wording was
based on a recommendation by the FSF. It can be shortened, because the full terms
of the license are provided alongside the distribution, in the file COPYING.
2024-11-17 23:42:55 +01:00
|
|
|
|
Copyright (C)
|
|
|
|
|
|
2016, Hermann Vosseler <Ichthyostega@web.de>
|
2016-12-12 02:20:58 +01:00
|
|
|
|
|
Copyright: clarify and simplify the file headers
* Lumiera source code always was copyrighted by individual contributors
* there is no entity "Lumiera.org" which holds any copyrights
* Lumiera source code is provided under the GPL Version 2+
== Explanations ==
Lumiera as a whole is distributed under Copyleft, GNU General Public License Version 2 or above.
For this to become legally effective, the ''File COPYING in the root directory is sufficient.''
The licensing header in each file is not strictly necessary, yet considered good practice;
attaching a licence notice increases the likeliness that this information is retained
in case someone extracts individual code files. However, it is not by the presence of some
text, that legally binding licensing terms become effective; rather the fact matters that a
given piece of code was provably copyrighted and published under a license. Even reformatting
the code, renaming some variables or deleting parts of the code will not alter this legal
situation, but rather creates a derivative work, which is likewise covered by the GPL!
The most relevant information in the file header is the notice regarding the
time of the first individual copyright claim. By virtue of this initial copyright,
the first author is entitled to choose the terms of licensing. All further
modifications are permitted and covered by the License. The specific wording
or format of the copyright header is not legally relevant, as long as the
intention to publish under the GPL remains clear. The extended wording was
based on a recommendation by the FSF. It can be shortened, because the full terms
of the license are provided alongside the distribution, in the file COPYING.
2024-11-17 23:42:55 +01:00
|
|
|
|
**Lumiera** is free software; you can redistribute it and/or modify it
|
|
|
|
|
|
under the terms of the GNU General Public License as published by the
|
|
|
|
|
|
Free Software Foundation; either version 2 of the License, or (at your
|
|
|
|
|
|
option) any later version. See the file COPYING for further details.
|
2016-12-12 02:20:58 +01:00
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
2016-12-12 03:09:08 +01:00
|
|
|
|
/** @file session-command-facade.h
|
|
|
|
|
|
** Major public Interface to the Session subsystem of Lumiera GUI.
|
|
|
|
|
|
** This interface describes the ability of the Session to trigger the execution
|
2016-12-23 07:26:00 +01:00
|
|
|
|
** of pre-defined commands, outfitted with suitable arguments and parameters.
|
|
|
|
|
|
** Triggering of these commands typically happens in response to some messages
|
2016-12-12 03:09:08 +01:00
|
|
|
|
** being sent over the UI-Bus. Likewise, external entities (e.g. plug-ins) may
|
|
|
|
|
|
** invoke commands over this interface to alter the session.
|
2016-12-23 07:26:00 +01:00
|
|
|
|
**
|
|
|
|
|
|
** For this reason, the operations exposed here are defined in terms matching
|
|
|
|
|
|
** the structure of binding and invocation messages. This goes so far as to
|
|
|
|
|
|
** accept the command arguments for binding packaged as `Record<GenNode>`.
|
|
|
|
|
|
** For each command, there needs to be a registration record within the
|
2018-11-15 21:13:52 +01:00
|
|
|
|
** Steam-Layer implementation. The service implementation backing this
|
2018-11-15 23:59:23 +01:00
|
|
|
|
** facade indeed retrieves the corresponding steam::control::Command
|
2016-12-23 07:26:00 +01:00
|
|
|
|
** handles to perform the binding operation and hands them over
|
2018-11-23 21:29:54 +01:00
|
|
|
|
** to the SteamDispatcher for invocation.
|
2016-12-23 23:42:27 +01:00
|
|
|
|
**
|
|
|
|
|
|
** @see command.hpp
|
2016-12-23 07:26:00 +01:00
|
|
|
|
** @see session-command-service.hpp implementation
|
2018-11-23 21:29:54 +01:00
|
|
|
|
** @see steam::control::SteamDispatcher
|
2018-11-15 23:59:23 +01:00
|
|
|
|
** @see stage::ctrl::CoreService
|
2016-12-12 02:20:58 +01:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-11-15 23:52:02 +01:00
|
|
|
|
#ifndef STEAM_CONTROL_SESSION_COMMAND_H
|
|
|
|
|
|
#define STEAM_CONTROL_SESSION_COMMAND_H
|
2016-12-12 02:20:58 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus /* ============== C++ Interface ================= */
|
|
|
|
|
|
|
2018-04-03 02:44:12 +02:00
|
|
|
|
#include "lib/depend.hpp"
|
2016-12-23 07:26:00 +01:00
|
|
|
|
#include "lib/diff/gen-node.hpp"
|
2017-04-09 02:59:16 +02:00
|
|
|
|
#include "lib/symbol.hpp"
|
2016-12-12 02:20:58 +01:00
|
|
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-11-15 23:55:13 +01:00
|
|
|
|
namespace steam {
|
2016-12-12 03:09:08 +01:00
|
|
|
|
namespace control {
|
2016-12-12 02:20:58 +01:00
|
|
|
|
|
2017-04-09 02:59:16 +02:00
|
|
|
|
using lib::Symbol;
|
2016-12-12 02:20:58 +01:00
|
|
|
|
using std::string;
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-12-23 23:42:27 +01:00
|
|
|
|
/**********************************************************************//**
|
|
|
|
|
|
* Global access point to invoke commands and cause edit operations within
|
|
|
|
|
|
* the Session. Any changes to the session are effected by prepared functors
|
2018-11-15 23:59:23 +01:00
|
|
|
|
* bound into a steam::control::Command registration. A command instance will
|
2016-12-23 23:42:27 +01:00
|
|
|
|
* first be outfitted with suitable parameters to define the target and to
|
|
|
|
|
|
* qualify and elaborate the action, before it can be actually triggered.
|
|
|
|
|
|
* Commands then go through a queue to be invoked one by one.
|
2016-12-12 02:20:58 +01:00
|
|
|
|
*
|
2017-04-09 19:11:40 +02:00
|
|
|
|
* The service exposed through this facade offers dedicated support for
|
|
|
|
|
|
* the _standard command cycle_, as is typically performed from the UI.
|
2018-09-21 13:46:42 +02:00
|
|
|
|
* Such a usage cycle starts with ["opening"](\ref #cycle) a local anonymous
|
2017-04-09 19:11:40 +02:00
|
|
|
|
* clone copy from the global command definition, which is then used
|
|
|
|
|
|
* in further calls to be outfitted with actual arguments and finally
|
|
|
|
|
|
* to be handed over to the dispatcher for execution.
|
|
|
|
|
|
* @warning this standard command cycle is intended for single-threaded
|
|
|
|
|
|
* use from the UI. It is not threadsafe. To the contrary, all
|
|
|
|
|
|
* operations with globally registered commands are threadsafe.
|
|
|
|
|
|
*
|
|
|
|
|
|
* @remark This is a layer separation facade interface. Clients should
|
|
|
|
|
|
* use the embedded #facade factory, which yields a proxy to route any
|
2016-12-23 07:26:00 +01:00
|
|
|
|
* calls through the lumieraorg_SessionCommand interface
|
2016-12-12 02:20:58 +01:00
|
|
|
|
* @throws lumiera::error::State when interface is not opened
|
2021-02-28 23:04:06 +01:00
|
|
|
|
* @todo as of 2/2021 only the #trigger operation is used; if no case for
|
|
|
|
|
|
* an elaborated command cycle with binding step and deferred invocation
|
|
|
|
|
|
* shows up, we may consider dropping the other operations
|
2018-09-21 13:46:42 +02:00
|
|
|
|
* @see [Command system](\ref command.hpp)
|
2017-04-09 19:11:40 +02:00
|
|
|
|
* @see SessionCommandFunction_test
|
2016-12-12 02:20:58 +01:00
|
|
|
|
*/
|
2016-12-12 03:09:08 +01:00
|
|
|
|
class SessionCommand
|
2016-12-12 02:20:58 +01:00
|
|
|
|
{
|
|
|
|
|
|
public:
|
2018-04-03 02:44:12 +02:00
|
|
|
|
static lib::Depend<SessionCommand> facade;
|
2016-12-12 02:20:58 +01:00
|
|
|
|
|
2017-04-09 02:59:16 +02:00
|
|
|
|
/** start next command cycle and "open" a new anonymous command instance */
|
|
|
|
|
|
virtual Symbol cycle (Symbol cmdID, string const& invocationID) =0;
|
|
|
|
|
|
|
2017-04-14 23:45:35 +02:00
|
|
|
|
/** bind the command's arguments and trigger command invocation immediately */
|
|
|
|
|
|
virtual void trigger (Symbol cmdID, lib::diff::Rec const& args) =0;
|
|
|
|
|
|
|
2016-12-23 07:26:00 +01:00
|
|
|
|
/** prepare command invocation: bind the command's arguments */
|
2017-04-09 02:59:16 +02:00
|
|
|
|
virtual void bindArg (Symbol cmdID, lib::diff::Rec const& args) =0;
|
2016-12-12 02:20:58 +01:00
|
|
|
|
|
2016-12-23 07:26:00 +01:00
|
|
|
|
/** trigger invocation of a prepared command */
|
2017-04-09 02:59:16 +02:00
|
|
|
|
virtual void invoke (Symbol cmdID) =0;
|
2016-12-12 02:20:58 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected:
|
2018-04-03 04:58:22 +02:00
|
|
|
|
virtual ~SessionCommand() {} ///< this is an interface
|
|
|
|
|
|
friend class lib::DependencyFactory<SessionCommand>;
|
2016-12-12 02:20:58 +01:00
|
|
|
|
};
|
2025-06-07 23:59:57 +02:00
|
|
|
|
|
2016-12-12 02:20:58 +01:00
|
|
|
|
|
|
|
|
|
|
|
2018-11-15 23:55:13 +01:00
|
|
|
|
}} // namespace steam::control
|
2016-12-12 02:20:58 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
extern "C" {
|
2025-06-07 23:59:57 +02:00
|
|
|
|
#endif /* =========================== CL Interface ===================== */
|
2016-12-12 02:20:58 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "common/interface.h"
|
|
|
|
|
|
|
2016-12-12 03:09:08 +01:00
|
|
|
|
LUMIERA_INTERFACE_DECLARE (lumieraorg_SessionCommand, 0,
|
2017-04-09 02:59:16 +02:00
|
|
|
|
LUMIERA_INTERFACE_SLOT (const char*, cycle, (const char*, const char*)),
|
2017-04-14 23:45:35 +02:00
|
|
|
|
LUMIERA_INTERFACE_SLOT (void, trigger, (const char*, const void*)),
|
2017-04-09 02:59:16 +02:00
|
|
|
|
LUMIERA_INTERFACE_SLOT (void, bindArg, (const char*, const void*)),
|
|
|
|
|
|
LUMIERA_INTERFACE_SLOT (void, invoke, (const char*)),
|
2016-12-12 02:20:58 +01:00
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
2018-04-03 06:28:29 +02:00
|
|
|
|
}// extern "C"
|
2016-12-12 02:20:58 +01:00
|
|
|
|
#endif
|
2018-11-15 23:52:02 +01:00
|
|
|
|
#endif /*STEAM_CONTROL_SESSION_COMMAND_H*/
|