32 #ifndef DRAIN_CMD_INSTALLER_H_
33 #define DRAIN_CMD_INSTALLER_H_
35 #include <drain/Log.h>
41 #include "drain/util/ReferenceMap.h"
46 #include "CommandBank.h"
47 #include "CommandSections.h"
79 template <
char PREFIX=0,
class SECTION=GeneralSection>
91 return drain::Static::get<SECTION>();
102 Command & install(
const std::string & name,
char alias = 0){
103 Command & cmd = cmdBank.add<CMD>(name,alias);
104 cmd.
section |= getSection().index;
109 Command & install(
char alias = 0){
110 std::string name = CMD().getName();
112 return install<CMD>(name, alias);
116 Command & installExternal(CMD & cmdExt,
const std::string & name,
char alias = 0){
117 Command & cmd = cmdBank.addExternal(cmdExt, name,alias);
118 cmd.section |= getSection().index;
123 Command & installExternal(CMD & cmdExt,
char alias = 0){
124 std::string name = cmdExt.getName();
128 return installExternal(cmdExt, name, alias);
136 cmd.
section |= getSection().index;
144 std::string name = CMD().getName();
146 return installShared<CMD>(name, alias);
158 template <
char PREFIX=0,
class SECTION=GeneralSection>
Container and execution tools for commands derived from Command.
Definition: CommandBank.h:54
static void deriveCmdName(std::string &name, char prefix=0)
Given a command class name like MyFileReadCommand, derives a respective command line option ("myFileR...
Definition: CommandBank.cpp:62
Creates an instance of command class C.
Definition: CommandInstaller.h:80
static Command & installShared(const std::string &name, char alias=0)
Install to shared CommandBank.
Definition: CommandInstaller.h:134
static Command & installShared(char alias=0)
Install to shared CommandBank.
Definition: CommandInstaller.h:143
static char getPrefix()
Return the character used as prefix for the commands in this section.
Definition: CommandInstaller.h:96
Combines command installation and sectioning.
Definition: CommandInstaller.h:159
CommandModule(CommandBank &bank=getCommandBank())
Definition: CommandInstaller.h:171
Definition: CommandSections.h:54
Base class for commands: typically actions taking parameters but also plain variable assignments and ...
Definition: Command.h:54
int section
Definition: Command.h:213
Definition: DataSelector.cpp:1277
CommandBank & getCommandBank()
Global program command registry. Optional utility.
Definition: CommandBank.cpp:51