@@ -167,7 +167,7 @@ classes:
167167 [](SimDevice &self, const char * name, int32_t direction, const wpi::SmallVector<std::string, 8> &options, int32_t initialValue) {
168168 wpi::SmallVector<const char *, 8> coptions;
169169 coptions.reserve(options.size());
170- for (auto s: options) {
170+ for (auto & s: options) {
171171 coptions.push_back(s.c_str());
172172 }
173173 return self.CreateEnum(name, direction, coptions, initialValue);
@@ -182,7 +182,7 @@ classes:
182182 [](SimDevice &self, const char * name, int32_t direction, const wpi::SmallVector<std::string, 8> &options, const wpi::SmallVector<double, 8> &optionValues, int32_t initialValue) {
183183 wpi::SmallVector<const char *, 8> coptions;
184184 coptions.reserve(options.size());
185- for (auto s: options) {
185+ for (auto & s: options) {
186186 coptions.push_back(s.c_str());
187187 }
188188 return self.CreateEnumDouble(name, direction, coptions, optionValues, initialValue);
@@ -327,20 +327,28 @@ inline_code: |
327327 if (self) {
328328 int32_t value;
329329 int32_t numOptions;
330+ int32_t numdOptions;
330331 const char ** options;
332+ const double * doptions;
331333 const char * option = "<unknown>";
334+ std::string doption;
332335 {
333336 py::gil_scoped_release release;
334337 value = self.Get();
335338 options = HALSIM_GetSimValueEnumOptions(self, &numOptions);
339+ doptions = HALSIM_GetSimValueEnumDoubleValues(self, &numdOptions);
336340 }
337341
338342 if (options && value >= 0 && value < numOptions) {
339343 option = options[value];
340344 }
341345
346+ if (doptions && value >= 0 && value < numdOptions) {
347+ doption = " dvalue=" + std::to_string(doptions[value]);
348+ }
349+
342350 return "<SimEnum name=" + std::string(option) +
343- " value=" + std::to_string(value) + ">";
351+ " value=" + std::to_string(value) + doption + ">";
344352 } else {
345353 return "<SimEnum (invalid)>";
346354 }
0 commit comments