@@ -106,43 +106,60 @@ void fmu_base::get_integer(const unsigned int vr[], size_t nvr, int value[]) con
106106 value[i] = integers_[idx].get ();
107107 }
108108}
109+
109110void fmu_base::get_real (const unsigned int vr[], size_t nvr, double value[]) const {
110111 for (unsigned i = 0 ; i < nvr; i++) {
111112 const auto ref = vr[i];
112113 const auto idx = vrToRealIndices_.at (ref);
113114 value[i] = reals_[idx].get ();
114115 }
115116}
117+
116118void fmu_base::get_boolean (const unsigned int vr[], size_t nvr, int value[]) const {
117119 for (unsigned i = 0 ; i < nvr; i++) {
118120 const auto ref = vr[i];
119121 const auto idx = vrToBooleanIndices_.at (ref);
120122 value[i] = static_cast <int >(booleans_[idx].get ());
121123 }
122124}
125+
123126void fmu_base::get_boolean (const unsigned int vr[], size_t nvr, bool value[]) const {
124127 for (unsigned i = 0 ; i < nvr; i++) {
125128 const auto ref = vr[i];
126129 const auto idx = vrToBooleanIndices_.at (ref);
127130 value[i] = booleans_[idx].get ();
128131 }
129132}
133+
130134void fmu_base::get_string (const unsigned int vr[], size_t nvr, const char *value[]) {
131- stringBuffer_.clear ();
132135 for (unsigned i = 0 ; i < nvr; i++) {
133136 const auto ref = vr[i];
134137 const auto idx = vrToStringIndices_.at (ref);
135- stringBuffer_.push_back (strings_[idx].get ());
136- value[i] = stringBuffer_.back ().c_str ();
138+ stringBuffer_ = strings_[idx].get ();
139+ value[i] = stringBuffer_.c_str ();
140+ }
141+ }
142+
143+ void fmu_base::get_binary (const unsigned int vr[], size_t nvr, size_t valueSizes[], const uint8_t *values[]) {
144+
145+ for (auto i = 0 ; i < nvr; i++) {
146+ const auto ref = vr[i];
147+ const auto idx = vrToBinaryIndices_.at (ref);
148+ const auto &data = binary_[idx].get ();
149+ valueSizes[i] = data.size ();
150+ binaryBuffer_.assign (data.begin (), data.end ());
151+ values[i] = binaryBuffer_.data ();
137152 }
138153}
154+
139155void fmu_base::set_integer (const unsigned int vr[], size_t nvr, const int value[]) {
140156 for (unsigned i = 0 ; i < nvr; i++) {
141157 const auto ref = vr[i];
142158 const auto idx = vrToIntegerIndices_.at (ref);
143159 integers_[idx].set (value[i]);
144160 }
145161}
162+
146163void fmu_base::set_real (const unsigned int vr[], size_t nvr, const double value[]) {
147164 for (unsigned i = 0 ; i < nvr; i++) {
148165 const auto ref = vr[i];
@@ -164,17 +181,16 @@ void fmu_base::set_boolean(const unsigned int vr[], size_t nvr, const bool value
164181 booleans_[idx].set (value[i]);
165182 }
166183}
184+
167185void fmu_base::set_string (const unsigned int vr[], size_t nvr, const char *const value[]) {
168186 for (unsigned i = 0 ; i < nvr; i++) {
169187 const auto ref = vr[i];
170188 const auto idx = vrToStringIndices_.at (ref);
171189 strings_[idx].set (value[i]);
172190 }
173191}
192+
174193void fmu_base::set_binary (const unsigned int vr[], size_t nvr, const size_t valueSizes[], const uint8_t *const value[]) {
175- #ifdef FMI2
176- static_assert (" set_binary not available for FMI2" );
177- #endif
178194
179195 for (unsigned i = 0 ; i < nvr; i++) {
180196 const auto ref = vr[i];
0 commit comments