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;
196 bool regroupArgv(
int& argc,
char**& argv);
199 void printManCompat()
const;
246 struct initValidTables
266 bool checkOpts =
true,
267 bool initialise =
true
275 bool checkArgs =
true,
276 bool checkOpts =
true,
277 bool initialise =
true
317 const bool caseTag =
false
325 void parse(
bool checkArgs,
bool checkOpts,
bool initialise);
363 const
bool caseTag = false
374 inline
int dryRun() const noexcept;
377 inline
int dryRun(const
int level) noexcept;
380 inline
int verbose() const noexcept;
383 inline
int verbose(const
int level) noexcept;
390 inline label
size() const noexcept;
405 inline
bool found(const
word& optName) const;
411 label
count(std::initializer_list<
word> optionNames) const;
420 inline
T get(const label index) const;
430 template<class
T=
string>
431 inline
T get(const
word& optName) const;
476 template<class
T, class Predicate>
481 const Predicate& pred,
482 bool mandatory = true
493 template<class
T, class Predicate>
498 const Predicate& pred
506 template<class
T, class Predicate>
510 const Predicate& pred
520 template<class
T, class Predicate>
525 const Predicate& pred
534 const
string& argName,
535 const
string& usage = ""
542 const
string& usage = "",
543 bool advanced = false
551 const
string& param = "",
552 const
string& usage = "",
553 bool advanced = false
569 std::pair<const
char*,
int> compat
581 std::pair<const
char*,
int> compat,
594 static
void addNote(const
string& note);
617 bool advanced = false
624 bool advanced = false
651 bool setOption(const
word& optName, const
string& param = "");
689 bool checkOpts = true
701 inline const
string& operator[](const label index) const;
704 inline const
string& operator[](const
word& optName) const;
711 template<class
T=
string>
714 return this->get<T>(optName);
720 T opt(
const word& optName,
const T& deflt)
const
722 return this->getOrDefault<T>(optName, deflt);
728 T get(
const word& optName,
const T& deflt)
const
730 return this->getOrDefault<T>(optName, deflt);
738 return this->getOrDefault<T>(optName, deflt);
747 #ifdef Foam_argList_1712
754 T read(const label index)
const
756 return this->get<T>(index);
766 return this->get<T>(index);
774 return found(optName);
791 return get<T>(optName);
805 return readIfPresent<T>(optName, val);
821 return readIfPresent<T>(optName, val, deflt);
835 return getOrDefault<T>(optName, deflt);
844 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.
dlLibraryTable & libs() const noexcept
Mutable access to the loaded dynamic libraries.
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.
const ParRunControl & parRunControl() const
Same as runControl() - v2106 and earlier.
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.
const fileName & caseName() const noexcept
Return case name (parallel run) or global case (serial run)
static void addNote(const string ¬e)
Add extra notes for the usage information.
bool optionFound(const word &optName) const
Deprecated(2018-01) return true if the named option is found.
const fileName & globalCaseName() const noexcept
Return global case name.
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)
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)
bool distributed() const noexcept
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.
static void addArgument(const string &argName, const string &usage="")
Append a (mandatory) argument to validArgs.
Template class for non-intrusive linked lists.
const stringList & args() const noexcept
Return arguments.
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.
int dryRun() const noexcept
Return the dry-run flag.
const HashTable< string > & options() const noexcept
Return options.
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 fileName envRelativePath(const fileName &input, const bool caseTag=false)
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(...)
const ParRunControl & runControl() const noexcept
Return the run control (parallel, dry-run etc)
int verbose() const noexcept
Return the verbose flag.
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.
const string & commandLine() const noexcept
The command line options and arguments concatenated as a string.
static void addDryRunOption(const string &usage, bool advanced=false)
Enable a 'dry-run' bool option, with usage information.
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 word envExecutable()
Name of the executable from environment variable.
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).
const word & executable() const noexcept
Name of executable without the path.
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.
static Istream & input(Istream &is, IntRange< T > &range)
bool checkRootCase() const
Check root path and case path.
class FOAM_DEPRECATED_FOR(2017-05, "Foam::Enum") NamedEnum
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, storing 'dry-run' state etc....
T argRead(const label index) const
Deprecated(2018-01) read a value from the argument at index.
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
fileName relativePath(const fileName &input, const bool caseTag=false) const
virtual ~argList()
Destructor.
const fileName & rootPath() const noexcept
Return root path.
void displayDoc(bool source=false) const
Display documentation in browser.
static void addVerboseOption(const string &usage, bool advanced=false)
Enable a 'verbose' bool option, with usage information.
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.