diff --git a/src/proc/control/command.cpp b/src/proc/control/command.cpp index 602fd9e2a..6902ea302 100644 --- a/src/proc/control/command.cpp +++ b/src/proc/control/command.cpp @@ -79,12 +79,15 @@ namespace control { - /** */ + /** Access existing command for use. + * @throw error::Invalid if command not + * registered or incompletely defined. + */ Command Command::get (Symbol cmdID) { Command cmd = CommandRegistry::instance().queryIndex (cmdID); - static format fmt("Command definition \"%s\" not found"); + static format fmt("Command \"%s\" not found"); if (!cmd) throw error::Invalid(str(fmt % cmdID), LUMIERA_ERROR_INVALID_COMMAND); @@ -99,13 +102,15 @@ namespace control { * thus this feature is unimplemented for the time being. */ Command - Command::get (FuncPtr funcP) + Command::get (FuncPtr) { UNIMPLEMENTED ("find a command definition which was based on the given function (ptr)"); } - Command const& + /** @internal to be invoked by CommandDef + * when starting a new definition */ + Command Command::fetchDef (Symbol cmdID) { CommandRegistry& registry = CommandRegistry::instance(); @@ -120,10 +125,11 @@ namespace control { } // return new or currently registered cmd... - /** @internal to be invoked by CommandDef + /** @internal to be invoked through CommandDef to make a command ready * @throw std::bad_alloc, in which case - * CommandRegistry::killCommandImpl is invoked */ - Command& + * CommandRegistry::killCommandImpl is invoked. + * @throw error::Logic when this is already activated. */ + void Command::activate (shared_ptr const& implFrame) { static format fmt("Command \"%s\" already defined"); @@ -135,7 +141,6 @@ namespace control { _Handle::activate (implFrame); INFO (command, "Command \"%s\" defined OK", cStr(*this)); - return *this; } diff --git a/src/proc/control/command.hpp b/src/proc/control/command.hpp index 269a53425..d064daf1c 100644 --- a/src/proc/control/command.hpp +++ b/src/proc/control/command.hpp @@ -122,6 +122,16 @@ namespace control { Command() { } ///< undefined command ~Command(); + + + /* === command lifecycle === */ + + void activate (shared_ptr const&); + + template + Command& bindArg (Tuple const&); + + ExecResult operator() () ; ExecResult undo () ; @@ -145,14 +155,6 @@ namespace control { - /* === command lifecycle === */ - - Command& activate (shared_ptr const&); - - template - Command& bindArg (Tuple const&); - - /* === diagnostics === */ static size_t definition_count(); @@ -166,7 +168,7 @@ namespace control { protected: - static Command const& fetchDef (Symbol cmdID); + static Command fetchDef (Symbol cmdID); friend class CommandDef;