@@ -167,7 +167,7 @@ classes:
167
167
[](SimDevice &self, const char * name, int32_t direction, const wpi::SmallVector<std::string, 8> &options, int32_t initialValue) {
168
168
wpi::SmallVector<const char *, 8> coptions;
169
169
coptions.reserve(options.size());
170
- for (auto s: options) {
170
+ for (auto & s: options) {
171
171
coptions.push_back(s.c_str());
172
172
}
173
173
return self.CreateEnum(name, direction, coptions, initialValue);
@@ -182,7 +182,7 @@ classes:
182
182
[](SimDevice &self, const char * name, int32_t direction, const wpi::SmallVector<std::string, 8> &options, const wpi::SmallVector<double, 8> &optionValues, int32_t initialValue) {
183
183
wpi::SmallVector<const char *, 8> coptions;
184
184
coptions.reserve(options.size());
185
- for (auto s: options) {
185
+ for (auto & s: options) {
186
186
coptions.push_back(s.c_str());
187
187
}
188
188
return self.CreateEnumDouble(name, direction, coptions, optionValues, initialValue);
@@ -327,20 +327,28 @@ inline_code: |
327
327
if (self) {
328
328
int32_t value;
329
329
int32_t numOptions;
330
+ int32_t numdOptions;
330
331
const char ** options;
332
+ const double * doptions;
331
333
const char * option = "<unknown>";
334
+ std::string doption;
332
335
{
333
336
py::gil_scoped_release release;
334
337
value = self.Get();
335
338
options = HALSIM_GetSimValueEnumOptions(self, &numOptions);
339
+ doptions = HALSIM_GetSimValueEnumDoubleValues(self, &numdOptions);
336
340
}
337
341
338
342
if (options && value >= 0 && value < numOptions) {
339
343
option = options[value];
340
344
}
341
345
346
+ if (doptions && value >= 0 && value < numdOptions) {
347
+ doption = " dvalue=" + std::to_string(doptions[value]);
348
+ }
349
+
342
350
return "<SimEnum name=" + std::string(option) +
343
- " value=" + std::to_string(value) + ">";
351
+ " value=" + std::to_string(value) + doption + ">";
344
352
} else {
345
353
return "<SimEnum (invalid)>";
346
354
}
0 commit comments