SimulationInspectorWare.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 SimulationInspectorWare.hpp
35 
36  @author Jean-Christophe FABRE <jean-christophe.fabre@inra.fr>
37  */
38 
39 
40 #ifndef __OPENFLUID_WARE_SIMULATIONINSPECTORWARE_HPP__
41 #define __OPENFLUID_WARE_SIMULATIONINSPECTORWARE_HPP__
42 
43 
44 #include <openfluid/dllexport.hpp>
50 
51 
52 namespace openfluid { namespace ware {
53 
54 
56 {
57  private:
58 
59  static bool IsUnitIDInPtrList(const openfluid::core::UnitsPtrList_t* UnitsList,
60  const openfluid::core::UnitID_t& ID);
61 
62 
63  openfluid::core::Datastore* mp_Datastore;
64 
65 
66  protected:
67 
68  // TODO check if const
69  /**
70  Pointer to the spatial graph. It should be used with care. Prefer using the OPENFLUID_Xxxx methods.
71  */
73 
74 
75  virtual bool isLinked() const
76  {
77  return (SimulationDrivenWare::isLinked() && mp_SpatialData != nullptr && mp_Datastore != nullptr);
78  }
79 
80 
81  /**
82  Returns true if a distributed attribute exists, false otherwise
83  @param[in] UnitPtr a Unit
84  @param[in] AttrName the name of the queried attribute
85 
86  @cond OpenFLUID:completion
87  {
88  "contexts" : ["SIMULATOR", "OBSERVER"],
89  "menupath" : ["Compute code", "Attributes"],
90  "title" : "Test if an attribute exists",
91  "text" : "OPENFLUID_IsAttributeExist(%%SEL_START%%UnitPtr%%SEL_END%%,\"attrname\")"
92  }
93  @endcond
94  */
95  bool OPENFLUID_IsAttributeExist(const openfluid::core::SpatialUnit *UnitPtr,
96  const openfluid::core::AttributeName_t& AttrName) const;
97 
98  /**
99  Gets attribute for a unit
100  @param[in] UnitPtr a Unit
101  @param[in] AttrName the name of the requested attribute
102  @param[out] Val the value of the requested attribute
103 
104  @cond OpenFLUID:completion
105  {
106  "contexts" : ["SIMULATOR", "OBSERVER"],
107  "menupath" : ["Compute code", "Attributes"],
108  "title" : "Get attribute value",
109  "text" : "OPENFLUID_GetAttribute(%%SEL_START%%UnitPtr%%SEL_END%%,\"attrname\",Val)"
110  }
111  @endcond
112  */
113  void OPENFLUID_GetAttribute(const openfluid::core::SpatialUnit *UnitPtr,
114  const openfluid::core::AttributeName_t& AttrName,
115  openfluid::core::Value& Val) const;
116 
117  /**
118  Gets attribute for a unit, as a double
119  @param[in] UnitPtr a Unit
120  @param[in] AttrName the name of the requested attribute
121  @param[out] Val the value of the requested attribute
122  */
123  void OPENFLUID_GetAttribute(const openfluid::core::SpatialUnit *UnitPtr,
124  const openfluid::core::AttributeName_t& AttrName,
125  double& Val) const;
126 
127  /**
128  Gets attribute for a unit, as a long integer
129  @param[in] UnitPtr a Unit
130  @param[in] AttrName the name of the requested attribute
131  @param[out] Val the value of the requested attribute
132  */
133  void OPENFLUID_GetAttribute(const openfluid::core::SpatialUnit *UnitPtr,
134  const openfluid::core::AttributeName_t& AttrName,
135  long& Val) const;
136 
137  /**
138  Gets attribute for a unit, as a string
139  @param[in] UnitPtr a Unit
140  @param[in] AttrName the name of the requested attribute
141  @param[out] Val the value of the requested attribute
142  */
143  void OPENFLUID_GetAttribute(const openfluid::core::SpatialUnit *UnitPtr,
144  const openfluid::core::AttributeName_t& AttrName,
145  std::string& Val) const;
146 
147  /**
148  Returns attribute for a unit, as a StringValue
149  @param[in] UnitPtr a Unit
150  @param[in] AttrName the name of the requested attribute
151  @return constant pointer to the value of the requested attribute
152 
153  @cond OpenFLUID:completion
154  {
155  "contexts" : ["SIMULATOR", "OBSERVER"],
156  "menupath" : ["Compute code", "Attributes"],
157  "title" : "Get attribute value (by return)",
158  "text" : "OPENFLUID_GetAttribute(%%SEL_START%%UnitPtr%%SEL_END%%,\"attrname\")"
159  }
160  @endcond
161  */
162  const openfluid::core::Value* OPENFLUID_GetAttribute(const openfluid::core::SpatialUnit *UnitPtr,
163  const openfluid::core::AttributeName_t& AttrName) const;
164 
165  /**
166  Returns true if a distributed variable exists, false otherwise
167  @param[in] UnitPtr a Unit
168  @param[in] VarName the name of the requested variable
169 
170  @cond OpenFLUID:completion
171  {
172  "contexts" : ["SIMULATOR", "OBSERVER"],
173  "menupath" : ["Compute code", "Variables"],
174  "title" : "Test if a variable exists",
175  "text" : "OPENFLUID_IsVariableExist(%%SEL_START%%UnitPtr%%SEL_END%%,\"varname\")"
176  }
177  @endcond
178  */
179  bool OPENFLUID_IsVariableExist(const openfluid::core::SpatialUnit *UnitPtr,
180  const openfluid::core::VariableName_t& VarName) const;
181 
182  /**
183  Returns true if a distributed variable exists and if a value has been set for the given index, false otherwise
184  @param[in] UnitPtr a Unit
185  @param[in] VarName the name of the requested variable
186  @param[in] Index the time index for the value of the variable
187 
188  @cond OpenFLUID:completion
189  {
190  "contexts" : ["SIMULATOR", "OBSERVER"],
191  "menupath" : ["Compute code", "Variables"],
192  "title" : "Test if a variable exists and has a value on given time index",
193  "text" : "OPENFLUID_IsVariableExist(%%SEL_START%%UnitPtr%%SEL_END%%,\"varname\",TimeIndex)"
194  }
195  @endcond
196  */
197  bool OPENFLUID_IsVariableExist(const openfluid::core::SpatialUnit *UnitPtr,
198  const openfluid::core::VariableName_t& VarName,
199  const openfluid::core::TimeIndex_t Index) const;
200 
201  /**
202  Returns true if a distributed variable exists and if a value has been set for the given index
203  and if the value type is the given type, false otherwise
204  @param[in] UnitPtr a Unit
205  @param[in] VarName the name of the requested variable
206  @param[in] Index the time index for the value of the variable
207  @param[in] ValueType the type of the value
208 
209  @cond OpenFLUID:completion
210  {
211  "contexts" : ["SIMULATOR", "OBSERVER"],
212  "menupath" : ["Compute code", "Variables"],
213  "title" : "Test if a variable exists and has a value of given type on given time index",
214  "text" : "OPENFLUID_IsVariableExist(%%SEL_START%%UnitPtr%%SEL_END%%,\"varname\",TimeIndex,Type)"
215  }
216  @endcond
217  */
218  bool OPENFLUID_IsVariableExist(const openfluid::core::SpatialUnit *UnitPtr,
219  const openfluid::core::VariableName_t& VarName,
220  const openfluid::core::TimeIndex_t Index,
221  const openfluid::core::Value::Type ValueType) const;
222 
223  /**
224  Returns true if a distributed variable exists
225  and if the type set for this variable is the given type, false otherwise
226  @param[in] UnitPtr a Unit
227  @param[in] VarName the name of the requested variable
228  @param[in] VarType the type of the variable
229 
230  @cond OpenFLUID:completion
231  {
232  "contexts" : ["SIMULATOR", "OBSERVER"],
233  "menupath" : ["Compute code", "Variables"],
234  "title" : "Test if a variable exists with given type",
235  "text" : "OPENFLUID_IsTypedVariableExist(%%SEL_START%%UnitPtr%%SEL_END%%,\"varname\",Type)"
236  }
237  @endcond
238  */
239  bool OPENFLUID_IsTypedVariableExist(const openfluid::core::SpatialUnit *UnitPtr,
240  const openfluid::core::VariableName_t& VarName,
241  const openfluid::core::Value::Type VarType) const;
242 
243  /**
244  Returns true if a distributed variable exists and if a value has been set for the given index
245  and if the type set for this variable is the given type, false otherwise
246  @param[in] UnitPtr a Unit
247  @param[in] VarName the name of the requested variable
248  @param[in] Index the time index for the value of the variable
249  @param[in] VarType the type of the variable
250 
251  @cond OpenFLUID:completion
252  {
253  "contexts" : ["SIMULATOR", "OBSERVER"],
254  "menupath" : ["Compute code", "Variables"],
255  "title" : "Test if a variable exists with given type and has a value on given time index",
256  "text" : "OPENFLUID_IsTypedVariableExist(%%SEL_START%%UnitPtr%%SEL_END%%,\"varname\",TimeIndex,Type)"
257  }
258  @endcond
259  */
260  bool OPENFLUID_IsTypedVariableExist(const openfluid::core::SpatialUnit *UnitPtr,
261  const openfluid::core::VariableName_t& VarName,
262  const openfluid::core::TimeIndex_t Index,
263  const openfluid::core::Value::Type VarType) const;
264 
265  /**
266  Gets the distributed variable value for a unit at a time index
267  @param[in] UnitPtr a Unit
268  @param[in] VarName the name of the requested variable
269  @param[in] Index the time index for the value of the requested variable
270  @param[out] Val the value of the requested variable
271 
272  @cond OpenFLUID:completion
273  {
274  "contexts" : ["SIMULATOR", "OBSERVER"],
275  "menupath" : ["Compute code", "Variables"],
276  "title" : "Get variable value on given time index",
277  "text" : "OPENFLUID_GetVariable(%%SEL_START%%UnitPtr%%SEL_END%%,\"varname\",TimeIndex,Val)"
278  }
279  @endcond
280  */
281  void OPENFLUID_GetVariable(const openfluid::core::SpatialUnit* UnitPtr,
282  const openfluid::core::VariableName_t& VarName,
283  const openfluid::core::TimeIndex_t Index,
284  openfluid::core::Value& Val) const;
285 
286  /**
287  Gets the distributed variable value for a unit at a time index
288  @param[in] UnitPtr a Unit
289  @param[in] VarName the name of the requested variable
290  @param[in] Index the time index for the value of the requested variable
291  @param[out] Val the value of the requested variable
292  */
293  void OPENFLUID_GetVariable(const openfluid::core::SpatialUnit* UnitPtr,
294  const openfluid::core::VariableName_t& VarName,
295  const openfluid::core::TimeIndex_t Index,
296  double& Val) const;
297 
298  /**
299  Gets the distributed variable value for a unit at a time index
300  @param[in] UnitPtr a Unit
301  @param[in] VarName the name of the requested variable
302  @param[in] Index the time index for the value of the requested variable
303  @param[out] Val the value of the requested variable
304  */
305  void OPENFLUID_GetVariable(const openfluid::core::SpatialUnit* UnitPtr,
306  const openfluid::core::VariableName_t& VarName,
307  const openfluid::core::TimeIndex_t Index,
308  long& Val) const;
309 
310  /**
311  Gets the distributed variable value for a unit at a time index
312  @param[in] UnitPtr a Unit
313  @param[in] VarName the name of the requested variable
314  @param[in] Index the time index for the value of the requested variable
315  @param[out] Val the value of the requested variable
316  */
317  void OPENFLUID_GetVariable(const openfluid::core::SpatialUnit* UnitPtr,
318  const openfluid::core::VariableName_t& VarName,
319  const openfluid::core::TimeIndex_t Index,
320  bool& Val) const;
321 
322  /**
323  Gets the distributed variable value for a unit at a time index
324  @param[in] UnitPtr a Unit
325  @param[in] VarName the name of the requested variable
326  @param[in] Index the time index for the value of the requested variable
327  @param[out] Val the value of the requested variable
328  */
329  void OPENFLUID_GetVariable(const openfluid::core::SpatialUnit* UnitPtr,
330  const openfluid::core::VariableName_t& VarName,
331  const openfluid::core::TimeIndex_t Index,
332  std::string& Val) const;
333 
334  /**
335  Returns the distributed variable value for a unit at a time index
336  @param[in] UnitPtr a Unit
337  @param[in] VarName the name of the requested variable
338  @param[in] Index the time index for the value of the requested variable
339  @return a constant pointer the value of the requested variable
340 
341  @cond OpenFLUID:completion
342  {
343  "contexts" : ["SIMULATOR", "OBSERVER"],
344  "menupath" : ["Compute code", "Variables"],
345  "title" : "Get variable value on given time index (by return)",
346  "text" : "OPENFLUID_GetVariable(%%SEL_START%%UnitPtr%%SEL_END%%,\"varname\",TimeIndex)"
347  }
348  @endcond
349  */
350  const openfluid::core::Value* OPENFLUID_GetVariable(const openfluid::core::SpatialUnit* UnitPtr,
351  const openfluid::core::VariableName_t& VarName,
352  const openfluid::core::TimeIndex_t Index) const;
353 
354  /**
355  Gets the distributed variable value for a unit at the current time index
356  @param[in] UnitPtr a Unit
357  @param[in] VarName the name of the requested variable
358  @param[out] Val the value of the requested variable
359 
360  @cond OpenFLUID:completion
361  {
362  "contexts" : ["SIMULATOR", "OBSERVER"],
363  "menupath" : ["Compute code", "Variables"],
364  "title" : "Get variable value on current time index",
365  "text" : "OPENFLUID_GetVariable(%%SEL_START%%UnitPtr%%SEL_END%%,\"varname\",Val)"
366  }
367  @endcond
368  */
369  void OPENFLUID_GetVariable(const openfluid::core::SpatialUnit* UnitPtr,
370  const openfluid::core::VariableName_t& VarName,
371  openfluid::core::Value& Val) const;
372 
373  /**
374  Gets the distributed variable value for a unit at the current time index
375  @param[in] UnitPtr a Unit
376  @param[in] VarName the name of the requested variable
377  @param[out] Val the value of the requested variable
378  */
379  void OPENFLUID_GetVariable(const openfluid::core::SpatialUnit* UnitPtr,
380  const openfluid::core::VariableName_t& VarName,
381  double& Val) const;
382 
383  /**
384  Gets the distributed variable value for a unit at the current time index
385  @param[in] UnitPtr a Unit
386  @param[in] VarName the name of the requested variable
387  @param[out] Val the value of the requested variable
388  */
389  void OPENFLUID_GetVariable(const openfluid::core::SpatialUnit* UnitPtr,
390  const openfluid::core::VariableName_t& VarName,
391  long& Val) const;
392 
393  /**
394  Gets the distributed variable value for a unit at the current time index
395  @param[in] UnitPtr a Unit
396  @param[in] VarName the name of the requested variable
397  @param[out] Val the value of the requested variable
398  */
399  void OPENFLUID_GetVariable(const openfluid::core::SpatialUnit* UnitPtr,
400  const openfluid::core::VariableName_t& VarName,
401  bool& Val) const;
402 
403  /**
404  Gets the distributed variable value for a unit at the current time index
405  @param[in] UnitPtr a Unit
406  @param[in] VarName the name of the requested variable
407  @param[out] Val the value of the requested variable
408  */
409  void OPENFLUID_GetVariable(const openfluid::core::SpatialUnit* UnitPtr,
410  const openfluid::core::VariableName_t& VarName,
411  std::string& Val) const;
412 
413  /**
414  Returns the distributed variable value for a unit at the current time index
415  @param[in] UnitPtr a Unit
416  @param[in] VarName the name of the requested variable
417  @return a constant pointer the value of the requested variable
418 
419  @cond OpenFLUID:completion
420  {
421  "contexts" : ["SIMULATOR", "OBSERVER"],
422  "menupath" : ["Compute code", "Variables"],
423  "title" : "Get variable value on current time index (by return)",
424  "text" : "OPENFLUID_GetVariable(%%SEL_START%%UnitPtr%%SEL_END%%,\"varname\")"
425  }
426  @endcond
427  */
428  const openfluid::core::Value* OPENFLUID_GetVariable(const openfluid::core::SpatialUnit* UnitPtr,
429  const openfluid::core::VariableName_t& VarName) const;
430 
431 
432  /**
433  Gets the latest available variable for a unit
434  @param[in] UnitPtr a Unit
435  @param[in] VarName the name of the requested variable
436  @param[out] IndVal the value and timeindex of the requested variable
437 
438  @cond OpenFLUID:completion
439  {
440  "contexts" : ["SIMULATOR", "OBSERVER"],
441  "menupath" : ["Compute code", "Variables"],
442  "title" : "Get latest available variable value",
443  "text" : "OPENFLUID_GetLatestVariable(%%SEL_START%%UnitPtr%%SEL_END%%,\"varname\",IndexedVal)"
444  }
445  @endcond
446  */
447  void OPENFLUID_GetLatestVariable(const openfluid::core::SpatialUnit* UnitPtr,
448  const openfluid::core::VariableName_t& VarName,
449  openfluid::core::IndexedValue& IndVal) const;
450 
451  /**
452  Returns the latest available variable for a unit
453  @param[in] UnitPtr a Unit
454  @param[in] VarName the name of the requested variable
455  @return the value and timeindex of the requested variable
456 
457  @cond OpenFLUID:completion
458  {
459  "contexts" : ["SIMULATOR", "OBSERVER"],
460  "menupath" : ["Compute code", "Variables"],
461  "title" : "Get latest available variable value (by return)",
462  "text" : "OPENFLUID_GetLatestVariable(%%SEL_START%%UnitPtr%%SEL_END%%,\"varname\")"
463  }
464  @endcond
465  */
466  openfluid::core::IndexedValue OPENFLUID_GetLatestVariable(const openfluid::core::SpatialUnit* UnitPtr,
467  const openfluid::core::VariableName_t& VarName) const;
468 
469 
470  /**
471  Gets the latest available variables for a unit since the given time index
472  @param[in] UnitPtr a Unit
473  @param[in] VarName the name of the requested variable
474  @param[in] BeginIndex The beginning time index of the search period
475  @param[out] IndValList the list of time-indexed values of the requested variable
476 
477  @cond OpenFLUID:completion
478  {
479  "contexts" : ["SIMULATOR", "OBSERVER"],
480  "menupath" : ["Compute code", "Variables"],
481  "title" : "Get latest available variable values since a time index",
482  "text" : ["OPENFLUID_GetLatestVariables(%%SEL_START%%UnitPtr%%SEL_END%%,",
483  "\"varname\",TimeIndex,IndexedValList)"]
484  }
485  @endcond
486  */
487  void OPENFLUID_GetLatestVariables(const openfluid::core::SpatialUnit* UnitPtr,
488  const openfluid::core::VariableName_t& VarName,
489  const openfluid::core::TimeIndex_t BeginIndex,
490  openfluid::core::IndexedValueList& IndValList) const;
491 
492  /**
493  Returns the latest available variables for a unit since the given time index
494  @param[in] UnitPtr a Unit
495  @param[in] VarName the name of the requested variable
496  @param[in] BeginIndex The beginning time index of the search period
497  @return the list of time-indexed values of the requested variable
498 
499  @cond OpenFLUID:completion
500  {
501  "contexts" : ["SIMULATOR", "OBSERVER"],
502  "menupath" : ["Compute code", "Variables"],
503  "title" : "Get latest available variable values since a time index (by return)",
504  "text" : "OPENFLUID_GetLatestVariables(%%SEL_START%%UnitPtr%%SEL_END%%,\"varname\",TimeIndex)"
505  }
506  @endcond
507 
508  */
509  openfluid::core::IndexedValueList OPENFLUID_GetLatestVariables(const openfluid::core::SpatialUnit* UnitPtr,
510  const openfluid::core::VariableName_t& VarName,
511  const openfluid::core::TimeIndex_t BeginIndex) const;
512 
513  /**
514  Gets the available variables for a unit during a given period (between two time indexes)
515  @param[in] UnitPtr a Unit
516  @param[in] VarName the name of the requested variable
517  @param[in] BeginIndex the time index for the beginning of the period
518  @param[in] EndIndex the time index for the end of the period
519  @param[out] IndValList the list of time-indexed values of the requested variable
520 
521  @cond OpenFLUID:completion
522  {
523  "contexts" : ["SIMULATOR", "OBSERVER"],
524  "menupath" : ["Compute code", "Variables"],
525  "title" : "Get variable values on given period",
526  "text" : ["OPENFLUID_GetVariables(%%SEL_START%%UnitPtr%%SEL_END%%,",
527  "\"varname\",BeginIndex,EndIndex,IndexedValList)"]
528  }
529  @endcond
530  */
531  void OPENFLUID_GetVariables(const openfluid::core::SpatialUnit* UnitPtr,
532  const openfluid::core::VariableName_t& VarName,
533  const openfluid::core::TimeIndex_t BeginIndex,
534  const openfluid::core::TimeIndex_t EndIndex,
535  openfluid::core::IndexedValueList& IndValList) const;
536 
537  /**
538  Returns the available variables for a unit during a given period (between two time indexes)
539  @param[in] UnitPtr a Unit
540  @param[in] VarName the name of the requested variable
541  @param[in] BeginIndex the time index for the beginning of the period
542  @param[in] EndIndex the time index for the end of the period
543  @return the list of time-indexed values of the requested variable
544 
545  @cond OpenFLUID:completion
546  {
547  "contexts" : ["SIMULATOR", "OBSERVER"],
548  "menupath" : ["Compute code", "Variables"],
549  "title" : "Get variable values on given period (by return)",
550  "text" : "OPENFLUID_GetVariables(%%SEL_START%%UnitPtr%%SEL_END%%,\"varname\",BeginIndex,EndIndex)"
551  }
552  @endcond
553 
554  */
555  openfluid::core::IndexedValueList OPENFLUID_GetVariables(const openfluid::core::SpatialUnit* UnitPtr,
556  const openfluid::core::VariableName_t& VarName,
557  const openfluid::core::TimeIndex_t BeginIndex,
558  const openfluid::core::TimeIndex_t EndIndex) const;
559 
560  /**
561  Gets discrete events happening on a unit during a time period
562  @param[in] UnitPtr a Unit
563  @param[in] BeginDate the beginning of the time period
564  @param[in] EndDate the ending of the time period
565  @param[out] Events the collection of event corresponding to the request
566 
567  @cond OpenFLUID:completion
568  {
569  "contexts" : ["SIMULATOR", "OBSERVER"],
570  "menupath" : ["Compute code", "Events"],
571  "title" : "Get events on a given period",
572  "text" : "OPENFLUID_GetEvents(%%SEL_START%%UnitPtr%%SEL_END%%,BeginDate,EndDate,EvColl)"
573  }
574  @endcond
575  */
576  void OPENFLUID_GetEvents(const openfluid::core::SpatialUnit *UnitPtr,
577  const openfluid::core::DateTime BeginDate,
578  const openfluid::core::DateTime EndDate,
579  openfluid::core::EventsCollection& Events) const;
580 
581  /**
582  Returns discrete events happening on a unit during a time period
583  @param[in] UnitPtr a Unit
584  @param[in] BeginDate the beginning of the time period
585  @param[in] EndDate the ending of the time period
586  @return the collection of event corresponding to the request
587 
588  @cond OpenFLUID:completion
589  {
590  "contexts" : ["SIMULATOR", "OBSERVER"],
591  "menupath" : ["Compute code", "Events"],
592  "title" : "Get events on a given period (by return)",
593  "text" : "OPENFLUID_GetEvents(%%SEL_START%%UnitPtr%%SEL_END%%,BeginDate,EndDate)"
594  }
595  @endcond
596  */
597  openfluid::core::EventsCollection OPENFLUID_GetEvents(const openfluid::core::SpatialUnit *UnitPtr,
598  const openfluid::core::DateTime BeginDate,
599  const openfluid::core::DateTime EndDate) const;
600 
601  /**
602  Returns true if the queried unit class exists
603  @param[in] ClassName the queried class name
604 
605  @cond OpenFLUID:completion
606  {
607  "contexts" : ["SIMULATOR", "OBSERVER"],
608  "menupath" : ["Compute code", "Spatial structure"],
609  "title" : "Test if a spatial units class exists",
610  "text" : "OPENFLUID_IsUnitsClassExist(%%SEL_START%%ClassName%%SEL_END%%)"
611  }
612  @endcond
613  */
614  bool OPENFLUID_IsUnitsClassExist(const openfluid::core::UnitsClass_t& ClassName) const;
615 
616  /**
617  @deprecated Since version 2.1.0.
618  Use openfluid::ware::SimulationInspectorWare::OPENFLUID_IsUnitsClassExist instead
619  */
620  [[deprecated]] bool OPENFLUID_IsUnitClassExist(const openfluid::core::UnitsClass_t& ClassName) const
621  {
622  return OPENFLUID_IsUnitsClassExist(ClassName);
623  }
624 
625  /**
626  Returns true if the queried unit exists
627  @param[in] ClassName the class of the queried unit
628  @param[in] ID the ID of the queried unit
629 
630  @cond OpenFLUID:completion
631  {
632  "contexts" : ["SIMULATOR", "OBSERVER"],
633  "menupath" : ["Compute code", "Spatial structure"],
634  "title" : "Test if a spatial unit exists in a given units class",
635  "text" : "OPENFLUID_IsUnitExist(%%SEL_START%%ClassName%%SEL_END%%,UnitID)"
636  }
637  @endcond
638  */
639  bool OPENFLUID_IsUnitExist(const openfluid::core::UnitsClass_t& ClassName,
640  openfluid::core::UnitID_t ID) const;
641 
642  /**
643  Returns the total number of units
644  @param[out] UnitsCount the total units count
645 
646  @cond OpenFLUID:completion
647  {
648  "contexts" : ["SIMULATOR", "OBSERVER"],
649  "menupath" : ["Compute code", "Spatial structure"],
650  "title" : "Get the number of spatial units in the spatial graph",
651  "text" : "OPENFLUID_GetUnitsCount(%%SEL_START%%UnitsCount%%SEL_END%%)"
652  }
653  @endcond
654  */
655  void OPENFLUID_GetUnitsCount(unsigned int& UnitsCount) const;
656 
657  /**
658  Returns the total number of units
659  @return the total units count
660 
661  @cond OpenFLUID:completion
662  {
663  "contexts" : ["SIMULATOR", "OBSERVER"],
664  "menupath" : ["Compute code", "Spatial structure"],
665  "title" : "Get the number of spatial units in the spatial graph (by return)",
666  "text" : "OPENFLUID_GetUnitsCount()"
667  }
668  @endcond
669  */
670  unsigned int OPENFLUID_GetUnitsCount() const;
671 
672  /**
673  Gets the number of units of the class if the queried unit class exists
674  @param[in] ClassName the queried class name
675  @param[out] UnitsCount the number of units in the queried class
676  @return false if the unit class does not exist
677 
678  @cond OpenFLUID:completion
679  {
680  "contexts" : ["SIMULATOR", "OBSERVER"],
681  "menupath" : ["Compute code", "Spatial structure"],
682  "title" : "Get the number of spatial units of a given class",
683  "text" : "OPENFLUID_GetUnitsCount(%%SEL_START%%ClassName%%SEL_END%%,UnitsCount)"
684  }
685  @endcond
686  */
687  bool OPENFLUID_GetUnitsCount(const openfluid::core::UnitsClass_t& ClassName,
688  unsigned int& UnitsCount) const;
689 
690  /**
691  Returns the number of units of the class if the queried unit class exists
692  @param[in] ClassName the queried class name
693  @return the number of units in the queried class, or 0 if the units class does not exist
694 
695  @cond OpenFLUID:completion
696  {
697  "contexts" : ["SIMULATOR", "OBSERVER"],
698  "menupath" : ["Compute code", "Spatial structure"],
699  "title" : "Get the number of spatial units of a given class (by return)",
700  "text" : "OPENFLUID_GetUnitsCount(%%SEL_START%%ClassName%%SEL_END%%)"
701  }
702  @endcond
703  */
704  unsigned int OPENFLUID_GetUnitsCount(const openfluid::core::UnitsClass_t& ClassName) const;
705 
706  /**
707  Returns a pointer to the queried unit if exists
708  @param[in] ClassName the queried class name
709  @param[in] ID the queried unit ID
710  @param[out] aUnit a pointer to the requested Unit, nullptr if the unit does not exist
711  @return false if the unit does not exist
712 
713  @cond OpenFLUID:completion
714  {
715  "contexts" : ["SIMULATOR", "OBSERVER"],
716  "menupath" : ["Compute code", "Spatial structure"],
717  "title" : "Get a pointer to a spatial unit of a given units class",
718  "text" : "OPENFLUID_GetUnit(%%SEL_START%%ClassName%%SEL_END%%,UnitID,UnitPtr)"
719  }
720  @endcond
721  */
722  bool OPENFLUID_GetUnit(const openfluid::core::UnitsClass_t& ClassName,
723  const openfluid::core::UnitID_t& ID,
724  openfluid::core::SpatialUnit* aUnit) const;
725 
726  openfluid::core::SpatialUnit* OPENFLUID_GetUnit(const openfluid::core::UnitsClass_t& ClassName,
727  const openfluid::core::UnitID_t& ID) const;
728 
729  /**
730  Returns a list of units of the requested class
731  Returns an empty list if the units class does not exist.
732  @param[in] ClassName the requested class
733 
734  @cond OpenFLUID:completion
735  {
736  "contexts" : ["SIMULATOR", "OBSERVER"],
737  "menupath" : ["Compute code", "Spatial structure"],
738  "title" : "Get a list of pointers to spatial units of a given units class",
739  "text" : "OPENFLUID_GetUnits(%%SEL_START%%ClassName%%SEL_END%%)"
740  }
741  @endcond
742  */
743  openfluid::core::UnitsPtrList_t OPENFLUID_GetUnits(const openfluid::core::UnitsClass_t& ClassName);
744 
745  /**
746  Returns true if a given unit is connected "to" another unit
747  @param[in] aUnit the given unit
748  @param[in] ClassNameTo the class name of the other unit to test
749  @param[in] IDTo the ID of the other unit to test
750  @return true if the given unit is connected "to" the other unit
751 
752  @cond OpenFLUID:completion
753  {
754  "contexts" : ["SIMULATOR", "OBSERVER"],
755  "menupath" : ["Compute code", "Spatial structure"],
756  "title" : "Test if a spatial unit is connected to another spatial unit",
757  "text" : "OPENFLUID_IsUnitConnectedTo(%%SEL_START%%UnitPtr%%SEL_END%%,ClassNameTo,UnitIDTo)"
758  }
759  @endcond
760  */
761  bool OPENFLUID_IsUnitConnectedTo(openfluid::core::SpatialUnit* aUnit,
762  const openfluid::core::UnitsClass_t& ClassNameTo,
763  const openfluid::core::UnitID_t& IDTo) const;
764 
765 
766  /**
767  Returns true if a given unit is connected "from" another unit
768  @param[in] aUnit the given unit
769  @param[in] ClassNameFrom the class name of the other unit to test
770  @param[in] IDFrom the ID of the other unit to test
771  @return true if the given unit is connected "from" the other unit
772 
773  @cond OpenFLUID:completion
774  {
775  "contexts" : ["SIMULATOR", "OBSERVER"],
776  "menupath" : ["Compute code", "Spatial structure"],
777  "title" : "Test if a spatial unit is connected from another spatial unit",
778  "text" : "OPENFLUID_IsUnitConnectedFrom(%%SEL_START%%UnitPtr%%SEL_END%%,ClassNameFrom,UnitIDFrom)"
779  }
780  @endcond
781  */
782  bool OPENFLUID_IsUnitConnectedFrom(openfluid::core::SpatialUnit* aUnit,
783  const openfluid::core::UnitsClass_t& ClassNameFrom,
784  const openfluid::core::UnitID_t& IDFrom) const;
785 
786 
787  /**
788  Returns true if a given unit is "a child of" another unit
789  @param[in] aUnit the given unit
790  @param[in] ClassNameParent the class name of the other unit to test
791  @param[in] IDParent the ID of the other unit to test
792  @return true if the given unit is "a child of" the other unit
793 
794  @cond OpenFLUID:completion
795  {
796  "contexts" : ["SIMULATOR", "OBSERVER"],
797  "menupath" : ["Compute code", "Spatial structure"],
798  "title" : "Test if a spatial unit is a child of another spatial unit",
799  "text" : "OPENFLUID_IsUnitChildOf(%%SEL_START%%UnitPtr%%SEL_END%%,ClassNameParent,UnitIDParent)"
800  }
801  @endcond
802  */
803  bool OPENFLUID_IsUnitChildOf(openfluid::core::SpatialUnit* aUnit,
804  const openfluid::core::UnitsClass_t& ClassNameParent,
805  const openfluid::core::UnitID_t& IDParent) const;
806 
807 
808  /**
809  Returns true if a given unit is "parent of" another unit
810  @param[in] aUnit the given unit
811  @param[in] ClassNameChild the class name of the other unit to test
812  @param[in] IDChild the ID of the other unit to test
813  @return true if the given unit is "parent of" the other unit
814 
815  @cond OpenFLUID:completion
816  {
817  "contexts" : ["SIMULATOR", "OBSERVER"],
818  "menupath" : ["Compute code", "Spatial structure"],
819  "title" : "Test if a spatial unit is a parent of another spatial unit",
820  "text" : "OPENFLUID_IsUnitParentOf(%%SEL_START%%UnitPtr%%SEL_END%%,ClassNameChild,UnitIDChild)"
821  }
822  @endcond
823  */
824  bool OPENFLUID_IsUnitParentOf(openfluid::core::SpatialUnit* aUnit,
825  const openfluid::core::UnitsClass_t& ClassNameChild,
826  const openfluid::core::UnitID_t& IDChild) const;
827 
828 
830  mp_Datastore(nullptr), mp_SpatialData(nullptr)
831  { }
832 
833 
834  public:
835 
837  { }
838 
840  {
841  mp_SpatialData = SGraph;
842  }
843 
845  {
846  mp_Datastore = DStore;
847  }
848 
849 };
850 
851 
852 } } // openfluid::ware
853 
854 
855 #endif /* __OPENFLUID_WARE_SIMULATIONINSPECTORWARE_HPP__ */
Definition: EventsCollection.hpp:70
openfluid::core::SpatialGraph * mp_SpatialData
Definition: SimulationInspectorWare.hpp:72
std::uint64_t TimeIndex_t
Definition: TypeDefs.hpp:298
virtual bool isLinked() const
Definition: SimulationInspectorWare.hpp:75
Definition: SimulationInspectorWare.hpp:55
Class for management of date and time information.
Definition: DateTime.hpp:87
Definition: Value.hpp:64
std::list< IndexedValue > IndexedValueList
Definition: IndexedValue.hpp:167
Definition: SimulationDrivenWare.hpp:291
bool OPENFLUID_IsUnitClassExist(const openfluid::core::UnitsClass_t &ClassName) const
Definition: SimulationInspectorWare.hpp:620
virtual bool isLinked() const
Definition: SimulationDrivenWare.hpp:305
Definition: IndexedValue.hpp:63
SimulationInspectorWare(WareType WType)
Definition: SimulationInspectorWare.hpp:829
Definition: SpatialUnit.hpp:110
void linkToDatastore(openfluid::core::Datastore *DStore)
Definition: SimulationInspectorWare.hpp:844
std::string UnitsClass_t
Definition: TypeDefs.hpp:98
WareType
Definition: TypeDefs.hpp:60
virtual ~SimulationInspectorWare()
Definition: SimulationInspectorWare.hpp:836
Definition: ApplicationException.hpp:47
std::string AttributeName_t
Definition: TypeDefs.hpp:117
Type
Definition: Value.hpp:68
Definition: SpatialGraph.hpp:52
std::string VariableName_t
Definition: TypeDefs.hpp:131
void linkToSpatialGraph(openfluid::core::SpatialGraph *SGraph)
Definition: SimulationInspectorWare.hpp:839
#define OPENFLUID_API
Definition: dllexport.hpp:86
unsigned int UnitID_t
Definition: TypeDefs.hpp:70
Definition: Datastore.hpp:58
std::list< SpatialUnit * > UnitsPtrList_t
Definition: SpatialUnit.hpp:77