Lumiera  0.pre.03
command-setup.hpp File Reference

Go to the source code of this file.


Provision for setup of concrete commands for use by the UI.

A Proc-Layer command is a functor, which can be parametrised with actual arguments. It needs to be defined beforehand, which means to establish an unique name and to supply three functions, one for the actual command operation, one to capture state and one to undo the effect of the command invocation. CommandSetup allows to create series of such definitions with minimal effort. Since any access and mutation from the UI into the Session data must be performed by invoking such commands, a huge amount of individual command definitions need to be written eventually.

The macro COMMAND_DEFINITION(NAME) allows to introduce a new definition with a single line, followed by a code block, which actually ends up as the body of a lambda function, and receives the bare CommandDef as single argument with name cmd. The _NAME_ argument of the macro ends up both stringified as the value of the command-ID, and as an variable holding a new CommandSetup instance. It is assumed that a header with corresponding declarations (the header cmd.hpp) is included by all UI elements actually to use, handle and invoke commands towards the session-command-facade.h

See also

Definition in file command-setup.hpp.

#include "lib/error.hpp"
#include "lib/nocopy.hpp"
#include "proc/control/command.hpp"
#include "lib/symbol.hpp"
#include <functional>
#include <string>


class  CommandSetup
 Marker and Helper for writing Proc-Layer Command definitions. More...


using DefinitionClosure = std::function< void(CommandDef &)>


 Macro to write command definitions in a compact form. More...


 Proc-Layer implementation namespace root.
 Proc-Layer dispatcher, controller and administrative facilities.

Macro Definition Documentation



Macro to write command definitions in a compact form.

On expansion, a variable of type CommandSetup will be defined in the current scope, and immediately be assigned by a lambda, whose body is what follows the macro invocation

Definition at line 144 of file command-setup.hpp.