129 double lower,
double upper,
double dflt = 0.0,
137 int lower,
int upper,
int dflt = 0,
155 std::string firstValue,
int dflt,
bool display =
true);
166 std::string dflt,
bool display =
true);
202 int kwdIndex(std::string kwd)
const;
207 std::string
kwdVal()
const;
236 std::string
strVal()
const;
315 int matches(std::string input)
const;
446 namespace CoinParamUtils {
471 std::string
getStringField(
int argc,
const char *argv[],
int *valid);
480 int getIntField(
int argc,
const char *argv[],
int *valid);
503 int matchParam(
const CoinParamVec ¶mVec, std::string name,
504 int &matchNdx,
int &shortCnt);
536 std::string
getCommand(
int argc,
const char *argv[],
537 const std::string prompt, std::string *pfx = 0);
576 int lookupParam(std::string name, CoinParamVec ¶mVec,
577 int *matchCnt = 0,
int *shortCnt = 0,
int *queryCnt = 0);
604 void shortOrHelpOne(CoinParamVec ¶mVec,
int matchNdx, std::string name,
int numQuery);
615 std::string name,
int numQuery);
636 void printHelp(CoinParamVec ¶mVec,
int firstParam,
int lastParam,
638 bool shortHelp,
bool longHelp,
bool hidden);
void setLongHelp(const std::string help)
Add a long help message to a parameter.
CoinParamFunc pullFunc_
Pull function.
void printGenericHelp()
Print a generic `how to use the command interface' help message.
void setPullFunc(CoinParamFunc func)
Set pull function.
void setName(std::string name)
Set the parameter keyword (name) string.
void shortOrHelpOne(CoinParamVec ¶mVec, int matchNdx, std::string name, int numQuery)
Utility routine to print help given a short match or explicit request for help.
int upperIntValue_
Upper bound on value for an integer parameter.
void printLongHelp() const
Print long help.
std::string shortHelp() const
Retrieve the short help string.
CoinParam()
Default constructor.
bool isCommandLine()
Returns true if command line parameters are being processed.
std::vector< CoinParam * > CoinParamVec
A type for a parameter vector.
void setPushFunc(CoinParamFunc func)
Set push function.
std::string kwdVal() const
Return the value-keyword that is the current value of the keyword parameter.
void setKwdVal(int value, bool printIt=false)
Set the value of the keyword parameter using the integer associated with a value-keyword.
CoinParamType type_
Parameter type (see CoinParamType)
std::string getStringField(int argc, const char *argv[], int *valid)
Attempt to read a string from the input.
std::string longHelp_
Long help.
double upperDblValue_
Upper bound on value for a double parameter.
size_t lengthName_
Length of parameter name.
std::string name_
Parameter name.
int intValue_
Integer parameter - current value.
double getDoubleField(int argc, const char *argv[], int *valid)
Attempt to read a real (double) from the input.
CoinParam & operator=(const CoinParam &rhs)
Assignment.
bool display() const
Get visibility of parameter.
void setStrVal(std::string value)
Set the value of a string parameter.
void setInputSrc(FILE *src)
Take command input from the file specified by src.
bool isInteractive()
Returns true if parameters are being obtained from stdin.
CoinParamFunc pushFunc_
Push function.
std::string longHelp() const
Retrieve the long help message.
void setShortHelp(const std::string help)
Add a short help string to a parameter.
std::vector< std::string > definedKwds_
Set of valid value-keywords for a keyword parameter.
std::string matchName() const
Return the parameter keyword (name) string formatted to show the minimum match length.
void setIntVal(int value)
Set the value of a integer parameter.
int getIntField(int argc, const char *argv[], int *valid)
Attempt to read an integer from the input.
int currentKwd_
Current value for a keyword parameter (index into definedKwds_)
double lowerDblValue_
Lower bound on value for a double parameter.
void shortOrHelpMany(CoinParamVec ¶mVec, std::string name, int numQuery)
Utility routine to print help given multiple matches.
int(* CoinParamFunc)(CoinParam *param)
Type declaration for push and pull functions.
virtual CoinParam * clone()
Clone.
std::string strValue_
String parameter - current value.
int matchParam(const CoinParamVec ¶mVec, std::string name, int &matchNdx, int &shortCnt)
Scan a parameter vector for parameters whose keyword (name) string matches name using minimal match r...
int lookupParam(std::string name, CoinParamVec ¶mVec, int *matchCnt=0, int *shortCnt=0, int *queryCnt=0)
Look up the command keyword (name) in the parameter vector. Print help if requested.
void appendKwd(std::string kwd)
Add an additional value-keyword to a keyword parameter.
void printIt(const char *msg)
Utility to print a long message as filled lines of text.
virtual ~CoinParam()
Destructor.
int intVal() const
Get the value of a integer parameter.
std::ostream & operator<<(std::ostream &s, const CoinParam ¶m)
A stream output function for a CoinParam object.
bool display_
Display when processing lists of parameters?
void setType(CoinParamType type)
Set the type of the parameter.
double dblVal() const
Get the value of a double parameter.
CoinParamType
Enumeration for the types of parameters supported by CoinParam.
int lowerIntValue_
Lower bound on value for an integer parameter.
void setDisplay(bool display)
Set visibility of parameter.
CoinParamFunc pullFunc()
Get pull function.
void setDblVal(double value)
Set the value of a double parameter.
std::string getCommand(int argc, const char *argv[], const std::string prompt, std::string *pfx=0)
Get the next command keyword (name)
void printIt(const char *msg)
Utility to print a long message as filled lines of text.
A base class for `keyword value' command line parameters.
size_t lengthMatch_
Minimum length required to declare a match for the parameter name.
int matches(std::string input) const
Check if the specified string matches the parameter keyword (name) string.
int kwdIndex(std::string kwd) const
Return the integer associated with the specified value-keyword.
void printKwds() const
Prints the set of value-keywords defined for this keyword parameter.
std::string strVal() const
Get the value of a string parameter.
double dblValue_
Double parameter - current value.
void printHelp(CoinParamVec ¶mVec, int firstParam, int lastParam, std::string prefix, bool shortHelp, bool longHelp, bool hidden)
Utility routine to print help messages for one or more parameters.
CoinParamType type() const
Return the type of the parameter.
std::string shortHelp_
Short help.
CoinParamFunc pushFunc()
Get push function.
std::string name() const
Return the parameter keyword (name) string.