mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-21 01:01:43 +00:00
[wpilibc] SimDeviceSim: use fmtlib (#3389)
Also clean up several sim classes to use the channel constructor.
This commit is contained in:
@@ -7,10 +7,9 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <fmt/format.h>
|
||||
#include <hal/SimDevice.h>
|
||||
#include <hal/simulation/SimDeviceData.h>
|
||||
#include <wpi/SmallString.h>
|
||||
#include <wpi/raw_ostream.h>
|
||||
|
||||
using namespace frc;
|
||||
using namespace frc::sim;
|
||||
@@ -19,19 +18,13 @@ SimDeviceSim::SimDeviceSim(const char* name)
|
||||
: m_handle{HALSIM_GetSimDeviceHandle(name)} {}
|
||||
|
||||
SimDeviceSim::SimDeviceSim(const char* name, int index) {
|
||||
wpi::SmallString<128> fullname;
|
||||
wpi::raw_svector_ostream os(fullname);
|
||||
os << name << '[' << index << ']';
|
||||
|
||||
m_handle = HALSIM_GetSimDeviceHandle(fullname.c_str());
|
||||
m_handle =
|
||||
HALSIM_GetSimDeviceHandle(fmt::format("{}[{}]", name, index).c_str());
|
||||
}
|
||||
|
||||
SimDeviceSim::SimDeviceSim(const char* name, int index, int channel) {
|
||||
wpi::SmallString<128> fullname;
|
||||
wpi::raw_svector_ostream os(fullname);
|
||||
os << name << '[' << index << ',' << channel << ']';
|
||||
|
||||
m_handle = HALSIM_GetSimDeviceHandle(fullname.c_str());
|
||||
m_handle = HALSIM_GetSimDeviceHandle(
|
||||
fmt::format("{}[{},{}]", name, index, channel).c_str());
|
||||
}
|
||||
|
||||
hal::SimValue SimDeviceSim::GetValue(const char* name) const {
|
||||
|
||||
Reference in New Issue
Block a user