10#include <initializer_list>
91 const char* name,
int32_t direction,
160 double initialValue) {
184 const char** options,
206 int32_t numOptions,
const char** options,
const double* optionValues,
811 double initialValue) {
830 std::initializer_list<const char*> options,
833 const_cast<const char**
>(options.begin()),
852 std::span<const char* const> options,
855 const_cast<const char**
>(options.data()),
876 std::initializer_list<const char*> options,
877 std::initializer_list<double> optionValues,
879 if (options.size() != optionValues.size()) {
883 m_handle, name, direction, options.size(),
884 const_cast<const char**
>(options.begin()), optionValues.begin(),
905 std::span<const char* const> options,
906 std::span<const double> optionValues,
908 if (options.size() != optionValues.size()) {
912 m_handle, name, direction, options.size(),
913 const_cast<const char**
>(options.data()), optionValues.data(),
struct HAL_Value HAL_MakeBoolean(HAL_Bool v)
Definition: Value.h:35
struct HAL_Value HAL_MakeDouble(double v)
Definition: Value.h:63
struct HAL_Value HAL_MakeEnum(int v)
Definition: Value.h:42
struct HAL_Value HAL_MakeInt(int v)
Definition: Value.h:49
struct HAL_Value HAL_MakeLong(int64_t v)
Definition: Value.h:56
@ HAL_DOUBLE
Definition: Value.h:13
@ HAL_LONG
Definition: Value.h:16
@ HAL_ENUM
Definition: Value.h:14
@ HAL_BOOLEAN
Definition: Value.h:12
@ HAL_INT
Definition: Value.h:15
C++ wrapper around a HAL simulator boolean value handle.
Definition: SimDevice.h:610
void Set(bool value)
Sets the simulated value.
Definition: SimDevice.h:638
bool Get() const
Gets the simulated value.
Definition: SimDevice.h:631
SimBoolean()=default
Default constructor that results in an "empty" object that is false in a boolean context.
SimBoolean(HAL_SimValueHandle val)
Wraps a simulated value handle as returned by HAL_CreateSimValueBoolean().
Definition: SimDevice.h:623
A move-only C++ wrapper around a HAL simulator device handle.
Definition: SimDevice.h:644
SimDouble CreateDouble(const char *name, int32_t direction, double initialValue)
Creates a double value on the simulated device.
Definition: SimDevice.h:810
SimLong CreateLong(const char *name, int32_t direction, int64_t initialValue)
Creates a long value on the simulated device.
Definition: SimDevice.h:794
SimDevice & operator=(const SimDevice &)=delete
HAL_SimDeviceHandle m_handle
Definition: SimDevice.h:934
~SimDevice()
Definition: SimDevice.h:709
SimInt CreateInt(const char *name, int32_t direction, int32_t initialValue)
Creates an int value on the simulated device.
Definition: SimDevice.h:779
SimEnum CreateEnum(const char *name, int32_t direction, std::span< const char *const > options, int32_t initialValue)
Creates an enumerated value on the simulated device.
Definition: SimDevice.h:851
SimDevice(const SimDevice &)=delete
SimEnum CreateEnumDouble(const char *name, int32_t direction, std::span< const char *const > options, std::span< const double > optionValues, int32_t initialValue)
Creates an enumerated value on the simulated device with double values.
Definition: SimDevice.h:904
std::string GetName() const
Get the name of the simulated device.
Definition: SimDevice.h:748
SimDevice & operator=(SimDevice &&rhs)
Definition: SimDevice.h:722
SimBoolean CreateBoolean(const char *name, int32_t direction, bool initialValue)
Creates a boolean value on the simulated device.
Definition: SimDevice.h:928
SimDevice(const char *name, int index)
Creates a simulated device.
SimDevice(const char *name)
Creates a simulated device.
Definition: SimDevice.h:674
SimDevice(SimDevice &&rhs)
Definition: SimDevice.h:718
SimEnum CreateEnum(const char *name, int32_t direction, std::initializer_list< const char * > options, int32_t initialValue)
Creates an enumerated value on the simulated device.
Definition: SimDevice.h:829
Direction
Direction of a simulated value (from the perspective of user code).
Definition: SimDevice.h:649
@ kInput
Definition: SimDevice.h:650
@ kBidir
Definition: SimDevice.h:652
@ kOutput
Definition: SimDevice.h:651
SimValue CreateValue(const char *name, int32_t direction, const HAL_Value &initialValue)
Creates a value on the simulated device.
Definition: SimDevice.h:763
SimEnum CreateEnumDouble(const char *name, int32_t direction, std::initializer_list< const char * > options, std::initializer_list< double > optionValues, int32_t initialValue)
Creates an enumerated value on the simulated device with double values.
Definition: SimDevice.h:875
SimDevice()=default
Default constructor that results in an "empty" object that is false in a boolean context.
SimDevice(const char *name, int index, int channel)
Creates a simulated device.
C++ wrapper around a HAL simulator double value handle.
Definition: SimDevice.h:535
void Set(double value)
Sets the simulated value.
Definition: SimDevice.h:563
void Reset()
Resets the simulated value to 0.
Definition: SimDevice.h:570
SimDouble()=default
Default constructor that results in an "empty" object that is false in a boolean context.
SimDouble(HAL_SimValueHandle val)
Wraps a simulated value handle as returned by HAL_CreateSimValueDouble().
Definition: SimDevice.h:548
double Get() const
Gets the simulated value.
Definition: SimDevice.h:556
C++ wrapper around a HAL simulator enum value handle.
Definition: SimDevice.h:576
SimEnum()=default
Default constructor that results in an "empty" object that is false in a boolean context.
int32_t Get() const
Gets the simulated value.
Definition: SimDevice.h:597
void Set(int32_t value)
Sets the simulated value.
Definition: SimDevice.h:604
SimEnum(HAL_SimValueHandle val)
Wraps a simulated value handle as returned by HAL_CreateSimValueEnum().
Definition: SimDevice.h:589
C++ wrapper around a HAL simulator int value handle.
Definition: SimDevice.h:453
SimInt()=default
Default constructor that results in an "empty" object that is false in a boolean context.
void Set(int32_t value)
Sets the simulated value.
Definition: SimDevice.h:481
void Reset()
Resets the simulated value to 0.
Definition: SimDevice.h:488
int32_t Get() const
Gets the simulated value.
Definition: SimDevice.h:474
SimInt(HAL_SimValueHandle val)
Wraps a simulated value handle as returned by HAL_CreateSimValueInt().
Definition: SimDevice.h:466
C++ wrapper around a HAL simulator long value handle.
Definition: SimDevice.h:494
int64_t Get() const
Gets the simulated value.
Definition: SimDevice.h:515
void Reset()
Resets the simulated value to 0.
Definition: SimDevice.h:529
SimLong()=default
Default constructor that results in an "empty" object that is false in a boolean context.
SimLong(HAL_SimValueHandle val)
Wraps a simulated value handle as returned by HAL_CreateSimValueLong().
Definition: SimDevice.h:507
void Set(int64_t value)
Sets the simulated value.
Definition: SimDevice.h:522
C++ wrapper around a HAL simulator value handle.
Definition: SimDevice.h:401
SimValue()=default
Default constructor that results in an "empty" object that is false in a boolean context.
void SetValue(const HAL_Value &value)
Sets the simulated value.
Definition: SimDevice.h:444
HAL_Value GetValue() const
Gets the simulated value.
Definition: SimDevice.h:437
HAL_SimValueHandle m_handle
Definition: SimDevice.h:447
SimValue(HAL_SimValueHandle val)
Wraps a simulated value handle as returned by HAL_CreateSimValue().
Definition: SimDevice.h:414
HAL_SimValueHandle HAL_CreateSimValueEnumDouble(HAL_SimDeviceHandle device, const char *name, int32_t direction, int32_t numOptions, const char **options, const double *optionValues, int32_t initialValue)
Creates an enumerated value on a simulated device with double values.
HAL_SimValueHandle HAL_CreateSimValueInt(HAL_SimDeviceHandle device, const char *name, int32_t direction, int32_t initialValue)
Creates an int value on a simulated device.
Definition: SimDevice.h:117
double HAL_GetSimValueDouble(HAL_SimValueHandle handle)
Gets a simulated value (double).
Definition: SimDevice.h:277
HAL_SimValueHandle HAL_CreateSimValue(HAL_SimDeviceHandle device, const char *name, int32_t direction, const struct HAL_Value *initialValue)
Creates a value on a simulated device.
int32_t HAL_GetSimValueEnum(HAL_SimValueHandle handle)
Gets a simulated value (enum).
Definition: SimDevice.h:289
HAL_SimValueHandle HAL_CreateSimValueBoolean(HAL_SimDeviceHandle device, const char *name, int32_t direction, HAL_Bool initialValue)
Creates a boolean value on a simulated device.
Definition: SimDevice.h:221
void HAL_SetSimValueEnum(HAL_SimValueHandle handle, int32_t value)
Sets a simulated value (enum).
Definition: SimDevice.h:362
void HAL_SetSimValueDouble(HAL_SimValueHandle handle, double value)
Sets a simulated value (double).
Definition: SimDevice.h:351
void HAL_FreeSimDevice(HAL_SimDeviceHandle handle)
Frees a simulated device.
void HAL_SetSimValue(HAL_SimValueHandle handle, const struct HAL_Value *value)
Sets a simulated value.
void HAL_SetSimValueLong(HAL_SimValueHandle handle, int64_t value)
Sets a simulated value (long).
Definition: SimDevice.h:340
HAL_SimDeviceHandle HAL_CreateSimDevice(const char *name)
Creates a simulated device.
HAL_SimValueHandle HAL_CreateSimValueEnum(HAL_SimDeviceHandle device, const char *name, int32_t direction, int32_t numOptions, const char **options, int32_t initialValue)
Creates an enumerated value on a simulated device.
HAL_SimValueHandle HAL_CreateSimValueDouble(HAL_SimDeviceHandle device, const char *name, int32_t direction, double initialValue)
Creates a double value on a simulated device.
Definition: SimDevice.h:157
HAL_SimValueHandle HAL_CreateSimValueLong(HAL_SimDeviceHandle device, const char *name, int32_t direction, int64_t initialValue)
Creates a long value on a simulated device.
Definition: SimDevice.h:137
void HAL_SetSimValueInt(HAL_SimValueHandle handle, int value)
Sets a simulated value (int).
Definition: SimDevice.h:329
HAL_SimValueDirection
Direction of a simulated value (from the perspective of user code).
Definition: SimDevice.h:34
HAL_Bool HAL_GetSimValueBoolean(HAL_SimValueHandle handle)
Gets a simulated value (boolean).
Definition: SimDevice.h:301
void HAL_GetSimValue(HAL_SimValueHandle handle, struct HAL_Value *value)
Gets a simulated value.
int64_t HAL_GetSimValueLong(HAL_SimValueHandle handle)
Gets a simulated value (long).
Definition: SimDevice.h:265
const char * HAL_GetSimDeviceName(HAL_SimDeviceHandle handle)
Get the name of a simulated device.
void HAL_SetSimValueBoolean(HAL_SimValueHandle handle, HAL_Bool value)
Sets a simulated value (boolean).
Definition: SimDevice.h:373
int32_t HAL_GetSimValueInt(HAL_SimValueHandle handle)
Gets a simulated value (int).
Definition: SimDevice.h:253
void HAL_ResetSimValue(HAL_SimValueHandle handle)
Resets a simulated double or integral value to 0.
@ HAL_SimValueBidir
bidirectional between user code and simulator
Definition: SimDevice.h:37
@ HAL_SimValueOutput
output from user code to the simulator
Definition: SimDevice.h:36
@ HAL_SimValueInput
input to user code from the simulator
Definition: SimDevice.h:35
int32_t HAL_Bool
Definition: Types.h:73
HAL_Handle HAL_SimDeviceHandle
Definition: Types.h:53
HAL_Handle HAL_SimValueHandle
Definition: Types.h:55
#define HAL_kInvalidHandle
Definition: Types.h:15
::int32_t int32_t
Definition: Meta.h:57
::int64_t int64_t
Definition: Meta.h:59
WPILib Hardware Abstraction Layer (HAL) namespace.
Definition: ChipObject.h:40
HAL Entry Value.
Definition: Value.h:20
double v_double
Definition: Value.h:26
int64_t v_long
Definition: Value.h:25
HAL_Bool v_boolean
Definition: Value.h:22
int32_t v_int
Definition: Value.h:24
enum HAL_Type type
Definition: Value.h:28
int32_t v_enum
Definition: Value.h:23