Arcane  4.1.12.0
User documentation
Loading...
Searching...
No Matches
IArcaneMain.h
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2026 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com)
4// See the top-level COPYRIGHT file for details.
5// SPDX-License-Identifier: Apache-2.0
6//-----------------------------------------------------------------------------
7/*---------------------------------------------------------------------------*/
8/* IArcaneMain.h (C) 2000-2025 */
9/* */
10/* Interface of the ArcaneMain class. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCANE_CORE_IARCANEMAIN_H
13#define ARCANE_CORE_IARCANEMAIN_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
18
19/*---------------------------------------------------------------------------*/
20/*---------------------------------------------------------------------------*/
21
22namespace Arcane
23{
24
25/*---------------------------------------------------------------------------*/
26/*---------------------------------------------------------------------------*/
27
28class ApplicationInfo;
30class IMainFactory;
33
34/*---------------------------------------------------------------------------*/
35/*---------------------------------------------------------------------------*/
36
37/*!
38 * \internal
39 * \brief Interface of the code management class.
40 *
41 This virtual class is used for the creation and initialization of instances
42 of code managers. It also controls the execution of a case.
43
44 An instance of this class is created via the method
45 IMainFactory::createArcaneMain(), called by
46 IMainFactory::arcaneMain().
47
48 * The implementation must at least take into account the following aspects.
49 * - Analyze the command line.
50 * - Create an instance of a supervisor (IMainFactory::createSuperMng()),
51 * build it (ISuperMng::build()) and initialize it (ISuperMng::initialize()).
52 * - Create an instance of the module loader (IMainFactory::createModuleLoader())
53 */
54class ARCANE_CORE_EXPORT IArcaneMain
55{
56 public:
57
58 //! Releases resources.
59 virtual ~IArcaneMain() {}
60
61 public:
62
63 /*!
64 * Retrieves the global instance.
65 *
66 * \warning The global instance is only available during the call to
67 * ArcaneMain::arcaneMain().
68 */
69 static IArcaneMain* arcaneMain();
70 /*!
71 * \internal.
72 */
73 static void setArcaneMain(IArcaneMain* arcane_main);
74
75 private:
76
77 static IArcaneMain* global_arcane_main;
78
79 public:
80
81 /*!
82 * \brief Constructs the class members.
83 * The instance is not usable until this method has been
84 * called. This method must be called before initialize().
85 * \warning This method must only be called once.
86 */
87 virtual void build() = 0;
88
89 /*!
90 * \brief Initializes the instance.
91 * The instance is not usable until this method has been
92 * called.
93 * \warning This method must only be called once.
94 */
95 virtual void initialize() = 0;
96
97 public:
98
99 /*! \brief Parses arguments.
100 *
101 * Recognized arguments must be removed from the list.
102 *
103 * \retval true if execution must stop,
104 * \retval false if it continues normally
105 */
106 virtual bool parseArgs(StringList args) = 0;
107
108 /*! \brief Starts execution.
109 * This method only returns when the program exits.
110 * \return the Arcane return code, 0 if everything is okay.
111 */
112 virtual int execute() = 0;
113
114 //! Performs the last operations before instance destruction
115 virtual void finalize() = 0;
116
117 //! Execution error code
118 virtual int errorCode() const = 0;
119
120 //! Sets the return code
121 virtual void setErrorCode(int errcode) = 0;
122
123 //! Performs an abort.
124 virtual void doAbort() = 0;
125
126 public:
127
128 //! Executable information
129 virtual const ApplicationInfo& applicationInfo() const = 0;
130
131 //! Information to build the IApplication instance.
132 virtual const ApplicationBuildInfo& applicationBuildInfo() const = 0;
133
134 //! .Net runtime initialization information.
136
137 //! Runtime initialization information for accelerators
139
140 //! Main factory
141 virtual IMainFactory* mainFactory() const = 0;
142
143 //! Application
144 virtual IApplication* application() const = 0;
145
146 public:
147
148 /*!
149 * \brief Indicates that certain objects are managed via a garbage collector.
150 */
151 virtual bool hasGarbageCollector() const = 0;
152
153 public:
154
155 //! List of registered service factories
157
158 //! List of registered module factories
160
161 public:
162
163 virtual void setDirectExecuteFunctor(IDirectSubDomainExecuteFunctor* f) = 0;
164};
165
166/*---------------------------------------------------------------------------*/
167/*---------------------------------------------------------------------------*/
168
169} // End namespace Arcane
170
171/*---------------------------------------------------------------------------*/
172/*---------------------------------------------------------------------------*/
173
174#endif
Declarations of Arcane's general types.
Information for constructing an instance of IApplication.
Application information.
Information for the initialization of the '.Net' runtime.
Application interface.
virtual IApplication * application() const =0
Application.
virtual void finalize()=0
Performs the last operations before instance destruction.
virtual void initialize()=0
Initializes the instance. The instance is not usable until this method has been called.
virtual int execute()=0
Starts execution. This method only returns when the program exits.
virtual ~IArcaneMain()
Releases resources.
Definition IArcaneMain.h:59
virtual ServiceFactoryInfoCollection registeredServiceFactoryInfos()=0
List of registered service factories.
virtual ModuleFactoryInfoCollection registeredModuleFactoryInfos()=0
List of registered module factories.
virtual bool hasGarbageCollector() const =0
Indicates that certain objects are managed via a garbage collector.
virtual const DotNetRuntimeInitialisationInfo & dotnetRuntimeInitialisationInfo() const =0
.Net runtime initialization information.
virtual const AcceleratorRuntimeInitialisationInfo & acceleratorRuntimeInitialisationInfo() const =0
Runtime initialization information for accelerators.
virtual const ApplicationInfo & applicationInfo() const =0
Executable information.
virtual void setErrorCode(int errcode)=0
Sets the return code.
virtual IMainFactory * mainFactory() const =0
Main factory.
virtual void doAbort()=0
Performs an abort.
virtual bool parseArgs(StringList args)=0
Parses arguments.
virtual int errorCode() const =0
Execution error code.
virtual void build()=0
Constructs the class members. The instance is not usable until this method has been called....
virtual const ApplicationBuildInfo & applicationBuildInfo() const =0
Information to build the IApplication instance.
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
Collection< IServiceFactoryInfo * > ServiceFactoryInfoCollection
Collection of service factory information.
List< String > StringList
Unicode string list.
Definition UtilsTypes.h:509
Collection< IModuleFactoryInfo * > ModuleFactoryInfoCollection
Collection of module factory information.