Arcane  4.1.12.0
User documentation
Loading...
Searching...
No Matches
DotNetRuntimeInitialisationInfo.cc
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/* DotNetRuntimeInitialisationInfo.cc (C) 2000-2025 */
9/* */
10/* Information for the initialization of the '.Net' runtime. */
11/*---------------------------------------------------------------------------*/
12/*---------------------------------------------------------------------------*/
13
14#include "arcane/core/DotNetRuntimeInitialisationInfo.h"
15#include "arcane/core/internal/DotNetRuntimeInitialisationInfoProperties.h"
16
17#include "arcane/utils/String.h"
18#include "arccore/common/internal/Property.h"
19
20/*---------------------------------------------------------------------------*/
21/*---------------------------------------------------------------------------*/
22
23namespace Arcane
24{
25
26/*---------------------------------------------------------------------------*/
27/*---------------------------------------------------------------------------*/
28
30{
31 public:
32
33 bool m_is_using_dotnet_runtime = false;
34 String m_main_assembly_name;
35 String m_execute_method_name;
36 String m_execute_class_name;
37 String m_embedded_runtime;
38};
39
40/*---------------------------------------------------------------------------*/
41/*---------------------------------------------------------------------------*/
42
43template <typename V> void DotNetRuntimeInitialisationInfoProperties::
44_applyPropertyVisitor(V& p)
45{
46 auto b = p.builder();
47 p << b.addString("MainAssemblyName")
48 .addDescription("Name of the assembly to load at startup")
49 .addCommandLineArgument("DotNetMainAssemblyName")
50 .addGetter([](auto a) { return a.x.mainAssemblyName(); })
51 .addSetter([](auto a) { a.x.setMainAssemblyName(a.v); });
52
53 p << b.addString("ExecuteMethodName")
54 .addDescription("Name of the method to execute")
55 .addCommandLineArgument("DotNetExecuteMethodName")
56 .addGetter([](auto a) { return a.x.executeMethodName(); })
57 .addSetter([](auto a) { a.x.setExecuteMethodName(a.v); });
58
59 p << b.addString("ExecuteClassName")
60 .addDescription("Name of the class containing the methode to execute")
61 .addCommandLineArgument("DotNetExecuteClassName")
62 .addGetter([](auto a) { return a.x.executeClassName(); })
63 .addSetter([](auto a) { a.x.setExecuteClassName(a.v); });
64
65 p << b.addString("EmbeddedRuntime")
66 .addDescription("Name of the dotnet runtime ('coreclr', 'mono') to use")
67 .addCommandLineArgument("DotNetEmbeddedRuntime")
68 .addGetter([](auto a) { return a.x.embeddedRuntime(); })
69 .addSetter([](auto a) { a.x.setEmbeddedRuntime(a.v); });
70
71 p << b.addBool("UsingDotNet")
72 .addDescription("Set/Unset the loading of the '.Net' runtime with 'coreclr'")
73 .addCommandLineArgument("UsingDotNet")
74 .addGetter([](auto a) { return a.x.isUsingDotNetRuntime(); })
75 .addSetter([](auto a) {
76 a.x.setIsUsingDotNetRuntime(a.v);
77 a.x.setEmbeddedRuntime("coreclr");
78 });
79}
80
81/*---------------------------------------------------------------------------*/
82/*---------------------------------------------------------------------------*/
83
84DotNetRuntimeInitialisationInfo::
85DotNetRuntimeInitialisationInfo()
86: m_p(new Impl())
87{
88}
89
90/*---------------------------------------------------------------------------*/
91/*---------------------------------------------------------------------------*/
92
93DotNetRuntimeInitialisationInfo::
94DotNetRuntimeInitialisationInfo(const DotNetRuntimeInitialisationInfo& rhs)
95: m_p(new Impl(*rhs.m_p))
96{
97}
98
99/*---------------------------------------------------------------------------*/
100/*---------------------------------------------------------------------------*/
101
102DotNetRuntimeInitialisationInfo& DotNetRuntimeInitialisationInfo::
103operator=(const DotNetRuntimeInitialisationInfo& rhs)
104{
105 if (&rhs != this) {
106 delete m_p;
107 m_p = new Impl(*(rhs.m_p));
108 }
109 return (*this);
110}
111
112/*---------------------------------------------------------------------------*/
113/*---------------------------------------------------------------------------*/
114
115DotNetRuntimeInitialisationInfo::
116~DotNetRuntimeInitialisationInfo()
117{
118 delete m_p;
119}
120
121/*---------------------------------------------------------------------------*/
122/*---------------------------------------------------------------------------*/
123
124/*---------------------------------------------------------------------------*/
125/*---------------------------------------------------------------------------*/
126
127bool DotNetRuntimeInitialisationInfo::
128isUsingDotNetRuntime() const
129{
130 return m_p->m_is_using_dotnet_runtime;
131}
132
133void DotNetRuntimeInitialisationInfo::
134setIsUsingDotNetRuntime(bool v)
135{
136 m_p->m_is_using_dotnet_runtime = v;
137}
138
139/*---------------------------------------------------------------------------*/
140/*---------------------------------------------------------------------------*/
141
142String DotNetRuntimeInitialisationInfo::
143mainAssemblyName() const
144{
145 return m_p->m_main_assembly_name;
146}
147
148void DotNetRuntimeInitialisationInfo::
149setMainAssemblyName(StringView v)
150{
151 m_p->m_main_assembly_name = v;
152 if (!v.empty())
153 setIsUsingDotNetRuntime(true);
154}
155
156/*---------------------------------------------------------------------------*/
157/*---------------------------------------------------------------------------*/
158
159String DotNetRuntimeInitialisationInfo::
160executeClassName() const
161{
162 return m_p->m_execute_class_name;
163}
164
165void DotNetRuntimeInitialisationInfo::
166setExecuteClassName(StringView v)
167{
168 m_p->m_execute_class_name = v;
169}
170
171/*---------------------------------------------------------------------------*/
172/*---------------------------------------------------------------------------*/
173
174String DotNetRuntimeInitialisationInfo::
175executeMethodName() const
176{
177 return m_p->m_execute_method_name;
178}
179
180void DotNetRuntimeInitialisationInfo::
181setExecuteMethodName(StringView v)
182{
183 m_p->m_execute_method_name = v;
184}
185
186/*---------------------------------------------------------------------------*/
187/*---------------------------------------------------------------------------*/
188
189String DotNetRuntimeInitialisationInfo::
190embeddedRuntime() const
191{
192 return m_p->m_embedded_runtime;
193}
194
197{
198 m_p->m_embedded_runtime = v;
199}
200
201/*---------------------------------------------------------------------------*/
202/*---------------------------------------------------------------------------*/
203
204ARCANE_REGISTER_PROPERTY_CLASS(DotNetRuntimeInitialisationInfoProperties, ());
205
206/*---------------------------------------------------------------------------*/
207/*---------------------------------------------------------------------------*/
208
209} // End namespace Arcane
210
211/*---------------------------------------------------------------------------*/
212/*---------------------------------------------------------------------------*/
void setEmbeddedRuntime(StringView name)
Runtime name for embedded mode ('mono' or 'coreclr').
View of a UTF-8 character string.
Definition StringView.h:44
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --