NGSolve
4.9
|
A storage for command-line flags. More...
#include <flags.hpp>
Public Member Functions | |
Flags () | |
no flags | |
Flags (const Flags &flags) | |
copy flags | |
Flags (string f1, string f2="", string f3="", string f4="", string f5="") | |
~Flags () | |
delete mem | |
void | DeleteFlags () |
Deletes all flags. | |
Flags & | SetFlag (const char *name, const char *val) |
Sets string flag, overwrite if exists. | |
Flags & | SetFlag (const char *name, double val) |
Sets numerical flag, overwrite if exists. | |
Flags & | SetFlag (const char *name) |
Sets boolean flag. | |
Flags & | SetFlag (const char *name, const Array< char * > &val) |
Sets string array flag. | |
Flags & | SetFlag (const char *name, const Array< double > &val) |
Sets double array flag. | |
void | SaveFlags (const char *filename) const |
Save flags to file. | |
void | PrintFlags (ostream &ost) const |
write flags to stream | |
void | LoadFlags (const char *filename) |
Load flags from file. | |
void | SetCommandLineFlag (const char *st) |
Set command line flag. | |
const char * | GetStringFlag (const char *name, const char *def) const |
Returns string flag, default value if not exists. | |
double | GetNumFlag (const char *name, double def) const |
Returns numerical flag, default value if not exists. | |
const double * | GetNumFlagPtr (const char *name) const |
Returns address of numerical flag, null if not exists. | |
double * | GetNumFlagPtr (const char *name) |
Returns address of numerical flag, null if not exists. | |
int | GetDefineFlag (const char *name) const |
Returns boolean flag. | |
int | GetDefineFlag (const string &name) const |
const Array< char * > & | GetStringListFlag (const char *name) const |
Returns string list flag, empty array if not exist. | |
const Array< double > & | GetNumListFlag (const char *name) const |
Returns num list flag, empty array if not exist. | |
int | StringFlagDefined (const char *name) const |
Test, if string flag is defined. | |
int | NumFlagDefined (const char *name) const |
Test, if num flag is defined. | |
int | StringListFlagDefined (const char *name) const |
Test, if string list flag is defined. | |
int | NumListFlagDefined (const char *name) const |
Test, if num list flag is defined. | |
int | GetNStringFlags () const |
number of string flags | |
int | GetNNumFlags () const |
number of num flags | |
int | GetNDefineFlags () const |
number of define flags | |
int | GetNStringListFlags () const |
number of string-list flags | |
int | GetNNumListFlags () const |
number of num-list flags | |
const char * | GetStringFlag (int i, const char *&name) const |
double | GetNumFlag (int i, const char *&name) const |
void | GetDefineFlag (int i, const char *&name) const |
const Array< double > * | GetNumListFlag (int i, const char *&name) const |
const Array< char * > * | GetStringListFlag (int i, const char *&name) const |
A storage for command-line flags.
The flag structure maintains string flags, numerical flags, define flags, string list flags, num list flags.
void ngstd::Flags::SetCommandLineFlag | ( | const char * | st | ) |
Set command line flag.
Flag must be in form: -name=hello -val=0.5 -defflag -names=[Joe,Jim] -values=[1,3,4]