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);
180 void raiseBadInput(
const word& optName)
const;
194 bool regroupArgv(
int& argc,
char**& argv);
197 void printManCompat()
const;
244 struct initValidTables
264 bool checkOpts =
true,
265 bool initialise =
true
273 bool checkArgs =
true,
274 bool checkOpts =
true,
275 bool initialise =
true
301 void parse(
bool checkArgs,
bool checkOpts,
bool initialise);
339 const bool caseTag =
false
356 inline label
size() const noexcept;
371 inline
bool found(const
word& optName) const;
377 label
count(std::initializer_list<
word> optionNames) const;
385 inline
T get(const label index) const;
394 template<class
T=
string>
395 inline
T get(const
word& optName) const;
440 template<class
T, class Predicate>
445 const Predicate& pred,
446 bool mandatory = true
457 template<class
T, class Predicate>
462 const Predicate& pred
470 template<class
T, class Predicate>
474 const Predicate& pred
484 template<class
T, class Predicate>
489 const Predicate& pred
498 const
string& argName,
499 const
string& usage = ""
506 const
string& usage = "",
507 bool advanced = false
515 const
string& param = "",
516 const
string& usage = "",
517 bool advanced = false
533 std::pair<const
char*,
int> compat
545 std::pair<const
char*,
int> compat,
558 static
void addNote(const
string& note);
601 bool setOption(const
word& optName, const
string& param = "");
639 bool checkOpts = true
651 inline const
string& operator[](const label index) const;
654 inline const
string& operator[](const
word& optName) const;
661 template<class
T=
string>
664 return this->get<T>(optName);
670 T opt(
const word& optName,
const T& deflt)
const
672 return this->getOrDefault<T>(optName, deflt);
678 T get(
const word& optName,
const T& deflt)
const
680 return this->getOrDefault<T>(optName, deflt);
688 return this->getOrDefault<T>(optName, deflt);
694 #ifdef Foam_argList_1712
701 T read(const label index)
const
703 return this->get<T>(index);
713 return this->get<T>(index);
721 return found(optName);
738 return get<T>(optName);
752 return readIfPresent<T>(optName, val);
768 return readIfPresent<T>(optName, val, deflt);
782 return getOrDefault<T>(optName, deflt);
791 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)
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.
T optionRead(const word &optName) const
Deprecated(2018-01) read a value from the named option.
static void addNote(const string ¬e)
Add extra notes for the usage information.
const HashTable< string > & options() const
Return options.
bool optionFound(const word &optName) const
Deprecated(2018-01) return true if the named option is found.
const stringList & args() const
Return arguments.
ITstream optionLookup(const word &optName) const
Deprecated(2018-01) return an input stream from the named option.
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
bool optionReadIfPresent(const word &optName, T &val) const
Deprecated(2018-01) read a value from the named option if present.
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 read(const label index) const
Deprecated(2018-08) read a value from the argument at index.
T opt(const word &optName) const
Deprecated(2020-05) identical to get(const word& optName)
const dlLibraryTable & libs() const
Access to the loaded libraries.
const fileName & rootPath() const
Return root path.
List< T > optionReadList(const word &optName) const
Deprecated(2018-01) read a List of values from the named option.
T optionLookupOrDefault(const word &optName, const T &deflt) const
Deprecated(2018-01) read a value from the named option if present.
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.
bool readCheck(const word &optName, T &val, const Predicate &pred, bool mandatory=true) const
Read the named option and check its validity.
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 occurrences.
ITstream lookup(const word &optName) const
Return an input stream from the named option.
const word & executable() const
Name of executable without the path.
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.
T get(const word &optName, const T &deflt) const
Deprecated(2020-05) identical to getOrDefault(...)
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.
bool readCheckIfPresent(const word &optName, T &val, const Predicate &pred) const
Read the named option if present and check its validity.
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
Deprecated(2020-05) identical to getOrDefault(...)
static bool postProcess(int argc, char *argv[])
Return true if the post-processing option is specified.
T getCheck(const word &optName, const Predicate &pred) const
Get a value from the named option with additional checking.
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
Deprecated(2020-05) identical to getOrDefault(...)
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...
fileName globalPath() const
Return the full path to the global case.
static SLList< string > notes
General usage notes.
bool checkRootCase() const
Check root path and case path.
class FOAM_DEPRECATED_FOR(2017-05, "Foam::Enum") NamedEnum
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. Also handles cleanup of paral...
T argRead(const label index) const
Deprecated(2018-01) read a value from the argument at index.
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.
void printUsage(bool full=true) const
Print usage.
T getCheckOrDefault(const word &optName, const T &deflt, const Predicate &pred) const
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.