NGSolve
5.3
|
A storage for command-line flags. More...
#include <flags.hpp>
Public Member Functions | |
Flags () | |
no flags | |
Flags (const Flags &flags) | |
copy flags | |
Flags (Flags &&flags) | |
steal flags | |
Flags (std::initializer_list< string > list) | |
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 string &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 string &name, const string &val) |
Sets string flag, overwrite if exists. | |
Flags & | SetFlag (const string &name, double val) |
Sets numerical flag, overwrite if exists. | |
Flags & | SetFlag (const string &name) |
Sets boolean flag. | |
Flags & | SetFlag (const string &name, const Array< string > &val) |
Sets string array flag. | |
Flags & | SetFlag (const string &name, const Array< double > &val) |
Sets double array flag. | |
Flags | SetFlag (const char *name)&& |
Flags | SetFlag (const char *name, double val)&& |
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. | |
string | GetStringFlag (const string &name, const char *def) const |
Returns string flag, default value if not exists. | |
string | GetStringFlag (const string &name, string def="") const |
Returns string flag, default value if not exists. | |
double | GetNumFlag (const string &name, double def) const |
Returns numerical flag, default value if not exists. | |
const double * | GetNumFlagPtr (const string &name) const |
Returns address of numerical flag, null if not exists. | |
double * | GetNumFlagPtr (const string &name) |
Returns address of numerical flag, null if not exists. | |
bool | GetDefineFlag (const string &name) const throw () |
Returns boolean flag. | |
const Array< string > & | GetStringListFlag (const string &name) const |
Returns string list flag, empty array if not exist. | |
const Array< double > & | GetNumListFlag (const string &name) const |
Returns num list flag, empty array if not exist. | |
bool | StringFlagDefined (const string &name) const |
Test, if string flag is defined. | |
bool | NumFlagDefined (const string &name) const |
Test, if num flag is defined. | |
bool | StringListFlagDefined (const string &name) const |
Test, if string list flag is defined. | |
bool | NumListFlagDefined (const string &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 string & | GetStringFlag (int i, string &name) const |
double | GetNumFlag (int i, string &name) const |
void | GetDefineFlag (int i, string &name) const |
const shared_ptr< Array< double > > | GetNumListFlag (int i, string &name) const |
const shared_ptr< Array< string > > | GetStringListFlag (int i, string &name) const |
Friends | |
Archive & | operator& (Archive &archive, Flags &flags) |
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]