14#include "arcane/utils/ApplicationInfo.h"
15#include "arcane/utils/String.h"
16#include "arcane/utils/CommandLineArguments.h"
17#include "arcane/utils/PlatformUtils.h"
18#include "arcane/utils/List.h"
19#include "arccore/common/internal/Property.h"
20#include "arcane/utils/internal/ApplicationInfoProperties.h"
31class ApplicationInfoPrivate
71ApplicationInfo(
int* argc,
char*** argv,
const String& name,
const VersionInfo& aversion)
74, m_p(new ApplicationInfoPrivate(CommandLineArguments(argc,argv),name,aversion))
125 m_p =
new ApplicationInfoPrivate(*rhs.m_p);
144void ApplicationInfo::
147 m_argc = m_p->m_command_line_args.commandLineArgc();
148 m_argv = m_p->m_command_line_args.commandLineArgv();
154void ApplicationInfo::
159 m_p->m_version_date =
"0";
160 m_p->m_data_os_dir = String();
161 m_p->m_data_dir = String();
166 m_p->m_code_name = s;
168 m_p->m_code_name = name;
184 m_p->m_data_os_dir = s;
188 m_p->m_data_os_dir = s;
203 m_p->m_target_full_name =
"TargetUnknown";
206 m_p->m_is_debug =
true;
208 m_p->m_is_debug =
false;
218 return m_p->m_application_name;
227 return m_p->m_version;
236 return m_p->m_data_os_dir;
242 m_p->m_data_os_dir = v;
251 return m_p->m_data_dir;
269 return m_p->m_version.versionMajor();
278 return m_p->m_version.versionMinor();
287 return m_p->m_version.versionPatch();
296 return m_p->m_is_debug;
305 return m_p->m_code_name;
314 return m_p->m_target_full_name;
320int* ApplicationInfo::
321commandLineArgc()
const
329char*** ApplicationInfo::
330commandLineArgv()
const
341 m_p->m_command_line_args.fillArgs(aargs);
350 m_p->m_dynamic_libraries_name.add(lib_name);
359 return m_p->m_dynamic_libraries_name;
368 return m_p->m_command_line_args;
377 m_p->m_application_name = v;
395 m_p->m_code_name = code_name;
404 m_p->m_command_line_args = aargs;
423 m_p->m_runtime_config_file_content = content;
432 return m_p->m_runtime_config_file_content;
441 m_p->m_command_line_args.addParameterLine(line);
450template<
typename V>
void ApplicationInfoProperties::
451_applyPropertyVisitor(V& p)
453 auto b = p.builder();
455 p << b.addString(
"CodeName")
456 .addDescription(
"Name of the code")
457 .addGetter([](
auto a) {
return a.x.codeName(); })
458 .addSetter([](
auto a) { a.x.setCodeName(a.v); });
460 p << b.addString(
"DataDir")
461 .addDescription(
"Directory containing os independant files")
462 .addGetter([](
auto a) {
return a.x.dataDir(); })
463 .addSetter([](
auto a) { a.x.setDataDir(a.v); });
465 p << b.addString(
"DataOsDir")
466 .addDescription(
"Directory containing os dependant files")
467 .addGetter([](
auto a) {
return a.x.dataOsDir(); })
468 .addSetter([](
auto a) { a.x.setDataOsDir(a.v); });
470 p << b.addBool(
"Debug")
471 .addDescription(
"Indicate if debug mode is active")
472 .addGetter([](
auto a) {
return a.x.isDebug(); })
473 .addSetter([](
auto a) { a.x.setIsDebug(a.v); });
475 p << b.addString(
"CodeVersion")
476 .addDescription(
"Version (x.y.z) of the code")
477 .addSetter([](
auto a) { a.x.setCodeVersion(
VersionInfo(a.v)); })
478 .addGetter([](
auto a) {
return a.x.codeVersion().versionAsString(); });
480 p << b.addStringList(
"DynamicLibraries")
481 .addDescription(
"Dynamic libraries to load at startup")
482 .addSetter([](
auto a)
485 a.x.addDynamicLibrary(s);
487 .addGetter([](
auto a) {
return a.x.dynamicLibrariesName(); });
493ARCANE_REGISTER_PROPERTY_CLASS(ApplicationInfoProperties,());
String m_target_full_name
Full target name.
bool m_is_debug
true if it is a debug version.
String m_data_os_dir
Directory of OS-dependent config files.
String m_data_dir
Directory of common config files.
VersionInfo m_version
Version number.
String m_version_date
Version date.
String m_code_name
Code name.
String m_application_name
Application name.
const String & dataDir() const
Returns the path where data files are located.
const String & codeName() const
Returns the name of the calculation code linked to the application.
void setCommandLineArguments(const CommandLineArguments &args)
Sets the command line arguments.
int * m_argc
Number of command line arguments.
void addParameterLine(const String &line)
Adds an Arcane parameter to the command line.
void setCodeVersion(const VersionInfo &version_info)
Sets the version number.
ByteConstSpan runtimeConfigFileContent() const
Application configuration file content.
void setDataDir(const String &v)
Sets the path where data files are located.
void setIsDebug(bool v)
Sets the debug state.
const String & applicationName() const
Application name.
void addDynamicLibrary(const String &lib_name)
Adds the library lib_name to the list of dynamically loaded libraries.
int versionMajor() const
Returns the major version number of the application.
int versionMinor() const
Returns the minor version number of the application.
const String & targetFullName() const
Returns the full target name.
const CommandLineArguments & commandLineArguments() const
Command line arguments.
void args(StringList &args) const
Fills args with command line arguments.
const VersionInfo & codeVersion() const
Version number.
const VersionInfo & version() const
Version number.
char *** m_argv
Array of command line arguments.
int versionPatch() const
Returns the patch version number of the application.
void setApplicationName(const String &v)
Sets the application name.
bool isDebug() const
Returns true if running in debug mode.
void setRuntimeConfigFileContent(ByteConstSpan content)
Sets the application configuration file content.
const String & dataOsDir() const
Returns the path where OS-dependent data files are located.
void setDataOsDir(const String &v)
Sets the path where OS-dependent data files are located.
StringCollection dynamicLibrariesName() const
List of dynamic libraries.
void setCodeName(const String &code_name)
Sets the code name.
Unicode character string.
1D data vector with value semantics (STL style).
Information about a version.
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
Collection< String > StringCollection
Collection of strings.
List< String > StringList
Unicode string list.
Span< const std::byte > ByteConstSpan
Read-only view of a 1D array of characters.