BASIS  version 1.2.3 (revision 2104)
Public Member Functions | Protected Attributes
sbia::basis::MultiArg< T > Class Template Reference

An argument that allows multiple values of type T to be specified. More...

#include <MultiArg.h>

+ Inheritance diagram for sbia::basis::MultiArg< T >:
+ Collaboration diagram for sbia::basis::MultiArg< T >:

List of all members.

Public Member Functions

virtual bool isRequired () const
 Whether the argument is required or not.
 MultiArg (const std::string &flag, const std::string &name, const std::string &desc, bool req, const std::string &typeDesc, unsigned int n=1, bool once=false, TCLAP::Visitor *v=NULL)
 Constructor.
 MultiArg (const std::string &flag, const std::string &name, const std::string &desc, bool req, const std::string &typeDesc, TCLAP::CmdLineInterface &parser, unsigned int n=1, bool once=false, TCLAP::Visitor *v=NULL)
 Constructor.
 MultiArg (const std::string &flag, const std::string &name, const std::string &desc, bool req, TCLAP::Constraint< T > *constraint, unsigned int n=1, bool once=false, TCLAP::Visitor *v=NULL)
 Constructor.
 MultiArg (const std::string &flag, const std::string &name, const std::string &desc, bool req, TCLAP::Constraint< T > *constraint, TCLAP::CmdLineInterface &parser, unsigned int n=1, bool once=false, TCLAP::Visitor *v=NULL)
 Constructor.
virtual bool processArg (int *i, std::vector< std::string > &args)
 Handles the processing of the argument.

Protected Attributes

unsigned int _numberOfArguments
 Number of values to process each time.

Detailed Description

template<class T>
class sbia::basis::MultiArg< T >

An argument that allows multiple values of type T to be specified.

Very similar to a TCLAP::ValueArg, except a vector of values will be returned instead of just one. Unlike TCLAP::MultiArg, this argument will each time its option keyword or flag is encountered process N > 0 argument values, where the number N is specified at construction time. Moreover, this argument can be given several times. Hence, the returned vector of values has length N * M, where M is the number of times the argument was given on the command-line.

Copyright (c) 2011 University of Pennsylvania. All rights reserved.
See https://www.cbica.upenn.edu/sbia/software/license.html or COPYING file.

Definition at line 47 of file basis/MultiArg.h.


Constructor & Destructor Documentation

template<class T >
sbia::basis::MultiArg< T >::MultiArg ( const std::string &  flag,
const std::string &  name,
const std::string &  desc,
bool  req,
const std::string &  typeDesc,
unsigned int  n = 1,
bool  once = false,
TCLAP::Visitor v = NULL 
)

Constructor.

Parameters:
[in]flagThe one character flag that identifies this argument on the command line.
[in]nameA one word name for the argument. Can be used as a long flag on the command line.
[in]descA description of what the argument is for or does.
[in]reqWhether the argument is required on the command-line.
[in]typeDescA 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]nNumber of values per argument occurrence.
[in]onceAccept argument only once.
[in]vAn optional visitor. You probably should not use this unless you have a very good reason.

Definition at line 207 of file basis/MultiArg.h.

template<class T >
sbia::basis::MultiArg< T >::MultiArg ( const std::string &  flag,
const std::string &  name,
const std::string &  desc,
bool  req,
const std::string &  typeDesc,
TCLAP::CmdLineInterface parser,
unsigned int  n = 1,
bool  once = false,
TCLAP::Visitor v = NULL 
)

Constructor.

Parameters:
[in]flagThe one character flag that identifies this argument on the command line.
[in]nameA one word name for the argument. Can be used as a long flag on the command line.
[in]descA description of what the argument is for or does.
[in]reqWhether the argument is required on the command-line.
[in]typeDescA 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]parserA CmdLine parser object to add this Arg to
[in]nNumber of values per argument occurrence.
[in]onceAccept argument only once.
[in]vAn optional visitor. You probably should not use this unless you have a very good reason.

Definition at line 224 of file basis/MultiArg.h.

template<class T >
sbia::basis::MultiArg< T >::MultiArg ( const std::string &  flag,
const std::string &  name,
const std::string &  desc,
bool  req,
TCLAP::Constraint< T > *  constraint,
unsigned int  n = 1,
bool  once = false,
TCLAP::Visitor v = NULL 
)

Constructor.

Parameters:
[in]flagThe one character flag that identifies this argument on the command line.
[in]nameA one word name for the argument. Can be used as a long flag on the command line.
[in]descA description of what the argument is for or does.
[in]reqWhether the argument is required on the command-line.
[in]constraintA pointer to a Constraint object used to constrain this Arg.
[in]nNumber of values per argument occurrence.
[in]onceAccept argument only once.
[in]vAn optional visitor. You probably should not use this unless you have a very good reason.

Definition at line 242 of file basis/MultiArg.h.

template<class T >
sbia::basis::MultiArg< T >::MultiArg ( const std::string &  flag,
const std::string &  name,
const std::string &  desc,
bool  req,
TCLAP::Constraint< T > *  constraint,
TCLAP::CmdLineInterface parser,
unsigned int  n = 1,
bool  once = false,
TCLAP::Visitor v = NULL 
)

Constructor.

Parameters:
[in]flagThe one character flag that identifies this argument on the command line.
[in]nameA one word name for the argument. Can be used as a long flag on the command line.
[in]descA description of what the argument is for or does.
[in]reqWhether the argument is required on the command-line.
[in]constraintA pointer to a Constraint object used to constrain this Arg.
[in]parserA CmdLine parser object to add this Arg to.
[in]nNumber of values per argument occurrence.
[in]onceAccept argument only once.
[in]vAn optional visitor. You probably should not use this unless you have a very good reason.

Definition at line 259 of file basis/MultiArg.h.


Member Function Documentation

template<class T >
bool sbia::basis::MultiArg< T >::isRequired ( ) const [virtual]

Whether the argument is required or not.

Once we've matched the first value, then the arg is no longer required, except if the argument is only accepted once with multiple values.

Reimplemented from TCLAP::MultiArg< T >.

Definition at line 331 of file basis/MultiArg.h.

template<class T >
bool sbia::basis::MultiArg< T >::processArg ( int *  i,
std::vector< std::string > &  args 
) [virtual]

Handles the processing of the argument.

This re-implements the TCLAP::MultiArg version of this method to set the _value of the argument appropriately. It knows the difference between labeled and unlabeled.

Parameters:
[in,out]iPointer to the current argument in the list.
[in,out]argsMutable list of strings. Passed from main().

Reimplemented from TCLAP::MultiArg< T >.

Definition at line 277 of file basis/MultiArg.h.


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