Documentation for OpenFLUID 2.2.2
Loading...
Searching...
No Matches
SimulatorSignature.hpp
Go to the documentation of this file.
1/*
2
3 This file is part of OpenFLUID software
4 Copyright(c) 2021-2026, INRAE
5
6
7 == GNU General Public License Usage ==
8
9 OpenFLUID is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
13
14 OpenFLUID is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with OpenFLUID. If not, see <http://www.gnu.org/licenses/>.
21
22
23 == Other Usage ==
24
25 Other Usage means a use of OpenFLUID that is inconsistent with the GPL
26 license, and requires a written agreement between You and INRA.
27 Licensees for Other Usage of OpenFLUID may use this file in accordance
28 with the terms contained in the written agreement between You and INRA.
29
30*/
31
32
33/**
34 @file SimulatorSignature.hpp
35
36 @author Jean-Christophe FABRE <jean-christophe.fabre@inra.fr>
37 @author Armel THÖNI <armel.thoni@inrae.fr>
38*/
39
40
41#ifndef __OPENFLUID_WARE_SIMULATORSIGNATURE_HPP__
42#define __OPENFLUID_WARE_SIMULATORSIGNATURE_HPP__
43
44
45#include <string>
46
47#include <openfluid/config.hpp>
49#include <openfluid/core/TypeDefs.hpp>
53
54
55namespace openfluid { namespace ware {
56
58{
59 public:
60
63
65 const std::string& D, const std::string& SI) :
66 SignatureSpatialDataItem(N,U,D,SI,openfluid::tools::extractVariableNameAndType)
67 { }
68
70 const std::string& D, const std::string& SI, openfluid::core::Value::Type T) :
71 SignatureSpatialDataItem(N,U,D,SI,T,openfluid::tools::isValidVariableName)
72 { }
73};
74
75
76// =====================================================================
77// =====================================================================
78
79
80/**
81 Class for storage of the definition of the data handled by the simulator. This is part of the signature.
82*/
84{
85 public:
86
87
88 std::vector<SignatureSpatialDataItem> ProducedVars;
89
90 std::vector<SignatureSpatialDataItem> UpdatedVars;
91
92 std::vector<SignatureSpatialDataItem> ProducedAttributes;
93
94 std::vector<openfluid::core::UnitsClass_t> UsedEventsOnUnits; // TODO add description to units class events?
95
96
98 {
99 clear();
100 }
101
102
103 void clear()
104 {
105 ProducedVars.clear();
106 UpdatedVars.clear();
107 ProducedAttributes.clear();
108 UsedEventsOnUnits.clear();
109 }
110
111};
112
113
114// =====================================================================
115// =====================================================================
116
117
118/**
119 Class for storage of the definition of spatial units handled by the simulator.
120*/
122{
123 public:
124
126
127 std::string Description;
128
130 UnitsClass(""),Description("")
131 { }
132
133 SignatureUnitsClassItem(const openfluid::core::UnitsClass_t& UClass,const std::string& DDescription) :
134 UnitsClass(UClass),Description(DDescription)
135 { }
136};
137
138
139// =====================================================================
140// =====================================================================
141
142
144{
145 public:
146
147 std::string UpdatedUnitsGraph;
148
149 std::vector<SignatureUnitsClassItem> UpdatedUnitsClasses;
150
151
153 {
154 clear();
155 }
156
157
158 void clear()
159 {
160 UpdatedUnitsGraph.clear();
161 UpdatedUnitsClasses.clear();
162 }
163};
164
165
166// =====================================================================
167// =====================================================================
168
169
171{
172 public:
173
174 enum class SchedulingType { UNDEFINED, DEFAULT, FIXED, RANGE };
175
177
179
181
182
184 {
185 setAsUndefined();
186 }
187
189 {
190 Type = SchedulingType::UNDEFINED;
191 Min = 0;
192 Max = 0;
193 }
194
196 {
197 Type = SchedulingType::DEFAULT;
198 Min = 0;
199 Max = 0;
200 }
201
203 {
204 Type = SchedulingType::FIXED;
205 Min = Val;
206 Max = Val;
207 }
208
210 {
211 Type = SchedulingType::RANGE;
212 Min = MinVal;
213 Max = MaxVal;
214 }
215
216 std::string getTypeAsString() const
217 {
218 if (Type == SchedulingType::DEFAULT)
219 {
220 return "default";
221 }
222 else if (Type == SchedulingType::FIXED)
223 {
224 return "fixed";
225 }
226 else if (Type == SchedulingType::RANGE)
227 {
228 return "range";
229 }
230 return "undefined";
231 }
232
233 void setTypeFromString(const std::string& ST)
234 {
235 Type = SchedulingType::UNDEFINED;
236
237 if (ST == "default")
238 {
239 Type = SchedulingType::DEFAULT;
240 }
241 else if (ST == "fixed")
242 {
243 Type = SchedulingType::FIXED;
244 }
245 else if (ST == "range")
246 {
247 Type = SchedulingType::RANGE;
248 }
249 }
250};
251
252
253// =====================================================================
254// =====================================================================
255
256
257/**
258 Class encapsulating the plugin signature,
259 returned from the plugin to the host app for registering
260*/
262{
263
264 public:
265
267
268 virtual WareType getType() const
269 {
270 return WareType::SIMULATOR;
271 }
272
273 /**
274 Handled units graph
275 */
277
278 /**
279 Time scheduling
280 */
282
283
285 {
286 clear();
287 }
288
289 virtual ~SimulatorSignature() = default;
290
291 void clear()
292 {
293 DataWareSignature::clear();
294 HandledUnitsGraph.clear();
295 TimeScheduling.setAsUndefined();
296 }
297};
298
299
300} } // namespaces
301
302
303#endif /* __OPENFLUID_WARE_SIMULATORSIGNATURE_HPP__ */
Type
Definition Value.hpp:66
Definition WareSignature.hpp:338
Definition WareSignature.hpp:263
Definition SimulatorSignature.hpp:171
void setAsFixed(openfluid::core::Duration_t Val)
Definition SimulatorSignature.hpp:202
std::string getTypeAsString() const
Definition SimulatorSignature.hpp:216
void setAsDefaultDeltaT()
Definition SimulatorSignature.hpp:195
SignatureTimeScheduling()
Definition SimulatorSignature.hpp:183
void setTypeFromString(const std::string &ST)
Definition SimulatorSignature.hpp:233
openfluid::core::Duration_t Min
Definition SimulatorSignature.hpp:178
SchedulingType
Definition SimulatorSignature.hpp:174
void setAsRange(openfluid::core::Duration_t MinVal, openfluid::core::Duration_t MaxVal)
Definition SimulatorSignature.hpp:209
openfluid::core::Duration_t Max
Definition SimulatorSignature.hpp:180
SchedulingType Type
Definition SimulatorSignature.hpp:176
void setAsUndefined()
Definition SimulatorSignature.hpp:188
Definition SimulatorSignature.hpp:122
openfluid::core::UnitsClass_t UnitsClass
Definition SimulatorSignature.hpp:125
SignatureUnitsClassItem(const openfluid::core::UnitsClass_t &UClass, const std::string &DDescription)
Definition SimulatorSignature.hpp:133
SignatureUnitsClassItem()
Definition SimulatorSignature.hpp:129
std::string Description
Definition SimulatorSignature.hpp:127
Definition SimulatorSignature.hpp:144
std::string UpdatedUnitsGraph
Definition SimulatorSignature.hpp:147
void clear()
Definition SimulatorSignature.hpp:158
std::vector< SignatureUnitsClassItem > UpdatedUnitsClasses
Definition SimulatorSignature.hpp:149
SignatureUnitsGraph()
Definition SimulatorSignature.hpp:152
Definition SimulatorSignature.hpp:58
SignatureVariableItem(const std::string &N, const openfluid::core::UnitsClass_t &U, const std::string &D, const std::string &SI)
Definition SimulatorSignature.hpp:64
SignatureVariableItem()
Definition SimulatorSignature.hpp:61
SignatureVariableItem(const std::string &N, const openfluid::core::UnitsClass_t &U, const std::string &D, const std::string &SI, openfluid::core::Value::Type T)
Definition SimulatorSignature.hpp:69
Definition SimulatorSignature.hpp:84
std::vector< SignatureSpatialDataItem > ProducedVars
Definition SimulatorSignature.hpp:88
std::vector< SignatureSpatialDataItem > UpdatedVars
Definition SimulatorSignature.hpp:90
std::vector< SignatureSpatialDataItem > ProducedAttributes
Definition SimulatorSignature.hpp:92
void clear()
Definition SimulatorSignature.hpp:103
std::vector< openfluid::core::UnitsClass_t > UsedEventsOnUnits
Definition SimulatorSignature.hpp:94
SimulatorSignatureHandledData()
Definition SimulatorSignature.hpp:97
Definition SimulatorSignature.hpp:262
SignatureTimeScheduling TimeScheduling
Definition SimulatorSignature.hpp:281
virtual WareType getType() const
Definition SimulatorSignature.hpp:268
SimulatorSignatureHandledData SimulatorHandledData
Definition SimulatorSignature.hpp:266
SimulatorSignature()
Definition SimulatorSignature.hpp:284
void clear()
Definition SimulatorSignature.hpp:291
SignatureUnitsGraph HandledUnitsGraph
Definition SimulatorSignature.hpp:276
#define OPENFLUID_API
Definition dllexport.hpp:86
std::uint64_t Duration_t
Definition TypeDefs.hpp:312
std::string UnitsClass_t
Definition TypeDefs.hpp:98
WareType
Definition TypeDefs.hpp:61
Definition ApplicationException.hpp:47