#include <BLCommandAlias.hh>
Usage: To define "alias" as an aslias for "mycommand": class BLCMDmycommand : public BLCommand { ... }; BLCMDmycommand defaultMycommand; BLCommandAlias aliasMycommand("alias",defaultMycommand);
Note this is a global instantiation of BLCommandAlias, and that the second argument must be the global default instantiation of the desired command. This also works if BLCMDmycommand is derived from BLElement.
The alias will be registered as a command to BLCommand, and will get an appropriate entry in the help text.
Public Member Functions | |
BLCommandAlias (const char *_alias, BLCommand &_instance) | |
G4String | commandName () |
int | command (BLArgumentVector &argv, BLArgumentMap &namedArgs) |
Private Attributes | |
const char * | alias |
BLCommand * | instance |
BLCommandAlias::BLCommandAlias | ( | const char * | _alias, | |
BLCommand & | _instance | |||
) | [inline] |
References alias, BLCommand::commandName(), BLCommand::getCmdType(), instance, BLCommand::registerCommand(), BLCommand::setDescription(), and BLCommand::setSynopsis().
00028 : BLCommand(){ 00029 alias = strdup(_alias); 00030 instance = &_instance; 00031 registerCommand(instance->getCmdType()); 00032 char tmp[256]; 00033 sprintf(tmp,"Alias for '%s'.",instance->commandName().c_str()); 00034 setSynopsis(strdup(tmp)); 00035 setDescription(""); 00036 }
G4String BLCommandAlias::commandName | ( | ) | [inline, virtual] |
int BLCommandAlias::command | ( | BLArgumentVector & | argv, | |
BLArgumentMap & | namedArgs | |||
) | [inline, virtual] |
const char* BLCommandAlias::alias [private] |
Referenced by BLCommandAlias(), and commandName().
BLCommand* BLCommandAlias::instance [private] |
Referenced by BLCommandAlias(), and command().