BLCommandAlias Class Reference

#include <BLCommandAlias.hh>

Inheritance diagram for BLCommandAlias:

BLCommand

List of all members.


Detailed Description

class BLCommandAlias defines an alias for an existing command

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
BLCommandinstance


Constructor & Destructor Documentation

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         }


Member Function Documentation

G4String BLCommandAlias::commandName (  )  [inline, virtual]

Implements BLCommand.

References alias.

00038 { return G4String(alias); }

int BLCommandAlias::command ( BLArgumentVector argv,
BLArgumentMap namedArgs 
) [inline, virtual]

Implements BLCommand.

References BLCommand::command(), and instance.

00041                 { return instance->command(argv,namedArgs); }


Member Data Documentation

const char* BLCommandAlias::alias [private]

Referenced by BLCommandAlias(), and commandName().

Referenced by BLCommandAlias(), and command().


The documentation for this class was generated from the following file:
g4beamline