AGX Dynamics  2.37.2.0
import/Variable.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2024. Algoryx Simulation AB.
3 
4 All AGX source code, intellectual property, documentation, sample code,
5 tutorials, scene files and technical white papers, are copyrighted, proprietary
6 and confidential material of Algoryx Simulation AB. You may not download, read,
7 store, distribute, publish, copy or otherwise disseminate, use or expose this
8 material unless having a written signed agreement with Algoryx Simulation AB, or having been
9 advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10 valid commercial license from Algoryx Simulation AB.
11 
12 Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13 from using this software, unless otherwise stated in written agreements with
14 Algoryx Simulation AB.
15 */
16 
17 #ifndef AGXFMI2_IMPORT_VARIABLE_H
18 #define AGXFMI2_IMPORT_VARIABLE_H
19 
20 #include <agx/config/AGX_USE_FMI.h>
21 
22 #if AGX_USE_FMI()
23 
24 #include <agxFMI2/Variable.h>
25 
26 
27 #include <agx/PushDisableWarnings.h> // Disabling warnings. Include agx/PopDisableWarnings.h below!
28 extern "C"
29 {
30  #include <FMI2/fmi2_import_variable.h>
31  #include <FMI2/fmi2_import_capi.h>
32 }
33 #include <agx/PopDisableWarnings.h> // End of disabled warnings.
34 
35 #if defined(__GNUC__) && !defined(SWIGPYTHON)
36 // GCC has a bug[1] that casuses our PushDisableWarnings.h to be ignored under
37 // certain circumstances. In this case we get a bunch of "unused function"
38 // warnings. The warnings are suppressed by using the symbol names below.
39 //
40 // [1]: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53431
41 static void warningSuppression() __attribute__((unused));
42 static inline void warningSuppression()
43 {
44  (void)jm_get_last_error;
45  (void)jm_clear_last_error;
46  (void)jm_log_debug_v;
47  (void)jm_log_debug;
48  (void)fmi2_get_types_platform;
49  (void)fmi1_get_platform;
50 }
51 #endif
52 
53 
54 namespace agxFMI2
55 {
56  namespace Import
57  {
58  class Module;
59 
60  AGX_DECLARE_POINTER_TYPES(Variable);
61  AGX_DECLARE_VECTOR_TYPES(Variable);
62 
66  class AGXFMI_EXPORT Variable : public agxFMI2::Variable
67  {
68  public:
69  Module *getModule();
70 
71 
72  agx::Real getStartValue_Real() const;
73  agx::Int32 getStartValue_Int() const;
74  agx::Bool getStartValue_Bool() const;
75  agx::String getStartValue_String() const;
76 
77 
78  void setValue_Real(agx::Real value);
79  void setValue_Int(agx::Int32 value);
80  void setValue_Bool(agx::Bool value);
81  void setValue_String(const agx::String& value);
82 
83  agx::Real getValue_Real() const;
84  agx::Int32 getValue_Int() const;
85  agx::Bool getValue_Bool() const;
86  agx::String getValue_String() const;
87 
88  agx::String toString() const;
89 
90  protected:
91  virtual ~Variable();
92 
93  private:
94  friend class Module;
95  Variable(Module *module, fmi2_import_variable_t *variable);
96 
97  private:
98  Module *m_module;
99  fmi2_import_variable_t *m_variable;
100  };
101  }
102 
103 }
104 
105 #endif /* AGX_USE_FMI */
106 
107 #endif /* AGXFMI2_IMPORT_VARIABLE_H */
int32_t Int32
Definition: Integer.h:45
bool Bool
Definition: Integer.h:48
#define AGXFMI_EXPORT
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:254
This namespace contains functionality for using AGX together with version 2 of the Functional Mockup ...
double Real
Definition: Real.h:42
#define AGX_DECLARE_VECTOR_TYPES(type)
Definition: Vector.h:34