@@ -106,43 +106,61 @@ 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[]) {
131135 stringBuffer_.clear ();
132136 for (unsigned i = 0 ; i < nvr; i++) {
133137 const auto ref = vr[i];
134138 const auto idx = vrToStringIndices_.at (ref);
135- stringBuffer_.push_back (strings_[idx].get ());
139+ stringBuffer_.emplace_back (strings_[idx].get ());
136140 value[i] = stringBuffer_.back ().c_str ();
137141 }
138142}
143+
144+ void fmu_base::get_binary (const unsigned int vr[], size_t nvr, size_t valueSizes[], const uint8_t *values[]) {
145+ binaryBuffer_.clear ();
146+ for (auto i = 0 ; i < nvr; i++) {
147+ const auto ref = vr[i];
148+ const auto idx = vrToBinaryIndices_.at (ref);
149+ const auto &data = binary_[idx].get ();
150+ valueSizes[i] = data.size ();
151+ binaryBuffer_.emplace_back (data.begin (), data.end ());
152+ values[i] = binaryBuffer_.back ().data ();
153+ }
154+ }
155+
139156void fmu_base::set_integer (const unsigned int vr[], size_t nvr, const int value[]) {
140157 for (unsigned i = 0 ; i < nvr; i++) {
141158 const auto ref = vr[i];
142159 const auto idx = vrToIntegerIndices_.at (ref);
143160 integers_[idx].set (value[i]);
144161 }
145162}
163+
146164void fmu_base::set_real (const unsigned int vr[], size_t nvr, const double value[]) {
147165 for (unsigned i = 0 ; i < nvr; i++) {
148166 const auto ref = vr[i];
@@ -164,17 +182,16 @@ void fmu_base::set_boolean(const unsigned int vr[], size_t nvr, const bool value
164182 booleans_[idx].set (value[i]);
165183 }
166184}
185+
167186void fmu_base::set_string (const unsigned int vr[], size_t nvr, const char *const value[]) {
168187 for (unsigned i = 0 ; i < nvr; i++) {
169188 const auto ref = vr[i];
170189 const auto idx = vrToStringIndices_.at (ref);
171190 strings_[idx].set (value[i]);
172191 }
173192}
193+
174194void 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
178195
179196 for (unsigned i = 0 ; i < nvr; i++) {
180197 const auto ref = vr[i];
0 commit comments