100#define Foam_argList_H
112#define Foam_argList_1712
128 static bool argsMandatory_;
131 static bool checkProcessorDirectories_;
134 static bool parallelThreads_;
161 static word optionCompat(
const word& optName);
164 static int optionIgnore(
const word& optName);
169 static void checkITstream(
const ITstream& is,
const label index);
174 static void checkITstream(
const ITstream& is,
const word& optName);
182 void raiseBadInput(
const word& optName)
const;
198 bool regroupArgv(
int& argc,
char**& argv);
201 void printManCompat()
const;
238 static std::string::size_type
usageMin;
241 static std::string::size_type
usageMax;
248 struct initValidTables
268 bool checkOpts =
true,
269 bool initialise =
true
277 bool checkArgs =
true,
278 bool checkOpts =
true,
279 bool initialise =
true
319 const bool caseTag =
false
327 void parse(
bool checkArgs,
bool checkOpts,
bool initialise);
365 const
bool caseTag = false
416 inline
bool found(const
word& optName) const;
422 label
count(std::initializer_list<
word> optionNames) const;
431 inline
T get(const label index) const;
441 template<class
T=
string>
442 inline
T get(const
word& optName) const;
487 template<class
T, class Predicate>
492 const Predicate& pred,
493 bool mandatory = true
504 template<class
T, class Predicate>
509 const Predicate& pred
517 template<class
T, class Predicate>
521 const Predicate& pred
531 template<class
T, class Predicate>
536 const Predicate& pred
545 const
string& argName,
546 const
string& usage =
""
553 const
string& usage =
"",
554 bool advanced = false
562 const
string& param =
"",
563 const
string& usage =
"",
564 bool advanced = false
580 std::pair<const
char*,
int> compat
592 std::pair<const
char*,
int> compat,
605 static
void addNote(const
string& note);
628 bool advanced = false
634 const
string& usage =
"",
635 bool advanced = false
662 bool setOption(const
word& optName, const
string& param =
"");
676 static
int verbose(
int argc,
char *argv[]);
709 bool checkOpts = true
721 inline const
string& operator[](const label index) const;
724 inline const
string& operator[](const
word& optName) const;
731 template<class
T=
string>
735 return this->
get<T>(optName);
742 T opt(const
word& optName, const
T& deflt)
const
751 T get(const word& optName, const
T& deflt)
const
766 const ParRunControl&
parRunControl()
const {
return runControl_; }
771 #ifdef Foam_argList_1712
778 T read(const label index)
const
780 return this->
get<T>(index);
790 return this->
get<T>(index);
798 return found(optName);
Functions used by OpenFOAM that are specific to POSIX compliant operating systems and need to be repl...
Non-intrusive singly-linked list.
A HashTable with keys but without contents that is similar to std::unordered_set.
A HashTable similar to std::unordered_map.
An input stream of tokens.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Helper class for initializing parallel jobs from the command arguments, storing 'dry-run' state etc....
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Extract command arguments and options from the supplied argc and argv parameters.
void parse(bool checkArgs, bool checkOpts, bool initialise)
Scan for -help, -doc options etc prior to checking the validity of other args/opts and finally initia...
static word postProcessOptionName
Standard name for the post-processing option.
T get(const label index) const
Get a value from the argument at index.
static HashTable< string, label, Hash< label > > argUsage
Short description for program arguments.
int dryRun() const noexcept
Return the dry-run flag.
static void noBanner()
Disable emitting the banner information.
static std::string::size_type usageMin
Min indentation when displaying usage (default: 20).
static void noFunctionObjects(bool addWithOption=false)
Remove '-noFunctionObjects' option and ignore any occurrences.
static HashTable< std::pair< word, int > > validOptionsCompat
A list of aliases for options.
static HashTable< string > validParOptions
A list of valid parallel options.
static void removeOption(const word &optName)
Remove option from validOptions and from optionUsage.
const ParRunControl & parRunControl() const
Same as runControl() - v2106 and earlier.
const stringList & args() const noexcept
Return arguments.
static void addVerboseOption(const string &usage="", bool advanced=false)
Enable a 'verbose' bool option, with usage information.
bool distributed() const noexcept
Return distributed flag (i.e. are rootPaths different on different machines).
argList(int &argc, char **&argv, bool checkArgs=argList::argsMandatory(), bool checkOpts=true, bool initialise=true)
Construct from argc and argv checking the arguments and options as requested.
static std::string::size_type usageMax
Max screen width when displaying usage (default: 80).
bool unsetOption(const word &optName)
Unset option directly (use with caution).
static bool postProcess(int argc, char *argv[])
True if the post-processing option is found in the argv list.
bool optionFound(const word &optName) const
Deprecated(2018-01) return true if the named option is found.
const HashTable< string > & options() const noexcept
Return options.
T opt(const word &optName) const
Deprecated(2020-05) identical to get(const word& optName).
int verbose() const noexcept
Return the verbose flag.
const ParRunControl & runControl() const noexcept
Return the run control (parallel, dry-run etc).
const fileName & rootPath() const noexcept
Return root path.
static void addArgument(const string &argName, const string &usage="")
Append a (mandatory) argument to validArgs.
static bool bannerEnabled()
Banner status (enabled/disabled).
bool readCheck(const word &optName, T &val, const Predicate &pred, bool mandatory=true) const
Read the named option and check its validity.
static fileName envGlobalPath()
Global case (directory) from environment variable.
static void noLibs()
Add the '-no-libs' command line option.
static void noJobInfo()
Suppress JobInfo, overriding controlDict setting.
bool allowLibs() const
The controlDict 'libs' entry is allowed to be used. (eg, has not been disabled by the -no-libs option...
bool optionReadIfPresent(const word &optName, T &val) const
Deprecated(2018-01) read a value from the named option if present.
void printUsage(bool full=true) const
Print usage.
static void setAdvanced(const word &optName, bool advanced=true)
Set an existing option as being 'advanced' or normal.
List< T > optionReadList(const word &optName) const
Deprecated(2018-01) read a List of values from the named option.
bool check(bool checkArgs=argList::argsMandatory(), bool checkOpts=true) const
Check the parsed command-line for mandatory arguments and that all the options are correct.
virtual ~argList()
Destructor.
fileName relativePath(const fileName &input, const bool caseTag=false) const
Return the input relative to the globalPath by stripping off a leading value of the globalPath.
bool readListIfPresent(const word &optName, List< T > &list) const
If named option is present, get a List of values treating a single entry like a list of size 1.
T optionLookupOrDefault(const word &optName, const T &deflt) const
Deprecated(2018-01) read a value from the named option if present.
static HashTable< string > optionUsage
Short description for validOptions.
bool allowFunctionObjects() const
The controlDict 'functions' entry is allowed to be used.
static fileName envRelativePath(const fileName &input, const bool caseTag=false)
Return the input relative to the globalPath by stripping off a leading value of the envGlobalPath.
static bool argsMandatory()
Command arguments type (optional/mandatory).
label count(const UList< word > &optionNames) const
Return how many of the specified options were used.
static HashSet< string > advancedOptions
The "advanced" options are shown with -help-full (not with –help).
bool setOption(const word &optName, const string ¶m="")
Set option directly (use with caution).
T lookupOrDefault(const word &optName, const T &deflt) const
Deprecated(2020-05) identical to getOrDefault(...).
static void addDryRunOption(const string &usage, bool advanced=false)
Enable a 'dry-run' bool option, with usage information.
label size() const noexcept
The number of arguments.
static void noCheckProcessorDirectories()
Disable checking of processor directories.
static SLList< string > notes
General usage notes.
bool checkRootCase() const
Check root path and case path.
void displayDoc(bool source=false) const
Display documentation in browser.
static void noMandatoryArgs()
Flag command arguments as being optional (non-mandatory).
bool found(const word &optName) const
Return true if the named option is found.
static void addBoolOption(const word &optName, const string &usage="", bool advanced=false)
Add a bool option to validOptions with usage information.
ITstream optionLookup(const word &optName) const
Deprecated(2018-01) return an input stream from the named option.
T optionRead(const word &optName) const
Deprecated(2018-01) read a value from the named option.
void printCompat() const
Print option compatibility.
bool readIfPresent(const word &optName, T &val) const
Read a value from the named option if present.
const fileName & globalCaseName() const noexcept
Return global case name.
static void noParallel()
Remove the parallel options.
static void addUsage(const word &optName, const string &usage)
Add option usage information to optionUsage.
void printMan() const
Print usage as nroff-man format (Experimental).
static void addOption(const word &optName, const string ¶m="", const string &usage="", bool advanced=false)
Add an option to validOptions with usage information.
void printNotes() const
Print notes (if any).
static void parallelThreads_on()
MPI threads are desired for the application.
fileName path() const
Return the full path to the (processor local) case.
static HashTable< string > validOptions
A list of valid options.
T getCheck(const word &optName, const Predicate &pred) const
Get a value from the named option with additional checking.
static SLList< string > validArgs
A list of valid (mandatory) arguments.
T argRead(const label index) const
Deprecated(2018-01) read a value from the argument at index.
ITstream lookup(const word &optName) const
Return an input stream from the named option.
List< T > getList(const label index) const
Get a List of values from the argument at index.
bool readCheckIfPresent(const word &optName, T &val, const Predicate &pred) const
Read the named option if present and check its validity.
T getOrDefault(const word &optName, const T &deflt) const
Get a value from the named option if present, or return default.
const word & executable() const noexcept
Name of executable without the path.
static word envExecutable()
Name of the executable from environment variable.
const string & commandLine() const noexcept
The command line options and arguments concatenated as a string.
T getCheckOrDefault(const word &optName, const T &deflt, const Predicate &pred) const
Get a value from the named option with additional checking (if present), or return default.
static HashTable< std::pair< bool, int > > ignoreOptionsCompat
A list of options to ignore.
static void addNote(const string ¬e)
Add extra notes for the usage information.
static void ignoreOptionCompat(std::pair< const char *, int > compat, bool expectArg)
Specify an option to be ignored.
dlLibraryTable & libs() const noexcept
Mutable access to the loaded dynamic libraries.
T read(const label index) const
Deprecated(2018-08) read a value from the argument at index.
static void addOptionCompat(const word &optName, std::pair< const char *, int > compat)
Specify an alias for the option name.
const fileName & caseName() const noexcept
Return case name (parallel run) or global case (serial run).
fileName globalPath() const
Return the full path to the global case.
A table of dynamically loaded libraries.
A class for handling file names.
Lookup type of boundary radiation properties.
A class for handling words, derived from Foam::string.
fileName path(UMean.rootPath()/UMean.caseName()/"graphs"/UMean.instance())
LList< SLListBase, T > SLList
List< string > stringList
List of string.
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
Foam::argList args(argc, argv)
#define FOAM_DEPRECATED_FOR(since, replacement)
#define FOAM_DEPRECATED_STRICT(since, replacement)