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"
72 Context & ctx = getContext<Context>();
73 ctx.log.setVerbosity(value);
76 drain::getLog().setVerbosity(value);
77 drain::image::getImgLog().setVerbosity(value-1);
92 Context & ctx = getContext<Context>();
93 ctx.log.setVerbosity(LOG_DEBUG);
94 drain::getLog().setVerbosity(LOG_DEBUG);
95 drain::image::getImgLog().setVerbosity(LOG_DEBUG);
116 std::string filename;
154 ctx.expandVariables = !ctx.expandVariables;
202 cmd_section_type TRIGGER = drain::Static::get<drain::TriggerSection>().index;
203 this->section |= TRIGGER;
239 mout.
debug(
"Executing script with '" ,
getName() ,
"' ." );
291 if (cmdBank.
has(
"general")){
292 cmdBank.
help(
"general");
331template <
class C=Context>
348 C &ctx = getContext<C>();
354 ifstr.open(value.c_str(), std::ios::in);
356 std::stringstream sstr;
357 sstr << ifstr.rdbuf();
365 ctx.formatStr = sstr.str();
369 mout.
error(getName() ,
": opening file '" , value ,
"' failed." );
388 Context & ctx = getContext<>();
392 mout.
error(
"Command '" , value ,
"' not found." );
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:424
const std::string & getName() const final
Definition Command.h:349
Definition CommandBankUtils.h:82
void exec() const
Run the command with current parameter values.
Definition CommandBankUtils.h:91
Load script file and execute the commands immediately using current Context.
Definition CommandBankUtils.h:261
Executes the defined script.
Definition CommandBankUtils.h:194
void exec() const
Run the command with current parameter values.
Definition CommandBankUtils.h:236
Definition CommandBankUtils.h:142
void exec() const
Run the command with current parameter values.
Definition CommandBankUtils.h:151
Definition CommandBankUtils.h:102
void exec() const
Run the command with current parameter values.
Definition CommandBankUtils.cpp:52
Special command for handling undefined commands.
Definition CommandBankUtils.h:375
void exec() const
Run the command with current parameter values.
Definition CommandBankUtils.h:387
Load script file and executes the commands immediately.
Definition CommandBankUtils.h:165
Definition CommandBankUtils.h:129
void exec() const
Run the command with current parameter values.
Definition CommandBankUtils.cpp:73
Definition CommandBankUtils.h:61
void exec() const
Run the command with current parameter values.
Definition CommandBankUtils.h:70
Container and execution tools for commands derived from Command.
Definition CommandBank.h:56
std::string notFoundHandlerCmdKey
If defined, the command - key not getName() - to which all unresolved commands are directed.
Definition CommandBank.h:230
std::string execFileCmd
Command for reading and executing commands from a file in the current (running) context.
Definition CommandBank.h:273
void help(std::ostream &ostr=std::cout)
Basic help dump, displays help commands to proceed.
Definition CommandBank.cpp:860
std::string scriptCmd
Command for storing a routine.
Definition CommandBank.h:242
int cmd_section_type
Definition Command.h:184
std::string formatStr
Definition Context.h:199
CommandBank-dependent.
Definition CommandBankUtils.h:280
void exec() const
Run the command with current parameter values.
Definition CommandBankUtils.h:289
LogSourc e is the means for a function or any program segment to "connect" to a Log.
Definition Log.h:312
Logger & debug(const TT &... args)
Debug information.
Definition Log.h:666
Logger & error(const TT &... args)
Echoes.
Definition Log.h:416
A single-parameter command.
Definition Command.h:448
Definition DataSelector.cpp:1277