extend command API to also accept a lib::diff::Rec<GenNode> for arguments
WIP: have to decide how the arguments can be unpacked and how to generate proper runtime type mismatch errors.
This commit is contained in:
parent
1dc9642ec4
commit
16597fcd99
2 changed files with 16 additions and 4 deletions
|
|
@ -60,6 +60,7 @@
|
|||
#include "proc/control/handling-pattern.hpp"
|
||||
#include "lib/meta/tuple-helper.hpp"
|
||||
#include "lib/bool-checkable.hpp"
|
||||
#include "lib/diff/gen-node.hpp"
|
||||
#include "lib/handle.hpp"
|
||||
|
||||
#include <string>
|
||||
|
|
@ -134,8 +135,7 @@ namespace control {
|
|||
template<typename...TYPES>
|
||||
Command& bindArg (std::tuple<TYPES...> const&);
|
||||
|
||||
/////////////////////////////////////////////////////////////TICKET #798 : we need a second overload to take the arguments as lib::diff::Record.
|
||||
///////////////////////////////////////////////////////////// : this needs to be built into the ParamAccessor within Closure (command-closure.hpp)
|
||||
Command& bindArg (lib::diff::Rec const&);
|
||||
|
||||
|
||||
ExecResult operator() () ;
|
||||
|
|
@ -231,6 +231,14 @@ namespace control {
|
|||
}
|
||||
|
||||
|
||||
inline Command&
|
||||
Command::bindArg (lib::diff::Rec const& paramData)
|
||||
{
|
||||
UNIMPLEMENTED ("how to accept a GenNode-Rec and unpack it into our argument holder...");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* == state predicate shortcuts == */
|
||||
|
||||
|
|
|
|||
|
|
@ -466,12 +466,16 @@ namespace test{
|
|||
|
||||
/* ==== CommandHandler ==== */
|
||||
|
||||
/** Case-1: the message provides parameter data to bind to the command */
|
||||
bool
|
||||
handle (Rec const& argBinding) override
|
||||
handle (Rec const& argData) override
|
||||
{
|
||||
log_.event("TestNexus", "bound command arguments "+string(argBinding));
|
||||
command_.bindArg (argData);
|
||||
log_.event("TestNexus", "bound command arguments "+string(argData));
|
||||
return true;
|
||||
}
|
||||
|
||||
/** Case-2: the message triggers execution of a prepared command */
|
||||
bool
|
||||
handle (int const&) override
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue