Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
Arcane::CommandLineArguments Class Reference

Command Line Arguments. More...

#include </__w/arcaneframework.github.io/arcaneframework.github.io/framework/arccore/src/common/arccore/common/CommandLineArguments.h>

Collaboration diagram for Arcane::CommandLineArguments:

Classes

class  Impl

Public Member Functions

 CommandLineArguments (int *argc, char ***argv)
 Create an instance from the arguments (argc,argv).
 CommandLineArguments (const StringList &args)
 CommandLineArguments (const CommandLineArguments &rhs)
CommandLineArgumentsoperator= (const CommandLineArguments &rhs)
int * commandLineArgc () const
char *** commandLineArgv () const
void fillArgs (StringList &args) const
 Fills args with command line arguments.
String getParameter (const String &param_name) const
 Retrieves the parameter with name param_name.
void addParameterLine (const String &line)
 Adds a parameter.
void fillParameters (StringList &param_names, StringList &values) const
 Retrieves the list of parameters and their values.
const ParameterListparameters () const
 List of parameters.
ParameterListparameters ()
 List of parameters.
bool needHelp () const
 Method to determine if the user requested help on the command line.

Private Attributes

Arccore::ReferenceCounter< Implm_p

Detailed Description

Command Line Arguments.

This class uses a reference semantics. The commandLineArgc() and commandLineArgv() methods return pointers to internal structures of this class which are allocated only as long as the instance is valid. They can be used for classic C methods that expect pointers to the command line arguments (i.e., the equivalent of the (argc,argv pair of the main() function).

Arguments starting with '-A' are considered as (key,value) parameters type and must be in the form -A,x=y where x is the key and y is the value. It is then possible to retrieve the value of a parameter through its key using the getParameter() method; If a parameter is present multiple times on the command line, the last value is retained.

Definition at line 49 of file arccore/src/common/arccore/common/CommandLineArguments.h.

Constructor & Destructor Documentation

◆ CommandLineArguments() [1/4]

Arcane::CommandLineArguments::CommandLineArguments ( int * argc,
char *** argv )

Create an instance from the arguments (argc,argv).

Definition at line 195 of file CommandLineArguments.cc.

◆ CommandLineArguments() [2/4]

Arcane::CommandLineArguments::CommandLineArguments ( )

Definition at line 205 of file CommandLineArguments.cc.

◆ CommandLineArguments() [3/4]

Arcane::CommandLineArguments::CommandLineArguments ( const StringList & args)
explicit

Definition at line 215 of file CommandLineArguments.cc.

◆ CommandLineArguments() [4/4]

Arcane::CommandLineArguments::CommandLineArguments ( const CommandLineArguments & rhs)

Definition at line 225 of file CommandLineArguments.cc.

◆ ~CommandLineArguments()

Arcane::CommandLineArguments::~CommandLineArguments ( )

Definition at line 244 of file CommandLineArguments.cc.

Member Function Documentation

◆ addParameterLine()

void Arcane::CommandLineArguments::addParameterLine ( const String & line)

Adds a parameter.

See also
ParameterList::addParameterLine()

Definition at line 292 of file CommandLineArguments.cc.

◆ commandLineArgc()

int * Arcane::CommandLineArguments::commandLineArgc ( ) const

Definition at line 252 of file CommandLineArguments.cc.

◆ commandLineArgv()

char *** Arcane::CommandLineArguments::commandLineArgv ( ) const

Definition at line 261 of file CommandLineArguments.cc.

◆ fillArgs()

void Arcane::CommandLineArguments::fillArgs ( StringList & args) const

Fills args with command line arguments.

Definition at line 270 of file CommandLineArguments.cc.

◆ fillParameters()

void Arcane::CommandLineArguments::fillParameters ( StringList & param_names,
StringList & values ) const

Retrieves the list of parameters and their values.

Returns the list of parameter names in param_names and the associated value in values.

Definition at line 301 of file CommandLineArguments.cc.

Referenced by Arcane::ArccoreApplicationBuildInfo::parseArgumentsAndSetDefaultsValues().

Here is the caller graph for this function:

◆ getParameter()

String Arcane::CommandLineArguments::getParameter ( const String & param_name) const

Retrieves the parameter with name param_name.

Returns a null string if there is no parameter with this name.

Definition at line 283 of file CommandLineArguments.cc.

Referenced by Arcane::ArcaneLauncher::init().

Here is the caller graph for this function:

◆ needHelp()

bool Arcane::CommandLineArguments::needHelp ( ) const

Method to determine if the user requested help on the command line.

Definition at line 319 of file CommandLineArguments.cc.

Referenced by Arcane::ArcaneLauncher::needHelp(), and parameters().

Here is the caller graph for this function:

◆ operator=()

CommandLineArguments & Arcane::CommandLineArguments::operator= ( const CommandLineArguments & rhs)

Definition at line 234 of file CommandLineArguments.cc.

◆ parameters()

const ParameterList & Arcane::CommandLineArguments::parameters ( ) const

List of parameters.

Definition at line 310 of file CommandLineArguments.cc.

Referenced by Arcane::ArcaneLauncher::init().

Here is the caller graph for this function:

Member Data Documentation

◆ m_p

Arccore::ReferenceCounter<Impl> Arcane::CommandLineArguments::m_p
private

The documentation for this class was generated from the following files: