SimulatorSignatureMacros.hpp
Go to the documentation of this file.
1 /*
2 
3  This file is part of OpenFLUID software
4  Copyright(c) 2007, INRA - Montpellier SupAgro
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  @file SimulatorSignatureMacros.hpp
34 
35  @author Jean-Christophe FABRE <jean-christophe.fabre@supagro.inra.fr>
36 */
37 
38 
39 #ifndef __OPENFLUID_WARE_SIMULATORSIGNATUREMACROS_HPP__
40 #define __OPENFLUID_WARE_SIMULATORSIGNATUREMACROS_HPP__
41 
42 
44 
45 
46 /**
47  Macro for the beginning of definition of signature hook
48 */
49 #define BEGIN_SIMULATOR_SIGNATURE(id) \
50  extern "C" { \
51  OPENFLUID_PLUGIN openfluid::ware::SimulatorSignature* WARESIGNATURE_PROC_DECL() \
52  { \
53  openfluid::ware::SimulatorSignature* Signature = new openfluid::ware::SimulatorSignature(); \
54  Signature->setABIVersion(openfluid::config::VERSION_FULL); \
55  Signature->ID = (id);
56 
57 
58 /**
59  Macro for the end of definition of signature hook
60 */
61 #define END_SIMULATOR_SIGNATURE \
62  return Signature; \
63  } \
64  }
65 
66 
67 // =====================================================================
68 // =====================================================================
69 
70 
71 /**
72  Macro for declaration of the simulator application domain
73 */
74 #define DECLARE_DOMAIN(domain) Signature->Domain = domain;
75 
76 /**
77  Macro for declaration of the simulator application processes
78 */
79 #define DECLARE_PROCESS(process) Signature->Process = process;
80 
81 /**
82  Macro for declaration of the simulator application numerical method
83 */
84 #define DECLARE_METHOD(method) Signature->Method = method;
85 
86 
87 // =====================================================================
88 // =====================================================================
89 
90 
91 /**
92  Macro for declaration of an used simulator parameter
93  @param[in] name name of the parameter
94  @param[in] description description of the parameter
95  @param[in] unit unit of the parameter. Could be an empty string if there is no unit
96 */
97 #define DECLARE_USED_PARAMETER(name,description,unit) \
98  Signature->HandledData.UsedParams\
99  .push_back(openfluid::ware::SignatureDataItem((name),description,unit));
100 
101 /**
102  @deprecated Since version 2.1.0. Use #DECLARE_USED_PARAMETER instead
103 */
104 #define DECLARE_SIMULATOR_PARAM(name,description,unit) DECLARE_USED_PARAMETER(name,description,unit)
105 
106 
107 /**
108  Macro for declaration of a required simulator parameter
109  @param[in] name name of the parameter
110  @param[in] description description of the parameter
111  @param[in] unit unit of the parameter. Could be an empty string if there is no unit
112 */
113 #define DECLARE_REQUIRED_PARAMETER(name,description,unit) \
114  Signature->HandledData.RequiredParams\
115  .push_back(openfluid::ware::SignatureDataItem((name),description,unit));
116 
117 
118 // =====================================================================
119 // =====================================================================
120 
121 
122 /**
123  Macro for declaration of a produced variable
124  @param[in] name name of the variable
125  @param[in] uclass class of the concerned units
126  @param[in] description description of the variable
127  @param[in] unit unit of the variable. Could be an empty string if there is no unit
128 */
129 #define DECLARE_PRODUCED_VARIABLE(name,uclass,description,unit) \
130  Signature->HandledData.ProducedVars\
131  .push_back(openfluid::ware::SignatureTypedSpatialDataItem((name),uclass,description,unit));
132 
133 /**
134  @deprecated Since version 2.1.0. Use #DECLARE_PRODUCED_VARIABLE instead
135 */
136 #define DECLARE_PRODUCED_VAR(name,uclass,description,unit) DECLARE_PRODUCED_VARIABLE(name,uclass,description,unit)
137 
138 
139 /**
140  Macro for declaration of an updated variable
141  @param[in] name name of the variable
142  @param[in] uclass class of the concerned units
143  @param[in] description description of the variable
144  @param[in] unit unit of the variable. Could be an empty string if there is no unit
145 */
146 #define DECLARE_UPDATED_VARIABLE(name,uclass,description,unit) \
147  Signature->HandledData.UpdatedVars\
148  .push_back(openfluid::ware::SignatureTypedSpatialDataItem((name),uclass,description,unit));
149 
150 /**
151  @deprecated Since version 2.1.0. Use #DECLARE_UPDATED_VARIABLE instead
152 */
153 #define DECLARE_UPDATED_VAR(name,uclass,description,unit) DECLARE_UPDATED_VARIABLE(name,uclass,description,unit)
154 
155 
156 /**
157  Macro for declaration of a required variable
158  @param[in] name name of the variable
159  @param[in] uclass class of the concerned units
160  @param[in] description description of the variable
161  @param[in] unit unit of the variable. Could be an empty string if there is no unit
162 */
163 #define DECLARE_REQUIRED_VARIABLE(name,uclass,description,unit) \
164  Signature->HandledData.RequiredVars\
165  .push_back(openfluid::ware::SignatureTypedSpatialDataItem((name),uclass,description,unit));
166 
167 /**
168  @deprecated Since version 2.1.0. Use #DECLARE_REQUIRED_VARIABLE instead
169 */
170 #define DECLARE_REQUIRED_VAR(name,uclass,description,unit) DECLARE_REQUIRED_VARIABLE(name,uclass,description,unit)
171 
172 
173 /**
174  Macro for declaration of an used variable
175  @param[in] name name of the variable
176  @param[in] uclass class of the concerned units
177  @param[in] description description of the variable
178  @param[in] unit unit of the variable. Could be an empty string if there is no unit
179 */
180 #define DECLARE_USED_VARIABLE(name,uclass,description,unit) \
181  Signature->HandledData.UsedVars\
182  .push_back(openfluid::ware::SignatureTypedSpatialDataItem((name),uclass,description,unit));
183 
184 /**
185  @deprecated Since version 2.1.0. Use #DECLARE_USED_VARIABLE instead
186 */
187 #define DECLARE_USED_VAR(name,uclass,description,unit) DECLARE_USED_VARIABLE(name,uclass,description,unit)
188 
189 
190 /**
191  Macro for declaration of a produced attribute
192  @param[in] name name of the attribute
193  @param[in] uclass class of the concerned units
194  @param[in] description description of the attribute
195  @param[in] unit unit of the attribute. Could be an empty string if there is no unit
196 */
197 #define DECLARE_PRODUCED_ATTRIBUTE(name,uclass,description,unit) \
198  Signature->HandledData.ProducedAttribute\
199  .push_back(openfluid::ware::SignatureSpatialDataItem((name),uclass,description,unit));
200 
201 
202 /**
203  Macro for declaration of a required attribute
204  @param[in] name name of the attribute
205  @param[in] uclass class of the concerned units
206  @param[in] description description of the attribute
207  @param[in] unit unit of the attribute. Could be an empty string if there is no unit
208 */
209 #define DECLARE_REQUIRED_ATTRIBUTE(name,uclass,description,unit) \
210  Signature->HandledData.RequiredAttribute\
211  .push_back(openfluid::ware::SignatureSpatialDataItem((name),uclass,description,unit));
212 
213 
214 /**
215  Macro for declaration of a used attribute
216  @param[in] name name of the attribute
217  @param[in] uclass class of the concerned units
218  @param[in] description description of the attribute
219  @param[in] unit unit of the attribute. Could be an empty string if there is no unit
220 */
221 #define DECLARE_USED_ATTRIBUTE(name,uclass,description,unit) \
222  Signature->HandledData.UsedAttribute\
223  .push_back(openfluid::ware::SignatureSpatialDataItem((name),uclass,description,unit));
224 
225 
226 /**
227  Macro for declaration of used events
228  @param[in] uclass class of the concerned units
229 */
230 #define DECLARE_USED_EVENTS(uclass) Signature->HandledData.UsedEventsOnUnits.push_back(uclass);
231 
232 
233 /**
234  Macro for declaration of units graph modification
235  @param[in] description description of modification
236 
237 */
238 #define DECLARE_UPDATED_UNITSGRAPH(description) Signature->HandledUnitsGraph.UpdatedUnitsGraph = (description);
239 
240 
241 /**
242  Macro for declaration of units class creation or update
243  @param[in] uclass name of the created or updated class
244  @param[in] description description of the updated class
245 
246 */
247 #define DECLARE_UPDATED_UNITSCLASS(uclass,description) \
248  Signature->HandledUnitsGraph.UpdatedUnitsClass\
249  .push_back(openfluid::ware::SignatureUnitsClassItem(uclass,description));
250 
251 
252 /**
253  Macro for declaration of required file
254  @param[in] name name of the file
255 */
256 #define DECLARE_REQUIRED_EXTRAFILE(name) \
257  Signature->HandledData.RequiredExtraFiles.push_back(name);
258 
259 
260 /**
261  Macro for declaration of used file
262  @param[in] name name of the file
263 */
264 #define DECLARE_USED_EXTRAFILE(name) \
265  Signature->HandledData.UsedExtraFiles.push_back(name);
266 
267 
268 /**
269  Macro for declaration of time scheduling as undefined
270 */
271 #define DECLARE_SCHEDULING_UNDEFINED \
272  Signature->TimeScheduling.setAsUndefined();
273 
274 
275 /**
276  Macro for declaration of time scheduling as default delta T
277 */
278 #define DECLARE_SCHEDULING_DEFAULT \
279  Signature->TimeScheduling.setAsDefaultDeltaT();
280 
281 
282 /**
283  Macro for declaration of fixed time scheduling
284  @param[in] deltat fixed time scheduling value
285 */
286 #define DECLARE_SCHEDULING_FIXED(deltat) \
287  Signature->TimeScheduling.setAsFixed(deltat);
288 
289 
290 /**
291  Macro for declaration of range of time scheduling
292  @param[in] min minimal time scheduling value
293  @param[in] max maximal time scheduling value
294 */
295 #define DECLARE_SCHEDULING_RANGE(min,max) \
296  Signature->TimeScheduling.setAsRange(min,max);
297 
298 
299 
300 #endif /* __OPENFLUID_WARE_SIMULATORSIGNATUREMACROS_HPP__ */