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