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. | |
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. | |
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. | |
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. | |
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. | |
Protected Attributes | |
bool | _allowOverwrite |
Detailed Description
template<class T>
class basis::ValueArg< T >
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 https://www.cbica.upenn.edu/sbia/software/license.html or COPYING file.
Definition at line 43 of file ValueArg.h.
Constructor & Destructor Documentation
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.
- Parameters:
-
[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 202 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.
- Parameters:
-
[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 218 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.
- Parameters:
-
[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 251 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.
- Parameters:
-
[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 235 of file ValueArg.h.
Member Function Documentation
bool basis::ValueArg< T >::processArg | ( | int * | i, |
std::vector< std::string > & | args | ||
) | [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.
- Parameters:
-
[in,out] i Pointer to the current argument in the list. [in,out] args Mutable list of strings. Passed from main().
Definition at line 268 of file ValueArg.h.
Member Data Documentation
bool basis::ValueArg< T >::_allowOverwrite [protected] |
Whether argument value can be overwritten by another occurrence of this argument.
Definition at line 190 of file ValueArg.h.
The documentation for this class was generated from the following file: