35 #ifndef COMMAND_BANK_UTILS_H_
36 #define COMMAND_BANK_UTILS_H_
41 #include "CommandBank.h"
42 #include "CommandSections.h"
43 #include "drain/image/Image.h"
71 Context & ctx = getContext<Context>();
72 ctx.log.setVerbosity(value);
75 drain::getLog().setVerbosity(value);
76 drain::image::getImgLog().setVerbosity(value-1);
91 Context & ctx = getContext<Context>();
92 ctx.log.setVerbosity(LOG_DEBUG);
93 drain::getLog().setVerbosity(LOG_DEBUG);
94 drain::image::getImgLog().setVerbosity(LOG_DEBUG);
115 std::string filename;
153 ctx.expandVariables = !ctx.expandVariables;
200 const drain::Flagger::ivalue_t TRIGGER = drain::Static::get<drain::TriggerSection>().index;
237 mout.
debug(
"Executing script with '" , getName() ,
"' ." );
289 if (cmdBank.
has(
"general")){
290 cmdBank.
help(
"general");
339 Context & ctx = getContext<>();
343 mout.
error(
"Command '" , value ,
"' not found." );
352 template <
class C=Context>
369 C &ctx = getContext<C>();
375 ifstr.open(value.c_str(), std::ios::in);
377 std::stringstream sstr;
378 sstr << ifstr.rdbuf();
386 ctx.formatStr = sstr.str();
390 mout.
error(getName() ,
": opening file '" , value ,
"' failed." );
bool has(const K &key) const
Check if a cloner is defined for this key.
Definition: Bank.h:141
Simple implementation of Command: adds name , description and parameters .
Definition: Command.h:417
Definition: CommandBankUtils.h:81
void exec() const
Run the command with current parameter values.
Definition: CommandBankUtils.h:90
Load script file and execute the commands immediately using current Context.
Definition: CommandBankUtils.h:259
Executes the defined script.
Definition: CommandBankUtils.h:193
void exec() const
Run the command with current parameter values.
Definition: CommandBankUtils.h:234
Definition: CommandBankUtils.h:141
void exec() const
Run the command with current parameter values.
Definition: CommandBankUtils.h:150
Definition: CommandBankUtils.h:101
void exec() const
Run the command with current parameter values.
Definition: CommandBankUtils.cpp:52
Special command for handling undefined commands.
Definition: CommandBankUtils.h:326
void exec() const
Run the command with current parameter values.
Definition: CommandBankUtils.h:338
Load script file and executes the commands immediately.
Definition: CommandBankUtils.h:164
Definition: CommandBankUtils.h:128
void exec() const
Run the command with current parameter values.
Definition: CommandBankUtils.cpp:73
Definition: CommandBankUtils.h:60
void exec() const
Run the command with current parameter values.
Definition: CommandBankUtils.h:69
Container and execution tools for commands derived from Command.
Definition: CommandBank.h:54
std::string notFoundHandlerCmdKey
If defined, the command - key not getName() - to which all unresolved commands are directed.
Definition: CommandBank.h:222
std::string execFileCmd
Command for reading and executing commands from a file in the current (running) context.
Definition: CommandBank.h:268
void help(std::ostream &ostr=std::cout)
Basic help dump, displays help commands to proceed.
Definition: CommandBank.cpp:850
std::string scriptCmd
Command for storing a routine.
Definition: CommandBank.h:234
int section
Definition: Command.h:213
std::string formatStr
Definition: Context.h:198
CommandBank-dependent.
Definition: CommandBankUtils.h:278
void exec() const
Run the command with current parameter values.
Definition: CommandBankUtils.h:287
LogSourc e is the means for a function or any program segment to "connect" to a Log.
Definition: Log.h:308
Logger & error(const TT &... args)
Echoes.
Definition: Log.h:412
Logger & debug(const TT &... args)
Public, yet typically used "internally", when TIMING=true.
Definition: Log.h:676
A single-parameter command.
Definition: Command.h:501
Definition: Context.h:204
Definition: DataSelector.cpp:1277