All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SimulationContributorWare.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 /**
34  \file SimulationContributorWare.hpp
35  \brief Header of ...
36 
37  \author Jean-Christophe FABRE <fabrejc@supagro.inra.fr>
38  */
39 
40 
41 #ifndef __SIMULATIONCONTRIBUTORWARE_HPP__
42 #define __SIMULATIONCONTRIBUTORWARE_HPP__
43 
44 #include <openfluid/dllexport.hpp>
46 
47 
48 namespace openfluid { namespace ware {
49 
50 
52 {
53  private:
54 
55  protected:
56 
57  /**
58  Sets attribute for a unit
59  @param[in] UnitPtr a Unit
60  @param[in] AttrName the name of the set attribute
61  @param[in] Val the value of the set attribute
62  */
63  void OPENFLUID_SetAttribute(openfluid::core::Unit *UnitPtr,
64  const openfluid::core::AttributeName_t& AttrName,
65  const openfluid::core::Value& Val);
66 
67  /**
68  Sets attribute for a unit, as a double
69  @param[in] UnitPtr a Unit
70  @param[in] AttrName the name of the set attribute
71  @param[in] Val the value of the set attribute
72  */
73  void OPENFLUID_SetAttribute(openfluid::core::Unit *UnitPtr,
74  const openfluid::core::AttributeName_t& AttrName,
75  const double& Val);
76 
77  /**
78  Sets attribute for a unit, as a long integer
79  @param[in] UnitPtr a Unit
80  @param[in] AttrName the name of the set attribute
81  @param[in] Val the value of the set attribute
82  */
83  void OPENFLUID_SetAttribute(openfluid::core::Unit *UnitPtr,
84  const openfluid::core::AttributeName_t& AttrName,
85  const long& Val);
86 
87  /**
88  Sets attribute for a unit, as a string
89  @param[in] UnitPtr a Unit
90  @param[in] AttrName the name of the set attribute
91  @param[out] Val the value of the set attribute
92  */
93  void OPENFLUID_SetAttribute(openfluid::core::Unit *UnitPtr,
94  const openfluid::core::AttributeName_t& AttrName,
95  const std::string& Val);
96 
97 
98  /**
99  Initializes a distributed variable value for a unit
100  @param[in] UnitPtr a Unit
101  @param[in] VarName the name of the variable
102  @param[in] Val the added value of the variable
103  @deprecated
104  */
105  void OPENFLUID_InitializeVariable(openfluid::core::Unit *UnitPtr,
106  const openfluid::core::VariableName_t& VarName,
107  const openfluid::core::Value& Val);
108 
109  /**
110  Initializes a distributed variable value for a unit
111  @param[in] aUnit a Unit
112  @param[in] VarName the name of the variable
113  @param[in] Val the added value of the variable
114  */
115  void OPENFLUID_InitializeVariable(openfluid::core::Unit& aUnit,
116  const openfluid::core::VariableName_t& VarName,
117  const openfluid::core::Value& Val);
118 
119  /**
120  Initializes a distributed double variable value for a unit
121  @param[in] UnitPtr a Unit
122  @param[in] VarName the name of the variable
123  @param[in] Val the added value of the variable (double)
124  */
125  void OPENFLUID_InitializeVariable(openfluid::core::Unit *UnitPtr,
126  const openfluid::core::VariableName_t& VarName,
127  const double& Val);
128 
129  /**
130  Initializes a distributed long variable value for a unit
131  @param[in] UnitPtr a Unit
132  @param[in] VarName the name of the variable
133  @param[in] Val the added value of the variable (long)
134  */
135  void OPENFLUID_InitializeVariable(openfluid::core::Unit *UnitPtr,
136  const openfluid::core::VariableName_t& VarName,
137  const long& Val);
138 
139  /**
140  Initializes a distributed boolean variable value for a unit
141  @param[in] UnitPtr a Unit
142  @param[in] VarName the name of the variable
143  @param[in] Val the added value of the variable (bool)
144  */
145  void OPENFLUID_InitializeVariable(openfluid::core::Unit *UnitPtr,
146  const openfluid::core::VariableName_t& VarName,
147  const bool& Val);
148 
149  /**
150  Initializes a distributed string variable value for a unit
151  @param[in] UnitPtr a Unit
152  @param[in] VarName the name of the variable
153  @param[in] Val the added value of the variable (string)
154  */
155  void OPENFLUID_InitializeVariable(openfluid::core::Unit *UnitPtr,
156  const openfluid::core::VariableName_t& VarName,
157  const std::string& Val);
158 
159  /**
160  Appends a distributed variable value for a unit at the end of the previously added values for this variable
161  @param[in] UnitPtr a Unit
162  @param[in] VarName the name of the variable
163  @param[in] Val the added value of the variable
164  @deprecated
165  */
166  void OPENFLUID_AppendVariable(openfluid::core::Unit *UnitPtr,
167  const openfluid::core::VariableName_t& VarName,
168  const openfluid::core::Value& Val);
169 
170  /**
171  Appends a distributed variable value for a unit at the end of the previously added values for this variable
172  @param[in] aUnit a Unit
173  @param[in] VarName the name of the variable
174  @param[in] Val the added value of the variable
175  */
176  void OPENFLUID_AppendVariable(openfluid::core::Unit& aUnit,
177  const openfluid::core::VariableName_t& VarName,
178  const openfluid::core::Value& Val);
179 
180  /**
181  Appends a distributed double variable value for a unit at the end of the previously added values for this variable
182  @param[in] UnitPtr a Unit
183  @param[in] VarName the name of the variable
184  @param[in] Val the added value of the variable (double)
185  */
186  void OPENFLUID_AppendVariable(openfluid::core::Unit *UnitPtr,
187  const openfluid::core::VariableName_t& VarName,
188  const double& Val);
189 
190  /**
191  Appends a distributed long variable value for a unit at the end of the previously added values for this variable
192  @param[in] UnitPtr a Unit
193  @param[in] VarName the name of the variable
194  @param[in] Val the added value of the variable (long)
195  */
196  void OPENFLUID_AppendVariable(openfluid::core::Unit *UnitPtr,
197  const openfluid::core::VariableName_t& VarName,
198  const long& Val);
199 
200  /**
201  Appends a distributed boolean variable value for a unit at the end of the previously added values for this variable
202  @param[in] UnitPtr a Unit
203  @param[in] VarName the name of the variable
204  @param[in] Val the added value of the variable (bool)
205  */
206  void OPENFLUID_AppendVariable(openfluid::core::Unit *UnitPtr,
207  const openfluid::core::VariableName_t& VarName,
208  const bool& Val);
209 
210  /**
211  Appends a distributed string variable value for a unit at the end of the previously added values for this variable
212  @param[in] UnitPtr a Unit
213  @param[in] VarName the name of the variable
214  @param[in] Val the added value of the variable (string)
215  */
216  void OPENFLUID_AppendVariable(openfluid::core::Unit *UnitPtr,
217  const openfluid::core::VariableName_t& VarName,
218  const std::string& Val);
219 
220 
221  /**
222  Sets a distributed variable value for a unit at the current time index
223  @param[in] UnitPtr a Unit
224  @param[in] VarName the name of the variable
225  @param[in] Val the added value of the variable
226  */
227  void OPENFLUID_SetVariable(openfluid::core::Unit *UnitPtr,
228  const openfluid::core::VariableName_t& VarName,
229  const openfluid::core::Value& Val);
230 
231  /**
232  Sets a distributed double variable value for a unit at the current time index
233  @param[in] UnitPtr a Unit
234  @param[in] VarName the name of the variable
235  @param[in] Val the added value of the variable (double)
236  */
237  void OPENFLUID_SetVariable(openfluid::core::Unit *UnitPtr,
238  const openfluid::core::VariableName_t& VarName,
239  const double& Val);
240 
241  /**
242  Sets a distributed double variable value for a unit at the current time index
243  @param[in] UnitPtr a Unit
244  @param[in] VarName the name of the variable
245  @param[in] Val the added value of the variable (long)
246  */
247  void OPENFLUID_SetVariable(openfluid::core::Unit *UnitPtr,
248  const openfluid::core::VariableName_t& VarName,
249  const long& Val);
250 
251  /**
252  Sets a distributed double variable value for a unit at the current time index
253  @param[in] UnitPtr a Unit
254  @param[in] VarName the name of the variable
255  @param[in] Val the added value of the variable (bool)
256  */
257  void OPENFLUID_SetVariable(openfluid::core::Unit *UnitPtr,
258  const openfluid::core::VariableName_t& VarName,
259  const bool& Val);
260 
261  /**
262  Sets a distributed double variable value for a unit at the current time index
263  @param[in] UnitPtr a Unit
264  @param[in] VarName the name of the variable
265  @param[in] Val the added value of the variable (string)
266  */
267  void OPENFLUID_SetVariable(openfluid::core::Unit *UnitPtr,
268  const openfluid::core::VariableName_t& VarName,
269  const std::string& Val);
270 
271  /**
272  Appends an event on a unit
273  @param[in] UnitPtr a Unit
274  @param[in] Ev the event to append
275  */
276  void OPENFLUID_AppendEvent(openfluid::core::Unit *UnitPtr,
278 
279 
280  /**
281  Adds a unit to the set of units if not already exists
282  @param[in] ClassName class name of the added unit
283  @param[in] ID ID of the added unit
284  @param[in] PcsOrder Process order of the added unit
285  */
286  void OPENFLUID_AddUnit(openfluid::core::UnitClass_t ClassName,
288  openfluid::core::PcsOrd_t PcsOrder);
289 
290  /**
291  Deletes a unit from the set of units if exists
292  @param[in] ClassName class name of the removed unit
293  @param[in] ID ID of the added unit
294  @return true if the unit has been correctly deleted
295  */
296  void OPENFLUID_DeleteUnit(openfluid::core::UnitClass_t ClassName,
298 
299 
300  /**
301  Adds a from-to connection between two units
302  @param[in] ClassNameFrom class name of the "from" unit
303  @param[in] IDFrom ID of the "from" unit
304  @param[in] ClassNameTo class name of the "to" unit
305  @param[in] IDTo ID of the "to" unit
306  @return false if the unit connection already exists
307  */
308  bool OPENFLUID_AddFromToConnection(openfluid::core::UnitClass_t ClassNameFrom,
310  openfluid::core::UnitClass_t ClassNameTo,
312 
313  /**
314  Adds a from-to connection between two units
315  @param[in] FromUnit pointer to the "from" unit
316  @param[in] ToUnit pointer to the "to" unit
317  @return false if the connection already exists
318  */
319  bool OPENFLUID_AddFromToConnection(openfluid::core::Unit* FromUnit,
320  openfluid::core::Unit* ToUnit);
321 
322  /**
323  Removes a from-to connection between two units
324  @param[in] ClassNameFrom class name of the "from" unit
325  @param[in] IDFrom ID of the "from" unit
326  @param[in] ClassNameTo class name of the "to" unit
327  @param[in] IDTo ID of the "to" unit
328  @return false if the unit connection does not exist
329  */
330  bool OPENFLUID_RemoveFromToConnection(openfluid::core::UnitClass_t ClassNameFrom,
332  openfluid::core::UnitClass_t ClassNameTo,
334 
335  /**
336  Removes a from-to connection between two units
337  @param[in] FromUnit pointer to the "from" unit
338  @param[in] ToUnit pointer to the "to" unit
339  @return false if the connection does not exist
340  */
341  bool OPENFLUID_RemoveFromToConnection(openfluid::core::Unit* FromUnit,
342  openfluid::core::Unit* ToUnit);
343 
344 
345  /**
346  Adds a child-parent connection between two units
347  @param[in] ClassNameChild class name of the "child" unit
348  @param[in] IDChild ID of the "child" unit
349  @param[in] ClassNameParent class name of the "parent" unit
350  @param[in] IDParent ID of the "parent" unit
351  @return false if the connection already exists
352  */
353  bool OPENFLUID_AddChildParentConnection(openfluid::core::UnitClass_t ClassNameChild,
355  openfluid::core::UnitClass_t ClassNameParent,
356  openfluid::core::UnitID_t IDParent);
357 
358  /**
359  Adds a child-parent connection between two units
360  @param[in] ChildUnit pointer to the "child" unit
361  @param[in] ParentUnit pointer to the "parent" unit
362  @return false if the connection already exists
363  */
364  bool OPENFLUID_AddChildParentConnection(openfluid::core::Unit* ChildUnit,
365  openfluid::core::Unit* ParentUnit);
366 
367 
368  /**
369  Removes a child-parent connection between two units
370  @param[in] ClassNameChild class name of the "child" unit
371  @param[in] IDChild ID of the "child" unit
372  @param[in] ClassNameParent class name of the "parent" unit
373  @param[in] IDParent ID of the "parent" unit
374  @return false if the connection does not exist
375  */
376  bool OPENFLUID_RemoveChildParentConnection(openfluid::core::UnitClass_t ClassNameChild,
378  openfluid::core::UnitClass_t ClassNameParent,
379  openfluid::core::UnitID_t IDParent);
380 
381  /**
382  Removes a child-parent connection between two units
383  @param[in] ChildUnit pointer to the "child" unit
384  @param[in] ParentUnit pointer to the "parent" unit
385  @return false if the connection does not exist
386  */
387  bool OPENFLUID_RemoveChildParentConnection(openfluid::core::Unit* ChildUnit,
388  openfluid::core::Unit* ParentUnit);
389 
390  /**
391  Builds a ColsNbr x RowsNbr unix matrix with bi-directionnal connections
392  @param[in] UnitsClass the name of units class
393  @param[in] ColsNbr the number of units on the X axis
394  @param[in] RowsNbr the number of units on the Y axis
395  */
396  void OPENFLUID_BuildUnitsMatrix(const openfluid::core::UnitClass_t& UnitsClass,
397  const unsigned int& ColsNbr,
398  const unsigned int& RowsNbr);
399 
401  {};
402 
403 
404  public:
405 
406 
408 
409 
410 };
411 
412 
413 
414 } } // openfluid::ware
415 
416 
417 
418 #endif /* __SIMULATIONCONTRIBUTORWARE_HPP__ */
std::string AttributeName_t
Definition: TypeDefs.hpp:74
std::string UnitClass_t
Definition: TypeDefs.hpp:69
WareType
Definition: PluggableWare.hpp:93
Definition: SimulationInspectorWare.hpp:55
Definition: SimulationContributorWare.hpp:51
unsigned int UnitID_t
Definition: TypeDefs.hpp:59
int PcsOrd_t
Definition: TypeDefs.hpp:64
virtual ~SimulationContributorWare()
Definition: SimulationContributorWare.hpp:407
Definition: Value.hpp:64
SimulationContributorWare(WareType WType)
Definition: SimulationContributorWare.hpp:400
std::string VariableName_t
Definition: TypeDefs.hpp:79
Class defining a discrete event, including attached information.
Definition: Event.hpp:61
Definition: Unit.hpp:107
#define DLLEXPORT
Definition: dllexport.hpp:51