An argument that allows multiple values of type T to be specified. More...
#include <ValueArg.h>
Public Member Functions | |
virtual bool | processArg (int *i, std::vector< std::string > &args) |
Handles the processing of the argument. More... | |
ValueArg (const std::string &flag, const std::string &name, const std::string &desc, bool req, T value, const std::string &typeDesc, bool allowOverwrite=false, TCLAP::Visitor *v=NULL) | |
Constructor. More... | |
ValueArg (const std::string &flag, const std::string &name, const std::string &desc, bool req, T value, const std::string &typeDesc, TCLAP::CmdLineInterface &parser, bool allowOverwrite=false, TCLAP::Visitor *v=NULL) | |
Constructor. More... | |
ValueArg (const std::string &flag, const std::string &name, const std::string &desc, bool req, T value, TCLAP::Constraint< T > *constraint, TCLAP::CmdLineInterface &parser, bool allowOverwrite=false, TCLAP::Visitor *v=NULL) | |
Constructor. More... | |
ValueArg (const std::string &flag, const std::string &name, const std::string &desc, bool req, T value, TCLAP::Constraint< T > *constraint, bool allowOverwrite=false, TCLAP::Visitor *v=NULL) | |
Constructor. More... | |
Protected Attributes | |
bool | _allowOverwrite |
An argument that allows multiple values of type T to be specified.
Unlike TCLAP::ValueArg, this argument optionally allows the assignement of a value more than once, overwriting the previously set argument value. This is useful when a visitor set on another option consumed the previously set argument already and thus the value can be overwritten before the next appearance of this option. See the basistest-driver executable, for example, where the tolerances are stored in a structure every time a –compare option is encountered and the tolerances can then be overwritten for the next –compare statement.
Copyright (c) 2012 University of Pennsylvania. All rights reserved.
See http://www.rad.upenn.edu/sbia/software/license.html or COPYING file.
Definition at line 47 of file ValueArg.h.
basis::ValueArg< T >::ValueArg | ( | const std::string & | flag, |
const std::string & | name, | ||
const std::string & | desc, | ||
bool | req, | ||
T | value, | ||
const std::string & | typeDesc, | ||
bool | allowOverwrite = false , |
||
TCLAP::Visitor * | v = NULL |
||
) |
Constructor.
[in] | flag | The one character flag that identifies this argument on the command line. |
[in] | name | A one word name for the argument. Can be used as a long flag on the command line. |
[in] | desc | A description of what the argument is for or does. |
[in] | req | Whether the argument is required on the command-line. |
[in] | value | The default value assigned to this argument if it is not present on the command line. |
[in] | typeDesc | A short, human readable description of the type that this object expects. This is used in the generation of the USAGE statement. The goal is to be helpful to the end user of the program. |
[in] | allowOverwrite | Whether value can be overwritten by another occurrence of the argument on the command-line. |
[in] | v | An optional visitor. You probably should not use this unless you have a very good reason. |
Definition at line 206 of file ValueArg.h.
basis::ValueArg< T >::ValueArg | ( | const std::string & | flag, |
const std::string & | name, | ||
const std::string & | desc, | ||
bool | req, | ||
T | value, | ||
const std::string & | typeDesc, | ||
TCLAP::CmdLineInterface & | parser, | ||
bool | allowOverwrite = false , |
||
TCLAP::Visitor * | v = NULL |
||
) |
Constructor.
[in] | flag | The one character flag that identifies this argument on the command line. |
[in] | name | A one word name for the argument. Can be used as a long flag on the command line. |
[in] | desc | A description of what the argument is for or does. |
[in] | req | Whether the argument is required on the command-line. |
[in] | value | The default value assigned to this argument if it is not present on the command line. |
[in] | typeDesc | A short, human readable description of the type that this object expects. This is used in the generation of the USAGE statement. The goal is to be helpful to the end user of the program. |
[in] | parser | A CmdLine parser object to add this Arg to. |
[in] | allowOverwrite | Whether value can be overwritten by another occurrence of the argument on the command-line. |
[in] | v | An optional visitor. You probably should not use this unless you have a very good reason. |
Definition at line 222 of file ValueArg.h.
basis::ValueArg< T >::ValueArg | ( | const std::string & | flag, |
const std::string & | name, | ||
const std::string & | desc, | ||
bool | req, | ||
T | value, | ||
TCLAP::Constraint< T > * | constraint, | ||
TCLAP::CmdLineInterface & | parser, | ||
bool | allowOverwrite = false , |
||
TCLAP::Visitor * | v = NULL |
||
) |
Constructor.
[in] | flag | The one character flag that identifies this argument on the command line. |
[in] | name | A one word name for the argument. Can be used as a long flag on the command line. |
[in] | desc | A description of what the argument is for or does. |
[in] | req | Whether the argument is required on the command-line. |
[in] | value | The default value assigned to this argument if it is not present on the command line. |
[in] | constraint | A pointer to a Constraint object used to constrain this Arg. |
[in] | parser | A CmdLine parser object to add this Arg to. |
[in] | allowOverwrite | Whether value can be overwritten by another occurrence of the argument on the command-line. |
[in] | v | An optional visitor. You probably should not use this unless you have a very good reason. |
Definition at line 255 of file ValueArg.h.
basis::ValueArg< T >::ValueArg | ( | const std::string & | flag, |
const std::string & | name, | ||
const std::string & | desc, | ||
bool | req, | ||
T | value, | ||
TCLAP::Constraint< T > * | constraint, | ||
bool | allowOverwrite = false , |
||
TCLAP::Visitor * | v = NULL |
||
) |
Constructor.
[in] | flag | The one character flag that identifies this argument on the command line. |
[in] | name | A one word name for the argument. Can be used as a long flag on the command line. |
[in] | desc | A description of what the argument is for or does. |
[in] | req | Whether the argument is required on the command-line. |
[in] | value | The default value assigned to this argument if it is not present on the command line. |
[in] | constraint | A pointer to a Constraint object used to constrain this Arg. |
[in] | allowOverwrite | Whether value can be overwritten by another occurrence of the argument on the command-line. |
[in] | v | An optional visitor. You probably should not use this unless you have a very good reason. |
Definition at line 239 of file ValueArg.h.
|
virtual |
Handles the processing of the argument.
This re-implements the TCLAP::ValueArg version of this method to ignore the _alreadySet flag if _allowOverwrite is true.
[in,out] | i | Pointer to the current argument in the list. |
[in,out] | args | Mutable list of strings. Passed from main(). |
Definition at line 272 of file ValueArg.h.
|
protected |
Whether argument value can be overwritten by another occurrence of this argument.
Definition at line 194 of file ValueArg.h.