Go to the documentation of this file.
113 #define Foam_argList_1712
129 static bool argsMandatory_;
132 static bool checkProcessorDirectories_;
159 static word optionCompat(
const word& optName);
162 static int optionIgnore(
const word& optName);
167 static void checkITstream(
const ITstream& is,
const label index);
172 static void checkITstream(
const ITstream& is,
const word& optName);
191 bool regroupArgv(
int& argc,
char**& argv);
194 void printManCompat()
const;
241 struct initValidTables
261 bool checkOpts =
true,
262 bool initialise =
true
270 bool checkArgs =
true,
271 bool checkOpts =
true,
272 bool initialise =
true
298 void parse(
bool checkArgs,
bool checkOpts,
bool initialise);
336 const bool caseTag =
false
368 inline
bool found(const
word& optName) const;
391 template<class
T=
string>
392 inline
T get(const
word& optName) const;
435 template<class
T=
string>
438 return this->get<T>(optName);
445 return this->get<T>(optName,
deflt);
454 const string& argName,
455 const string& usage =
""
462 const string& usage =
"",
463 bool advanced =
false
471 const string& param =
"",
472 const string& usage =
"",
473 bool advanced =
false
489 std::pair<const char*, int> compat
501 std::pair<const char*,int> compat,
514 static void addNote(
const string& note);
557 bool setOption(
const word& optName,
const string& param =
"");
595 bool checkOpts =
true
619 return getOrDefault<T>(optName,
deflt);
625 #ifdef Foam_argList_1712
634 return this->get<T>(index);
642 argRead(const
label index)
const
644 return this->get<T>(index);
650 optionFound(const
word& optName)
const
652 return found(optName);
658 optionLookup(const
word& optName)
const
667 optionRead(const
word& optName)
const
669 return get<T>(optName);
683 return readIfPresent<T>(optName,
val);
699 return readIfPresent<T>(optName,
val,
deflt);
707 optionLookupOrDefault
713 return getOrDefault<T>(optName,
deflt);
720 optionReadList(const
word& optName)
const
722 return this->getList<T>(optName);
static SLList< string > validArgs
A list of valid (mandatory) arguments.
label count(const UList< word > &optionNames) const
Return how many of the specified options were used.
static void noBanner()
Disable emitting the banner information.
void printMan() const
Print usage as nroff-man format (Experimental)
static std::string::size_type usageMin
Min indentation when displaying usage (default: 20)
T FOAM_DEPRECATED_FOR(2018-08, "get() method") read(const label index) const
Deprecated(2018-08) read a value from the argument at index.
Functions used by OpenFOAM that are specific to POSIX compliant operating systems and need to be repl...
A table of dynamically loaded libraries.
static void addUsage(const word &optName, const string &usage)
Add option usage information to optionUsage.
A class for handling words, derived from Foam::string.
static std::string::size_type usageMax
Max screen width when displaying usage (default: 80)
A class for handling file names.
static HashTable< std::pair< word, int > > validOptionsCompat
A list of aliases for options.
static fileName envGlobalPath()
Global case (directory) from environment variable.
T getOrDefault(const word &optName, const T &deflt) const
Get a value from the named option if present, or return default.
static HashTable< string > optionUsage
Short description for validOptions.
bool read(const char *buf, int32_t &val)
Same as readInt32.
static void addNote(const string ¬e)
Add extra notes for the usage information.
const HashTable< string > & options() const
Return options.
const stringList & args() const
Return arguments.
static void addOptionCompat(const word &optName, std::pair< const char *, int > compat)
Specify an alias for the option name.
Extract command arguments and options from the supplied argc and argv parameters.
bool readListIfPresent(const word &optName, List< T > &list) const
T FOAM_DEPRECATED_FOR(2018-01, "get() method") argRead(const label index) const
Deprecated(2018-01) read a value from the argument at index.
A HashTable with keys but without contents that is similar to std::unordered_set.
T get(const label index) const
Get a value from the argument at index.
void printCompat() const
Print option compatibility.
bool readIfPresent(const word &optName, T &val) const
Read a value from the named option if present.
static void noMandatoryArgs()
Flag command arguments as being optional (non-mandatory)
T opt(const word &optName) const
Alternative name for option get(const word& optName)
const dlLibraryTable & libs() const
Access to the loaded libraries.
const fileName & rootPath() const
Return root path.
argList(int &argc, char **&argv, bool checkArgs=argList::argsMandatory(), bool checkOpts=true, bool initialise=true)
static void ignoreOptionCompat(std::pair< const char *, int > compat, bool expectArg)
Specify an option to be ignored.
const ParRunControl & parRunControl() const
Return the ParRunControl.
static void addArgument(const string &argName, const string &usage="")
Append a (mandatory) argument to validArgs.
Template class for non-intrusive linked lists.
static HashTable< string > validParOptions
A list of valid parallel options.
void printNotes() const
Print notes (if any)
void parse(bool checkArgs, bool checkOpts, bool initialise)
static void noLibs()
Add the '-no-libs' command line option.
static void noFunctionObjects(bool addWithOption=false)
Remove '-noFunctionObjects' option and ignore any occurances.
ITstream lookup(const word &optName) const
Return an input stream from the named option.
const word & executable() const
Name of executable without the path.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
T FOAM_DEPRECATED_FOR(2018-01, "get() method") optionRead(const word &optName) const
Deprecated(2018-01) read a value from the named option.
An input stream of tokens.
bool setOption(const word &optName, const string ¶m="")
Set option directly (use with caution)
static void noJobInfo()
Suppress JobInfo, overriding controlDict setting.
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
static word postProcessOptionName
Standard name for the post-processing option.
graph_traits< Graph >::vertices_size_type size_type
static void setAdvanced(const word &optName, bool advanced=true)
Set an existing option as being 'advanced' or normal.
Lookup type of boundary radiation properties.
static void noCheckProcessorDirectories()
Remove checking of processor directories.
fileName path() const
Return the full path to the (processor local) case.
static HashTable< string > validOptions
A list of valid options.
T lookupOrDefault(const word &optName, const T &deflt) const
Get a value from the named option if present, or return default.
static bool postProcess(int argc, char *argv[])
Return true if the post-processing option is specified.
bool unsetOption(const word &optName)
Unset option directly (use with caution)
A HashTable similar to std::unordered_map.
static void addBoolOption(const word &optName, const string &usage="", bool advanced=false)
Add a bool option to validOptions with usage information.
static HashSet< string > advancedOptions
The "advanced" options are shown with -help-full (not with –help)
label size() const noexcept
The number of arguments.
T opt(const word &optName, const T &deflt) const
Alternative name for option get(const word& optName, ...)
static bool argsMandatory()
Command arguments type (optional/mandatory).
Non-intrusive singly-linked list.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
bool T const T &const deflt
fileName globalPath() const
Return the full path to the global case.
List< T > FOAM_DEPRECATED_FOR(2018-01, "getList() method") optionReadList(const word &optName) const
Deprecated(2018-01) read a List of values from the named option.
static SLList< string > notes
General usage notes.
bool checkRootCase() const
Check root path and case path.
const string & commandLine() const
The command line options and arguments concatenated as a string.
List< T > getList(const label index) const
Get a List of values from the argument at index.
Helper class for initializing parallel jobs from the command arguments.
const fileName & caseName() const
Return case name (parallel run) or global case (serial run)
static HashTable< std::pair< bool, int > > ignoreOptionsCompat
A list of options to ignore.
static HashTable< string, label, Hash< label > > argUsage
Short description for program arguments.
bool check(bool checkArgs=argList::argsMandatory(), bool checkOpts=true) const
static void noParallel()
Remove the parallel options.
static bool bannerEnabled()
Banner status (enabled/disabled).
static void addOption(const word &optName, const string ¶m="", const string &usage="", bool advanced=false)
Add an option to validOptions with usage information.
const string & operator[](const label index) const
The string corresponding to the argument index.
void printUsage(bool full=true) const
Print usage.
const fileName & globalCaseName() const
Return global case name.
fileName relativePath(const fileName &input, const bool caseTag=false) const
virtual ~argList()
Destructor.
void displayDoc(bool source=false) const
Display documentation in browser.
static void removeOption(const word &optName)
Remove option from validOptions and from optionUsage.
bool found(const word &optName) const
Return true if the named option is found.