![]() |
|
Simple implementation of Command: adds name
, description
and parameters
.
More...
#include <Command.h>
Inherits BeanCommand< BeanLike >.
Inherited by SimpleCommand< std::string >, SimpleCommand< int >, SimpleCommand< float >, SimpleCommand< bool >, SimpleCommand< double >, SimpleCommand< drain::Point2D< double >::tuple_t >, Deprecator< CmdOutputPalette >, CmdDebug, CmdExecScript, CmdExpandVariables, CmdLog, CmdStatus, SimpleCommand< T >, CartesianBBox, CartesianBBoxReset, CartesianBBoxTest, CartesianBBoxTile, CartesianCreateLookup, CartesianGrid, CartesianInit, CartesianPlot, CartesianRange, CartesianReset, CartesianSize, CartesianSpread, CmdCheckType, CmdCompleteODIM, CmdConvert, CmdCreateDefaultQuality, CmdDumpMap, CmdGeoTiff, CmdHistogram, CmdImage, CmdImageAlphaBase, CmdImageQuality, CmdImageTitle, CmdLayout, CmdMove, CmdPaletteConf, CmdPaletteDefault, CmdQuantityConf, CmdSweep, CmdTest2, CmdTestSelect, CmdTitle, CmdUpdateVariables, CmdVersion, Compositor, Deprecator< C >, PolarAdd, PolarPlot, UndetectWeight, and VerboseCmd.
Public Member Functions | |
BasicCommand (const std::string &name, const std::string &description) | |
BasicCommand (const BasicCommand &cmd) | |
![]() | |
BeanCommand (const std::string &name, const std::string &description) | |
BeanCommand (const BeanCommand &cmd) | |
BeanCommand (BeanLike &b) | |
virtual const bean_t & | getBean () const |
virtual bean_t & | getBean () |
const std::string & | getName () const final |
Returns the class name of this command, like "CmdVerbose". | |
const std::string & | getDescription () const final |
virtual const drain::ReferenceMap & | getParameters () const final |
![]() | |
Command (const Command &cmd) | |
virtual void | setParameters (const std::string &args) final |
template<class T > | |
void | setParameters (const T &args) |
template<class T > | |
void | setParameter (const std::string &key, const T &value) |
Set a value to a single parameter. | |
bool | hasParameters () const |
virtual void | run (const std::string ¶ms="") final |
Description of result, comparable to a return type of a function. ? | |
virtual void | update () |
Optional method for preparing command to execution. | |
virtual void | exec () const |
Run the command with current parameter values. | |
Command & | addSection (int i) |
const std::string & | getLastParameters () const |
virtual void | help (std::ostream &ostr=std::cout, bool DETAILED=false) const |
virtual void | getRelatedCommands (std::ostream &ostr=std::cout) const |
![]() | |
Contextual () | |
Sets internal contextPtr to NULL. | |
Contextual (const Contextual &src) | |
Copies base context (even null) of the source. Notice that the actual instance may be of derived class. | |
Contextual (Context &ctx) | |
Copies internal contextPtr. | |
template<class C > | |
void | setContext () |
Sets internal contextPtr to the static source. | |
void | setExternalContext (Context &ctx) |
Sets internal contextPtr to outside target. | |
bool | contextIsSet () const |
True, if contextPtr has been set. | |
template<class T = Context> | |
T & | getContext () const |
If context has been set, returns it through a cast to base class Context. | |
Additional Inherited Members | |
![]() | |
typedef BeanLike | bean_t |
![]() | |
typedef int | cmd_section_type |
![]() | |
template<class T > | |
static Cloner< Context, T > & | getCloner () |
![]() | |
BeanLike | bean |
![]() | |
cmd_section_type | section = 1 |
std::set< std::string > | relatedCommands |
Add related command(s), to appear in help after "See-also:" phrase. | |
![]() | |
static const SprinterLayout | cmdArgLayout = {",", "?", "=", ""} |
![]() | |
virtual drain::ReferenceMap & | getParameters () final |
![]() | |
Command & | linkRelatedCommands () |
![]() | |
std::string | lastParameters |
![]() | |
Context * | contextPtr |
Simple implementation of Command: adds name
, description
and parameters
.
Wrapper for simple template classes; no member functions are required. BasicDrainLet implements getDescription(), getParameters(), setParameters(). The default implementation of run() calls setParameters() and exec(). The default implementation exec() does nothing, it should be redefined in derived classes.